git: 45c8ddc874bb - main - uart/pci: recover ADL AMT device after FIFO size probing

From: Roger Pau Monné <royger_at_FreeBSD.org>
Date: Fri, 17 Apr 2026 19:37:40 UTC
The branch main has been updated by royger:

URL: https://cgit.FreeBSD.org/src/commit/?id=45c8ddc874bb9149ed20cb46b6ef8bdd0567714c

commit 45c8ddc874bb9149ed20cb46b6ef8bdd0567714c
Author:     Roger Pau Monné <royger@FreeBSD.org>
AuthorDate: 2026-03-27 09:55:02 +0000
Commit:     Roger Pau Monné <royger@FreeBSD.org>
CommitDate: 2026-04-17 19:37:26 +0000

    uart/pci: recover ADL AMT device after FIFO size probing
    
    When the Alder Lake Serial-over-LAN device is put into loopback mode and
    repeated writes are performed to the data register it results in the device
    ending up in a non-functional state afterwards.
    
    Recovering the device to a working state requires re-writing the LCR
    register with it's current value (no effective change).  This should be
    harmless on all other devices.
    
    Sponsored by: Citrix Systems R&D
    Differential revision: https://reviews.freebsd.org/D56107
    Reviewed by: imp
---
 sys/dev/uart/uart_dev_ns8250.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c
index b0c7cd4b44e1..c13eabe9055e 100644
--- a/sys/dev/uart/uart_dev_ns8250.c
+++ b/sys/dev/uart/uart_dev_ns8250.c
@@ -999,6 +999,15 @@ ns8250_bus_probe(struct uart_softc *sc)
 			uart_setreg(bas, REG_IER, ier);
 			uart_setreg(bas, REG_MCR, mcr);
 			uart_setreg(bas, REG_FCR, 0);
+			/*
+			 * The Alder Lake AMT SOL Redirection device will never
+			 * set LSR_OE (when in loopback mode at least) and
+			 * instead block further input by not setting LSR_TEMT.
+			 * Recovering the device afterwards into a working
+			 * state requires re-writing the LCR register.  This
+			 * should be harmless on all other devices.
+			 */
+			uart_setreg(bas, REG_LCR, uart_getreg(bas, REG_LCR));
 			uart_barrier(bas);
 			count = 0;
 			goto describe;