diff options
author | marius <marius@FreeBSD.org> | 2005-06-04 21:54:31 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2005-06-04 21:54:31 +0000 |
commit | f1c26a9917b41db8f8f147a22576945ea521bb0b (patch) | |
tree | 1898fbb5445e5e8dcfc7535d4b84168d69882873 /sys/dev/uart/uart_kbd_sun.c | |
parent | d128ff3218882f4ff46a3cefae1cc7b96bfbee79 (diff) | |
download | FreeBSD-src-f1c26a9917b41db8f8f147a22576945ea521bb0b.zip FreeBSD-src-f1c26a9917b41db8f8f147a22576945ea521bb0b.tar.gz |
Replace the band-aid for allowing to call sunkbd_configure() multiple
times which was added in the last revision with what should be a proper
solution as long as keyboards that were pluggged in after the kernel
has fully booted aren't supported. I.e. when sunkbd_configure() is
called for the high-level console probe make sure that the keyboard is
both successfully configured (i.e. also probed) and attached. The band-
aid left the possibility to attach the keyboard device to the high-level
console without attaching the keyboard device itself when the keyboard
is plugged in after uart(4) attached but before syscons(4) does.
Diffstat (limited to 'sys/dev/uart/uart_kbd_sun.c')
-rw-r--r-- | sys/dev/uart/uart_kbd_sun.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/sys/dev/uart/uart_kbd_sun.c b/sys/dev/uart/uart_kbd_sun.c index 97c8bc5..4d024d2 100644 --- a/sys/dev/uart/uart_kbd_sun.c +++ b/sys/dev/uart/uart_kbd_sun.c @@ -190,22 +190,27 @@ sunkbd_configure(int flags) { struct sunkbd_softc *sc; - if (KBD_IS_CONFIGURED(&sunkbd_softc.sc_kbd)) - goto found; - - if (!KBD_IS_INITIALIZED(&sunkbd_softc.sc_kbd)) { - if (uart_cpu_getdev(UART_DEV_KEYBOARD, &uart_keyboard)) - return (0); - if (uart_probe(&uart_keyboard)) + /* + * We are only prepared to be used for the high-level console + * when the keyboard is both configured and attached. + */ + if (!(flags & KB_CONF_PROBE_ONLY)) { + if (KBD_IS_INITIALIZED(&sunkbd_softc.sc_kbd)) + goto found; + else return (0); - uart_init(&uart_keyboard); - - uart_keyboard.type = UART_DEV_KEYBOARD; - uart_keyboard.attach = sunkbd_attach; - uart_add_sysdev(&uart_keyboard); - KBD_INIT_DONE(&sunkbd_softc.sc_kbd); } + if (uart_cpu_getdev(UART_DEV_KEYBOARD, &uart_keyboard)) + return (0); + if (uart_probe(&uart_keyboard)) + return (0); + uart_init(&uart_keyboard); + + uart_keyboard.type = UART_DEV_KEYBOARD; + uart_keyboard.attach = sunkbd_attach; + uart_add_sysdev(&uart_keyboard); + if (sunkbd_probe_keyboard(&uart_keyboard) == -1) return (0); @@ -222,7 +227,6 @@ sunkbd_configure(int flags) kbd_register(&sc->sc_kbd); sc->sc_sysdev = &uart_keyboard; - KBD_CONFIG_DONE(&sc->sc_kbd); found: /* Return number of found keyboards. */ @@ -254,6 +258,7 @@ sunkbd_attach(struct uart_softc *sc) &sunkbd_softc, SWI_TTY, INTR_TYPE_TTY, &sc->sc_softih); sc->sc_opened = 1; + KBD_INIT_DONE(&sunkbd_softc.sc_kbd); } return (0); |