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_core.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sys/dev/uart/uart_core.c') 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