diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2017-04-04 14:07:16 +0100 |
---|---|---|
committer | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2017-04-04 15:25:16 +0100 |
commit | b1f3e48ed8f9ddd62222953a7b343f9833c71809 (patch) | |
tree | 9f9c952ecdc5269571663c4b50a052078c6cde81 /ArmVirtPkg | |
parent | d014044395b5ac2d37efb65f889dd8910869a332 (diff) | |
download | edk2-platforms-b1f3e48ed8f9ddd62222953a7b343f9833c71809.tar.xz |
ArmVirtPkg/FdtPL011SerialPortLib: honor DT node 'status' property
In some cases, (e.g., when running QEMU with TrustZone emulation), the
DT may contain DT nodes whose status is set to 'secure'. Similarly, the
status may be set to 'disabled' if the consumer of the DT image is
expected to treat it as if it weren't there.
So check whether a 'status' property is present, and if so, ignore the
node if the status is not 'okay'.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'ArmVirtPkg')
-rw-r--r-- | ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c b/ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c index c458abb622..e28750f3b4 100644 --- a/ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c +++ b/ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c @@ -66,6 +66,7 @@ SerialPortGetBaseAddress ( INT32 Node, Prev;
INT32 Len;
CONST CHAR8 *Compatible;
+ CONST CHAR8 *NodeStatus;
CONST CHAR8 *CompatibleItem;
CONST UINT64 *RegProperty;
UINTN UartBase;
@@ -98,6 +99,11 @@ SerialPortGetBaseAddress ( CompatibleItem += 1 + AsciiStrLen (CompatibleItem)) {
if (AsciiStrCmp (CompatibleItem, "arm,pl011") == 0) {
+ NodeStatus = fdt_getprop (DeviceTreeBase, Node, "status", &Len);
+ if (NodeStatus != NULL && AsciiStrCmp (NodeStatus, "okay") != 0) {
+ continue;
+ }
+
RegProperty = fdt_getprop (DeviceTreeBase, Node, "reg", &Len);
if (Len != 16) {
return 0;
|