diff options
author | Alexey Zaytsev <alexey.zaytsev@gmail.com> | 2008-03-02 04:36:50 +0300 |
---|---|---|
committer | Alexey Zaytsev <alexey.zaytsev@gmail.com> | 2008-03-02 04:36:50 +0300 |
commit | 379c37bafba794b47afcb1e9970b6207fb0eb9f4 (patch) | |
tree | 05d4e08cdf0708093b62c3d6fe8d58b9a036dc9f | |
parent | a1572e0ab0f5fab9a1f0185ded593bec811aa175 (diff) | |
download | ipxe-379c37bafba794b47afcb1e9970b6207fb0eb9f4.tar.gz |
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>
-rw-r--r-- | src/arch/i386/drivers/timer_rtdsc.c | 5 | ||||
-rw-r--r-- | src/arch/i386/include/bits/errfile.h | 3 | ||||
-rw-r--r-- | src/core/timer.c | 8 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/arch/i386/drivers/timer_rtdsc.c b/src/arch/i386/drivers/timer_rtdsc.c index 1cd2abea..336e3e6f 100644 --- a/src/arch/i386/drivers/timer_rtdsc.c +++ b/src/arch/i386/drivers/timer_rtdsc.c @@ -1,6 +1,7 @@ #include <gpxe/init.h> #include <gpxe/timer.h> +#include <errno.h> #include <stdio.h> #include <bits/cpu.h> #include <bits/timer2.h> @@ -78,8 +79,8 @@ static int rtdsc_ts_init(void) } } - 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) = { diff --git a/src/arch/i386/include/bits/errfile.h b/src/arch/i386/include/bits/errfile.h index a6f87825..ce58eefd 100644 --- a/src/arch/i386/include/bits/errfile.h +++ b/src/arch/i386/include/bits/errfile.h @@ -26,6 +26,9 @@ #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 */ diff --git a/src/core/timer.c b/src/core/timer.c index da53e053..e736f528 100644 --- a/src/core/timer.c +++ b/src/core/timer.c @@ -53,17 +53,13 @@ static void timer_init(void) 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 ) = { |