Implement UART_IOCTL_BAUD. Consequently, when the baudrate was unset

for the console, we emit the actual baudrate during bus enumeration.
This commit is contained in:
Marcel Moolenaar 2004-11-14 23:31:19 +00:00
parent 54e2bcc7ad
commit d8518925d0

View file

@ -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;