boot: Add a way to get writable image information

The bootflow_img_find() function does not permit updating the image.
Some bootmeths may want to do this, e.g. to change the address. Add a
function which returns a writeable pointer.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-06-09 06:31:32 -06:00
parent 8fd296aae9
commit 2e1d6e0db8
3 changed files with 29 additions and 5 deletions

View File

@@ -648,6 +648,16 @@ struct bootflow_img *bootflow_img_add(struct bootflow *bflow, const char *fname,
enum bootflow_img_t type, ulong addr,
ulong size);
/**
* bootflow_img_findw() - Find the first image of a given type
*
* @bflow: Bootflow to search
* @type: Image type to search for
* Return: Non-const pointer to image, or NULL if not found
*/
struct bootflow_img *bootflow_img_findw(const struct bootflow *bflow,
enum bootflow_img_t type);
/**
* bootflow_img_find() - Find the first image of a given type
*
@@ -655,8 +665,12 @@ struct bootflow_img *bootflow_img_add(struct bootflow *bflow, const char *fname,
* @type: Image type to search for
* Return: Pointer to image, or NULL if not found
*/
const struct bootflow_img *bootflow_img_find(const struct bootflow *bflow,
enum bootflow_img_t type);
static inline const struct bootflow_img *
bootflow_img_find(const struct bootflow *bflow,
enum bootflow_img_t type)
{
return bootflow_img_findw(bflow, type);
}
/**
* bootflow_get_seq() - Get the sequence number of a bootflow