mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Rouven Czerwinski <r.czerwinski@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Subject: [PATCH] of: base: ignore disabled memory nodes
Date: Mon,  9 Nov 2020 06:51:50 +0100	[thread overview]
Message-ID: <20201109055150.16444-1-r.czerwinski@pengutronix.de> (raw)

Qemu with the secure extension enabled will insert a secram node into
the device tree:

  secram@e000000 {
          secure-status = "okay";
          status = "disabled";
          reg = <0x0 0xe000000 0x0 0x1000000>;
          device_type = "memory";
  };

Barebox would previously parse this node, add it as a memory bank and
than reinsert an enabled node into the fixed up device tree.
Fix this by skipping disabled memory nodes.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
 drivers/of/base.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 0a2632f963..32cb1e78a5 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2090,6 +2090,9 @@ int of_add_memory(struct device_node *node, bool dump)
 		if (!resource_size(&res))
 			continue;
 
+		if (!of_device_is_available(node))
+			continue;
+
 		of_add_memory_bank(node, dump, mem_bank_num,
 				res.start, resource_size(&res));
 		mem_bank_num++;
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2020-11-09  5:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-09  5:51 Rouven Czerwinski [this message]
2020-11-09  9:23 ` Sascha Hauer

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-all 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=20201109055150.16444-1-r.czerwinski@pengutronix.de \
    --to=r.czerwinski@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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