From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/4] bootm: print memreserve map in verbose mode
Date: Thu, 19 Oct 2023 13:27:25 +0200 [thread overview]
Message-ID: <20231019112727.3876442-2-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20231019112727.3876442-1-s.hauer@pengutronix.de>
There currently is no way to print the /memreserve/ map barebox boots
the kernel with. As this contains useful debugging information sometimes
print it along with the device tree when booting with -vv.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/bootm.c | 4 +++-
drivers/of/fdt.c | 23 +++++++++++++++++++++++
include/of.h | 1 +
3 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/common/bootm.c b/common/bootm.c
index 2469d43441..29ea13e28c 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -468,8 +468,10 @@ int bootm_load_devicetree(struct image_data *data, void *fdt,
memcpy((void *)data->oftree_res->start, fdt, fdt_size);
of_print_cmdline(data->of_root_node);
- if (bootm_verbose(data) > 1)
+ if (bootm_verbose(data) > 1) {
of_print_nodes(data->of_root_node, 0, ~0);
+ fdt_print_reserve_map(fdt);
+ }
return 0;
}
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 734dbfc92a..223abe9375 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -585,3 +585,26 @@ void fdt_add_reserve_map(void *__fdt)
of_write_number(&fdt_res->address, 0, 2);
of_write_number(&fdt_res->size, 0, 2);
}
+
+void fdt_print_reserve_map(const void *__fdt)
+{
+ const struct fdt_header *fdt = __fdt;
+ const struct fdt_reserve_entry *fdt_res =
+ __fdt + be32_to_cpu(fdt->off_mem_rsvmap);
+ int n = 0;
+
+ while (1) {
+ uint64_t size = fdt64_to_cpu(fdt_res->size);
+ uint64_t address = fdt64_to_cpu(fdt_res->address);
+
+ if (!size)
+ break;
+
+ printf("/memreserve/ #%d: 0x%08llx - 0x%08llx\n", n, address, address + size - 1);
+
+ n++;
+ fdt_res++;
+ if (n == OF_MAX_RESERVE_MAP)
+ return;
+ }
+}
diff --git a/include/of.h b/include/of.h
index a7a1ce125f..5686709fcf 100644
--- a/include/of.h
+++ b/include/of.h
@@ -61,6 +61,7 @@ struct of_reserve_map {
int of_add_reserve_entry(resource_size_t start, resource_size_t end);
void of_clean_reserve_map(void);
void fdt_add_reserve_map(void *fdt);
+void fdt_print_reserve_map(const void *fdt);
struct device;
struct driver;
--
2.39.2
next prev parent reply other threads:[~2023-10-19 11:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-19 11:27 [PATCH 1/4] fdt: Do not reserve device tree blob Sascha Hauer
2023-10-19 11:27 ` Sascha Hauer [this message]
2023-10-19 11:27 ` [PATCH 3/4] arm: layerscape: ppa: reserve SDRAM region for PPA Sascha Hauer
2023-10-19 11:27 ` [PATCH 4/4] arm: layerscape: ppa: Add PPA as /reserved-memory/ppa node 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=20231019112727.3876442-2-s.hauer@pengutronix.de \
--to=s.hauer@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