svn commit: r338809 - stable/10/sys/dev/uart
Alexander Motin
mav at FreeBSD.org
Wed Sep 19 19:54:15 UTC 2018
Author: mav
Date: Wed Sep 19 19:54:13 2018
New Revision: 338809
URL: https://svnweb.freebsd.org/changeset/base/338809
Log:
MFC r317659, r317752:
Make some UART consoles to not spin wait for data to be sent.
At least with Tx FIFO enabled it shows me ~10% reduction of verbose boot
time with serial console at 115200 baud.
Modified:
stable/10/sys/dev/uart/uart_dev_lpc.c
stable/10/sys/dev/uart/uart_dev_ns8250.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/dev/uart/uart_dev_lpc.c
==============================================================================
--- stable/10/sys/dev/uart/uart_dev_lpc.c Wed Sep 19 19:52:53 2018 (r338808)
+++ stable/10/sys/dev/uart/uart_dev_lpc.c Wed Sep 19 19:54:13 2018 (r338809)
@@ -346,9 +346,6 @@ lpc_ns8250_putc(struct uart_bas *bas, int c)
DELAY(4);
uart_setreg(bas, REG_DATA, c);
uart_barrier(bas);
- limit = 250000;
- while ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0 && --limit)
- DELAY(4);
}
static int
@@ -889,8 +886,13 @@ lpc_ns8250_bus_transmit(struct uart_softc *sc)
bas = &sc->sc_bas;
uart_lock(sc->sc_hwmtx);
- while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0)
- ;
+ if (sc->sc_txdatasz > 1) {
+ if ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0)
+ lpc_ns8250_drain(bas, UART_DRAIN_TRANSMITTER);
+ } else {
+ while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0)
+ DELAY(4);
+ }
uart_setreg(bas, REG_IER, lpc_ns8250->ier | IER_ETXRDY);
uart_barrier(bas);
for (i = 0; i < sc->sc_txdatasz; i++) {
Modified: stable/10/sys/dev/uart/uart_dev_ns8250.c
==============================================================================
--- stable/10/sys/dev/uart/uart_dev_ns8250.c Wed Sep 19 19:52:53 2018 (r338808)
+++ stable/10/sys/dev/uart/uart_dev_ns8250.c Wed Sep 19 19:54:13 2018 (r338809)
@@ -305,7 +305,7 @@ ns8250_init(struct uart_bas *bas, int baudrate, int da
/* Disable the FIFO (if present). */
val = 0;
#ifdef CPU_XBURST
- val = FCR_UART_ON;
+ val |= FCR_UART_ON;
#endif
uart_setreg(bas, REG_FCR, val);
uart_barrier(bas);
@@ -336,9 +336,6 @@ ns8250_putc(struct uart_bas *bas, int c)
DELAY(4);
uart_setreg(bas, REG_DATA, c);
uart_barrier(bas);
- limit = 250000;
- while ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0 && --limit)
- DELAY(4);
}
static int
@@ -993,8 +990,13 @@ ns8250_bus_transmit(struct uart_softc *sc)
bas = &sc->sc_bas;
uart_lock(sc->sc_hwmtx);
- while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0)
- ;
+ if (sc->sc_txdatasz > 1) {
+ if ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0)
+ ns8250_drain(bas, UART_DRAIN_TRANSMITTER);
+ } else {
+ while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0)
+ DELAY(4);
+ }
uart_setreg(bas, REG_IER, ns8250->ier | IER_ETXRDY);
uart_barrier(bas);
for (i = 0; i < sc->sc_txdatasz; i++) {
More information about the svn-src-stable-10
mailing list