ArmVirtPkg/FdtClientDxe: honor memory DT node 'status' property

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>
This commit is contained in:
Ard Biesheuvel 2017-04-04 13:55:44 +01:00
parent 12b04866af
commit d014044395
1 changed files with 8 additions and 0 deletions

View File

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