mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
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:
parent
54e2bcc7ad
commit
d8518925d0
1 changed files with 11 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue