From ast@marabu.ch  Tue Jan 27 12:16:14 2004
Return-Path: <ast@marabu.ch>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 568AC16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 27 Jan 2004 12:16:14 -0800 (PST)
Received: from oneplusone.ch (oneplusone.ch [212.55.208.170])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 481C843D62
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 27 Jan 2004 12:16:04 -0800 (PST)
	(envelope-from ast@marabu.ch)
Received: from oneplusone.ch (localhost [127.0.0.1])
	by oneplusone.ch (8.12.9p1/8.12.9) with ESMTP id i0RKG3i3093384
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 27 Jan 2004 21:16:03 +0100 (MET)
	(envelope-from ast@marabu.ch)
Received: (from uucp@localhost)
	by oneplusone.ch (8.12.9p1/8.12.9/Submit) with UUCP id i0RKG3Pr093383
	for FreeBSD-gnats-submit@freebsd.org; Tue, 27 Jan 2004 21:16:03 +0100 (MET)
	(envelope-from ast@marabu.ch)
Received: from marabu.marabu.ch (marabu.marabu.ch [192.168.21.3])
	by nano.marabu.ch (8.12.9/8.12.9) with ESMTP id i0RKCBux087327
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 27 Jan 2004 21:12:11 +0100 (MET)
	(envelope-from ast@marabu.marabu.ch)
Received: by marabu.marabu.ch (8.7.5/20001028-ast-8.3) id VAA15195; Tue, 27 Jan 2004 21:12:11 +0100 (CET)
Received: from pico.marabu.ch (pico.marabu.ch [192.168.21.120]) by
	nano.marabu.ch (8.12.9/8.12.9) with ESMTP id i0RK7vux087042; Tue, 27
	Jan 2004 21:07:58 +0100 (MET) (envelope-from ast@pico.marabu.ch)
Received: from pico.marabu.ch (localhost.marabu.ch [127.0.0.1]) by
	pico.marabu.ch (8.12.10/8.12.10) with ESMTP id i0RK7vPi000726; Tue, 27
	Jan 2004 21:07:57 +0100 (CET) (envelope-from ast@pico.marabu.ch)
Received: (from ast@localhost) by pico.marabu.ch (8.12.10/8.12.10/Submit) id
	i0RK7vpC000725; Tue, 27 Jan 2004 21:07:57 +0100 (CET) (envelope-from
	ast)
Message-Id: <200401272007.i0RK7vpC000725@pico.marabu.ch>
Date: Tue, 27 Jan 2004 21:07:57 +0100 (CET)
From: Adrian Steinmann <ast@marabu.ch>
Reply-To: Adrian Steinmann <ast@marabu.ch>
To: FreeBSD-gnats-submit@freebsd.org
Cc: phk@phk.freebsd.dk
Subject: make /boot/loader "reboot" code same as reboot() syscall
X-Send-Pr-Version: 3.113

>Number:         62003
>Category:       i386
>Synopsis:       [loader] [patch] make /boot/loader "reboot" code same as reboot() syscall
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 27 12:20:19 PST 2004
>Closed-Date:    
>Last-Modified:  Wed Jul 03 01:51:29 UTC 2013
>Originator:     Adrian Steinmann
>Release:        FreeBSD 5.2-RELEASE i386
>Organization:
Webgroup Consulting AG
>Environment:
System: FreeBSD pico.marabu.ch 5.2-RELEASE FreeBSD 5.2-RELEASE #5: Mon Jan 26 09:37:10 CET 2004 root@pico.marabu.ch:/r/obj/usr/src/sys/PIC i386

>Description:
On Soekris net4501 and net4801 with comBIOS 1.22, reboot
from loader may hang. This was fixed by a change in btx.s:
revision 1.33 near line 293:

-		ljmp $0xffff,$0x0		# reboot the machine
+		ljmp $0xf000,$0xfff0		# reboot the machine

Nevertheless, it would be more consistant to also apply the patch for
loader main.c below where the same logic as for the syscall reboot() 

This would also follow the recommendation found Frank van Gilluwe,
1st ed., Addison Wesley 1994, ISBN 0-201-62277-7, p91ff, where he
says that using INT19 or jumping to BIOS boot f000:ffff are
"misconceptions" and that software control (keyboard reset) should
be used whenever possible.

This was discussed at length in soekris-tech mailing list mid-november
2003 (right before the 5.2 code freeze).

>How-To-Repeat:
Remove patch rev 1.33 from btx.s and test reboot on soekris
with comBIOS from loader -> hang.  Add patch below -> ok.

>Fix:

Index: main.c
===================================================================
RCS file: /usr/cvs/src/sys/boot/i386/loader/main.c,v
retrieving revision 1.28
diff -u -r1.28 main.c
--- main.c	25 Aug 2003 23:28:32 -0000	1.28
+++ main.c	27 Jan 2004 19:43:43 -0000
@@ -36,6 +36,7 @@
 #include <string.h>
 #include <machine/bootinfo.h>
 #include <sys/reboot.h>
+#include <i386/isa/isa.h>
 
 #include "bootstrap.h"
 #include "libi386/libi386.h"
@@ -243,6 +244,13 @@
 	    (devsw[i]->dv_cleanup)();
 
     printf("Rebooting...\n");
+
+#if !defined(BROKEN_KEYBOARD_RESET)
+    isa_outb(IO_KBD + 4, 0xFE);
+    delay(1000000);
+    printf("Keyboard reset failed; exiting...\n");
+#endif
+
     delay(1000000);
     __exit(0);
 }
>Release-Note:
>Audit-Trail:

From: Bruce M Simpson <bms@spc.org>
To: freebsd-gnats-submit@freebsd.org
Cc:  
Subject: Re: i386/62003: make /boot/loader "reboot" code same as reboot() syscall
Date: Wed, 23 Jun 2004 08:19:44 +0100

 The patch here looks correct; the segment for calling the BIOS reset
 vector should always be 0xF000. Sounds like loader is cutting corners.
 
 This problem has been observed before with various third-party BIOS
 and x86 emulators.
State-Changed-From-To: open->feedback 
State-Changed-By: remko 
State-Changed-When: Mon Sep 11 12:43:24 UTC 2006 
State-Changed-Why:  
Hello, 

Can you tell me whether this problem you described got fixed 
already by someone?  Is it still there in freebsd 6.1? 

Thanks 


Responsible-Changed-From-To: freebsd-i386->remko 
Responsible-Changed-By: remko 
Responsible-Changed-When: Mon Sep 11 12:43:24 UTC 2006 
Responsible-Changed-Why:  
grab the pr 

http://www.freebsd.org/cgi/query-pr.cgi?pr=62003 
State-Changed-From-To: feedback->closed 
State-Changed-By: remko 
State-Changed-When: Mon Sep 11 13:08:14 UTC 2006 
State-Changed-Why:  
the mail bounces, close pr 

http://www.freebsd.org/cgi/query-pr.cgi?pr=62003 
State-Changed-From-To: closed->open 
State-Changed-By: remko 
State-Changed-When: Mon Sep 11 15:47:55 UTC 2006 
State-Changed-Why:  
the submitter responded (something else must have been bouncing or something) 
and mentions that the issue is not resolved yet.  I will try to get Warner or 
someone to look into this and if possible commit this to the proper tree. 

Thanks for the feedback from the submitter! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=62003 
Responsible-Changed-From-To: remko->brucec 
Responsible-Changed-By: brucec 
Responsible-Changed-When: Mon Feb 21 10:46:29 UTC 2011 
Responsible-Changed-Why:  
Grab. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=62003 

From: Bruce Cran <bruce@cran.org.uk>
To: bug-followup@freebsd.org,
 ast@marabu.ch
Cc:  
Subject: Re: i386/62003: [loader] [patch] make /boot/loader "reboot" code same as reboot() syscall
Date: Mon, 21 Feb 2011 11:11:13 +0000

 Will this break on PC98? The i386 reboot code attempts to reboot via the CPU 
 reset port on PC98 - should this be duplicated for the loader?
 
 -- 
 Bruce Cran
Responsible-Changed-From-To: brucec->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Wed Jul 3 00:50:32 UTC 2013 
Responsible-Changed-Why:  
commit bit has been taken in for safekeeping. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=62003 
>Unformatted:
