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 4/8] of: add flag to not create resmem DT entries
Date: Tue, 20 Apr 2021 09:56:57 +0200	[thread overview]
Message-ID: <20210420075700.246124-4-r.czerwinski@pengutronix.de> (raw)
In-Reply-To: <20210420075700.246124-1-r.czerwinski@pengutronix.de>

If we are parsing entries from the /reserved-memory device tree path we
don't want to add them again as resmem blocks at the beginning of the
device tree. Therefore add another flag to indicate this.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
 drivers/of/fdt.c | 10 +++++++---
 include/of.h     |  2 ++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 6aade13fa0..da36739713 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -552,6 +552,9 @@ int of_add_reserve_entry(resource_size_t start, resource_size_t end,
 	if (flags & OF_RESERVE_ENTRY_FLAG_XN)
 		of_reserve_map.xn |= BIT(e);
 
+	if (flags & OF_RESERVE_ENTRY_FLAG_NO_RESERVE)
+		of_reserve_map.noentry |= BIT(e);
+
 	return 0;
 }
 
@@ -594,9 +597,10 @@ void fdt_add_reserve_map(void *__fdt)
 	fdt_res += n;
 
 	for (i = 0; i < res->num_entries; i++) {
-		of_write_number(&fdt_res->address, res->start[i], 2);
-		of_write_number(&fdt_res->size, res->end[i] - res->start[i] + 1,
-				2);
+		if (!(res->noentry & BIT(i))) {
+			of_write_number(&fdt_res->address, res->start[i], 2);
+			of_write_number(&fdt_res->size, res->end[i] - res->start[i] + 1, 2);
+		}
 		fdt_res++;
 	}
 
diff --git a/include/of.h b/include/of.h
index 088b088223..c6d3836db1 100644
--- a/include/of.h
+++ b/include/of.h
@@ -55,9 +55,11 @@ struct of_reserve_map {
 	uint64_t end[OF_MAX_RESERVE_MAP];
 	int num_entries;
 	u32 xn;
+	u32 noentry;
 };
 
 #define OF_RESERVE_ENTRY_FLAG_XN		BIT(0)
+#define OF_RESERVE_ENTRY_FLAG_NO_RESERVE	BIT(1)
 
 int of_add_reserve_entry(resource_size_t start, resource_size_t end,
 		 int flags);
-- 
2.31.1


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


  parent reply	other threads:[~2021-04-20  8:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20  7:56 [PATCH 1/8] of: reserve: add xn flag mem entries Rouven Czerwinski
2021-04-20  7:56 ` [PATCH 2/8] of: export of_get_reserve_map Rouven Czerwinski
2021-04-20  8:47   ` Ahmad Fatoum
2021-04-20  7:56 ` [PATCH 3/8] ARM: mmu: use reserve mem entries to modify maps Rouven Czerwinski
2021-04-20  9:09   ` Ahmad Fatoum
2021-04-20  7:56 ` Rouven Czerwinski [this message]
2021-04-20  9:22   ` [PATCH 4/8] of: add flag to not create resmem DT entries Ahmad Fatoum
2021-04-20  7:56 ` [PATCH 5/8] of: add reserved_mem_read initcall Rouven Czerwinski
2021-04-20  9:23   ` Ahmad Fatoum
2021-04-20 10:36   ` Ahmad Fatoum
2021-04-20  7:56 ` [PATCH 6/8] pbl: fdt: add support to parse reserved mem Rouven Czerwinski
2021-04-20 10:29   ` Ahmad Fatoum
2021-04-20  7:57 ` [PATCH 7/8] ARM: mmu-early: map no-map entries XN & uncached Rouven Czerwinski
2021-04-20  9:00   ` Lucas Stach
2021-04-20  7:57 ` [PATCH 8/8] PBL: enable LIBFDT for OP-TEE early loading Rouven Czerwinski
2021-04-20 10:33   ` Ahmad Fatoum
2021-04-20  8:45 ` [PATCH 1/8] of: reserve: add xn flag mem entries Ahmad Fatoum

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=20210420075700.246124-4-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