mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
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 <sjg@chromium.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
This commit is contained in:
@@ -84,14 +84,15 @@ int bootmeth_boot(struct udevice *dev, struct bootflow *bflow)
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
const struct bootmeth_ops *ops = bootmeth_get_ops(dev);
|
||||
|
||||
if (!ops->read_file)
|
||||
return -ENOSYS;
|
||||
|
||||
return ops->read_file(dev, bflow, file_path, addr, sizep);
|
||||
return ops->read_file(dev, bflow, file_path, addr, type, sizep);
|
||||
}
|
||||
|
||||
int bootmeth_get_bootflow(struct udevice *dev, struct bootflow *bflow)
|
||||
@@ -394,7 +395,8 @@ int bootmeth_alloc_other(struct bootflow *bflow, const char *fname,
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
struct blk_desc *desc = NULL;
|
||||
loff_t len_read;
|
||||
@@ -423,6 +425,9 @@ int bootmeth_common_read_file(struct udevice *dev, struct bootflow *bflow,
|
||||
return ret;
|
||||
*sizep = len_read;
|
||||
|
||||
if (!bootflow_img_add(bflow, bflow->fname, type, addr, size))
|
||||
return log_msg_ret("bci", -ENOMEM);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user