@@ -115,7 +115,7 @@ int extlinux_boot(struct udevice *dev, struct bootflow *bflow,
return log_msg_ret("elb", ret);
plat->ctx.restart = restart;
addr = map_to_sysmem(bflow->buf);
- ret = pxe_process(&plat->ctx, addr, false);
+ ret = pxe_process_str(&plat->ctx, addr, false);
}
if (ret)
return log_msg_ret("elb", -EFAULT);
@@ -1325,11 +1325,12 @@ static struct pxe_menu *pxe_prepare(struct pxe_context *ctx,
return cfg;
}
-int pxe_process(struct pxe_context *ctx, ulong pxefile_addr_r, bool prompt)
+int pxe_process(struct pxe_context *ctx, ulong addr, ulong size, bool prompt)
{
struct pxe_menu *cfg;
- cfg = pxe_prepare(ctx, pxefile_addr_r, prompt);
+ ctx->pxe_file_size = size;
+ cfg = pxe_prepare(ctx, addr, prompt);
if (!cfg)
return 1;
@@ -1340,6 +1341,18 @@ int pxe_process(struct pxe_context *ctx, ulong pxefile_addr_r, bool prompt)
return 0;
}
+int pxe_process_str(struct pxe_context *ctx, ulong pxefile_addr_r, bool prompt)
+{
+ void *ptr;
+ int len;
+
+ ptr = map_sysmem(pxefile_addr_r, 0);
+ len = strnlen(ptr, SZ_64K);
+ unmap_sysmem(ptr);
+
+ return pxe_process(ctx, pxefile_addr_r, len, prompt);
+}
+
int pxe_probe(struct pxe_context *ctx, ulong pxefile_addr_r, bool prompt)
{
ctx->cfg = pxe_prepare(ctx, pxefile_addr_r, prompt);
@@ -286,7 +286,7 @@ do_pxe_boot(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
printf("Out of memory\n");
return CMD_RET_FAILURE;
}
- ret = pxe_process(&ctx, pxefile_addr_r, false);
+ ret = pxe_process(&ctx, pxefile_addr_r, ctx.pxe_file_size, false);
pxe_destroy_ctx(&ctx);
if (ret)
return CMD_RET_FAILURE;
@@ -119,7 +119,7 @@ static int do_sysboot(struct cmd_tbl *cmdtp, int flag, int argc,
return 1;
}
- ret = pxe_process(&ctx, pxefile_addr_r, prompt);
+ ret = pxe_process(&ctx, pxefile_addr_r, ctx.pxe_file_size, prompt);
pxe_destroy_ctx(&ctx);
if (ret)
return CMD_RET_FAILURE;
@@ -21,7 +21,7 @@ When invoked on a bootdev, this bootmeth searches for the file and creates a
bootflow if found.
When the bootflow is booted, the bootmeth calls ``pxe_setup_ctx()`` to set up
-the context, then ``pxe_process()`` to process the file. Depending on the
+the context, then ``pxe_process_str()`` to process the file. Depending on the
contents, this may boot an operating system or provide a list of options to
the user, perhaps with a timeout.
@@ -19,7 +19,7 @@ bootflow if found. See
a full description of the search procedure.
When the bootflow is booted, the bootmeth calls ``pxe_setup_ctx()`` to set up
-the context, then ``pxe_process()`` to process the file. Depending on the
+the context, then ``pxe_process_str()`` to process the file. Depending on the
contents, this may boot an Operating System or provide a list of options to the
user, perhaps with a timeout.
@@ -366,14 +366,26 @@ int pxe_setup_ctx(struct pxe_context *ctx, pxe_getfile_func getfile,
*/
void pxe_destroy_ctx(struct pxe_context *ctx);
+/**
+ * pxe_process_str() - Process a PXE file through to boot
+ *
+ * Note: The file at @pxefile_addr_r must be a nul-terminated string.
+ *
+ * @ctx: PXE context created with pxe_setup_ctx()
+ * @pxefile_addr_r: Address of config to process
+ * @prompt: Force a prompt for the user
+ */
+int pxe_process_str(struct pxe_context *ctx, ulong pxefile_addr_r, bool prompt);
+
/**
* pxe_process() - Process a PXE file through to boot
*
* @ctx: PXE context created with pxe_setup_ctx()
- * @pxefile_addr_r: Address to load file
+ * @addr: Address of config to process
+ * @size: Size of continue to process
* @prompt: Force a prompt for the user
*/
-int pxe_process(struct pxe_context *ctx, ulong pxefile_addr_r, bool prompt);
+int pxe_process(struct pxe_context *ctx, ulong addr, ulong size, bool prompt);
/**
* pxe_get_file_size() - Read the value of the 'filesize' environment variable