Reenable the AUXWRITE dance to try and find the aux port in pckbc(4), based
authormiod <miod@openbsd.org>
Tue, 29 Jul 2008 04:20:35 +0000 (04:20 +0000)
committermiod <miod@openbsd.org>
Tue, 29 Jul 2008 04:20:35 +0000 (04:20 +0000)
on an attachment dependent flag; the Tadople SPARCLE needs it.
ok kettenis@ deraadt@

sys/arch/sparc64/dev/pckbc_ebus.c
sys/dev/ic/pckbc.c
sys/dev/ic/pckbcvar.h

index d88d3b1..bffaae1 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: pckbc_ebus.c,v 1.9 2008/07/16 20:03:22 miod Exp $     */
+/*     $OpenBSD: pckbc_ebus.c,v 1.10 2008/07/29 04:20:35 miod Exp $    */
 
 /*
  * Copyright (c) 2002 Jason L. Wright (jason@thought.net)
@@ -128,7 +128,7 @@ pckbc_ebus_attach(parent, self, aux)
                char model[128];
                OF_getprop(ea->ea_node, "model", &model, sizeof model);
                if (strcmp(model, "INTC,80c42") == 0)
-                       flags = PCKBC_CANT_TRANSLATE;
+                       flags = PCKBC_CANT_TRANSLATE | PCKBC_NEED_AUXWRITE;
        }
 
        if (console) {
index 5a75938..ce6df5b 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: pckbc.c,v 1.16 2008/07/16 20:03:22 miod Exp $ */
+/* $OpenBSD: pckbc.c,v 1.17 2008/07/29 04:20:37 miod Exp $ */
 /* $NetBSD: pckbc.c,v 1.5 2000/06/09 04:58:35 soda Exp $ */
 
 /*
@@ -359,25 +359,28 @@ pckbc_attach(sc)
        }
        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 0
-       /*
-        * The following code is necessary to find the aux port on the
-        * oqo-1 machine.  However if confuses old (non-ps/2) keyboard
-        * controllers.
-        */
-       if (res == -1) {
-               /* Read of aux echo timed out, try again */
-               if (!pckbc_send_cmd(iot, ioh_c, KBC_AUXWRITE))
-                       goto nomouse;
-               if (!pckbc_wait_output(iot, ioh_c))
-                       goto nomouse;
-               bus_space_write_1(iot, ioh_d, 0, 0x5a);
-               res = pckbc_poll_data1(iot, ioh_d, ioh_c, PCKBC_AUX_SLOT, 1);
+
+       if (ISSET(t->t_flags, PCKBC_NEED_AUXWRITE)) {
+               /*
+                * The following code is necessary to find the aux port on the
+                * oqo-1 machine, among others.  However if confuses old
+                * (non-ps/2) keyboard controllers (at least UMC880x again).
+                */
+               if (res == -1) {
+                       /* Read of aux echo timed out, try again */
+                       if (!pckbc_send_cmd(iot, ioh_c, KBC_AUXWRITE))
+                               goto nomouse;
+                       if (!pckbc_wait_output(iot, ioh_c))
+                               goto nomouse;
+                       bus_space_write_1(iot, ioh_d, 0, 0x5a);
+                       res = pckbc_poll_data1(iot, ioh_d, ioh_c,
+                           PCKBC_AUX_SLOT, 1);
 #ifdef PCKBCDEBUG
-               printf("kbc: aux echo: %x\n", res);
+                       printf("kbc: aux echo: %x\n", res);
 #endif
+               }
        }
-#endif
+
        if (res != -1) {
                /*
                 * In most cases, the 0x5a gets echoed.
index 7533742..947f542 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: pckbcvar.h,v 1.6 2008/07/16 20:03:22 miod Exp $ */
+/* $OpenBSD: pckbcvar.h,v 1.7 2008/07/29 04:20:37 miod Exp $ */
 /* $NetBSD: pckbcvar.h,v 1.4 2000/06/09 04:58:35 soda Exp $ */
 
 /*
@@ -53,6 +53,7 @@ struct pckbc_internal {
 
        int t_flags;
 #define        PCKBC_CANT_TRANSLATE    0x0001  /* can't translate to XT scancodes */
+#define        PCKBC_NEED_AUXWRITE     0x0002  /* need auxwrite command to find aux */
        int t_haveaux; /* controller has an aux port */
 
        struct pckbc_slotdata *t_slotdata[PCKBC_NSLOTS];