summaryrefslogtreecommitdiffstats
path: root/ArmVirtPkg/Library
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2017-04-04 14:20:12 +0100
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2017-04-04 15:25:19 +0100
commit83ae7589b08a0d11592527cf45fd1ad8d62118ab (patch)
treee527e2069c5c43bf08599e4d01374674a5ee2dd0 /ArmVirtPkg/Library
parentb1f3e48ed8f9ddd62222953a7b343f9833c71809 (diff)
downloadedk2-83ae7589b08a0d11592527cf45fd1ad8d62118ab.tar.gz
edk2-83ae7589b08a0d11592527cf45fd1ad8d62118ab.tar.bz2
edk2-83ae7589b08a0d11592527cf45fd1ad8d62118ab.zip
ArmVirtPkg/PlatformPeiLib: 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/Library')
-rw-r--r--ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c b/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c
index bdf2b57fcb..df52d36533 100644
--- a/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c
+++ b/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c
@@ -39,7 +39,9 @@ PlatformPeim (
INT32 Node, Prev;
CONST CHAR8 *Compatible;
CONST CHAR8 *CompItem;
+ CONST CHAR8 *NodeStatus;
INT32 Len;
+ INT32 StatusLen;
CONST UINT64 *RegProp;
UINT64 UartBase;
@@ -83,6 +85,11 @@ PlatformPeim (
CompItem += 1 + AsciiStrLen (CompItem)) {
if (AsciiStrCmp (CompItem, "arm,pl011") == 0) {
+ NodeStatus = fdt_getprop (Base, Node, "status", &StatusLen);
+ if (NodeStatus != NULL && AsciiStrCmp (NodeStatus, "okay") != 0) {
+ continue;
+ }
+
RegProp = fdt_getprop (Base, Node, "reg", &Len);
ASSERT (Len == 16);