From c050d7dea93605c856bd3a212804146c0166a6ee Mon Sep 17 00:00:00 2001 From: miod Date: Tue, 29 Jul 2008 04:20:35 +0000 Subject: [PATCH] Reenable the AUXWRITE dance to try and find the aux port in pckbc(4), based on an attachment dependent flag; the Tadople SPARCLE needs it. ok kettenis@ deraadt@ --- sys/arch/sparc64/dev/pckbc_ebus.c | 4 ++-- sys/dev/ic/pckbc.c | 37 +++++++++++++++++-------------- sys/dev/ic/pckbcvar.h | 3 ++- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/sys/arch/sparc64/dev/pckbc_ebus.c b/sys/arch/sparc64/dev/pckbc_ebus.c index d88d3b1188e..bffaae1eabe 100644 --- a/sys/arch/sparc64/dev/pckbc_ebus.c +++ b/sys/arch/sparc64/dev/pckbc_ebus.c @@ -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) { diff --git a/sys/dev/ic/pckbc.c b/sys/dev/ic/pckbc.c index 5a759389e0d..ce6df5bd1ac 100644 --- a/sys/dev/ic/pckbc.c +++ b/sys/dev/ic/pckbc.c @@ -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. diff --git a/sys/dev/ic/pckbcvar.h b/sys/dev/ic/pckbcvar.h index 75337423671..947f542ce3d 100644 --- a/sys/dev/ic/pckbcvar.h +++ b/sys/dev/ic/pckbcvar.h @@ -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]; -- 2.20.1