bloblist: add api to get blob with size

bloblist_find function only returns the pointer of blob data,
which is fine for those self-describing data like FDT.
But as a common scenario, an interface is needed to retrieve both
the pointer and the size of the blob data.

Add a few ut test cases for the new api.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
This commit is contained in:
Raymond Mao
2025-01-27 06:49:34 -08:00
committed by Ilias Apalodimas
parent b8eaa52612
commit bb894c5da5
3 changed files with 37 additions and 2 deletions

View File

@@ -250,6 +250,24 @@ static inline void *bloblist_check_magic(ulong addr)
return ptr;
}
#if CONFIG_IS_ENABLED(BLOBLIST)
/**
* bloblist_get_blob() - Find a blob and get the size of it
*
* Searches the bloblist and returns the blob with the matching tag
*
* @tag: Tag to search for (enum bloblist_tag_t)
* @sizep: Size of the blob found
* Return: pointer to bloblist if found, or NULL if not found
*/
void *bloblist_get_blob(uint tag, int *sizep);
#else
static inline void *bloblist_get_blob(uint tag, int *sizep)
{
return NULL;
}
#endif
/**
* bloblist_find() - Find a blob
*