From nobody@FreeBSD.org  Mon Oct 13 00:58:49 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C83701065686
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 13 Oct 2008 00:58:49 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id B5CB58FC0C
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 13 Oct 2008 00:58:49 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id m9D0wnrP072569
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 13 Oct 2008 00:58:49 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id m9D0wndN072568;
	Mon, 13 Oct 2008 00:58:49 GMT
	(envelope-from nobody)
Message-Id: <200810130058.m9D0wndN072568@www.freebsd.org>
Date: Mon, 13 Oct 2008 00:58:49 GMT
From: Arthur Hartwig <arthur.hartwig@nokia.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Serial console mostly ignores typein to restart after shutdown
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         128036
>Category:       kern
>Synopsis:       [sio] [patch] serial console mostly ignores typein to restart after shutdown
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 13 01:00:01 UTC 2008
>Closed-Date:    
>Last-Modified:  Fri Nov 16 04:08:42 UTC 2012
>Originator:     Arthur Hartwig
>Release:        6.3
>Organization:
Nokia
>Environment:
>Description:
System with serial console.

If the system is shutdown by "shutdown -h ..." the following prompt is displayed on the console:

"The operating system has halted.
Please press any key to reboot."

Often a single keypress is not recognised; multiple keypresses are often required for the system to reboot.
>How-To-Repeat:
On system with serial console, issue 

# shutdown -h now 

command
>Fix:
In sys/dev/sio.c, function siocnclose() change

    outb(iobase + com_mcr, sp->mcr | MCR_DTR | MCR_RTS);
    outb(iobase + com_ier, sp->ier);
to
    outb(iobase + com_mcr, sp->mcr | MCR_DTR | MCR_RTS);
    if (rebooting == 0) {
        /*
         * Only restore the interrupt enables if not rebooting. If 
	 * rebooting leave interrupts disabled, else a key press might be 
	 * swallowed by the interrupt handler and not seen by the shutdown code.
	 */
        outb(iobase + com_ier, sp->ier);
    }

The problem is that the shutdown code looking for a keypress on the console (loop in sys/kern/kern_shutdown.c function shutdown_halt) runs with console interrupts enabled. If the keypress generates a console interrupt then the keypress is swallowed by the console interrupt handler and not seen by the code polling for a keypress.

 

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->eadler 
Responsible-Changed-By: eadler 
Responsible-Changed-When: Wed Nov 14 23:34:55 UTC 2012 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=128036 
Responsible-Changed-From-To: eadler->freebsd-bugs 
Responsible-Changed-By: eadler 
Responsible-Changed-When: Fri Nov 16 04:07:52 UTC 2012 
Responsible-Changed-Why:  
according to bde@ this patch is incorrect. In particular the bug actually lies in a higher level driver and needs to be fixed there. I can't track this down at the moment. 


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