]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmVirtPkg/PlatformPeiLib: honor DT node 'status' property
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 4 Apr 2017 13:20:12 +0000 (14:20 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 4 Apr 2017 14:25:19 +0000 (15:25 +0100)
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>
ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c

index bdf2b57fcb1e00a2da7329cc6805f4311529739f..df52d36533600fcee70d0533f215bc3de02f704e 100644 (file)
@@ -39,7 +39,9 @@ PlatformPeim (
   INT32              Node, Prev;\r
   CONST CHAR8        *Compatible;\r
   CONST CHAR8        *CompItem;\r
+  CONST CHAR8        *NodeStatus;\r
   INT32              Len;\r
+  INT32              StatusLen;\r
   CONST UINT64       *RegProp;\r
   UINT64             UartBase;\r
 \r
@@ -83,6 +85,11 @@ PlatformPeim (
       CompItem += 1 + AsciiStrLen (CompItem)) {\r
 \r
       if (AsciiStrCmp (CompItem, "arm,pl011") == 0) {\r
+        NodeStatus = fdt_getprop (Base, Node, "status", &StatusLen);\r
+        if (NodeStatus != NULL && AsciiStrCmp (NodeStatus, "okay") != 0) {\r
+          continue;\r
+        }\r
+\r
         RegProp = fdt_getprop (Base, Node, "reg", &Len);\r
         ASSERT (Len == 16);\r
 \r