Date: Mon, 29 Jun 1998 15:14:24 +0200 (CEST) From: hm@kts.org To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: i386/7108: pcvt: kernel panic when reconnecting keyboard Message-ID: <m0yqdlI-000020C@bert.kts.org>
next in thread | raw e-mail | index | archive | help
>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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?m0yqdlI-000020C>