From: Sascha Hauer <s.hauer@pengutronix.de>
To: "open list:BAREBOX" <barebox@lists.infradead.org>
Subject: [PATCH 1/4] handoff_data: add handoff_data_add_dt()
Date: Wed, 30 Oct 2024 12:30:36 +0100 [thread overview]
Message-ID: <20241030-handoff-data-v1-1-4403e0c62c2a@pengutronix.de> (raw)
In-Reply-To: <20241030-handoff-data-v1-0-4403e0c62c2a@pengutronix.de>
Factor out a handoff_data_add_dt() from the existing ARM code in case a
board wants to set the fdt directly in board code rather than passing it
in the boarddata pointer.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/cpu/uncompress.c | 18 ++----------------
include/pbl/handoff-data.h | 2 ++
pbl/handoff-data.c | 15 +++++++++++++++
3 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/arch/arm/cpu/uncompress.c b/arch/arm/cpu/uncompress.c
index 8f916359b3..ac1462b7b1 100644
--- a/arch/arm/cpu/uncompress.c
+++ b/arch/arm/cpu/uncompress.c
@@ -31,21 +31,6 @@ unsigned long free_mem_end_ptr;
extern unsigned char input_data[];
extern unsigned char input_data_end[];
-static void add_handoff_data(void *boarddata)
-{
- if (!boarddata)
- return;
- if (blob_is_fdt(boarddata)) {
- handoff_data_add(HANDOFF_DATA_INTERNAL_DT, boarddata,
- get_unaligned_be32(boarddata + 4));
- } else if (blob_is_compressed_fdt(boarddata)) {
- struct barebox_boarddata_compressed_dtb *bd = boarddata;
-
- handoff_data_add(HANDOFF_DATA_INTERNAL_DT_Z, boarddata,
- bd->datalen + sizeof(*bd));
- }
-}
-
void __noreturn barebox_pbl_start(unsigned long membase, unsigned long memsize,
void *boarddata)
{
@@ -82,7 +67,8 @@ void __noreturn barebox_pbl_start(unsigned long membase, unsigned long memsize,
mmu_early_enable(membase, memsize);
/* Add handoff data now, so arm_mem_barebox_image takes it into account */
- add_handoff_data(boarddata);
+ if (boarddata)
+ handoff_data_add_dt(boarddata);
barebox_base = arm_mem_barebox_image(membase, endmem,
uncompressed_len, NULL);
diff --git a/include/pbl/handoff-data.h b/include/pbl/handoff-data.h
index d475bdd694..eac3b9bf3e 100644
--- a/include/pbl/handoff-data.h
+++ b/include/pbl/handoff-data.h
@@ -51,4 +51,6 @@ static inline size_t handoff_data_size(void)
return __handoff_data_size(NULL);
}
+void handoff_data_add_dt(void *fdt);
+
#endif /* __PBL_HANDOFF_DATA_H */
diff --git a/pbl/handoff-data.c b/pbl/handoff-data.c
index 7453c9c82c..17b0512132 100644
--- a/pbl/handoff-data.c
+++ b/pbl/handoff-data.c
@@ -4,6 +4,8 @@
#include <init.h>
#include <linux/list.h>
#include <memory.h>
+#include <fdt.h>
+#include <compressed-dtb.h>
static struct handoff_data *handoff_data = (void *)-1;
@@ -160,6 +162,19 @@ int handoff_data_show(void)
return 0;
}
+void handoff_data_add_dt(void *fdt)
+{
+ if (blob_is_fdt(fdt)) {
+ handoff_data_add(HANDOFF_DATA_INTERNAL_DT, fdt,
+ get_unaligned_be32(fdt + 4));
+ } else if (blob_is_compressed_fdt(fdt)) {
+ struct barebox_boarddata_compressed_dtb *bd = fdt;
+
+ handoff_data_add(HANDOFF_DATA_INTERNAL_DT_Z, fdt,
+ bd->datalen + sizeof(*bd));
+ }
+}
+
static const char *handoff_data_entry_name(struct handoff_data_entry *hde)
{
static char name[sizeof("handoff 12345678")];
--
2.39.5
next prev parent reply other threads:[~2024-10-30 11:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-30 11:30 [PATCH 0/4] handoff-data: some update Sascha Hauer
2024-10-30 11:30 ` Sascha Hauer [this message]
2024-10-30 11:30 ` [PATCH 2/4] ARM: i.MX93: add destination argument to imx93_romapi_load_image() Sascha Hauer
2024-10-30 11:30 ` [PATCH 3/4] handoff-data: set flags of moved handoff data entry Sascha Hauer
2024-10-30 11:30 ` [PATCH 4/4] handoff-data: add protection against multiple invocation Sascha Hauer
2024-11-04 8:17 ` [PATCH 0/4] handoff-data: some update 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=20241030-handoff-data-v1-1-4403e0c62c2a@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