From owner-freebsd-current Sat Nov 16 16:31:27 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id QAA00199 for current-outgoing; Sat, 16 Nov 1996 16:31:27 -0800 (PST) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id QAA00194 for ; Sat, 16 Nov 1996 16:31:14 -0800 (PST) Received: (from bde@localhost) by godzilla.zeta.org.au (8.7.6/8.6.9) id LAA00201; Sun, 17 Nov 1996 11:27:16 +1100 Date: Sun, 17 Nov 1996 11:27:16 +1100 From: Bruce Evans Message-Id: <199611170027.LAA00201@godzilla.zeta.org.au> To: current@FreeBSD.org, nate@mt.sri.com Subject: Re: UserConfig is broken + PS/2 support success Sender: owner-current@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk >UserConfig is now broken in current. It may have to do withe the recent >syscons changes, but in any case nothing happens at the "config>" prompt >when I type anymore. The sources are from early this morning, so it's >probably a fairly recent change. This is (at least) because sc_port is not initialized until scprobe() is called much later. There is no keyboard at port 0. I don't like the new keyboard driver much. It's has too many features, and too many spinloops. Some of the flags and flags testing seem to be wrong: 1. KBD_DISABLE_AUX_PORT 0x20 According to Van Gilluwe, on ISA/EISA keyboards setting this gives: "Ignore parity from keyboard, no scan code conversion" [not the default]. This is now used. It seems to be harmless. It was also used in pccons. It is still defined in /sys/i386/isa/ic/i8042.h (which is where all the i8042-specific defines should always have been) as KC8_OLDPC 0x20 /* old 9bit codes instead of new 11bit */ 2. KC8_IGNSEC 0x08 /* ignore security lock */ [in i8042.h] This silently went away. Now syscons honors the security lock switch like most drivers. The PROBE_KEYBOARD_LOCK feature in the bootstrap works better with old buggy behaviour. 3. KBDS_CONTROLLER_BUSY 0x0002 aka KBS_IBF 0x02 According to Van Gilluwe and all other docs and drivers that I've seen, this bit is for "The motherboard controller's input buffer is full ... no writes should occur to ports 60h or 64h or the data/command will be lost". It has nothing to do with the controller's output buffer (i.e., scancodes for the driver to read). This bit is spun on for up to 100 msec in wait_while_controller_busy() which is (incorrectly) called from read_kbd_data_no_wait(). Not good for a no-wait routine in an interrupt handler. Calling it a "busy" bit encourages this error. --- The wait_until_controller_is_really_idle() function seems to be unusable. E.g., when it use used for a LED update,, interrupts are disabled, so it is guaranteed to spin if a scancode arrives. The LED update will succeed after a delay of a couple of hundred msec because it ignores the return code. The empty_*_buffer*() functions are broken. They miss scancodes that arrive a microsecond after the test and are almost certain to miss all but the first of a bunch of scancodes - the controller is unlikely to be able to deliver another scancode on the 0-20 usec delay time, especially if the keyboard is a few msec away from sending it! See pcvt_kbd.c for a working version (which is unsuitable for general use because of the lengthy spinloop). write_kbd_command() ignores the return code from wait_until_controller_is_really_idle(). Apart from the buggy interface (see above), this is critical for issueing the reset command - it is possible for the keyboard to hang and resetting it fixes it. I think the return code should not be ignored for other commands - the keyboard should be reset and reinitialized in this case. The 7us delays that are said to be necessary for MCA keyboards aren't there. Bruce