[Skiboot] [PATCH 2/2] hw/lpc-uart.c: Handle LSR = 0xFF Case in UART Communication

ABHISHEK SINGH TOMAR abhishek at linux.ibm.com
Mon Apr 7 22:22:58 AEST 2025


From: Abhishek Singh Tomar <abhishek at linux.ibm.com>

Added logic to handle cases where the Line Status Register (LSR)
reads 0xFF, which may indicate an error in reading the
register through LPC or the presence of multiple simultaneous UART errors.
previously, This false read of set bit lead to soft lock or hand in older
production systems.

In such scenarios, processing data read/write operations does
not make sense. The function now returns `false` to signal
the failure and halt further operations.

Signed-off-by: Abhishek Singh Tomar <abhishek at linux.ibm.com>
---
 hw/lpc-uart.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/lpc-uart.c b/hw/lpc-uart.c
index a5ffc5f22..33955b29c 100644
--- a/hw/lpc-uart.c
+++ b/hw/lpc-uart.c
@@ -98,10 +98,12 @@ static inline void uart_write(unsigned int reg, uint8_t val)
 
 static bool uart_check_tx_room(void)
 {
+	uint8_t reg;
+
 	if (tx_room)
 		return true;
-
-	if (uart_read(REG_LSR) & LSR_THRE) {
+	reg = uart_read(REG_LSR);
+	if (reg & LSR_THRE && reg != 0xff) {
 		/* FIFO is 16 entries */
 		tx_room = 16;
 		tx_full = false;
-- 
2.48.1



More information about the Skiboot mailing list