@@ -188,7 +188,7 @@ static int extlinux_boot(struct udevice *dev, struct bootflow *bflow)
plat = dev_get_plat(dev);
ret = pxe_setup_ctx(&ctx, extlinux_getfile, &info, true, bflow->fname,
- false, plat->use_fallback);
+ false, plat->use_fallback, bflow);
if (ret)
return log_msg_ret("ctx", -EINVAL);
@@ -148,7 +148,7 @@ static int extlinux_pxe_boot(struct udevice *dev, struct bootflow *bflow)
info.dev = dev;
info.bflow = bflow;
ret = pxe_setup_ctx(ctx, extlinux_pxe_getfile, &info, false,
- bflow->subdir, false, false);
+ bflow->subdir, false, false, bflow);
if (ret)
return log_msg_ret("ctx", -EINVAL);
@@ -1632,7 +1632,7 @@ void handle_pxe_menu(struct pxe_context *ctx, struct pxe_menu *cfg)
int pxe_setup_ctx(struct pxe_context *ctx, pxe_getfile_func getfile,
void *userdata, bool allow_abs_path, const char *bootfile,
- bool use_ipv6, bool use_fallback)
+ bool use_ipv6, bool use_fallback, struct bootflow *bflow)
{
const char *last_slash;
size_t path_len = 0;
@@ -1643,6 +1643,7 @@ int pxe_setup_ctx(struct pxe_context *ctx, pxe_getfile_func getfile,
ctx->allow_abs_path = allow_abs_path;
ctx->use_ipv6 = use_ipv6;
ctx->use_fallback = use_fallback;
+ ctx->bflow = bflow;
/* figure out the boot directory, if there is one */
if (bootfile && strlen(bootfile) >= MAX_TFTP_PATH_LEN)
@@ -130,7 +130,7 @@ int pxe_get(ulong pxefile_addr_r, char **bootdirp, ulong *sizep, bool use_ipv6)
int i;
if (pxe_setup_ctx(&ctx, do_get_tftp, NULL, false, env_get("bootfile"),
- use_ipv6, false))
+ use_ipv6, false, NULL))
return -ENOMEM;
if (IS_ENABLED(CONFIG_BOOTP_PXE_DHCP_OPTION) &&
@@ -280,7 +280,7 @@ do_pxe_boot(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
}
if (pxe_setup_ctx(&ctx, do_get_tftp, NULL, false, env_get("bootfile"),
- use_ipv6, false)) {
+ use_ipv6, false, NULL)) {
printf("Out of memory\n");
return CMD_RET_FAILURE;
}
@@ -106,7 +106,7 @@ static int do_sysboot(struct cmd_tbl *cmdtp, int flag, int argc,
}
if (pxe_setup_ctx(&ctx, sysboot_read_file, &info, true, filename, false,
- false)) {
+ false, NULL)) {
printf("Out of memory\n");
return CMD_RET_FAILURE;
}
@@ -109,6 +109,7 @@ typedef int (*pxe_getfile_func)(struct pxe_context *ctx, const char *file_path,
* @use_ipv6: TRUE : use IPv6 addressing, FALSE : use IPv4 addressing
* @use_fallback: TRUE : use "fallback" option as default, FALSE : use
* "default" option as default
+ * @bflow: Bootflow being booted, or NULL if none
*/
struct pxe_context {
/**
@@ -129,6 +130,7 @@ struct pxe_context {
ulong pxe_file_size;
bool use_ipv6;
bool use_fallback;
+ struct bootflow *bflow;
};
/**
@@ -231,12 +233,13 @@ int format_mac_pxe(char *outbuf, size_t outbuf_len);
* other choice be selected
* FALSE : Use "default" option should no other choice be
* selected
+ * @bflow: Bootflow to update, NULL if none
* Return: 0 if OK, -ENOMEM if out of memory, -E2BIG if bootfile is larger than
* MAX_TFTP_PATH_LEN bytes
*/
int pxe_setup_ctx(struct pxe_context *ctx, pxe_getfile_func getfile,
void *userdata, bool allow_abs_path, const char *bootfile,
- bool use_ipv6, bool use_fallback);
+ bool use_ipv6, bool use_fallback, struct bootflow *bflow);
/**
* pxe_destroy_ctx() - Destroy a PXE context
At present the only option with PXE is to boot it and see what happens. Provide a bootflow, when available, so that PXE will eventually be able to add some useful information to it. Signed-off-by: Simon Glass <sjg@chromium.org> --- (no changes since v1) boot/bootmeth_extlinux.c | 2 +- boot/bootmeth_pxe.c | 2 +- boot/pxe_utils.c | 3 ++- cmd/pxe.c | 4 ++-- cmd/sysboot.c | 2 +- include/pxe_utils.h | 5 ++++- 6 files changed, 11 insertions(+), 7 deletions(-)