summaryrefslogtreecommitdiffstats
path: root/ArmPlatformPkg/Library
diff options
context:
space:
mode:
authorIrene Park <ipark@nvidia.com>2020-06-09 13:56:31 -0400
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-07-02 07:11:26 +0000
commitc8edb70945099fd35a0997d3f3db105efc144e13 (patch)
tree5a8c828479f146af8ee0f1004df28913eee2a5e8 /ArmPlatformPkg/Library
parent00217f1919270007d7a911f89b32e39b9dcaa907 (diff)
downloadedk2-c8edb70945099fd35a0997d3f3db105efc144e13.tar.gz
edk2-c8edb70945099fd35a0997d3f3db105efc144e13.tar.bz2
edk2-c8edb70945099fd35a0997d3f3db105efc144e13.zip
ArmPlatformPkg/PL011UartLib: Check PID2 if FiFoDepth is zero
PL011UartLib determines its FIFO depth based on the PID2 value but the register PID2 is not mandatory as per the SBSA spec. This change won't check PID2 if PcdUartDefaultReceiveFifoDepth is set to a value > 0. Signed-off-by: Irene Park <ipark@nvidia.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Diffstat (limited to 'ArmPlatformPkg/Library')
-rw-r--r--ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c10
-rw-r--r--ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf1
2 files changed, 8 insertions, 3 deletions
diff --git a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c b/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c
index 801990d955..f1015b1fce 100644
--- a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c
+++ b/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c
@@ -78,10 +78,14 @@ PL011UartInitializePort (
UINT32 Integer;
UINT32 Fractional;
UINT32 HardwareFifoDepth;
+ UINT32 UartPid2;
+
+ HardwareFifoDepth = FixedPcdGet16 (PcdUartDefaultReceiveFifoDepth);
+ if (HardwareFifoDepth == 0) {
+ UartPid2 = MmioRead32 (UartBase + UARTPID2);
+ HardwareFifoDepth = (PL011_UARTPID2_VER (UartPid2) > PL011_VER_R1P4) ? 32 : 16;
+ }
- HardwareFifoDepth = (PL011_UARTPID2_VER (MmioRead32 (UartBase + UARTPID2)) \
- > PL011_VER_R1P4) \
- ? 32 : 16 ;
// The PL011 supports a buffer of 1, 16 or 32 chars. Therefore we can accept
// 1 char buffer as the minimum FIFO size. Because everything can be rounded
// down, there is no maximum FIFO size.
diff --git a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf b/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf
index d99e89fe00..e3da507988 100644
--- a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf
+++ b/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf
@@ -30,6 +30,7 @@
ArmPlatformPkg/ArmPlatformPkg.dec
[FixedPcd]
+ gEfiMdePkgTokenSpaceGuid.PcdUartDefaultReceiveFifoDepth
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate
gArmPlatformTokenSpaceGuid.PL011UartInteger