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 2/3] ArmVirtPkg/FdtPL011SerialPortLib: take DT node 'status' property into account
Date: Tue, 4 Apr 2017 14:24:08 +0100 [thread overview]
Message-ID: <20170404132409.20422-3-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/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c b/ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c
index c458abb622d9..e28750f3b4c4 100644
--- a/ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c
+++ b/ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c
@@ -66,6 +66,7 @@ SerialPortGetBaseAddress (
INT32 Node, Prev;
INT32 Len;
CONST CHAR8 *Compatible;
+ CONST CHAR8 *NodeStatus;
CONST CHAR8 *CompatibleItem;
CONST UINT64 *RegProperty;
UINTN UartBase;
@@ -98,6 +99,11 @@ SerialPortGetBaseAddress (
CompatibleItem += 1 + AsciiStrLen (CompatibleItem)) {
if (AsciiStrCmp (CompatibleItem, "arm,pl011") == 0) {
+ NodeStatus = fdt_getprop (DeviceTreeBase, Node, "status", &Len);
+ if (NodeStatus != NULL && AsciiStrCmp (NodeStatus, "okay") != 0) {
+ continue;
+ }
+
RegProperty = fdt_getprop (DeviceTreeBase, Node, "reg", &Len);
if (Len != 16) {
return 0;
--
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 ` Ard Biesheuvel [this message]
2017-04-04 13:24 ` [PATCH 3/3] ArmVirtPkg/PlatformPeiLib: take DT " 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-3-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