Skip to content

Commit

Permalink
ns8250: Fix sense of LSR_TEMT FCR check
Browse files Browse the repository at this point in the history
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 <[email protected]>
Fixes:		c4b68e7 "ns8250: Check if flush via FCR succeeded"
Differential Revision:	https://reviews.freebsd.org/D37185
  • Loading branch information
cperciva committed Oct 28, 2022
1 parent ba9f71d commit 5ad8c32
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sys/dev/uart/uart_dev_ns8250.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5ad8c32

Please sign in to comment.