From 5ab1600213608129ea63fc3046f46349515821d6 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Tue, 19 May 2026 10:20:56 -0600 Subject: bloblist: Rework bloblist_init and bloblist_maybe_init With bloblist, we need to both see if one already exists as well as create one if it does not. However, the current implementation leads to odd cases where we attempt to create a bloblist before this is possible and have things be overly complicated when we are given one to work with. This reworks things to instead have a bloblist_exists function, which as the name implies checks for an existing bloblist. This is used in the case of booting, to see if we have one and in turn if we have a device tree there as well as in the bloblist_init function to see if we need to do anything. In practical details, we move the logic from bloblist_init that was checking for a bloblist to the new bloblist_exists function and then can clarify the logic as it is much easier to state when we know we do not have one rather than all the ways we might have one. Then we have the locations that set gd->bloblist now also set the GD_FLG_BLOBLIST_READY flag. Reviewed-by: Raymond Mao Tested-by: Alexander Stein Signed-off-by: Tom Rini --- include/bloblist.h | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'include') diff --git a/include/bloblist.h b/include/bloblist.h index e67b2a76358..4c578772965 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -488,10 +488,24 @@ const char *bloblist_tag_name(enum bloblist_tag_t tag); */ int bloblist_reloc(void *to, uint to_size); +/** + * bloblist_exists() - Check for the prior existence of a bloblist + * + * This will check for a transfer list having been passed via standard + * convention. If CONFIG_BLOBLIST_PASSAGE_MANDATORY is selected and one is not + * found, we return false. + * + * If CONFIG_BLOBLIST_FIXED is selected, it uses CONFIG_BLOBLIST_ADDR and + * CONFIG_BLOBLIST_SIZE to check for a bloblist. + * + * Return: true if found, false if not + */ +bool bloblist_exists(void); + /** * bloblist_init() - Init the bloblist system with a single bloblist * - * This locates and sets up the blocklist for use. + * This creates a bloblist for use, if not already found. * * If CONFIG_BLOBLIST_FIXED is selected, it uses CONFIG_BLOBLIST_ADDR and * CONFIG_BLOBLIST_SIZE to set up a bloblist for use by U-Boot. @@ -508,22 +522,6 @@ int bloblist_reloc(void *to, uint to_size); */ int bloblist_init(void); -#if CONFIG_IS_ENABLED(BLOBLIST) -/** - * bloblist_maybe_init() - Init the bloblist system if not already done - * - * Calls bloblist_init() if the GD_FLG_BLOBLIST_READY flag is not set - * - * Return: 0 if OK, -ve on error - */ -int bloblist_maybe_init(void); -#else -static inline int bloblist_maybe_init(void) -{ - return 0; -} -#endif /* BLOBLIST */ - /** * bloblist_check_reg_conv() - Check whether the bloblist is compliant to * the register conventions according to the -- cgit v1.3.1