summaryrefslogtreecommitdiffstats
path: root/sys/arm/sa11x0
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/arm/sa11x0
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/arm/sa11x0')
-rw-r--r--sys/arm/sa11x0/uart_dev_sa1110.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/sys/arm/sa11x0/uart_dev_sa1110.c b/sys/arm/sa11x0/uart_dev_sa1110.c
index 6765cf2..1df1009 100644
--- a/sys/arm/sa11x0/uart_dev_sa1110.c
+++ b/sys/arm/sa11x0/uart_dev_sa1110.c
@@ -137,6 +137,8 @@ static int sa1110_bus_param(struct uart_softc *, int, int, int, int);
static int sa1110_bus_receive(struct uart_softc *);
static int sa1110_bus_setsig(struct uart_softc *, int);
static int sa1110_bus_transmit(struct uart_softc *);
+static void sa1110_bus_grab(struct uart_softc *);
+static void sa1110_bus_ungrab(struct uart_softc *);
static kobj_method_t sa1110_methods[] = {
KOBJMETHOD(uart_probe, sa1110_bus_probe),
@@ -149,6 +151,8 @@ static kobj_method_t sa1110_methods[] = {
KOBJMETHOD(uart_receive, sa1110_bus_receive),
KOBJMETHOD(uart_setsig, sa1110_bus_setsig),
KOBJMETHOD(uart_transmit, sa1110_bus_transmit),
+ KOBJMETHOD(uart_grab, sa1110_bus_grab),
+ KOBJMETHOD(uart_ungrab, sa1110_bus_ungrab),
{0, 0 }
};
@@ -164,10 +168,10 @@ sa1110_bus_probe(struct uart_softc *sc)
static int
sa1110_bus_attach(struct uart_softc *sc)
{
- bcopy(&sc->sc_sysdev->bas, &sc->sc_bas, sizeof(sc->sc_bas));
+ bcopy(&sc->sc_sysdev->bas, &sc->sc_bas, sizeof(sc->sc_bas));
- sc->sc_hwiflow = 0;
- uart_setreg(&sc->sc_bas, SACOM_CR3, CR3_RXE | CR3_TXE | CR3_RIE | CR3_TIE);
+ sc->sc_hwiflow = 0;
+ uart_setreg(&sc->sc_bas, SACOM_CR3, CR3_RXE | CR3_TXE | CR3_RIE | CR3_TIE);
return (0);
}
static int
@@ -273,6 +277,26 @@ sa1110_bus_ioctl(struct uart_softc *sc, int request, intptr_t data)
return (EINVAL);
}
+static void
+sa1110_bus_grab(struct uart_softc *sc)
+{
+
+ /* Turn off Rx interrupts */
+ uart_lock(sc->sc_hwmtx);
+ uart_setreg(&sc->sc_bas, SACOM_CR3, CR3_TXE | CR3_TIE);
+ uart_unlock(sc->sc_hwmtx);
+}
+
+static void
+sa1110_bus_ungrab(struct uart_softc *sc)
+{
+
+ /* Turn on Rx interrupts */
+ uart_lock(sc->sc_hwmtx);
+ uart_setreg(&sc->sc_bas, SACOM_CR3, CR3_RXE | CR3_TXE | CR3_RIE | CR3_TIE);
+ uart_unlock(sc->sc_hwmtx);
+}
+
struct uart_class uart_sa1110_class = {
"sa1110",
sa1110_methods,
OpenPOWER on IntegriCloud