svn commit: r309276 - head/sys/dev/uart

Jayachandran C. jchandra at FreeBSD.org
Tue Nov 29 04:32:16 UTC 2016


Author: jchandra
Date: Tue Nov 29 04:32:14 2016
New Revision: 309276
URL: https://svnweb.freebsd.org/changeset/base/309276

Log:
  Fix interrupt clear in pl011 uart receive function
  
  Clear the interrupt state before reading the input char from the
  input FIFO. In the current code there is a window between the read
  to the data register and the write to the the ICR, during which an
  input char will not cause an interrupt.
  
  This fixes the issue by which the serial port input on QEMU freezes
  when using the emulated pl011 serial port.

Modified:
  head/sys/dev/uart/uart_dev_pl011.c

Modified: head/sys/dev/uart/uart_dev_pl011.c
==============================================================================
--- head/sys/dev/uart/uart_dev_pl011.c	Tue Nov 29 01:08:09 2016	(r309275)
+++ head/sys/dev/uart/uart_dev_pl011.c	Tue Nov 29 04:32:14 2016	(r309276)
@@ -443,6 +443,8 @@ uart_pl011_bus_receive(struct uart_softc
 			sc->sc_rxbuf[sc->sc_rxput] = UART_STAT_OVERRUN;
 			break;
 		}
+
+		__uart_setreg(bas, UART_ICR, (UART_RXREADY | RIS_RTIM));
 		xc = __uart_getreg(bas, UART_DR);
 		rx = xc & 0xff;
 
@@ -451,8 +453,6 @@ uart_pl011_bus_receive(struct uart_softc
 		if (xc & DR_PE)
 			rx |= UART_STAT_PARERR;
 
-		__uart_setreg(bas, UART_ICR, (UART_RXREADY | RIS_RTIM));
-
 		uart_rx_put(sc, rx);
 		ints = __uart_getreg(bas, UART_MIS);
 	}


More information about the svn-src-head mailing list