summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraaron <aaron@openbsd.org>2001-04-14 03:27:47 +0000
committeraaron <aaron@openbsd.org>2001-04-14 03:27:47 +0000
commit748ee5b19e8eb73e6fd937a9ff181395100f1c11 (patch)
treea4eab1fb8074676c0c6f688ee30d34fb425d5267
parentAdd an lxtphy_reset function; from NetBSD. Tested on a NewMedia LiveWire (diff)
downloadwireguard-openbsd-748ee5b19e8eb73e6fd937a9ff181395100f1c11.tar.xz
wireguard-openbsd-748ee5b19e8eb73e6fd937a9ff181395100f1c11.zip
Instead of using KBC_AUXTEST, probe the aux port with KBC_AUXECHO, which is
what Linux does; from NetBSD. This apparently fixes problems with old chipsets that handle the test command differently, leading to a non-working keyboard. This patch was tested by many people successfully.
-rw-r--r--sys/dev/ic/pckbc.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/sys/dev/ic/pckbc.c b/sys/dev/ic/pckbc.c
index 095a899c6fc..28d796de6eb 100644
--- a/sys/dev/ic/pckbc.c
+++ b/sys/dev/ic/pckbc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pckbc.c,v 1.1 2000/11/13 20:12:34 aaron Exp $ */
+/* $OpenBSD: pckbc.c,v 1.2 2001/04/14 03:27:47 aaron Exp $ */
/* $NetBSD: pckbc.c,v 1.5 2000/06/09 04:58:35 soda Exp $ */
/*
@@ -346,26 +346,31 @@ pckbc_attach(sc)
#endif /* 0 */
/*
- * check aux port ok
+ * Check aux port ok.
+ * Avoid KBC_AUXTEST because it hangs some older controllers
+ * (eg UMC880?).
*/
- if (!pckbc_send_cmd(iot, ioh_c, KBC_AUXTEST))
- return;
- res = pckbc_poll_data1(iot, ioh_d, ioh_c, PCKBC_KBD_SLOT, 0);
-
- if (res == 0 || res == 0xfa || res == 0x01) {
-#ifdef PCKBCDEBUG
- if (res != 0)
- printf("kbc: returned %x on aux slot test\n", res);
-#endif
+ if (!pckbc_send_cmd(iot, ioh_c, KBC_AUXECHO)) {
+ printf("kbc: aux echo error 1\n");
+ goto nomouse;
+ }
+ if (!pckbc_wait_output(iot, ioh_c)) {
+ printf("kbc: aux echo error 2\n");
+ goto nomouse;
+ }
+ bus_space_write_1(iot, ioh_d, 0, 0x5a); /* a random value */
+ res = pckbc_poll_data1(iot, ioh_d, ioh_c, PCKBC_AUX_SLOT, 1);
+ if (res == 0x5a) {
t->t_haveaux = 1;
if (pckbc_attach_slot(sc, PCKBC_AUX_SLOT))
cmdbits |= KC8_MENABLE;
}
#ifdef PCKBCDEBUG
else
- printf("kbc: aux port test: %x\n", res);
+ printf("kbc: aux echo: %x\n", res);
#endif
+nomouse:
/* enable needed interrupts */
t->t_cmdbyte |= cmdbits;
if (!pckbc_put8042cmd(t))
@@ -392,7 +397,7 @@ pckbc_init_slotdata(q)
TAILQ_INIT(&q->cmdqueue);
TAILQ_INIT(&q->freequeue);
- for (i=0; i<NCMD; i++) {
+ for (i = 0; i < NCMD; i++) {
TAILQ_INSERT_TAIL(&q->freequeue, &(q->cmds[i]), next);
}
q->polling = 0;