Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Oct 2022 19:20:50 GMT
From:      Colin Percival <cperciva@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 5ad8c32c722b - main - ns8250: Fix sense of LSR_TEMT FCR check
Message-ID:  <202210281920.29SJKoti077591@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=5ad8c32c722b58da4c153f241201af51b11f3152

commit 5ad8c32c722b58da4c153f241201af51b11f3152
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2022-10-28 04:42:44 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2022-10-28 19:20:28 +0000

    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:          c4b68e7e53bb "ns8250: Check if flush via FCR succeeded"
    Differential Revision:  https://reviews.freebsd.org/D37185
---
 sys/dev/uart/uart_dev_ns8250.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c
index d0eadeded943..475ab5d4425e 100644
--- a/sys/dev/uart/uart_dev_ns8250.c
+++ b/sys/dev/uart/uart_dev_ns8250.c
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202210281920.29SJKoti077591>