summaryrefslogtreecommitdiffstats
path: root/sys/dev/uart/uart_core.c
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2014-01-19 19:39:13 +0000
committerimp <imp@FreeBSD.org>2014-01-19 19:39:13 +0000
commit94a6f4f9ab32806b4ad781889a671328ab81e122 (patch)
tree90f500f8dae436ffff7d1b262113646a73f06e4a /sys/dev/uart/uart_core.c
parentda5df765d5b2dcffd55c078fbb36f27310d0751e (diff)
downloadFreeBSD-src-94a6f4f9ab32806b4ad781889a671328ab81e122.zip
FreeBSD-src-94a6f4f9ab32806b4ad781889a671328ab81e122.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. Should have been part of r260889, but waasn't due to command line typo. Reviewed by: bde (with reservations)
Diffstat (limited to 'sys/dev/uart/uart_core.c')
-rw-r--r--sys/dev/uart/uart_core.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/sys/dev/uart/uart_core.c b/sys/dev/uart/uart_core.c
index 17dabd7..08ac576 100644
--- a/sys/dev/uart/uart_core.c
+++ b/sys/dev/uart/uart_core.c
@@ -412,6 +412,13 @@ uart_bus_attach(device_t dev)
sc = sc0;
/*
+ * Now that we know the softc for this device, connect the back
+ * pointer from the sysdev for this device, if any
+ */
+ if (sc->sc_sysdev != NULL)
+ sc->sc_sysdev->sc = sc;
+
+ /*
* Protect ourselves against interrupts while we're not completely
* finished attaching and initializing. We don't expect interrupts
* until after UART_ATTACH() though.
@@ -617,3 +624,23 @@ uart_bus_resume(device_t dev)
sc = device_get_softc(dev);
return (UART_ATTACH(sc));
}
+
+void
+uart_grab(struct uart_devinfo *di)
+{
+
+ uart_lock(di->hwmtx);
+ if (di->sc)
+ UART_GRAB(di->sc);
+ uart_unlock(di->hwmtx);
+}
+
+void
+uart_ungrab(struct uart_devinfo *di)
+{
+
+ uart_lock(di->hwmtx);
+ if (di->sc)
+ UART_UNGRAB(di->sc);
+ uart_unlock(di->hwmtx);
+}
OpenPOWER on IntegriCloud