From 0d2fd5b99c95329085d0700a4dd38507a054a50d Mon Sep 17 00:00:00 2001 From: Andriy Gapon Date: Sun, 10 Nov 2024 13:15:30 +0200 Subject: ns8250: use LSR_THRE instead of LSR_TEMT for checking tx flush LSR_TEMT bit is set if both transmit hold and shift registers are empty, but the flush command flushes only the hold register. While here, update the diagnostic message to report which registers could not be flushed. MFC after: 2 weeks --- sys/dev/uart/uart_dev_ns8250.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c index 1df39b499539..0f19ede6d9df 100644 --- a/sys/dev/uart/uart_dev_ns8250.c +++ b/sys/dev/uart/uart_dev_ns8250.c @@ -265,12 +265,12 @@ 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) == 0) && (what & UART_FLUSH_TRANSMITTER)) + if (((lsr & LSR_THRE) == 0) && (what & UART_FLUSH_TRANSMITTER)) drain |= UART_DRAIN_TRANSMITTER; if ((lsr & LSR_RXRDY) && (what & UART_FLUSH_RECEIVER)) drain |= UART_DRAIN_RECEIVER; if (drain != 0) { - printf("uart: ns8250: UART FCR is broken\n"); + printf("uart: ns8250: UART FCR is broken (%#x)\n", drain); ns8250_drain(bas, drain); } } -- cgit v1.3