]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg: Fix PL011 FIFO size test
authorEvan Lloyd <evan.lloyd@arm.com>
Wed, 21 Sep 2016 20:33:13 +0000 (21:33 +0100)
committerLeif Lindholm <leif.lindholm@linaro.org>
Tue, 11 Oct 2016 13:23:33 +0000 (14:23 +0100)
This change updates PL011UartInitializePort to compare ReceiveFifoDepth
with the correct hardware FIFO size instead of the constant 32 used
previously.
This corrects a minor bug where a request for a fifo size > 15 and < 32
would not have been honoured on a system with a 16 byte FIFO.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c

index 3748972acbfc80f1077b9b928756a72cc77b5c75..b3ea138bf60b93a1000dd29aedaad206f2d15f2b 100644 (file)
@@ -79,17 +79,18 @@ PL011UartInitializePort (
   UINT32      Divisor;\r
   UINT32      Integer;\r
   UINT32      Fractional;\r
+  UINT32      HardwareFifoDepth;\r
 \r
+  HardwareFifoDepth = (PL011_UARTPID2_VER (MmioRead32 (UartBase + UARTPID2)) \\r
+                       > PL011_VER_R1P4) \\r
+                      ? 32 : 16 ;\r
   // The PL011 supports a buffer of 1, 16 or 32 chars. Therefore we can accept\r
   // 1 char buffer as the minimum FIFO size. Because everything can be rounded\r
   // down, there is no maximum FIFO size.\r
-  if ((*ReceiveFifoDepth == 0) || (*ReceiveFifoDepth >= 32)) {\r
+  if ((*ReceiveFifoDepth == 0) || (*ReceiveFifoDepth >= HardwareFifoDepth)) {\r
     // Enable FIFO\r
     LineControl = PL011_UARTLCR_H_FEN;\r
-    if (PL011_UARTPID2_VER (MmioRead32 (UartBase + UARTPID2)) > PL011_VER_R1P4)\r
-      *ReceiveFifoDepth = 32;\r
-    else\r
-      *ReceiveFifoDepth = 16;\r
+    *ReceiveFifoDepth = HardwareFifoDepth;\r
   } else {\r
     // Disable FIFO\r
     LineControl = 0;\r