diff options
author | marcel <marcel@FreeBSD.org> | 2004-11-14 23:12:14 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2004-11-14 23:12:14 +0000 |
commit | e8dfdbc0d9271a989b2c87716156eb42006a19f2 (patch) | |
tree | bdc6452d228c1213096f5f8255b04a8086e25b63 /sys/dev/uart | |
parent | 1808b89247609346e38f66d8b9f9d4bcd6254e43 (diff) | |
download | FreeBSD-src-e8dfdbc0d9271a989b2c87716156eb42006a19f2.zip FreeBSD-src-e8dfdbc0d9271a989b2c87716156eb42006a19f2.tar.gz |
Add UART_IOCTL_BAUD to allow us to query the hardware about the
current baudrate setting. Use this ioctl() when we don't know the
baudrate of the sysdev (as represented by a 0 value). When the
ioctl() fails, e.g. when the backend hasn't implemented it or the
hardware doesn't provide the means to determine its current baudrate
setting, we invalidate the baudrate setting by setting it to -1.
None of the backends currently implement the new ioctl().
Diffstat (limited to 'sys/dev/uart')
-rw-r--r-- | sys/dev/uart/uart_bus.h | 1 | ||||
-rw-r--r-- | sys/dev/uart/uart_core.c | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/sys/dev/uart/uart_bus.h b/sys/dev/uart/uart_bus.h index 4a2d8aa..cc9ce4d 100644 --- a/sys/dev/uart/uart_bus.h +++ b/sys/dev/uart/uart_bus.h @@ -80,6 +80,7 @@ #define UART_IOCTL_BREAK 1 #define UART_IOCTL_IFLOW 2 #define UART_IOCTL_OFLOW 3 +#define UART_IOCTL_BAUD 4 /* * UART class & instance (=softc) diff --git a/sys/dev/uart/uart_core.c b/sys/dev/uart/uart_core.c index 9740cff..ca89c5c 100644 --- a/sys/dev/uart/uart_core.c +++ b/sys/dev/uart/uart_core.c @@ -391,6 +391,11 @@ uart_bus_attach(device_t dev) } if (sc->sc_sysdev != NULL) { + if (sc->sc_sysdev->baudrate == 0) { + if (UART_IOCTL(sc, UART_IOCTL_BAUD, + (intptr_t)&sc->sc_sysdev->baudrate) != 0) + sc->sc_sysdev->baudrate = -1; + } switch (sc->sc_sysdev->type) { case UART_DEV_CONSOLE: device_printf(dev, "console"); |