aboutsummaryrefslogtreecommitdiff
path: root/cmd/sysboot.c
diff options
context:
space:
mode:
authorSimon Glass2021-10-14 12:47:56 -0600
committerTom Rini2021-11-11 19:02:11 -0500
commitfd3fa5c3941d4de0736d066f77d0158cf933e207 (patch)
tree3e8291c7ad555000c4c1852c82351cc6e9736542 /cmd/sysboot.c
parent3d24636e925f89841aac4482c8cc372a2b9d96a6 (diff)
pxe: Use a context pointer
At present the PXE functions pass around a pointer to command-table entry which is very strange. It is only needed in a few places and it is odd to pass around a data structure from another module in this way. For bootmethod we will need to provide some context information when reading files. Create a PXE context struct to hold the command-table-entry pointer and pass that around instead. We can then add more things to the context as needed. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Artem Lapkin <email2tema@gmail.com> Tested-by: Artem Lapkin <email2tema@gmail.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Diffstat (limited to 'cmd/sysboot.c')
-rw-r--r--cmd/sysboot.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/cmd/sysboot.c b/cmd/sysboot.c
index af6a2f1b7f1..9ba713c8aae 100644
--- a/cmd/sysboot.c
+++ b/cmd/sysboot.c
@@ -59,6 +59,7 @@ static int do_sysboot(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
unsigned long pxefile_addr_r;
+ struct pxe_context ctx;
struct pxe_menu *cfg;
char *pxefile_addr_str;
char *filename;
@@ -90,6 +91,7 @@ static int do_sysboot(struct cmd_tbl *cmdtp, int flag, int argc,
env_set("bootfile", filename);
}
+ pxe_setup_ctx(&ctx, cmdtp);
if (strstr(argv[3], "ext2")) {
do_getfile = do_get_ext2;
} else if (strstr(argv[3], "fat")) {
@@ -108,12 +110,12 @@ static int do_sysboot(struct cmd_tbl *cmdtp, int flag, int argc,
return 1;
}
- if (get_pxe_file(cmdtp, filename, pxefile_addr_r) < 0) {
+ if (get_pxe_file(&ctx, filename, pxefile_addr_r) < 0) {
printf("Error reading config file\n");
return 1;
}
- cfg = parse_pxefile(cmdtp, pxefile_addr_r);
+ cfg = parse_pxefile(&ctx, pxefile_addr_r);
if (!cfg) {
printf("Error parsing config file\n");
@@ -123,7 +125,7 @@ static int do_sysboot(struct cmd_tbl *cmdtp, int flag, int argc,
if (prompt)
cfg->prompt = 1;
- handle_pxe_menu(cmdtp, cfg);
+ handle_pxe_menu(&ctx, cfg);
destroy_pxe_menu(cfg);