bloblist: Refactor Kconfig to support alloc or fixed

At present we do support allocating the bloblist but the Kconfig is a bit
strange, since we still have to specify an address in that case. Partly
this is because it is a pain to have CONFIG options that disappears when
its dependency is enabled. It means that we must have #ifdefs in the code,
either in the C code or header file.

Make use of IF_ENABLED_INT() and its friend to solve that problem, so we
can separate out the location of bloblist into a choice. Put the address
and size into variables so we can log the result.

Add the options for SPL as well, so we can use CONFIG_IS_ENABLED().

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2022-01-12 19:26:22 -07:00
parent 5938d654de
commit 99047f5d7f
3 changed files with 116 additions and 24 deletions

View File

@@ -147,6 +147,16 @@ struct bloblist_rec {
u32 spare;
};
/* access CONFIG_BLOBLIST_ADDR, dealing with it possibly not being defined */
static inline ulong bloblist_addr(void)
{
#ifdef CONFIG_BLOBLIST_FIXED
return CONFIG_BLOBLIST_ADDR;
#else
return 0;
#endif
}
/**
* bloblist_check_magic() - return a bloblist if the magic matches
*