summaryrefslogtreecommitdiffstats
path: root/sys/arm
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
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')
-rw-r--r--sys/arm/s3c2xx0/uart_dev_s3c2410.c24
-rw-r--r--sys/arm/sa11x0/uart_dev_sa1110.c30
-rw-r--r--sys/arm/xilinx/uart_dev_cdnc.c25
3 files changed, 75 insertions, 4 deletions
diff --git a/sys/arm/s3c2xx0/uart_dev_s3c2410.c b/sys/arm/s3c2xx0/uart_dev_s3c2410.c
index 0f9f798..aadd835 100644
--- a/sys/arm/s3c2xx0/uart_dev_s3c2410.c
+++ b/sys/arm/s3c2xx0/uart_dev_s3c2410.c
@@ -203,7 +203,6 @@ s3c2410_getc(struct uart_bas *bas, struct mtx *mtx)
return sscom_getc(bas->bst, bas->bsh);
}
-
static int s3c2410_bus_probe(struct uart_softc *sc);
static int s3c2410_bus_attach(struct uart_softc *sc);
static int s3c2410_bus_flush(struct uart_softc *, int);
@@ -214,6 +213,8 @@ static int s3c2410_bus_param(struct uart_softc *, int, int, int, int);
static int s3c2410_bus_receive(struct uart_softc *);
static int s3c2410_bus_setsig(struct uart_softc *, int);
static int s3c2410_bus_transmit(struct uart_softc *);
+static void s3c2410_bus_grab(struct uart_softc *);
+static void s3c2410_bus_ungrab(struct uart_softc *);
static kobj_method_t s3c2410_methods[] = {
KOBJMETHOD(uart_probe, s3c2410_bus_probe),
@@ -226,6 +227,8 @@ static kobj_method_t s3c2410_methods[] = {
KOBJMETHOD(uart_receive, s3c2410_bus_receive),
KOBJMETHOD(uart_setsig, s3c2410_bus_setsig),
KOBJMETHOD(uart_transmit, s3c2410_bus_transmit),
+ KOBJMETHOD(uart_grab, s3c2410_bus_grab),
+ KOBJMETHOD(uart_ungrab, s3c2410_bus_ungrab),
{0, 0 }
};
@@ -373,6 +376,25 @@ s3c2410_bus_ioctl(struct uart_softc *sc, int request, intptr_t data)
return (EINVAL);
}
+
+static void
+s3c2410_bus_grab(struct uart_softc *sc)
+{
+ uintptr_t irq;
+
+ irq = rman_get_start(sc->sc_ires);
+ arm_mask_irq(get_sub_irq(irq, RX_OFF));
+}
+
+static void
+s3c2410_bus_ungrab(struct uart_softc *sc)
+{
+ uintptr_t irq;
+
+ irq = rman_get_start(sc->sc_ires);
+ arm_unmask_irq(get_sub_irq(irq, RX_OFF));
+}
+
struct uart_class uart_s3c2410_class = {
"s3c2410 class",
s3c2410_methods,
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,
diff --git a/sys/arm/xilinx/uart_dev_cdnc.c b/sys/arm/xilinx/uart_dev_cdnc.c
index a008853..6224503 100644
--- a/sys/arm/xilinx/uart_dev_cdnc.c
+++ b/sys/arm/xilinx/uart_dev_cdnc.c
@@ -398,6 +398,8 @@ static int cdnc_uart_bus_param(struct uart_softc *, int, int, int, int);
static int cdnc_uart_bus_receive(struct uart_softc *);
static int cdnc_uart_bus_setsig(struct uart_softc *, int);
static int cdnc_uart_bus_transmit(struct uart_softc *);
+static void cdnc_uart_bus_grab(struct uart_softc *);
+static void cdnc_uart_bus_ungrab(struct uart_softc *);
static kobj_method_t cdnc_uart_bus_methods[] = {
KOBJMETHOD(uart_probe, cdnc_uart_bus_probe),
@@ -410,6 +412,8 @@ static kobj_method_t cdnc_uart_bus_methods[] = {
KOBJMETHOD(uart_receive, cdnc_uart_bus_receive),
KOBJMETHOD(uart_setsig, cdnc_uart_bus_setsig),
KOBJMETHOD(uart_transmit, cdnc_uart_bus_transmit),
+ KOBJMETHOD(uart_grab, cdnc_uart_bus_grab),
+ KOBJMETHOD(uart_ungrab, cdnc_uart_bus_ungrab),
KOBJMETHOD_END
};
@@ -675,6 +679,27 @@ cdnc_uart_bus_ioctl(struct uart_softc *sc, int request, intptr_t data)
return (error);
}
+static void
+cdnc_uart_bus_grab(struct uart_softc *sc)
+{
+
+ /* Enable interrupts. */
+ WR4(&sc->sc_bas, CDNC_UART_IEN_REG,
+ CDNC_UART_INT_TXOVR | CDNC_UART_INT_RXOVR |
+ CDNC_UART_INT_DMSI);
+}
+
+static void
+cdnc_uart_bus_ungrab(struct uart_softc *sc)
+{
+
+ /* Enable interrupts. */
+ WR4(&sc->sc_bas, CDNC_UART_IEN_REG,
+ CDNC_UART_INT_RXTRIG | CDNC_UART_INT_RXTMOUT |
+ CDNC_UART_INT_TXOVR | CDNC_UART_INT_RXOVR |
+ CDNC_UART_INT_DMSI);
+}
+
struct uart_class uart_cdnc_class = {
"cdnc_uart",
cdnc_uart_bus_methods,
OpenPOWER on IntegriCloud