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 3/3] ArmVirtPkg/PlatformPeiLib: take DT node 'status' property into account
Date: Tue, 4 Apr 2017 14:24:09 +0100 [thread overview]
Message-ID: <20170404132409.20422-4-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 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>
---
ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c b/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c
index bdf2b57fcb1e..df52d3653360 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);
--
2.9.3
next prev parent 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 ` [PATCH 1/3] ArmVirtPkg/FdtClientDxe: take DT memory node 'status' property into account Ard Biesheuvel
2017-04-04 13:24 ` [PATCH 2/3] ArmVirtPkg/FdtPL011SerialPortLib: take DT " Ard Biesheuvel
2017-04-04 13:24 ` Ard Biesheuvel [this message]
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-4-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