PERFORCE change 36398 for review

Marcel Moolenaar marcel at FreeBSD.org
Tue Aug 19 01:21:58 PDT 2003


http://perforce.freebsd.org/chv.cgi?CH=36398

Change 36398 by marcel at marcel_nfs on 2003/08/19 01:21:34

	ns8250_flush() clobbers the FIFO setting. Add a warning and
	make sure the callers deal with it. While here, set the
	trigger level to MEDH (=8 bytes). Throughput testing has
	shown that MEDL (=4 bytes) results in a receive interrupt
	every 6 or 7 characters at 115200 baud. We therefore
	have a 2 or 3 character latency. With MEDH we should have an
	interrupt every 10 or 11 characters, with 6 or 5 characters
	slack.
	(trivia: uart(4) is currently <1% slower than sio(4) for
	 transmissions due to the limited Tx buffer -- not bad for
	 a non-tuned driver).

Affected files ...

.. //depot/projects/uart/dev/uart/uart_dev_ns8250.c#16 edit

Differences ...

==== //depot/projects/uart/dev/uart/uart_dev_ns8250.c#16 (text+ko) ====

@@ -130,7 +130,7 @@
 
 /*
  * We can only flush UARTs with FIFOs. UARTs without FIFOs should be
- * drained.
+ * drained. WARNING: this function clobbers the FIFO setting!
  */
 static void
 ns8250_flush(struct uart_bas *bas, int what)
@@ -380,10 +380,10 @@
 	bas = &sc->sc_bas;
 
 	ns8250->mcr = uart_getreg(bas, REG_MCR);
-	ns8250->fcr = FCR_ENABLE | FCR_RX_MEDL;
+	ns8250->fcr = FCR_ENABLE | FCR_RX_MEDH;
+	ns8250_flush(bas, UART_FLUSH_RECEIVER|UART_FLUSH_TRANSMITTER);
 	uart_setreg(bas, REG_FCR, ns8250->fcr);
 	uart_barrier(bas);
-	ns8250_flush(bas, UART_FLUSH_RECEIVER|UART_FLUSH_TRANSMITTER);
 	if (ns8250->mcr & MCR_DTR)
 		ns8250->signals |= UART_SIG_DTR;
 	if (ns8250->mcr & MCR_RTS)
@@ -407,12 +407,17 @@
 static int
 ns8250_bus_flush(struct uart_softc *sc, int what)
 {
+	struct ns8250_softc *ns8250 = (struct ns8250_softc*)sc;
+	struct uart_bas *bas;
 
+	bas = &sc->sc_bas;
 	if (sc->sc_hasfifo) {
-		ns8250_flush(&sc->sc_bas, what);
+		ns8250_flush(bas, what);
+		uart_setreg(bas, REG_FCR, ns8250->fcr);
+		uart_barrier(bas);
 		return (0);
 	}
-	return (ns8250_drain(&sc->sc_bas, what));
+	return (ns8250_drain(bas, what));
 }
 
 static int


More information about the p4-projects mailing list