summaryrefslogtreecommitdiffstats
path: root/sys/dev/uart/uart_dev_sab82532.c
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2014-03-01 04:16:54 +0000
committerimp <imp@FreeBSD.org>2014-03-01 04:16:54 +0000
commit33b9ca9ab1e84f2fbd3154eb278624e7f535e144 (patch)
treef4dec5665294aedbe5d1458dcc6ef4f5938bc1af /sys/dev/uart/uart_dev_sab82532.c
parent1135c91d00efe0ccd2baec70e62034511c5310f8 (diff)
downloadFreeBSD-src-33b9ca9ab1e84f2fbd3154eb278624e7f535e144.zip
FreeBSD-src-33b9ca9ab1e84f2fbd3154eb278624e7f535e144.tar.gz
MFC: r260889, r260890, r260911:
r260911 | imp | 2014-01-20 10:45:36 -0700 (Mon, 20 Jan 2014) | 5 lines Don't lock in the generic grab just to lock again in the specific grabs. r260890 | imp | 2014-01-19 12:39:13 -0700 (Sun, 19 Jan 2014) | 11 lines 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/dev/uart/uart_dev_sab82532.c')
-rw-r--r--sys/dev/uart/uart_dev_sab82532.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/sys/dev/uart/uart_dev_sab82532.c b/sys/dev/uart/uart_dev_sab82532.c
index e2ec227..8caa7a7 100644
--- a/sys/dev/uart/uart_dev_sab82532.c
+++ b/sys/dev/uart/uart_dev_sab82532.c
@@ -365,6 +365,8 @@ static int sab82532_bus_probe(struct uart_softc *);
static int sab82532_bus_receive(struct uart_softc *);
static int sab82532_bus_setsig(struct uart_softc *, int);
static int sab82532_bus_transmit(struct uart_softc *);
+static void sab82532_bus_grab(struct uart_softc *);
+static void sab82532_bus_ungrab(struct uart_softc *);
static kobj_method_t sab82532_methods[] = {
KOBJMETHOD(uart_attach, sab82532_bus_attach),
@@ -378,6 +380,8 @@ static kobj_method_t sab82532_methods[] = {
KOBJMETHOD(uart_receive, sab82532_bus_receive),
KOBJMETHOD(uart_setsig, sab82532_bus_setsig),
KOBJMETHOD(uart_transmit, sab82532_bus_transmit),
+ KOBJMETHOD(uart_grab, sab82532_bus_grab),
+ KOBJMETHOD(uart_ungrab, sab82532_bus_ungrab),
{ 0, 0 }
};
@@ -724,3 +728,32 @@ sab82532_bus_transmit(struct uart_softc *sc)
uart_unlock(sc->sc_hwmtx);
return (0);
}
+
+static void
+sab82532_bus_grab(struct uart_softc *sc)
+{
+ struct uart_bas *bas;
+ uint8_t imr0;
+
+ bas = &sc->sc_bas;
+ imr0 = SAB_IMR0_TIME|SAB_IMR0_CDSC|SAB_IMR0_RFO; /* No TCD or RPF */
+ uart_lock(sc->sc_hwmtx);
+ uart_setreg(bas, SAB_IMR0, 0xff & ~imr0);
+ uart_barrier(bas);
+ uart_unlock(sc->sc_hwmtx);
+}
+
+static void
+sab82532_bus_ungrab(struct uart_softc *sc)
+{
+ struct uart_bas *bas;
+ uint8_t imr0;
+
+ bas = &sc->sc_bas;
+ imr0 = SAB_IMR0_TCD|SAB_IMR0_TIME|SAB_IMR0_CDSC|SAB_IMR0_RFO|
+ SAB_IMR0_RPF;
+ uart_lock(sc->sc_hwmtx);
+ uart_setreg(bas, SAB_IMR0, 0xff & ~imr0);
+ uart_barrier(bas);
+ uart_unlock(sc->sc_hwmtx);
+}
OpenPOWER on IntegriCloud