From owner-freebsd-arch@FreeBSD.ORG Wed Nov 14 20:38:09 2007 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9386916A474 for ; Wed, 14 Nov 2007 20:38:09 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from speedfactory.net (mail6.speedfactory.net [66.23.216.219]) by mx1.freebsd.org (Postfix) with ESMTP id 3E30E13C4C5 for ; Wed, 14 Nov 2007 20:38:09 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (unverified [66.23.211.162]) by speedfactory.net (SurgeMail 3.8p) with ESMTP id 219323150-1834499 for multiple; Wed, 14 Nov 2007 15:38:55 -0500 Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.8/8.13.8) with ESMTP id lAEKbwow072725; Wed, 14 Nov 2007 15:38:00 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-arch@freebsd.org Date: Wed, 14 Nov 2007 15:37:51 -0500 User-Agent: KMail/1.9.6 References: <473B521D.7050202@nlcc.us> In-Reply-To: <473B521D.7050202@nlcc.us> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200711141537.51447.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Wed, 14 Nov 2007 15:38:01 -0500 (EST) X-Virus-Scanned: ClamAV 0.91.2/4790/Wed Nov 14 13:13:53 2007 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: Billy Newsom Subject: Re: reBoot code: can we detect if there is an AT keyboard controller? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Nov 2007 20:38:09 -0000 On Wednesday 14 November 2007 02:53:01 pm Billy Newsom wrote: > AFAIK, the FreeBSD kernel still relies on a 90s codebase for rebooting... It uses the > keyboard controller reset method to do a warm reboot. > > I have had trouble with this method over the years... a Pentium Pro and more recently > a Mac Pro with no keyboard controller. I have speculated that Mac laptops and blade > servers would also lack the KBC. If Intel continues their progress of dropping > deprecated hardware, the KBC could disappear in the next 3 to 5 years. > > So could there be some intelligent software code to check the presence of this > device, and if not present, use the alternate reboot? The ACPI reboot sequence, for > example, works for FreeBSD 6.2 and later, on my Mac Pro quad Xeon, amd64. > > Unfortunately, although the kernel detects the presence of a KBC during boot, it > doesn't seem that this information gets stored as a global variable for later use. (I > made this assertion a few times at freebsd-stable.) It seems like the logical course > is to only reboot the keyboard controller if such a thing exists!! > > Looking back at my notes and my previous research, it appears that the code is around > where you can find the cpu_reset code near... > > /* "good night, sweet prince .... " */ > > Setting hw.acpi.handle_reboot=1 must bypass that. Could we force the use of this > tunable when it's obvious that the KBC is missing? Actually, I recently updated the reboot code to try several other sequences besides just the keyboard controller such as flipping reset bits in I/O ports 0xcf9 and 0x92. Also, when I did the update I also fixed a bug in the triple-fault last-effort that had caused it to not actually cause a triple-fault. As a result, you might be able to reboot just fine now on newer stable w/o the tunable if you have this commit: revision 1.259.2.6 date: 2007/04/30 17:45:44; author: jhb; state: Exp; lines: +40 -6 MFC: Various fixes to cpu_reset_real() - Try to use the reset control register (I/O port 0xcf9) and the fast a20 and init register (I/O port 0x92) if the keyboard reset fails. - Fix the triple fault to actually work when PGE is enabled. -- John Baldwin