@@ -217,15 +217,19 @@ static int extlinux_read_bootflow(struct udevice *dev, struct bootflow *bflow)
static int extlinux_local_boot(struct udevice *dev, struct bootflow *bflow)
{
- return extlinux_boot(dev, bflow, extlinux_getfile, true, bflow->fname,
- false);
+ struct extlinux_plat *plat = dev_get_plat(dev);
+
+ return extlinux_boot(dev, bflow, &plat->ctx, extlinux_getfile, true,
+ bflow->fname, false);
}
#if CONFIG_IS_ENABLED(BOOTSTD_FULL)
static int extlinux_local_read_all(struct udevice *dev, struct bootflow *bflow)
{
- return extlinux_read_all(dev, bflow, extlinux_getfile, true,
- bflow->fname);
+ struct extlinux_plat *plat = dev_get_plat(dev);
+
+ return extlinux_read_all(dev, bflow, &plat->ctx, extlinux_getfile,
+ true, bflow->fname);
}
#endif
@@ -145,15 +145,19 @@ static int extlinux_pxe_read_file(struct udevice *dev, struct bootflow *bflow,
static int extlinux_pxe_boot(struct udevice *dev, struct bootflow *bflow)
{
- return extlinux_boot(dev, bflow, extlinux_pxe_getfile, false,
- bflow->subdir, false);
+ struct extlinux_plat *plat = dev_get_plat(dev);
+
+ return extlinux_boot(dev, bflow, &plat->ctx, extlinux_pxe_getfile,
+ false, bflow->subdir, false);
}
#if CONFIG_IS_ENABLED(BOOTSTD_FULL)
static int extlinux_pxe_read_all(struct udevice *dev, struct bootflow *bflow)
{
- return extlinux_read_all(dev, bflow, extlinux_pxe_getfile, false,
- bflow->subdir);
+ struct extlinux_plat *plat = dev_get_plat(dev);
+
+ return extlinux_read_all(dev, bflow, &plat->ctx,
+ extlinux_pxe_getfile, false, bflow->subdir);
}
#endif
@@ -97,25 +97,24 @@ static int extlinux_setup(struct udevice *dev, struct bootflow *bflow,
}
int extlinux_boot(struct udevice *dev, struct bootflow *bflow,
- pxe_getfile_func getfile, bool allow_abs_path,
- const char *bootfile, bool restart)
+ struct pxe_context *ctx, pxe_getfile_func getfile,
+ bool allow_abs_path, const char *bootfile, bool restart)
{
- struct extlinux_plat *plat = dev_get_plat(dev);
ulong addr;
int ret;
/* if we have already selected a label, just boot it */
- if (plat->ctx.label) {
- plat->ctx.fake_go = bflow->flags & BOOTFLOWF_FAKE_GO;
- ret = pxe_boot(&plat->ctx);
+ if (ctx->label) {
+ ctx->fake_go = bflow->flags & BOOTFLOWF_FAKE_GO;
+ ret = pxe_boot(ctx);
} else {
ret = extlinux_setup(dev, bflow, getfile, allow_abs_path,
- bootfile, &plat->ctx);
+ bootfile, ctx);
if (ret)
return log_msg_ret("elb", ret);
- plat->ctx.restart = restart;
+ ctx->restart = restart;
addr = map_to_sysmem(bflow->buf);
- ret = pxe_process_str(&plat->ctx, addr, false);
+ ret = pxe_process_str(ctx, addr, false);
}
if (ret)
return log_msg_ret("elb", -EFAULT);
@@ -124,20 +123,19 @@ int extlinux_boot(struct udevice *dev, struct bootflow *bflow,
}
int extlinux_read_all(struct udevice *dev, struct bootflow *bflow,
- pxe_getfile_func getfile, bool allow_abs_path,
- const char *bootfile)
+ struct pxe_context *ctx, pxe_getfile_func getfile,
+ bool allow_abs_path, const char *bootfile)
{
- struct extlinux_plat *plat = dev_get_plat(dev);
ulong addr;
int ret;
ret = extlinux_setup(dev, bflow, getfile, allow_abs_path, bootfile,
- &plat->ctx);
+ ctx);
if (ret)
return log_msg_ret("era", ret);
addr = map_to_sysmem(bflow->buf);
- plat->ctx.pxe_file_size = bflow->size;
- ret = pxe_probe(&plat->ctx, addr, false);
+ ctx->pxe_file_size = bflow->size;
+ ret = pxe_probe(ctx, addr, false);
if (ret)
return log_msg_ret("elb", -EFAULT);
@@ -204,6 +204,7 @@ err_buf:
static int vbe_abrec_boot(struct udevice *dev, struct bootflow *bflow)
{
+ struct extlinux_plat *plat = dev_get_plat(dev);
const struct bootflow_img *img;
int ret;
@@ -230,15 +231,17 @@ static int vbe_abrec_boot(struct udevice *dev, struct bootflow *bflow)
printf("Loading OS FIT%s\n", img ? " keeping existing FDT" : "");
- return extlinux_boot(dev, bflow, vbe_abrec_getfile, true, bflow->fname,
- img);
+ return extlinux_boot(dev, bflow, &plat->ctx, vbe_abrec_getfile, true,
+ bflow->fname, img);
}
#if CONFIG_IS_ENABLED(BOOTSTD_FULL)
static int vbe_abrec_read_all(struct udevice *dev, struct bootflow *bflow)
{
- return extlinux_read_all(dev, bflow, vbe_abrec_getfile, true,
- bflow->fname);
+ struct extlinux_plat *plat = dev_get_plat(dev);
+
+ return extlinux_read_all(dev, bflow, &plat->ctx, vbe_abrec_getfile,
+ true, bflow->fname);
}
#endif
@@ -54,6 +54,7 @@ int extlinux_set_property(struct udevice *dev, const char *property,
*
* @dev: bootmeth device
* @bflow: Bootflow to boot
+ * @ctx: PXE context to use for booting
* @getfile: Function to use to read files
* @allow_abs_path: true to allow absolute paths
* @bootfile: Bootfile whose directory loaded files are relative to, NULL if
@@ -63,14 +64,15 @@ int extlinux_set_property(struct udevice *dev, const char *property,
* Return: 0 if OK, -ve error code on failure
*/
int extlinux_boot(struct udevice *dev, struct bootflow *bflow,
- pxe_getfile_func getfile, bool allow_abs_path,
- const char *bootfile, bool restart);
+ struct pxe_context *ctx, pxe_getfile_func getfile,
+ bool allow_abs_path, const char *bootfile, bool restart);
/**
* extlinux_read_all() - read all files for a bootflow
*
* @dev: Bootmethod device to boot
* @bflow: Bootflow to read
+ * @ctx: PXE context to use for reading
* @getfile: Function to use to read files
* @allow_abs_path: true to allow absolute paths
* @bootfile: Bootfile whose directory loaded files are relative to, NULL if
@@ -78,7 +80,7 @@ int extlinux_boot(struct udevice *dev, struct bootflow *bflow,
* Return: 0 if OK, -EIO on I/O error, other -ve on other error
*/
int extlinux_read_all(struct udevice *dev, struct bootflow *bflow,
- pxe_getfile_func getfile, bool allow_abs_path,
- const char *bootfile);
+ struct pxe_context *ctx, pxe_getfile_func getfile,
+ bool allow_abs_path, const char *bootfile);
#endif