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>
#include <gpxe/init.h>
#include <gpxe/timer.h>
+#include <errno.h>
#include <stdio.h>
#include <bits/cpu.h>
#include <bits/timer2.h>
}
}
- printf("RTDSC timer not available on this machine.\n");
- return 1;
+ DBG("RTDSC timer not available on this machine.\n");
+ return -ENODEV;
}
struct timer rtdsc_ts __timer (01) = {
#define ERRFILE_undionly ( ERRFILE_ARCH | ERRFILE_NET | 0x00030000 )
#define ERRFILE_undirom ( ERRFILE_ARCH | ERRFILE_NET | 0x00040000 )
+#define ERRFILE_timer_rtdsc ( ERRFILE_ARCH | ERRFILE_DRIVER | 0x00000000 )
+#define ERRFILE_timer_bios ( ERRFILE_ARCH | ERRFILE_DRIVER | 0x00010000 )
+
/** @} */
#endif /* _BITS_ERRFILE_H */
struct timer *ts;
for (ts = ts_table; ts < ts_table_end; ts++) {
- if (ts->init && !ts->init()) {
+ if (ts->init && ts->init() >= 0) {
used_ts = ts;
break;
}
}
- if (!used_ts) {
- printf("No timer available. This should never happen. Expect gPXE to die soon.\n");
- /* Panic */
- }
-
+ assert(used_ts);
}
struct init_fn ts_init_fn __init_fn ( INIT_NORMAL ) = {