Extend time for rtc to be ready.
authorKevin O'Connor <kevin@koconnor.net>
Sun, 14 Mar 2010 04:04:41 +0000 (23:04 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Sun, 14 Mar 2010 04:04:41 +0000 (23:04 -0500)
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

index 9afa71d8c3447e959491d125cb96594f34c3c605..4756ea8c4be5ef74a513967b822bfb66194c9b02 100644 (file)
@@ -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