public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: edk2-devel@lists.01.org, lersek@redhat.com
Cc: jens.wiklander@linaro.org, Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH 1/3] ArmVirtPkg/FdtClientDxe: take DT memory node 'status' property into account
Date: Tue,  4 Apr 2017 14:24:07 +0100	[thread overview]
Message-ID: <20170404132409.20422-2-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <20170404132409.20422-1-ard.biesheuvel@linaro.org>

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>
---
 ArmVirtPkg/FdtClientDxe/FdtClientDxe.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
index 2d867b16fda8..fb6e0aeb9215 100644
--- a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
+++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
@@ -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) {
       //
-- 
2.9.3



  reply	other threads:[~2017-04-04 13:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-04 13:24 [PATCH 0/3] ArmVirtPkg: ignore DT nodes with a status != 'okay' Ard Biesheuvel
2017-04-04 13:24 ` Ard Biesheuvel [this message]
2017-04-04 13:24 ` [PATCH 2/3] ArmVirtPkg/FdtPL011SerialPortLib: take DT node 'status' property into account Ard Biesheuvel
2017-04-04 13:24 ` [PATCH 3/3] ArmVirtPkg/PlatformPeiLib: " Ard Biesheuvel
2017-04-04 14:16 ` [PATCH 0/3] ArmVirtPkg: ignore DT nodes with a status != 'okay' Laszlo Ersek
2017-04-04 14:26   ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170404132409.20422-2-ard.biesheuvel@linaro.org \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox