From 11cc662d04f29b9639f222efc9cc51bbfa2ff737 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sat, 13 Mar 2010 23:04:41 -0500 Subject: [PATCH] Extend time for rtc to be ready. Increase the time waiting for rtc from 3ms to 15ms - only 3ms is needed on real hardware, but scheduling delays on qemu can make this longer. Extending the time prevents annoying debugging messages. --- src/clock.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/clock.c b/src/clock.c index 9afa71d..4756ea8 100644 --- a/src/clock.c +++ b/src/clock.c @@ -156,18 +156,19 @@ rtc_updating(void) // to 0, and will return 0 if such a transition occurs. A -1 // is returned only after timing out. The maximum period // that this bit should be set is constrained to (1984+244) - // useconds, so we wait for 3 msec max. + // useconds, but we wait for longer just to be sure. if ((inb_cmos(CMOS_STATUS_A) & RTC_A_UIP) == 0) return 0; - u64 end = calc_future_tsc(3); - do { + u64 end = calc_future_tsc(15); + for (;;) { if ((inb_cmos(CMOS_STATUS_A) & RTC_A_UIP) == 0) return 0; - } while (!check_time(end)); - - // update-in-progress never transitioned to 0 - return -1; + if (check_time(end)) + // update-in-progress never transitioned to 0 + return -1; + yield(); + } } static void -- 2.25.1