From owner-freebsd-bugs Mon Jun 29 06:40:57 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id GAA16415 for freebsd-bugs-outgoing; Mon, 29 Jun 1998 06:40:57 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id GAA16407 for ; Mon, 29 Jun 1998 06:40:52 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id GAA21804; Mon, 29 Jun 1998 06:40:02 -0700 (PDT) Received: from mail.ppp.net (mail.ppp.net [194.64.12.35]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id GAA14716 for ; Mon, 29 Jun 1998 06:32:05 -0700 (PDT) (envelope-from ernie!bert.kts.org!hm@ppp.net) Received: from casparc.ppp.net (casparc2.ppp.net [194.64.12.42]) by mail.ppp.net (8.8.8/8.8.8) with SMTP id PAA19575 for ; Mon, 29 Jun 1998 15:32:01 +0200 Received: from ernie by casparc.ppp.net with uucp (Smail3.1.28.1 #1) id m0yqe2L-002ZjZC; Mon, 29 Jun 98 15:32 MET DST Received: from bert.kts.org(really [194.55.156.2]) by ernie.kts.org via sendmail with smtp id for ; Mon, 29 Jun 1998 15:19:10 +0200 (CEST) (Smail-3.2.0.91 1997-Jan-14 #3 built 1998-Feb-14) Received: by bert.kts.org via sendmail with stdio id for FreeBSD-gnats-submit@freebsd.org; Mon, 29 Jun 1998 15:14:24 +0200 (CEST) (Smail-3.2.0.94 1997-Apr-22 #1 built 1998-Jun-6) Message-Id: Date: Mon, 29 Jun 1998 15:14:24 +0200 (CEST) From: hm@kts.org Reply-To: hm@kts.org To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: i386/7108: pcvt: kernel panic when reconnecting keyboard Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 7108 >Category: i386 >Synopsis: pcvt: kernel panic when reconnecting keyboard after keyboard-less boot >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jun 29 06:40:01 PDT 1998 >Last-Modified: >Originator: Hellmuth Michaelis >Organization: Kitchen Table Systems >Release: FreeBSD 2.2.6-RELEASE i386 >Environment: In the kernel config(8) file, replace the line device sc0 at isa? port "IO_KBD" tty irq 1 vector scintr with device vt0 at isa? port "IO_KBD" tty irq 1 vector pcrint to enable the pcvt console driver and disable the syscons driver and produce a new kernel. >Description: With the conversion of pcvt to the common keyboard code found in i386/isa/kbdio.c, the "kbdc" pointer may be left uninitialized ( = set to NULL ) when the keyboard was not plugged into the machine when the kernel boots. In case the keyboard is plugged into the machine after it was booted without it, the "kbdc" pointer is not initialized causing cyclic panics to occur due to calling kbdio.c functions with a NULL pointer as an argument. >How-To-Repeat: With the kernel made at item "Environment" , execute "shutdown -h now". When the kernel has halted, unplug the keyboard cable and press the reset switch (or cycle power) to reboot. After the machine has come up (with the keyboard unplugged), plug the keyboard into the machine. The machine will panic (cyclic) until it reboots. >Fix: The following patch to i386/isa/pcvt/pcvt_drv.c will fix the above described problem: *** pcvt_drv.c-226 Wed Sep 10 03:23:31 1997 --- pcvt_drv.c Mon Jun 29 13:55:21 1998 *************** *** 41,47 **** * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ! * @(#)pcvt_drv.c, 3.20, Last Edit-Date: [Mon Jun 29 15:12:38 1998] * */ --- 41,47 ---- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ! * @(#)pcvt_drv.c, 3.20, Last Edit-Date: [Mon Jun 29 13:55:20 1998] * */ *************** *** 151,156 **** --- 151,163 ---- { #ifdef _I386_ISA_KBDIO_H_ kbdc = kbdc_open(IO_KBD); + + if(kbdc == NULL) + { + reset_keyboard = 0; + return 1; + } + reset_keyboard = 1; /* it's now safe to do kbd reset */ #endif /* _I386_ISA_KBDIO_H_ */ *************** *** 848,853 **** --- 855,879 ---- #else /* !PCVT_KBD_FIFO */ u_char *cp; #endif /* PCVT_KBD_FIFO */ + + /* + * in case the keyboard was not plugged in while booting, kbdc + * was set to NULL at that time. When a keyboard IRQ occurs and + * kbdc is NULL, the keyboard was probably reconnected to the + * keyboard controller and we have to initialize the keyboard. + */ + + if(kbdc == NULL) + { + kbdc = kbdc_open(IO_KBD); + if(kbdc == NULL) + { + reset_keyboard = 0; + return; + } + reset_keyboard = 1; + kbd_code_init(); + } #if PCVT_SCREENSAVER pcvt_scrnsv_reset(); >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message