From: Laszlo Ersek <lersek@redhat.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>, edk2-devel@lists.01.org
Cc: leif.lindholm@linaro.org, philmd@redhat.com,
hongbo.zhang@linaro.org, nariman.poushin@linaro.org,
thomas.abraham@arm.com
Subject: Re: [PATCH v2 3/5] ArmVirtPkg/FdtClientDxe: take DT node 'status' properties into account
Date: Wed, 21 Nov 2018 18:12:33 +0100 [thread overview]
Message-ID: <bb29ec7e-8dc6-bec8-3fa0-de297903e928@redhat.com> (raw)
In-Reply-To: <20181121115828.3026-4-ard.biesheuvel@linaro.org>
On 11/21/18 12:58, Ard Biesheuvel wrote:
> DT has a [pseudo-]standardized 'status' property that can be set on
> any node, and which signifies that a node should be treated as
> absent unless it is set to 'ok' or 'okay'.
(I now really want "oktopus" to be [pseudo-]standardized too! ;) /jk)
> So take this into account
> when iterating over nodes.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
> ArmVirtPkg/FdtClientDxe/FdtClientDxe.c | 38 +++++++++++++++++---
> 1 file changed, 33 insertions(+), 5 deletions(-)
>
> diff --git a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
> index fb6e0aeb9215..5bfde381ecd0 100644
> --- a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
> +++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
> @@ -78,6 +78,33 @@ SetNodeProperty (
> return EFI_SUCCESS;
> }
>
> +STATIC
> +BOOLEAN
> +IsNodeEnabled (
> + INT32 Node
> + )
> +{
> + CONST CHAR8 *NodeStatus;
> + INT32 Len;
> +
> + //
> + // A missing status property implies 'ok' so ignore any errors that
> + // may occur here. If the status property is present, check whether
> + // it is set to 'ok' or 'okay', anything else is treated as 'disabled'.
> + //
> + NodeStatus = fdt_getprop (mDeviceTreeBase, Node, "status", &Len);
> + if (NodeStatus == NULL) {
> + return TRUE;
> + }
> + if (Len >= 5 && AsciiStrCmp (NodeStatus, "okay") == 0) {
> + return TRUE;
> + }
> + if (Len >= 3 && AsciiStrCmp (NodeStatus, "ok") == 0) {
> + return TRUE;
> + }
> + return FALSE;
> +}
> +
> STATIC
> EFI_STATUS
> EFIAPI
> @@ -101,6 +128,10 @@ FindNextCompatibleNode (
> break;
> }
>
> + if (!IsNodeEnabled (Next)) {
> + continue;
> + }
> +
> Type = fdt_getprop (mDeviceTreeBase, Next, "compatible", &Len);
> if (Type == NULL) {
> continue;
> @@ -210,7 +241,6 @@ FindNextMemoryNodeReg (
> {
> INT32 Prev, Next;
> CONST CHAR8 *DeviceType;
> - CONST CHAR8 *NodeStatus;
> INT32 Len;
> EFI_STATUS Status;
>
> @@ -223,10 +253,8 @@ 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));
> + if (!IsNodeEnabled (Next)) {
> + DEBUG ((DEBUG_WARN, "%a: ignoring disabled memory node\n", __FUNCTION__));
> continue;
> }
>
>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Thanks!
Laszlo
next prev parent reply other threads:[~2018-11-21 17:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-21 11:58 [PATCH v2 0/5] ArmPlatformPkg, ArmVirtPkg: discover NOR flash banks from DTB Ard Biesheuvel
2018-11-21 11:58 ` [PATCH v2 1/5] ArmPlatformPkg/NorFlashDxe: prepare for devicepath format change Ard Biesheuvel
2018-11-21 17:01 ` Laszlo Ersek
2018-11-22 15:54 ` Philippe Mathieu-Daudé
2018-11-21 11:58 ` [PATCH v2 2/5] ArmPlatformPkg/NorFlashDxe: use one GUID plus index to identify flash banks Ard Biesheuvel
2018-11-21 17:03 ` Laszlo Ersek
2018-11-22 15:36 ` Philippe Mathieu-Daudé
2018-11-21 11:58 ` [PATCH v2 3/5] ArmVirtPkg/FdtClientDxe: take DT node 'status' properties into account Ard Biesheuvel
2018-11-21 17:12 ` Laszlo Ersek [this message]
2018-11-22 13:12 ` Ard Biesheuvel
2018-11-22 15:38 ` Philippe Mathieu-Daudé
2018-11-21 11:58 ` [PATCH v2 4/5] ArmVirtPkg/NorFlashQemuLib: discover NOR flash banks dynamically Ard Biesheuvel
2018-11-21 17:18 ` Laszlo Ersek
2018-11-21 11:58 ` [PATCH v2 5/5] ArmPlatformPkg/NorFlashPlatformLib: remove unused Guid member from struct Ard Biesheuvel
2018-11-21 17:22 ` Laszlo Ersek
2018-11-26 17:00 ` [PATCH v2 0/5] ArmPlatformPkg, ArmVirtPkg: discover NOR flash banks from DTB Ard Biesheuvel
2018-11-26 17:02 ` Ard Biesheuvel
2018-11-27 12:07 ` 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=bb29ec7e-8dc6-bec8-3fa0-de297903e928@redhat.com \
--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