diff options
author | Warner Losh <imp@FreeBSD.org> | 2014-01-19 19:36:11 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 2014-01-19 19:36:11 +0000 |
commit | 294ef64a179a325470350e10e150130bd3dfb895 (patch) | |
tree | 76518547e862bbe70161720988a5bae5fd6a90ab /sys/mips/cavium | |
parent | 80f9f1580ec919d5e0951cde031accb2e5a61b6c (diff) | |
download | src-294ef64a179a325470350e10e150130bd3dfb895.tar.gz src-294ef64a179a325470350e10e150130bd3dfb895.zip |
Introduce grab and ungrab upcalls. When the kernel desires to grab the
console, it calls the grab functions. These functions should turn off
the RX interrupts, and any others that interfere. This makes mountroot
prompt work again. If there's more generalized need other than
prompting, many of these routines should be expanded to do those new
things.
Reviewed by: bde (with reservations)
Notes
Notes:
svn path=/head/; revision=260889
Diffstat (limited to 'sys/mips/cavium')
-rw-r--r-- | sys/mips/cavium/uart_dev_oct16550.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/sys/mips/cavium/uart_dev_oct16550.c b/sys/mips/cavium/uart_dev_oct16550.c index 753559ff7a92..f3d47ca9ef56 100644 --- a/sys/mips/cavium/uart_dev_oct16550.c +++ b/sys/mips/cavium/uart_dev_oct16550.c @@ -398,6 +398,8 @@ static int oct16550_bus_probe(struct uart_softc *); static int oct16550_bus_receive(struct uart_softc *); static int oct16550_bus_setsig(struct uart_softc *, int); static int oct16550_bus_transmit(struct uart_softc *); +static void oct16550_bus_grab(struct uart_softc *); +static void oct16550_bus_ungrab(struct uart_softc *); static kobj_method_t oct16550_methods[] = { KOBJMETHOD(uart_attach, oct16550_bus_attach), @@ -411,6 +413,8 @@ static kobj_method_t oct16550_methods[] = { KOBJMETHOD(uart_receive, oct16550_bus_receive), KOBJMETHOD(uart_setsig, oct16550_bus_setsig), KOBJMETHOD(uart_transmit, oct16550_bus_transmit), + KOBJMETHOD(uart_grab, oct16550_bus_grab), + KOBJMETHOD(uart_ungrab, oct16550_bus_ungrab), { 0, 0 } }; @@ -810,3 +814,34 @@ oct16550_bus_transmit (struct uart_softc *sc) uart_unlock(sc->sc_hwmtx); return (0); } + +static void +oct16550_bus_grab(struct uart_softc *sc) +{ + struct uart_bas *bas = &sc->sc_bas; + + /* + * turn off all interrupts to enter polling mode. Leave the + * saved mask alone. We'll restore whatever it was in ungrab. + * All pending interupt signals are reset when IER is set to 0. + */ + uart_lock(sc->sc_hwmtx); + uart_setreg(bas, REG_IER, 0); + uart_barrier(bas); + uart_unlock(sc->sc_hwmtx); +} + +static void +oct16550_bus_ungrab(struct uart_softc *sc) +{ + struct oct16550_softc *oct16550 = (struct oct16550_softc*)sc; + struct uart_bas *bas = &sc->sc_bas; + + /* + * Restore previous interrupt mask + */ + uart_lock(sc->sc_hwmtx); + uart_setreg(bas, REG_IER, oct16550->ier); + uart_barrier(bas); + uart_unlock(sc->sc_hwmtx); +} |