1
0
Fork 0
mirror of https://github.com/u-boot/u-boot.git synced 2025-04-24 22:36:05 +00:00

upl: Plumb in universal payload to the init process

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>
This commit is contained in:
Simon Glass 2024-08-07 16:47:34 -06:00 committed by Tom Rini
parent ec2186acbc
commit 0fc406ab20
3 changed files with 35 additions and 1 deletions

View file

@ -763,7 +763,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"
@ -774,6 +776,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

View file

@ -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>
@ -859,6 +860,26 @@ __weak int clear_bss(void)
return 0;
}
static int initf_upl(void)
{
struct upl *upl;
int ret;
if (!IS_ENABLED(CONFIG_UPL_IN) || !(gd->flags & GD_FLG_UPL))
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
@ -868,6 +889,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,

View file

@ -521,6 +521,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 ||