}
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)
}
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;
return ret;
*sizep = len_read;
+ if (!bootflow_img_add(bflow, bflow->fname, type, addr, size))
+ return log_msg_ret("bci", -ENOMEM);
+
return 0;
}
}
static int android_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)
{
/*
* Reading individual files is not supported since we only
}
static int cros_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)
{
return -ENOSYS;
}
size = SZ_1G;
ret = bootmeth_common_read_file(bflow->method, bflow, bflow->fname,
- addr, &size);
+ addr, BFI_EFI, &size);
if (ret)
return log_msg_ret("rdf", ret);
bflow->buf = map_sysmem(addr, bflow->size);
/* Limit FDT files to 4MB */
size = SZ_4M;
ret = bootmeth_common_read_file(dev, bflow, fname,
- fdt_addr, &size);
+ fdt_addr, (enum bootflow_img_t)IH_TYPE_FLATDT,
+ &size);
}
}
}
static int efi_mgr_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)
{
/* Files are loaded by the 'bootefi bootmgr' command */
/* Allow up to 1GB */
*sizep = 1 << 30;
ret = bootmeth_read_file(info->dev, info->bflow, file_path, addr,
- sizep);
+ (enum bootflow_img_t)IH_TYPE_INVALID, sizep);
if (ret)
return log_msg_ret("read", ret);
#include <pxe_utils.h>
static int extlinux_pxe_getfile(struct pxe_context *ctx, const char *file_path,
- char *file_addr, ulong *sizep)
+ char *file_addr, ulong *sizep)
{
struct extlinux_info *info = ctx->userdata;
ulong addr;
/* Allow up to 1GB */
*sizep = 1 << 30;
ret = bootmeth_read_file(info->dev, info->bflow, file_path, addr,
- sizep);
+ IH_TYPE_INVALID, sizep);
if (ret)
return log_msg_ret("read", ret);
static int extlinux_pxe_read_file(struct udevice *dev, struct bootflow *bflow,
const char *file_path, ulong addr,
- ulong *sizep)
+ enum bootflow_img_t type, ulong *sizep)
{
char *tftp_argv[] = {"tftp", NULL, NULL, NULL};
struct pxe_context *ctx = dev_get_priv(dev);
}
static int qfw_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)
{
return -ENOSYS;
}
}
static int sandbox_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)
{
return -ENOSYS;
}
}
static int vbe_simple_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)
{
int ret;
if (vbe_phase() == VBE_PHASE_OS) {
ret = bootmeth_common_read_file(dev, bflow, file_path, addr,
- sizep);
+ type, sizep);
if (ret)
return log_msg_ret("os", ret);
}
#define __bootmeth_h
#include <bootflow.h>
-#include <image.h>
#include <linux/bitops.h>
struct blk_desc;
* @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
* @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
* @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