summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2003-05-26 07:32:37 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2003-05-26 07:32:37 +0000
commitfd3f7f88c164f8c05ef4409cb74cb9ae840ae7c5 (patch)
tree07555f6c8ab06a656edfa339c135beace298650a /sys
parentf50fe502de2688b3d7d3f708203e25f74ef7ee9a (diff)
Make sure to do the keyboard layout selection dance before wskbd_cnattach()
is invoked.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/sparc64/dev/comkbd_ebus.c49
1 files changed, 28 insertions, 21 deletions
diff --git a/sys/arch/sparc64/dev/comkbd_ebus.c b/sys/arch/sparc64/dev/comkbd_ebus.c
index 68c0535b4a2..942b104983d 100644
--- a/sys/arch/sparc64/dev/comkbd_ebus.c
+++ b/sys/arch/sparc64/dev/comkbd_ebus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: comkbd_ebus.c,v 1.11 2003/02/17 01:29:20 henric Exp $ */
+/* $OpenBSD: comkbd_ebus.c,v 1.12 2003/05/26 07:32:36 miod Exp $ */
/*
* Copyright (c) 2002 Jason L. Wright (jason@thought.net)
@@ -117,7 +117,7 @@ int comkbd_ioctl(void *, u_long, caddr_t, int, struct proc *);
/* internals */
void comkbd_enqueue(struct comkbd_softc *, u_int8_t *, u_int);
void comkbd_raw(struct comkbd_softc *, u_int8_t);
-void comkbd_init(struct comkbd_softc *);
+int comkbd_init(struct comkbd_softc *);
void comkbd_putc(struct comkbd_softc *, u_int8_t);
int comkbd_intr(void *);
void comkbd_soft(void *);
@@ -239,24 +239,10 @@ comkbd_attach(parent, self, aux)
return;
}
- if (console) {
- comkbd_init(sc);
- cn_tab->cn_dev = makedev(77, sc->sc_dv.dv_unit); /* XXX */
- cn_tab->cn_pollc = wskbd_cnpollc;
- cn_tab->cn_getc = wskbd_cngetc;
- if (ISTYPE5(sc->sc_layout)) {
- wskbd_cnattach(&comkbd_consops, sc,
- &sunkbd5_keymapdata);
- } else {
- wskbd_cnattach(&comkbd_consops, sc,
- &sunkbd_keymapdata);
- }
- sc->sc_ier = IER_ETXRDY | IER_ERXRDY;
- COM_WRITE(sc, com_ier, sc->sc_ier);
- COM_READ(sc, com_iir);
- COM_WRITE(sc, com_mcr, MCR_IENABLE | MCR_DTR | MCR_RTS);
- } else
- printf("\n");
+ if (!comkbd_init(sc)) {
+ printf("%s: no keyboard\n", self->dv_xname);
+ return;
+ }
a.console = console;
if (ISTYPE5(sc->sc_layout)) {
@@ -278,6 +264,25 @@ comkbd_attach(parent, self, aux)
}
a.accessops = &comkbd_accessops;
a.accesscookie = sc;
+
+ if (console) {
+ cn_tab->cn_dev = makedev(77, sc->sc_dv.dv_unit); /* XXX */
+ cn_tab->cn_pollc = wskbd_cnpollc;
+ cn_tab->cn_getc = wskbd_cngetc;
+ if (ISTYPE5(sc->sc_layout)) {
+ wskbd_cnattach(&comkbd_consops, sc,
+ &sunkbd5_keymapdata);
+ } else {
+ wskbd_cnattach(&comkbd_consops, sc,
+ &sunkbd_keymapdata);
+ }
+ sc->sc_ier = IER_ETXRDY | IER_ERXRDY;
+ COM_WRITE(sc, com_ier, sc->sc_ier);
+ COM_READ(sc, com_iir);
+ COM_WRITE(sc, com_mcr, MCR_IENABLE | MCR_DTR | MCR_RTS);
+ } else
+ printf("\n");
+
sc->sc_wskbddev = config_found(self, &a, wskbddevprint);
}
@@ -544,7 +549,7 @@ comkbd_intr(vsc)
return (1);
}
-void
+int
comkbd_init(sc)
struct comkbd_softc *sc;
{
@@ -612,6 +617,8 @@ comkbd_init(sc)
printf(": reset timeout\n");
else
printf(": layout %d\n", sc->sc_layout);
+
+ return tries;
}
void