]> xenbits.xensource.com Git - seabios.git/commitdiff
Cache boot-fail-wait to avoid romfile access after POST.
authorKevin O'Connor <kevin@koconnor.net>
Tue, 5 Mar 2013 09:52:21 +0000 (17:52 +0800)
committerKevin O'Connor <kevin@koconnor.net>
Wed, 6 Mar 2013 01:16:52 +0000 (20:16 -0500)
Memory allocated with malloc_tmp() can't be used after the POST phase.
So, access boot-fail-wait in post phase and store it for the boot
phase to use.  This fixes the regression introduced by commit
59d6ca52.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Amos Kong <akong@redhat.com>
src/boot.c

index ec411b70403577df95508fdac2d647c0a214158a..3370c2d685a56e1610b0e56a665a56a0d4c58c4d 100644 (file)
@@ -235,6 +235,7 @@ int bootprio_find_usb(struct usbdevice_s *usbdev, int lun)
  * Boot setup
  ****************************************************************/
 
+static int BootRetryTime;
 static int CheckFloppySig = 1;
 
 #define DEFAULT_PRIO           9999
@@ -271,6 +272,8 @@ boot_init(void)
         }
     }
 
+    BootRetryTime = romfile_loadint("etc/boot-fail-wait", 60*1000);
+
     loadBootOrder();
 }
 
@@ -629,15 +632,15 @@ boot_rom(u32 vector)
 static void
 boot_fail(void)
 {
-    u32 retrytime = romfile_loadint("etc/boot-fail-wait", 60*1000);
-    if (retrytime == (u32)-1)
+    if (BootRetryTime == (u32)-1)
         printf("No bootable device.\n");
     else
-        printf("No bootable device.  Retrying in %d seconds.\n", retrytime/1000);
-    // Wait for 'retrytime' milliseconds and then reboot.
-    u32 end = calc_future_timer(retrytime);
+        printf("No bootable device.  Retrying in %d seconds.\n"
+               , BootRetryTime/1000);
+    // Wait for 'BootRetryTime' milliseconds and then reboot.
+    u32 end = calc_future_timer(BootRetryTime);
     for (;;) {
-        if (retrytime != (u32)-1 && check_timer(end))
+        if (BootRetryTime != (u32)-1 && check_timer(end))
             break;
         yield_toirq();
     }