summaryrefslogtreecommitdiffstats
path: root/sys/mips/rt305x
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2014-01-19 19:36:11 +0000
committerimp <imp@FreeBSD.org>2014-01-19 19:36:11 +0000
commitda5df765d5b2dcffd55c078fbb36f27310d0751e (patch)
tree76518547e862bbe70161720988a5bae5fd6a90ab /sys/mips/rt305x
parent13c3304ef662d70494a0b84b14a9b3548ec34229 (diff)
downloadFreeBSD-src-da5df765d5b2dcffd55c078fbb36f27310d0751e.zip
FreeBSD-src-da5df765d5b2dcffd55c078fbb36f27310d0751e.tar.gz
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)
Diffstat (limited to 'sys/mips/rt305x')
-rw-r--r--sys/mips/rt305x/uart_dev_rt305x.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/sys/mips/rt305x/uart_dev_rt305x.c b/sys/mips/rt305x/uart_dev_rt305x.c
index 94d0386..3154cb9 100644
--- a/sys/mips/rt305x/uart_dev_rt305x.c
+++ b/sys/mips/rt305x/uart_dev_rt305x.c
@@ -195,6 +195,8 @@ static int rt305x_uart_bus_probe(struct uart_softc *);
static int rt305x_uart_bus_receive(struct uart_softc *);
static int rt305x_uart_bus_setsig(struct uart_softc *, int);
static int rt305x_uart_bus_transmit(struct uart_softc *);
+static void rt305x_uart_bus_grab(struct uart_softc *);
+static void rt305x_uart_bus_ungrab(struct uart_softc *);
static kobj_method_t rt305x_uart_methods[] = {
KOBJMETHOD(uart_attach, rt305x_uart_bus_attach),
@@ -208,6 +210,8 @@ static kobj_method_t rt305x_uart_methods[] = {
KOBJMETHOD(uart_receive, rt305x_uart_bus_receive),
KOBJMETHOD(uart_setsig, rt305x_uart_bus_setsig),
KOBJMETHOD(uart_transmit, rt305x_uart_bus_transmit),
+ KOBJMETHOD(uart_grab, rt305x_uart_bus_grab),
+ KOBJMETHOD(uart_ungrab, rt305x_uart_bus_ungrab),
{ 0, 0 }
};
@@ -278,7 +282,7 @@ rt305x_uart_bus_attach(struct uart_softc *sc)
uart_setreg(bas, UART_FCR_REG,
uart_getreg(bas, UART_FCR_REG) |
UART_FCR_FIFOEN | UART_FCR_TXTGR_1 | UART_FCR_RXTGR_1);
- uart_barrier(bas);
+ uart_barrier(bas);
/* Enable interrupts */
uart_setreg(bas, UART_IER_REG,
UART_IER_EDSSI | UART_IER_ELSI | UART_IER_ERBFI);
@@ -505,3 +509,28 @@ rt305x_uart_bus_transmit(struct uart_softc *sc)
uart_unlock(sc->sc_hwmtx);
return (0);
}
+
+static void
+rt305x_uart_bus_grab(struct uart_softc *sc)
+{
+ struct uart_bas *bas = &sc->sc_bas;
+
+ /* disable interrupts -- XXX not sure which one is RX, so kill them all */
+ uart_lock(sc->sc_hwmtx);
+ uart_setreg(bas, UART_IER_REG, 0);
+ uart_barrier(bas);
+ uart_unlock(sc->sc_hwmtx);
+}
+
+static void
+rt305x_uart_bus_ungrab(struct uart_softc *sc)
+{
+ struct uart_bas *bas = &sc->sc_bas;
+
+ /* Enable interrupts */
+ uart_lock(sc->sc_hwmtx);
+ uart_setreg(bas, UART_IER_REG,
+ UART_IER_EDSSI | UART_IER_ELSI | UART_IER_ERBFI);
+ uart_barrier(bas);
+ uart_unlock(sc->sc_hwmtx);
+}
OpenPOWER on IntegriCloud