From 54e2bcc7add7bc78d5bc253c597bda0f9b67052a Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Sun, 14 Nov 2004 23:12:14 +0000 Subject: 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(). --- sys/dev/uart/uart_bus.h | 1 + sys/dev/uart/uart_core.c | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'sys/dev/uart') diff --git a/sys/dev/uart/uart_bus.h b/sys/dev/uart/uart_bus.h index 4a2d8aad71f34..cc9ce4df5a75d 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 9740cffc28ea0..ca89c5cfd0e30 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"); -- cgit v1.3