From: Simon Glass <sjg@chromium.org>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: "Simon Glass" <sjg@chromium.org>, "Bin Meng" <bmeng.cn@gmail.com>,
"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
"Marek Vasut" <marek.vasut+renesas@mailbox.org>,
"Michal Suchanek" <msuchanek@suse.de>,
"Nikhil M Jain" <n-jain1@ti.com>,
"Ovidiu Panait" <ovpanait@gmail.com>,
"Pierre-Clément Tosi" <ptosi@google.com>,
"Rasmus Villemoes" <rasmus.villemoes@prevas.dk>,
"Shiji Yang" <yangshiji66@outlook.com>,
"Stefan Roese" <sr@denx.de>,
"Sughosh Ganu" <sughosh.ganu@linaro.org>
Subject: [RFC PATCH 7/9] Plumb in universal payload to the init process
Date: Wed, 30 Aug 2023 17:29:21 -0600 [thread overview]
Message-ID: <20230830232928.2590178-8-sjg@chromium.org> (raw)
In-Reply-To: <20230830232928.2590178-1-sjg@chromium.org>
Read the UPL early in boot so that it is available. For now none of the
information is used.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
boot/Kconfig | 12 +++++++++++-
common/board_f.c | 22 ++++++++++++++++++++++
common/board_r.c | 2 ++
3 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/boot/Kconfig b/boot/Kconfig
index 1cefa7d6873..b4b78a8b5b5 100644
--- a/boot/Kconfig
+++ b/boot/Kconfig
@@ -694,7 +694,9 @@ config UPL_READ
help
Provides support for decoding a UPL-format payload into a C structure
which can be used elsewhere in U-Boot. This is just the reading
- implementation, useful for trying it out.
+ implementation, useful for trying it out. See UPL_IN for how
+ to tell U-Boot to actually read it on startup and use it for memory
+ and device information, etc.
config UPL_WRITE
bool "upl - Support writing a Universal Payload handoff"
@@ -705,6 +707,14 @@ config UPL_WRITE
for how to tell U-Boot SPL to actually write it before jumping to
the next phase.
+config UPL_IN
+ bool "upl - Read the UPL handoff on startup"
+ select UPL_READ
+ help
+ Read an SPL handoff when U-Boot starts and use it to provide
+ devices, memory layout, etc. required by U-Boot. This allows U-Boot
+ to function as a payload in the meaning of the specification.
+
if SPL
config SPL_UPL
diff --git a/common/board_f.c b/common/board_f.c
index 76ae415487d..716025601c5 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -40,6 +40,7 @@
#include <sysreset.h>
#include <timer.h>
#include <trace.h>
+#include <upl.h>
#include <video.h>
#include <watchdog.h>
#include <asm/cache.h>
@@ -841,6 +842,26 @@ static int misc_init_f(void)
return event_notify_null(EVT_MISC_INIT_F);
}
+static int initf_upl(void)
+{
+ struct upl *upl;
+ int ret;
+
+ if (!IS_ENABLED(CONFIG_UPL_IN))
+ return 0;
+
+ upl = malloc(sizeof(struct upl));
+ if (upl)
+ ret = upl_read_handoff(upl, oftree_default());
+ if (ret) {
+ printf("UPL handoff: read failure (err=%dE)\n", ret);
+ return ret;
+ }
+ gd_set_upl(upl);
+
+ return 0;
+}
+
static const init_fnc_t init_sequence_f[] = {
setup_mon_len,
#ifdef CONFIG_OF_CONTROL
@@ -850,6 +871,7 @@ static const init_fnc_t init_sequence_f[] = {
trace_early_init,
#endif
initf_malloc,
+ initf_upl,
log_init,
initf_bootstage, /* uses its own timer, so does not need DM */
event_init,
diff --git a/common/board_r.c b/common/board_r.c
index 598155c7753..1c1f139430b 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -549,6 +549,8 @@ static int dm_announce(void)
uclass_count);
if (CONFIG_IS_ENABLED(OF_REAL))
printf(", devicetree: %s", fdtdec_get_srcname());
+ if (CONFIG_IS_ENABLED(UPL))
+ printf(", universal payload active");
printf("\n");
if (IS_ENABLED(CONFIG_OF_HAS_PRIOR_STAGE) &&
(gd->fdt_src == FDTSRC_SEPARATE ||
--
2.42.0.rc2.253.gd59a3bf2b4-goog
next prev parent reply other threads:[~2023-08-30 23:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-30 23:29 [RFC PATCH 0/9] Universal Payload initial series Simon Glass
2023-08-30 23:29 ` [RFC PATCH 1/9] upl: Add support for reading a upl handoff Simon Glass
2023-08-30 23:29 ` [RFC PATCH 2/9] upl: Add support for writing " Simon Glass
2023-08-30 23:29 ` [RFC PATCH 3/9] upl: Add basic tests Simon Glass
2023-08-30 23:29 ` [RFC PATCH 4/9] upl: Add a command Simon Glass
2023-08-30 23:29 ` [RFC PATCH 5/9] upl: Add support for Universal Payload in SPL Simon Glass
2023-08-30 23:29 ` [RFC PATCH 6/9] spl: Plumb in the Universal Payload handoff Simon Glass
2023-08-30 23:29 ` Simon Glass [this message]
2023-08-30 23:29 ` [RFC PATCH 8/9] sandbox_vpl: Enable Universal Payload Simon Glass
2023-08-30 23:29 ` [RFC PATCH 9/9] upl: Add initial documentation Simon Glass
2023-08-31 3:58 ` Heinrich Schuchardt
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=20230830232928.2590178-8-sjg@chromium.org \
--to=sjg@chromium.org \
--cc=bmeng.cn@gmail.com \
--cc=ilias.apalodimas@linaro.org \
--cc=marek.vasut+renesas@mailbox.org \
--cc=msuchanek@suse.de \
--cc=n-jain1@ti.com \
--cc=ovpanait@gmail.com \
--cc=ptosi@google.com \
--cc=rasmus.villemoes@prevas.dk \
--cc=sr@denx.de \
--cc=sughosh.ganu@linaro.org \
--cc=u-boot@lists.denx.de \
--cc=yangshiji66@outlook.com \
/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;
as well as URLs for NNTP newsgroup(s).