ns8250: Fix sense of LSR_TEMT FCR check

When flushing the UART, we need to drain manually if LSR_TEMT is
*not* asserted, aka. if the transmit FIFO is not empty.

Reported by:	void <void@f-m.fm>
Fixes:		c4b68e7e53 "ns8250: Check if flush via FCR succeeded"
Differential Revision:	https://reviews.freebsd.org/D37185
This commit is contained in:
Colin Percival 2022-10-27 21:42:44 -07:00
parent ba9f71ddec
commit 5ad8c32c72

View File

@ -232,7 +232,7 @@ ns8250_flush(struct uart_bas *bas, int what)
* https://github.com/rust-vmm/vm-superio/issues/83
*/
lsr = uart_getreg(bas, REG_LSR);
if ((lsr & LSR_TEMT) && (what & UART_FLUSH_TRANSMITTER))
if (((lsr & LSR_TEMT) == 0) && (what & UART_FLUSH_TRANSMITTER))
drain |= UART_DRAIN_TRANSMITTER;
if ((lsr & LSR_RXRDY) && (what & UART_FLUSH_RECEIVER))
drain |= UART_DRAIN_RECEIVER;