]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/BaseSerialPortLib16550: Fix Serial Port Ready
authorAshish Singhal <ashishsingha@nvidia.com>
Mon, 27 Jan 2020 17:52:45 +0000 (01:52 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 6 Feb 2020 14:46:42 +0000 (14:46 +0000)
Before writing data to FIFO, wait for the serial port to be ready,
to make sure both the transmit FIFO and shift register empty. Code
comment was saying the right thing but code was missing a check.

Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com>
MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c

index bbae379887c075ab0ebf588ca320d89849dfe590..9cb50dd80d5634ab2aa6d68bf5ca7fb891463eef 100644 (file)
@@ -646,7 +646,7 @@ SerialPortWrite (
     // Wait for the serial port to be ready, to make sure both the transmit FIFO\r
     // and shift register empty.\r
     //\r
-    while ((SerialPortReadRegister (SerialRegisterBase, R_UART_LSR) & B_UART_LSR_TEMT) == 0);\r
+    while ((SerialPortReadRegister (SerialRegisterBase, R_UART_LSR) & (B_UART_LSR_TEMT | B_UART_LSR_TXRDY)) != (B_UART_LSR_TEMT | B_UART_LSR_TXRDY));\r
 \r
     //\r
     // Fill then entire Tx FIFO\r