Date: Thu, 27 Mar 1997 16:20:03 -0800 (PST) From: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp> To: freebsd-bugs Subject: Re: i386/3124: BOOT_PROBE_KEYBOARD hangs system in bootblocks Message-ID: <199703280020.QAA05847@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR i386/3124; it has been noted by GNATS. From: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp> To: nsayer@quack.kfu.com Cc: FreeBSD-gnats-submit@freebsd.org, yokota@zodiac.mech.utsunomiya-u.ac.jp Subject: Re: i386/3124: BOOT_PROBE_KEYBOARD hangs system in bootblocks Date: Fri, 28 Mar 1997 09:23:28 +0900 >>Number: 3124 >>Category: i386 >>Synopsis: BOOT_PROBE_KEYBOARD hangs system in bootblocks >>Confidential: no >>Severity: serious >>Priority: high >>Responsible: freebsd-bugs >>State: open >>Class: sw-bug >>Submitter-Id: current-users >>Arrival-Date: Thu Mar 27 11:00:04 PST 1997 >>Last-Modified: >>Originator: Nick Sayer >>Organization: >Just me >>Release: FreeBSD 2.2-RELEASE i386 >>Environment: > >Award BIOS, 486, no keyboard > >>Description: > >If you set BOOT_PROBE_KEYBOARD=true in /etc/make.conf and rebuild and >install the resulting boot blocks, the system will hang on reboot. >If you plug in a keyboard while it is hanging, it will instantly >start booting as if a keyboard was plugged in. The probe is obviously >hanging when no keyboard is present. AFAIK, BOOT_PROBE_KEYBOARD didn't work well in the past and nobody is actively working on it nowadays. That's why it is currently an option. The problem is that probe_keyboard() (in /sys/i386/boot/biosboot/probe_keyboard.c) doesn't work as expected in some systems. I once wrote a replacement routine. It worked in my systems, but I abandoned the project because I had other, more urgent code to work on. I don't know if it is good for you, but if you are interested, here goes. Save the following code as probe_keyboard.c (of course you had better save the original copy of probe_keyboard.c somewhere), and rebuild the boot block. Please remember that I don't guarantee anything; this code may or may not work in your system. To test the boot block, you had better have the `install' and `fixit' floppy handy; a broken boot block and an unbootable system are too bad. Kazu ----8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<--- /*- * $Id:$ */ #ifdef PROBE_KEYBOARD #include <i386/include/cpufunc.h> #include <i386/isa/isa.h> #include <i386/isa/ic/i8042.h> #include <i386/isa/kbdio.h> #include "boot.h" #define PROBE_MAXRETRY 5 #define PROBE_MAXWAIT 500 #define IO_DUMMY 0x84 /* 7 microsec delay necessary for some keyboard controllers */ static void delay7(void) { /* * I know this is broken, but no timer is avaiable yet at this stage... * See also comments in `delay1ms()' in `io.c'. */ inb(IO_DUMMY); inb(IO_DUMMY); inb(IO_DUMMY); inb(IO_DUMMY); inb(IO_DUMMY); inb(IO_DUMMY); } /* * Perform a simple test on the keyboard; issue the ECHO command and see * if the right answer is returned. We don't do anything as drastic as * full keyboard reset; it will be too troublesome and take too much time. */ int probe_keyboard(void) { int retry = PROBE_MAXRETRY; int wait; int i; while (--retry >= 0) { /* flush any noise */ while (inb(IO_KBD + KBD_STATUS_PORT) & KBDS_ANY_BUFFER_FULL) { delay7(); inb(IO_KBD + KBD_DATA_PORT); delay1ms(); } /* wait until the controller can accept a command */ for (wait = PROBE_MAXWAIT; wait > 0; --wait) { if (((i = inb(IO_KBD + KBD_STATUS_PORT)) & (KBDS_INPUT_BUFFER_FULL | KBDS_ANY_BUFFER_FULL)) == 0) break; if (i & KBDS_ANY_BUFFER_FULL) { delay7(); inb(IO_KBD + KBD_DATA_PORT); } delay1ms(); } if (wait <= 0) continue; /* ECHO command */ outb(IO_KBD + KBD_DATA_PORT, KBDC_ECHO); /* wait for a response */ for (wait = PROBE_MAXWAIT; wait > 0; --wait) { if (inb(IO_KBD + KBD_STATUS_PORT) & KBDS_ANY_BUFFER_FULL) break; delay1ms(); } if (wait <= 0) continue; delay7(); i = inb(IO_KBD + KBD_DATA_PORT); #ifdef PROBE_KBD_BEBUG printf("probe_keyboard: got 0x%x.\n", i); #endif if (i == KBD_ECHO) { /* got the right answer */ #ifdef PROBE_KBD_BEBUG printf("probe_keyboard: succeeded.\n"); #endif return (0); } } #ifdef PROBE_KBD_BEBUG printf("probe_keyboard: failed.\n"); #endif return (1); } #endif /* PROBE_KEYBOARD */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703280020.QAA05847>