From 31774f6d83ddd88d80fb353d49bcb64cdf57b4cd Mon Sep 17 00:00:00 2001 From: Kazutaka YOKOTA Date: Fri, 28 Mar 1997 10:11:24 +0000 Subject: [PATCH] Interim patch/kludge for keyboard lock-up when `kbdcontrol' tries to change typematic rate, or the X server (XFree86 or Accelerated X) starts up. So far, there have been two independent reports from Dell Latitude XPi notebook/laptop owners. The Latitude seems to be the only system which suffers from this problem. (I don't know the problem is with the entire Latitude line or with only some Latitude models) No problem report has been heard about other systems (I certainly cannot reproduce the problem in my -current and 2.2 systems). In 3.0-CURRENT, 2.2-RELEASE and 2.2-GAMMA-970310, when programming the keyboard LED/repeat-rate, `set_keyboard()' in `syscons' tells the keyboard controller not to generate keyboard interrupt (IRQ1) and then enable tty interrupts, expecting the keyboard interrupt doesn't occur. It appears that somehow Latitude's keyboard controller still generates the keyboard interrupt thereafter, and `set_keyboard()' doesn't see the return code from the keyboard because it is consumed by the keyboard interrupt handler. The patch entirely disables tty interrupts while setting LED and typematic rate in `set_keyboard()', making the routine behave more like the previous versions of `syscons' (versions in 2.1.X and 2.2-ALPHA, -BETA, and some -GAMMAs). The reporter said this patch eliminated the problem. (I also found another typo/bug, but the reporter and I found that it wasn't the cause of the problem...) This should go into RELENG_2_2. --- sys/dev/syscons/syscons.c | 13 ++++++++++--- sys/i386/isa/syscons.c | 13 ++++++++++--- sys/isa/syscons.c | 13 ++++++++++--- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index cbeae8bf2df9..f34d99ebff23 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.205 1997/03/01 23:53:46 jmg Exp $ + * $Id: syscons.c,v 1.206 1997/03/24 11:24:07 bde Exp $ */ #include "sc.h" @@ -3109,11 +3109,12 @@ set_keyboard(int command, int data) /* disable the keyboard and mouse interrupt */ s = spltty(); +#if 0 c = get_controller_command_byte(sc_kbdc); if ((c == -1) || !set_controller_command_byte(sc_kbdc, kbdc_get_device_mask(sc_kbdc), - KBD_ENABLE_KBD_PORT | KBD_DISABLE_KBD_INT + KBD_DISABLE_KBD_PORT | KBD_DISABLE_KBD_INT | KBD_DISABLE_AUX_PORT | KBD_DISABLE_AUX_INT)) { /* CONTROLLER ERROR */ kbdc_lock(sc_kbdc, FALSE); @@ -3128,15 +3129,21 @@ set_keyboard(int command, int data) * by the lock flag set via `kbdc_lock()' */ splx(s); +#endif - send_kbd_command_and_data(sc_kbdc, command, data); + if (send_kbd_command_and_data(sc_kbdc, command, data) != KBD_ACK) + send_kbd_command(sc_kbdc, KBDC_ENABLE_KBD); +#if 0 /* restore the interrupts */ if (!set_controller_command_byte(sc_kbdc, kbdc_get_device_mask(sc_kbdc), c & (KBD_KBD_CONTROL_BITS | KBD_AUX_CONTROL_BITS))) { /* CONTROLLER ERROR */ } +#else + splx(s); +#endif kbdc_lock(sc_kbdc, FALSE); } diff --git a/sys/i386/isa/syscons.c b/sys/i386/isa/syscons.c index cbeae8bf2df9..f34d99ebff23 100644 --- a/sys/i386/isa/syscons.c +++ b/sys/i386/isa/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.205 1997/03/01 23:53:46 jmg Exp $ + * $Id: syscons.c,v 1.206 1997/03/24 11:24:07 bde Exp $ */ #include "sc.h" @@ -3109,11 +3109,12 @@ set_keyboard(int command, int data) /* disable the keyboard and mouse interrupt */ s = spltty(); +#if 0 c = get_controller_command_byte(sc_kbdc); if ((c == -1) || !set_controller_command_byte(sc_kbdc, kbdc_get_device_mask(sc_kbdc), - KBD_ENABLE_KBD_PORT | KBD_DISABLE_KBD_INT + KBD_DISABLE_KBD_PORT | KBD_DISABLE_KBD_INT | KBD_DISABLE_AUX_PORT | KBD_DISABLE_AUX_INT)) { /* CONTROLLER ERROR */ kbdc_lock(sc_kbdc, FALSE); @@ -3128,15 +3129,21 @@ set_keyboard(int command, int data) * by the lock flag set via `kbdc_lock()' */ splx(s); +#endif - send_kbd_command_and_data(sc_kbdc, command, data); + if (send_kbd_command_and_data(sc_kbdc, command, data) != KBD_ACK) + send_kbd_command(sc_kbdc, KBDC_ENABLE_KBD); +#if 0 /* restore the interrupts */ if (!set_controller_command_byte(sc_kbdc, kbdc_get_device_mask(sc_kbdc), c & (KBD_KBD_CONTROL_BITS | KBD_AUX_CONTROL_BITS))) { /* CONTROLLER ERROR */ } +#else + splx(s); +#endif kbdc_lock(sc_kbdc, FALSE); } diff --git a/sys/isa/syscons.c b/sys/isa/syscons.c index cbeae8bf2df9..f34d99ebff23 100644 --- a/sys/isa/syscons.c +++ b/sys/isa/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.205 1997/03/01 23:53:46 jmg Exp $ + * $Id: syscons.c,v 1.206 1997/03/24 11:24:07 bde Exp $ */ #include "sc.h" @@ -3109,11 +3109,12 @@ set_keyboard(int command, int data) /* disable the keyboard and mouse interrupt */ s = spltty(); +#if 0 c = get_controller_command_byte(sc_kbdc); if ((c == -1) || !set_controller_command_byte(sc_kbdc, kbdc_get_device_mask(sc_kbdc), - KBD_ENABLE_KBD_PORT | KBD_DISABLE_KBD_INT + KBD_DISABLE_KBD_PORT | KBD_DISABLE_KBD_INT | KBD_DISABLE_AUX_PORT | KBD_DISABLE_AUX_INT)) { /* CONTROLLER ERROR */ kbdc_lock(sc_kbdc, FALSE); @@ -3128,15 +3129,21 @@ set_keyboard(int command, int data) * by the lock flag set via `kbdc_lock()' */ splx(s); +#endif - send_kbd_command_and_data(sc_kbdc, command, data); + if (send_kbd_command_and_data(sc_kbdc, command, data) != KBD_ACK) + send_kbd_command(sc_kbdc, KBDC_ENABLE_KBD); +#if 0 /* restore the interrupts */ if (!set_controller_command_byte(sc_kbdc, kbdc_get_device_mask(sc_kbdc), c & (KBD_KBD_CONTROL_BITS | KBD_AUX_CONTROL_BITS))) { /* CONTROLLER ERROR */ } +#else + splx(s); +#endif kbdc_lock(sc_kbdc, FALSE); }