diff options
author | marcel <marcel@FreeBSD.org> | 2004-11-14 23:31:19 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2004-11-14 23:31:19 +0000 |
commit | c55bdcd31dc4393dcbfa99d06bbb35a6b0040793 (patch) | |
tree | 7ac4aa5a38e4e6ad8667b62772bd5130f408fb8a | |
parent | e8dfdbc0d9271a989b2c87716156eb42006a19f2 (diff) | |
download | FreeBSD-src-c55bdcd31dc4393dcbfa99d06bbb35a6b0040793.zip FreeBSD-src-c55bdcd31dc4393dcbfa99d06bbb35a6b0040793.tar.gz |
Implement UART_IOCTL_BAUD. Consequently, when the baudrate was unset
for the console, we emit the actual baudrate during bus enumeration.
-rw-r--r-- | sys/dev/uart/uart_dev_ns8250.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c index adac35f..975ed4d 100644 --- a/sys/dev/uart/uart_dev_ns8250.c +++ b/sys/dev/uart/uart_dev_ns8250.c @@ -468,7 +468,7 @@ static int ns8250_bus_ioctl(struct uart_softc *sc, int request, intptr_t data) { struct uart_bas *bas; - int error; + int divisor, error; uint8_t efr, lcr; bas = &sc->sc_bas; @@ -514,6 +514,16 @@ ns8250_bus_ioctl(struct uart_softc *sc, int request, intptr_t data) uart_setreg(bas, REG_LCR, lcr); uart_barrier(bas); break; + case UART_IOCTL_BAUD: + lcr = uart_getreg(bas, REG_LCR); + uart_setreg(bas, REG_LCR, lcr | LCR_DLAB); + uart_barrier(bas); + divisor = uart_getdreg(bas, REG_DL); + uart_barrier(bas); + uart_setreg(bas, REG_LCR, lcr); + uart_barrier(bas); + *(int*)data = bas->rclk / divisor / 16; + break; default: error = EINVAL; break; |