Browse Source

Cleanups

Replace a printf with a DBG in timer_rtdsc.c
Replace a printf in timer.c with assert
Return proper error codes from timer drivers

Signed-off-by: Alexey Zaytsev <alexey.zaytsev@gmail.com>
tags/v0.9.4
Alexey Zaytsev 17 years ago
parent
commit
379c37bafb
3 changed files with 8 additions and 8 deletions
  1. 3
    2
      src/arch/i386/drivers/timer_rtdsc.c
  2. 3
    0
      src/arch/i386/include/bits/errfile.h
  3. 2
    6
      src/core/timer.c

+ 3
- 2
src/arch/i386/drivers/timer_rtdsc.c View File

1
 
1
 
2
 #include <gpxe/init.h>
2
 #include <gpxe/init.h>
3
 #include <gpxe/timer.h>
3
 #include <gpxe/timer.h>
4
+#include <errno.h>
4
 #include <stdio.h>
5
 #include <stdio.h>
5
 #include <bits/cpu.h>
6
 #include <bits/cpu.h>
6
 #include <bits/timer2.h>
7
 #include <bits/timer2.h>
78
 		}
79
 		}
79
 	}
80
 	}
80
 
81
 
81
-	printf("RTDSC timer not available on this machine.\n");
82
-	return 1;
82
+	DBG("RTDSC timer not available on this machine.\n");
83
+	return -ENODEV;
83
 }
84
 }
84
 
85
 
85
 struct timer rtdsc_ts __timer (01) = {
86
 struct timer rtdsc_ts __timer (01) = {

+ 3
- 0
src/arch/i386/include/bits/errfile.h View File

26
 #define ERRFILE_undionly	 ( ERRFILE_ARCH | ERRFILE_NET | 0x00030000 )
26
 #define ERRFILE_undionly	 ( ERRFILE_ARCH | ERRFILE_NET | 0x00030000 )
27
 #define ERRFILE_undirom		 ( ERRFILE_ARCH | ERRFILE_NET | 0x00040000 )
27
 #define ERRFILE_undirom		 ( ERRFILE_ARCH | ERRFILE_NET | 0x00040000 )
28
 
28
 
29
+#define ERRFILE_timer_rtdsc    ( ERRFILE_ARCH | ERRFILE_DRIVER | 0x00000000 )
30
+#define ERRFILE_timer_bios     ( ERRFILE_ARCH | ERRFILE_DRIVER | 0x00010000 )
31
+
29
 /** @} */
32
 /** @} */
30
 
33
 
31
 #endif /* _BITS_ERRFILE_H */
34
 #endif /* _BITS_ERRFILE_H */

+ 2
- 6
src/core/timer.c View File

53
 	struct timer *ts;
53
 	struct timer *ts;
54
 
54
 
55
 	for (ts = ts_table; ts < ts_table_end; ts++) {
55
 	for (ts = ts_table; ts < ts_table_end; ts++) {
56
-		if (ts->init && !ts->init()) {
56
+		if (ts->init && ts->init() >= 0) {
57
 			used_ts = ts;
57
 			used_ts = ts;
58
 			break;
58
 			break;
59
 		}
59
 		}
60
 	}
60
 	}
61
 
61
 
62
-	if (!used_ts) {
63
-		printf("No timer available. This should never happen. Expect gPXE to die soon.\n");
64
-		/* Panic */
65
-	}
66
-
62
+	assert(used_ts);
67
 }
63
 }
68
 
64
 
69
 struct init_fn ts_init_fn __init_fn ( INIT_NORMAL ) = {
65
 struct init_fn ts_init_fn __init_fn ( INIT_NORMAL ) = {

Loading…
Cancel
Save