From: miod Date: Wed, 16 Jul 2008 20:03:20 +0000 (+0000) Subject: Add a new parameter to pckbc_cnattach(): flags to put in the pckbc bowels. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=aa6164b3aaee5d8f66ff37502f1193524b99b9ce;p=openbsd Add a new parameter to pckbc_cnattach(): flags to put in the pckbc bowels. For now, only one such flag is defined, PCKBC_CANT_TRANSLATE. It hints pckbc that the device does not behave correctly to the ``set translation'' commands. Set this flag if we are running on a Tadpole Ultrabook machine, which needs it. This makes the built-in keyboard work correctly on this laptop (with the help of the software translation pckbd diff). tested & ok kettenis@ --- diff --git a/sys/arch/alpha/alpha/api_up1000.c b/sys/arch/alpha/alpha/api_up1000.c index 244fe78d0c3..c58d0049b2c 100644 --- a/sys/arch/alpha/alpha/api_up1000.c +++ b/sys/arch/alpha/alpha/api_up1000.c @@ -1,4 +1,4 @@ -/* $OpenBSD: api_up1000.c,v 1.8 2006/11/28 16:56:50 dlg Exp $ */ +/* $OpenBSD: api_up1000.c,v 1.9 2008/07/16 20:03:20 miod Exp $ */ /* $NetBSD: api_up1000.c,v 1.4 2000/06/20 03:48:53 matt Exp $ */ /* @@ -131,7 +131,7 @@ api_up1000_cons_init() /* display console ... */ /* XXX */ (void) pckbc_cnattach(&icp->ic_iot, IO_KBD, KBCMDP, - PCKBC_KBD_SLOT); + PCKBC_KBD_SLOT, 0); if (CTB_TURBOSLOT_TYPE(ctb->ctb_turboslot) == CTB_TURBOSLOT_TYPE_ISA) diff --git a/sys/arch/alpha/alpha/dec_1000a.c b/sys/arch/alpha/alpha/dec_1000a.c index 36261982e54..3bc81d1dca2 100644 --- a/sys/arch/alpha/alpha/dec_1000a.c +++ b/sys/arch/alpha/alpha/dec_1000a.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dec_1000a.c,v 1.5 2008/06/26 05:42:08 ray Exp $ */ +/* $OpenBSD: dec_1000a.c,v 1.6 2008/07/16 20:03:20 miod Exp $ */ /* $NetBSD: dec_1000a.c,v 1.14 2001/06/05 04:53:11 thorpej Exp $ */ /* @@ -201,7 +201,7 @@ dec_1000a_cons_init() #if NPCKBD > 0 /* display console ... */ /* XXX */ - (void) pckbc_cnattach(iot, IO_KBD, KBCMDP, PCKBC_KBD_SLOT); + (void) pckbc_cnattach(iot, IO_KBD, KBCMDP, PCKBC_KBD_SLOT, 0); /* * AlphaServer 1000s have a firmware bug whereby the diff --git a/sys/arch/alpha/alpha/dec_2100_a50.c b/sys/arch/alpha/alpha/dec_2100_a50.c index 52ded48e041..c16c17c4eb8 100644 --- a/sys/arch/alpha/alpha/dec_2100_a50.c +++ b/sys/arch/alpha/alpha/dec_2100_a50.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dec_2100_a50.c,v 1.18 2006/11/28 16:56:50 dlg Exp $ */ +/* $OpenBSD: dec_2100_a50.c,v 1.19 2008/07/16 20:03:20 miod Exp $ */ /* $NetBSD: dec_2100_a50.c,v 1.43 2000/05/22 20:13:31 thorpej Exp $ */ /* @@ -140,7 +140,7 @@ dec_2100_a50_cons_init() /* display console ... */ /* XXX */ (void) pckbc_cnattach(&acp->ac_iot, IO_KBD, KBCMDP, - PCKBC_KBD_SLOT); + PCKBC_KBD_SLOT, 0); if (CTB_TURBOSLOT_TYPE(ctb->ctb_turboslot) == CTB_TURBOSLOT_TYPE_ISA) diff --git a/sys/arch/alpha/alpha/dec_550.c b/sys/arch/alpha/alpha/dec_550.c index 6a8ef78cbe2..b4ba2ba45b0 100644 --- a/sys/arch/alpha/alpha/dec_550.c +++ b/sys/arch/alpha/alpha/dec_550.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dec_550.c,v 1.10 2006/11/28 16:56:50 dlg Exp $ */ +/* $OpenBSD: dec_550.c,v 1.11 2008/07/16 20:03:20 miod Exp $ */ /* $NetBSD: dec_550.c,v 1.10 2000/06/20 03:48:53 matt Exp $ */ /* @@ -132,7 +132,7 @@ dec_550_cons_init() /* display console ... */ /* XXX */ (void) pckbc_cnattach(&ccp->cc_iot, IO_KBD, KBCMDP, - PCKBC_KBD_SLOT); + PCKBC_KBD_SLOT, 0); if (CTB_TURBOSLOT_TYPE(ctb->ctb_turboslot) == CTB_TURBOSLOT_TYPE_ISA) diff --git a/sys/arch/alpha/alpha/dec_6600.c b/sys/arch/alpha/alpha/dec_6600.c index 20c1e9d3431..458e0dc19ef 100644 --- a/sys/arch/alpha/alpha/dec_6600.c +++ b/sys/arch/alpha/alpha/dec_6600.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dec_6600.c,v 1.9 2006/11/28 16:56:50 dlg Exp $ */ +/* $OpenBSD: dec_6600.c,v 1.10 2008/07/16 20:03:20 miod Exp $ */ /* $NetBSD: dec_6600.c,v 1.7 2000/06/20 03:48:54 matt Exp $ */ /* @@ -128,7 +128,7 @@ dec_6600_cons_init() /* display console ... */ /* XXX */ (void) pckbc_cnattach(&tsp->pc_iot, IO_KBD, KBCMDP, - PCKBC_KBD_SLOT); + PCKBC_KBD_SLOT, 0); if (CTB_TURBOSLOT_TYPE(ctbslot) == CTB_TURBOSLOT_TYPE_ISA) diff --git a/sys/arch/alpha/alpha/dec_axppci_33.c b/sys/arch/alpha/alpha/dec_axppci_33.c index 42662b098ef..a696883b951 100644 --- a/sys/arch/alpha/alpha/dec_axppci_33.c +++ b/sys/arch/alpha/alpha/dec_axppci_33.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dec_axppci_33.c,v 1.19 2006/11/28 16:56:50 dlg Exp $ */ +/* $OpenBSD: dec_axppci_33.c,v 1.20 2008/07/16 20:03:20 miod Exp $ */ /* $NetBSD: dec_axppci_33.c,v 1.44 2000/05/22 20:13:32 thorpej Exp $ */ /* @@ -174,7 +174,7 @@ dec_axppci_33_cons_init() /* display console ... */ /* XXX */ (void) pckbc_cnattach(&lcp->lc_iot, IO_KBD, KBCMDP, - PCKBC_KBD_SLOT); + PCKBC_KBD_SLOT, 0); if (CTB_TURBOSLOT_TYPE(ctb->ctb_turboslot) == CTB_TURBOSLOT_TYPE_ISA) diff --git a/sys/arch/alpha/alpha/dec_eb164.c b/sys/arch/alpha/alpha/dec_eb164.c index 61150dd9f0f..aa02493655a 100644 --- a/sys/arch/alpha/alpha/dec_eb164.c +++ b/sys/arch/alpha/alpha/dec_eb164.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dec_eb164.c,v 1.14 2006/11/28 16:56:50 dlg Exp $ */ +/* $OpenBSD: dec_eb164.c,v 1.15 2008/07/16 20:03:20 miod Exp $ */ /* $NetBSD: dec_eb164.c,v 1.33 2000/05/22 20:13:32 thorpej Exp $ */ /* @@ -126,7 +126,7 @@ dec_eb164_cons_init() /* display console ... */ /* XXX */ (void) pckbc_cnattach(&ccp->cc_iot, IO_KBD, KBCMDP, - PCKBC_KBD_SLOT); + PCKBC_KBD_SLOT, 0); /* * On at least LX164, SRM reports an isa video board diff --git a/sys/arch/alpha/alpha/dec_eb64plus.c b/sys/arch/alpha/alpha/dec_eb64plus.c index dca2457aa73..230b538a604 100644 --- a/sys/arch/alpha/alpha/dec_eb64plus.c +++ b/sys/arch/alpha/alpha/dec_eb64plus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dec_eb64plus.c,v 1.6 2007/03/21 22:10:57 martin Exp $ */ +/* $OpenBSD: dec_eb64plus.c,v 1.7 2008/07/16 20:03:20 miod Exp $ */ /* $NetBSD: dec_eb64plus.c,v 1.25 2001/06/05 04:53:11 thorpej Exp $ */ /* @@ -131,7 +131,7 @@ dec_eb64plus_cons_init() /* display console ... */ /* XXX */ (void) pckbc_cnattach(&acp->ac_iot, IO_KBD, KBCMDP, - PCKBC_KBD_SLOT); + PCKBC_KBD_SLOT, 0); if (CTB_TURBOSLOT_TYPE(ctb->ctb_turboslot) == CTB_TURBOSLOT_TYPE_ISA) diff --git a/sys/arch/alpha/alpha/dec_kn20aa.c b/sys/arch/alpha/alpha/dec_kn20aa.c index 9735679d88f..be0f750d421 100644 --- a/sys/arch/alpha/alpha/dec_kn20aa.c +++ b/sys/arch/alpha/alpha/dec_kn20aa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dec_kn20aa.c,v 1.17 2006/11/28 16:56:50 dlg Exp $ */ +/* $OpenBSD: dec_kn20aa.c,v 1.18 2008/07/16 20:03:20 miod Exp $ */ /* $NetBSD: dec_kn20aa.c,v 1.42 2000/05/22 20:13:32 thorpej Exp $ */ /* @@ -131,7 +131,7 @@ dec_kn20aa_cons_init() /* display console ... */ /* XXX */ (void) pckbc_cnattach(&ccp->cc_iot, IO_KBD, KBCMDP, - PCKBC_KBD_SLOT); + PCKBC_KBD_SLOT, 0); if (CTB_TURBOSLOT_TYPE(ctb->ctb_turboslot) == CTB_TURBOSLOT_TYPE_ISA) diff --git a/sys/arch/alpha/alpha/dec_kn300.c b/sys/arch/alpha/alpha/dec_kn300.c index 503aeb8585c..93cd8e98c44 100644 --- a/sys/arch/alpha/alpha/dec_kn300.c +++ b/sys/arch/alpha/alpha/dec_kn300.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dec_kn300.c,v 1.2 2007/03/21 22:10:57 martin Exp $ */ +/* $OpenBSD: dec_kn300.c,v 1.3 2008/07/16 20:03:20 miod Exp $ */ /* $NetBSD: dec_kn300.c,v 1.34 2007/03/04 15:18:10 yamt Exp $ */ /* @@ -181,7 +181,7 @@ dec_kn300_cons_init() /* display console ... */ /* XXX */ (void) pckbc_cnattach(&ccp->cc_iot, IO_KBD, KBCMDP, - PCKBC_KBD_SLOT); + PCKBC_KBD_SLOT, 0); if (CTB_TURBOSLOT_TYPE(ctb->ctb_turboslot) == CTB_TURBOSLOT_TYPE_ISA) diff --git a/sys/arch/amd64/amd64/wscons_machdep.c b/sys/arch/amd64/amd64/wscons_machdep.c index b0fb5e2a591..a5fb88593bc 100644 --- a/sys/arch/amd64/amd64/wscons_machdep.c +++ b/sys/arch/amd64/amd64/wscons_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wscons_machdep.c,v 1.6 2008/01/23 16:37:56 jsing Exp $ */ +/* $OpenBSD: wscons_machdep.c,v 1.7 2008/07/16 20:03:22 miod Exp $ */ /* * Copyright (c) 2001 Aaron Campbell @@ -123,7 +123,8 @@ wscninit(struct consdev *cp) if (0) goto dokbd; /* XXX stupid gcc */ dokbd: #if (NPCKBC > 0) - if (!pckbc_cnattach(X86_BUS_SPACE_IO, IO_KBD, KBCMDP, PCKBC_KBD_SLOT)) + if (!pckbc_cnattach(X86_BUS_SPACE_IO, IO_KBD, KBCMDP, PCKBC_KBD_SLOT, + 0)) return; #endif #if (NUKBD > 0) diff --git a/sys/arch/i386/i386/wscons_machdep.c b/sys/arch/i386/i386/wscons_machdep.c index 584d76fcc0a..79f1c6aef55 100644 --- a/sys/arch/i386/i386/wscons_machdep.c +++ b/sys/arch/i386/i386/wscons_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wscons_machdep.c,v 1.14 2008/01/23 16:37:56 jsing Exp $ */ +/* $OpenBSD: wscons_machdep.c,v 1.15 2008/07/16 20:03:22 miod Exp $ */ /* * Copyright (c) 2001 Aaron Campbell @@ -123,7 +123,8 @@ wscninit(struct consdev *cp) if (0) goto dokbd; /* XXX stupid gcc */ dokbd: #if (NPCKBC > 0) - if (!pckbc_cnattach(I386_BUS_SPACE_IO, IO_KBD, KBCMDP, PCKBC_KBD_SLOT)) + if (!pckbc_cnattach(I386_BUS_SPACE_IO, IO_KBD, KBCMDP, PCKBC_KBD_SLOT, + 0)) return; #endif #if (NUKBD > 0) diff --git a/sys/arch/sparc64/dev/pckbc_ebus.c b/sys/arch/sparc64/dev/pckbc_ebus.c index f2e432987bd..d88d3b1188e 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.8 2007/10/01 16:11:19 krw Exp $ */ +/* $OpenBSD: pckbc_ebus.c,v 1.9 2008/07/16 20:03:22 miod Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -96,6 +96,7 @@ pckbc_ebus_attach(parent, self, aux) struct ebus_attach_args *ea = aux; struct pckbc_internal *t = NULL; int console; + int flags = 0; sc->sc_node = ea->ea_node; console = pckbc_ebus_is_console(sc); @@ -117,10 +118,23 @@ pckbc_ebus_attach(parent, self, aux) return; } + /* + * The 8042 controller found on the Tadpole SPARCLE doesn't + * implement XT scan code translation. + * XXX I have not checked the value of the model property on + * XXX UltraAXe boards... + */ + { + char model[128]; + OF_getprop(ea->ea_node, "model", &model, sizeof model); + if (strcmp(model, "INTC,80c42") == 0) + flags = PCKBC_CANT_TRANSLATE; + } + if (console) { if (pckbc_cnattach(sc->sc_iot, EBUS_PADDR_FROM_REG(&ea->ea_regs[0]), KBCMDP, - PCKBC_KBD_SLOT) == 0) { + PCKBC_KBD_SLOT, flags) == 0) { t = &pckbc_consdata; pckbc_console_attached = 1; sc->sc_ioh_c = t->t_ioh_c; @@ -142,6 +156,7 @@ pckbc_ebus_attach(parent, self, aux) } t = malloc(sizeof(*t), M_DEVBUF, M_NOWAIT | M_ZERO); + t->t_flags = flags; } psc->intr_establish = pckbc_ebus_intr_establish; @@ -165,11 +180,11 @@ pckbc_ebus_attach(parent, self, aux) t->t_ioh_d = sc->sc_ioh_d; t->t_cmdbyte = KC8_CPU; t->t_sc = psc; + psc->id = t; printf("\n"); pckbc_attach(psc); - } int diff --git a/sys/dev/ic/pckbc.c b/sys/dev/ic/pckbc.c index b1b798edf3d..5a759389e0d 100644 --- a/sys/dev/ic/pckbc.c +++ b/sys/dev/ic/pckbc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pckbc.c,v 1.15 2007/11/26 22:45:27 miod Exp $ */ +/* $OpenBSD: pckbc.c,v 1.16 2008/07/16 20:03:22 miod Exp $ */ /* $NetBSD: pckbc.c,v 1.5 2000/06/09 04:58:35 soda Exp $ */ /* @@ -475,7 +475,8 @@ pckbc_xt_translation(self, slot, on) struct pckbc_internal *t = self; int ison; - if (slot != PCKBC_KBD_SLOT) { + if (ISSET(t->t_flags, PCKBC_CANT_TRANSLATE) || + slot != PCKBC_KBD_SLOT) { /* translation only for kbd slot */ if (on) return (0); @@ -998,11 +999,12 @@ pckbcintr_internal(t, sc) } int -pckbc_cnattach(iot, addr, cmd_offset, slot) +pckbc_cnattach(iot, addr, cmd_offset, slot, flags) bus_space_tag_t iot; bus_addr_t addr; bus_size_t cmd_offset; pckbc_slot_t slot; + int flags; { bus_space_handle_t ioh_d, ioh_c; int res = 0; @@ -1018,6 +1020,7 @@ pckbc_cnattach(iot, addr, cmd_offset, slot) pckbc_consdata.t_ioh_d = ioh_d; pckbc_consdata.t_ioh_c = ioh_c; pckbc_consdata.t_addr = addr; + pckbc_consdata.t_flags = flags; timeout_set(&pckbc_consdata.t_cleanup, pckbc_cleanup, &pckbc_consdata); timeout_set(&pckbc_consdata.t_poll, pckbc_poll, &pckbc_consdata); diff --git a/sys/dev/ic/pckbcvar.h b/sys/dev/ic/pckbcvar.h index e5db6e5f54a..75337423671 100644 --- a/sys/dev/ic/pckbcvar.h +++ b/sys/dev/ic/pckbcvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pckbcvar.h,v 1.5 2007/01/31 14:35:51 mickey Exp $ */ +/* $OpenBSD: pckbcvar.h,v 1.6 2008/07/16 20:03:22 miod Exp $ */ /* $NetBSD: pckbcvar.h,v 1.4 2000/06/09 04:58:35 soda Exp $ */ /* @@ -51,7 +51,10 @@ struct pckbc_internal { bus_addr_t t_addr; u_char t_cmdbyte; /* shadow */ + int t_flags; +#define PCKBC_CANT_TRANSLATE 0x0001 /* can't translate to XT scancodes */ int t_haveaux; /* controller has an aux port */ + struct pckbc_slotdata *t_slotdata[PCKBC_NSLOTS]; struct pckbc_softc *t_sc; /* back pointer */ @@ -103,7 +106,7 @@ void pckbc_slot_enable(pckbc_tag_t, pckbc_slot_t, int); void pckbc_attach(struct pckbc_softc *); int pckbc_cnattach(bus_space_tag_t, bus_addr_t, bus_size_t, - pckbc_slot_t); + pckbc_slot_t, int); int pckbc_is_console(bus_space_tag_t, bus_addr_t); int pckbcintr(void *);