From aa0ba7fbda4121fa9f3f11161fb4ebdd7e227299 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 15 Nov 2024 16:19:17 -0700 Subject: bootmeth: Update the read_file() method to include a type We want to record the type of each file which is loaded. Add an new parameter for this, to the read_file() method. Update all users. Make bootmeth_common_read_file() store information about the image that is read. Signed-off-by: Simon Glass Reviewed-by: Mattijs Korpershoek --- include/bootmeth.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/bootmeth.h b/include/bootmeth.h index e812974ec4d..788d4046ce9 100644 --- a/include/bootmeth.h +++ b/include/bootmeth.h @@ -8,7 +8,6 @@ #define __bootmeth_h #include -#include #include struct blk_desc; @@ -117,13 +116,15 @@ struct bootmeth_ops { * @bflow: Bootflow providing info on where to read from * @file_path: Path to file (may be absolute or relative) * @addr: Address to load file + * @type: File type (IH_TYPE_...) * @sizep: On entry provides the maximum permitted size; on exit * returns the size of the file * Return: 0 if OK, -ENOSPC if the file is too large for @sizep, other * -ve value if something else goes wrong */ int (*read_file)(struct udevice *dev, struct bootflow *bflow, - const char *file_path, ulong addr, ulong *sizep); + const char *file_path, ulong addr, + enum bootflow_img_t type, ulong *sizep); #if CONFIG_IS_ENABLED(BOOTSTD_FULL) /** * readall() - read all files for a bootflow @@ -245,13 +246,15 @@ int bootmeth_set_bootflow(struct udevice *dev, struct bootflow *bflow, * @bflow: Bootflow providing info on where to read from * @file_path: Path to file (may be absolute or relative) * @addr: Address to load file + * @type: File type (IH_TYPE_...) * @sizep: On entry provides the maximum permitted size; on exit * returns the size of the file * Return: 0 if OK, -ENOSPC if the file is too large for @sizep, other * -ve value if something else goes wrong */ int bootmeth_read_file(struct udevice *dev, struct bootflow *bflow, - const char *file_path, ulong addr, ulong *sizep); + const char *file_path, ulong addr, + enum bootflow_img_t type, ulong *sizep); /** * bootmeth_read_all() - read all bootflow files @@ -397,11 +400,13 @@ int bootmeth_alloc_other(struct bootflow *bflow, const char *fname, * @bflow: Bootflow information * @file_path: Path to file * @addr: Address to load file to + * @type: File type (IH_TYPE_...) * @sizep: On entry, the maximum file size to accept, on exit the actual file * size read */ int bootmeth_common_read_file(struct udevice *dev, struct bootflow *bflow, - const char *file_path, ulong addr, ulong *sizep); + const char *file_path, ulong addr, + enum bootflow_img_t type, ulong *sizep); /** * bootmeth_get_bootflow() - Get a bootflow from a global bootmeth -- cgit v1.2.3