From 630b2f39ddabd43a27a98f0356b948df18e97d88 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 14 Aug 2019 19:56:14 -0600 Subject: cbfs: Add functions to support multiple CBFSs Sometimes an image has multiple CBFS. The current CBFS API is limited to handling only one at time. Also it keeps track of the CBFS internally in BSS, which does not work before relocation, for example. Add a few new functions to overcome these limitations. Signed-off-by: Simon Glass Reviewed-by: Bin Meng Tested-by: Bin Meng --- include/cbfs.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'include/cbfs.h') diff --git a/include/cbfs.h b/include/cbfs.h index 742e34e24f..6d4c4d4b06 100644 --- a/include/cbfs.h +++ b/include/cbfs.h @@ -135,6 +135,28 @@ void file_cbfs_get_next(const struct cbfs_cachenode **file); */ const struct cbfs_cachenode *file_cbfs_find(const char *name); +struct cbfs_priv *priv; + +/** + * cbfs_find_file() - Find a file in a given CBFS + * + * @cbfs: CBFS to look in (use cbfs_init_mem() to set it up) + * @name: Filename to look for + * @return pointer to CBFS node if found, else NULL + */ +const struct cbfs_cachenode *cbfs_find_file(struct cbfs_priv *cbfs, + const char *name); + +/** + * cbfs_init_mem() - Set up a new CBFS + * + * @base: Base address of CBFS + * @size: Size of CBFS in bytes + * @cbfsp: Returns a pointer to CBFS on success + * @return 0 if OK, -ve on error + */ +int cbfs_init_mem(ulong base, ulong size, struct cbfs_priv **privp); + /***************************************************************************/ /* All of the functions below can be used without first initializing CBFS. */ -- cgit v1.2.3