summaryrefslogtreecommitdiffstats
path: root/sys/dev/uart/uart_core.c
diff options
context:
space:
mode:
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