]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmVirtPkg/FdtClientDxe: honor memory DT node 'status' property
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 4 Apr 2017 12:55:44 +0000 (13:55 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 4 Apr 2017 14:24:59 +0000 (15:24 +0100)
In some cases, (e.g., when running QEMU with TrustZone emulation), the
DT may contain memory 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/FdtClientDxe/FdtClientDxe.c

index 2d867b16fda875a7794aacd86125a83f1296f16b..fb6e0aeb9215e122ece6f8074715c7ad7a0aae2f 100644 (file)
@@ -210,6 +210,7 @@ FindNextMemoryNodeReg (
 {\r
   INT32          Prev, Next;\r
   CONST CHAR8    *DeviceType;\r
+  CONST CHAR8    *NodeStatus;\r
   INT32          Len;\r
   EFI_STATUS     Status;\r
 \r
@@ -222,6 +223,13 @@ FindNextMemoryNodeReg (
       break;\r
     }\r
 \r
+    NodeStatus = fdt_getprop (mDeviceTreeBase, Next, "status", &Len);\r
+    if (NodeStatus != NULL && AsciiStrCmp (NodeStatus, "okay") != 0) {\r
+      DEBUG ((DEBUG_WARN, "%a: ignoring memory node with status \"%a\"\n",\r
+        __FUNCTION__, NodeStatus));\r
+      continue;\r
+    }\r
+\r
     DeviceType = fdt_getprop (mDeviceTreeBase, Next, "device_type", &Len);\r
     if (DeviceType != NULL && AsciiStrCmp (DeviceType, "memory") == 0) {\r
       //\r