From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34941) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCoYi-0005Kl-Kb for qemu-devel@nongnu.org; Tue, 05 Mar 2013 04:53:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UCoYh-0006TP-DE for qemu-devel@nongnu.org; Tue, 05 Mar 2013 04:53:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:11681) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCoYh-0006TE-6E for qemu-devel@nongnu.org; Tue, 05 Mar 2013 04:53:19 -0500 From: Amos Kong Date: Tue, 5 Mar 2013 17:52:21 +0800 Message-Id: <1362477141-3637-1-git-send-email-akong@redhat.com> In-Reply-To: <20130304094502.GA10725@t430s.nay.redhat.com> References: <20130304094502.GA10725@t430s.nay.redhat.com> Subject: [Qemu-devel] [Seabios PATCH v2] make reboot-timeout to static for using it after POST phase List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: kevin@koconnor.net Cc: seabios@seabios.org, qemu-devel@nongnu.org From: Kevin O'Connor Memory allocated with malloc_tmp() can't be used after the POST phase. The reboot-timeout inside romfile could not be loaded in boot_fail(). The patch saved reboot-timeout to a static variable, it fixed the regression bug introduced by commit 59d6ca52 I already tested this patch, reboot-timeout parameter of qemu works now. @ qemu -boot reboot-timeout=1000 ... Signed-off-by: Kevin O'Connor Signed-off-by: Amos Kong -- V2: trivial fix in comment (li guang) --- src/boot.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/boot.c b/src/boot.c index ec411b7..3370c2d 100644 --- a/src/boot.c +++ b/src/boot.c @@ -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(); } -- 1.7.1