[PATCH v2 18/18] bloblist: Load the bloblist from the previous loader
Simon Glass
sjg at chromium.org
Sat Dec 2 19:31:52 CET 2023
Hi Raymond,
On Mon, 27 Nov 2023 at 12:53, Raymond Mao <raymond.mao at linaro.org> wrote:
>
> During bloblist initialization, when CONFIG_OF_BOARD is defined,
> invoke the platform custom function to load the bloblist via boot
> arguments from the previous loader.
> If the bloblist exists, copy it into the fixed bloblist memory region.
>
> Signed-off-by: Raymond Mao <raymond.mao at linaro.org>
> ---
> Changes in v2
> - New patch file created for v2.
>
> common/bloblist.c | 29 +++++++++++++----------------
> include/bloblist.h | 14 ++++++++++++++
> 2 files changed, 27 insertions(+), 16 deletions(-)
>
This should already work so I am hoping that this patch is not
needed...these changes seem to break sandbox_spl
> diff --git a/common/bloblist.c b/common/bloblist.c
> index 91d69e9439..251093ecfa 100644
> --- a/common/bloblist.c
> +++ b/common/bloblist.c
> @@ -477,15 +477,8 @@ int bloblist_init(void)
> bool fixed = IS_ENABLED(CONFIG_BLOBLIST_FIXED);
> int ret = -ENOENT;
> ulong addr, size;
> - bool expected;
> -
> - /**
> - * We don't expect to find an existing bloblist in the first phase of
> - * U-Boot that runs. Also we have no way to receive the address of an
> - * allocated bloblist from a previous stage, so it must be at a fixed
> - * address.
> - */
> - expected = fixed && !u_boot_first_phase();
> + bool expected = fixed;
> +
> if (spl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
> expected = false;
> if (fixed)
> @@ -493,14 +486,17 @@ int bloblist_init(void)
> CONFIG_BLOBLIST_ADDR);
> size = CONFIG_BLOBLIST_SIZE;
> if (expected) {
> - ret = bloblist_check(addr, size);
> - if (ret) {
> - log_warning("Expected bloblist at %lx not found (err=%d)\n",
> + if (IS_ENABLED(CONFIG_OF_BOARD))
> + /* Get the bloblist from previous loader */
> + ret = board_bloblist_from_boot_arg(addr, size);
> + else
> + ret = bloblist_check(addr, size);
> +
> + if (ret)
> + log_warning("Bloblist at %lx not found, err=%d\n",
> addr, ret);
> - } else {
> - /* Get the real size, if it is not what we expected */
> + else
> size = gd->bloblist->total_size;
> - }
> }
> if (ret) {
> if (CONFIG_IS_ENABLED(BLOBLIST_ALLOC)) {
> @@ -510,7 +506,8 @@ int bloblist_init(void)
> return log_msg_ret("alloc", -ENOMEM);
> addr = map_to_sysmem(ptr);
> } else if (!fixed) {
> - return log_msg_ret("!fixed", ret);
> + return log_msg_ret("BLOBLIST_FIXED is not enabled",
> + ret);
> }
> log_debug("Creating new bloblist size %lx at %lx\n", size,
> addr);
> diff --git a/include/bloblist.h b/include/bloblist.h
> index 0f5afec9f4..e65cd27b90 100644
> --- a/include/bloblist.h
> +++ b/include/bloblist.h
> @@ -438,6 +438,20 @@ void bloblist_reloc(void *to, uint to_size, void *from, uint from_size);
> */
> int bloblist_init(void);
>
> +#if CONFIG_IS_ENABLED(ARCH_QEMU)
> +int board_bloblist_from_boot_arg(unsigned long addr, unsigned long size);
> +#else
> +/*
> + * A board need to implement this custom function if it needs to retrieve
> + * bloblist from a previous loader
> + */
> +static inline int board_bloblist_from_boot_arg(unsigned long __always_unused addr,
> + unsigned long __always_unused size)
> +{
> + return -1;
> +}
> +#endif
> +
> #if CONFIG_IS_ENABLED(BLOBLIST)
> /**
> * bloblist_maybe_init() - Init the bloblist system if not already done
> --
> 2.25.1
>
Regards,
Simon
More information about the U-Boot
mailing list