bootm: Adjust arguments of boot_os_fn

Adjust boot_os_fn to use struct bootm_info instead of the separate
argc, argv and image parameters. Update the handlers accordingly. Few
of the functions make use of the arguments, so this improves code size
slightly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
Simon Glass 2023-12-15 20:14:13 -07:00 committed by Tom Rini
parent c49216253d
commit a48336e5ea
15 changed files with 100 additions and 72 deletions

View file

@ -3,6 +3,7 @@
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved. * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
*/ */
#include <bootm.h>
#include <bootstage.h> #include <bootstage.h>
#include <env.h> #include <env.h>
#include <image.h> #include <image.h>
@ -78,8 +79,10 @@ static void boot_jump_linux(struct bootm_headers *images, int flag)
board_jump_and_run(kernel_entry, r0, 0, r2); board_jump_and_run(kernel_entry, r0, 0, r2);
} }
int do_bootm_linux(int flag, int argc, char *argv[], struct bootm_headers *images) int do_bootm_linux(int flag, struct bootm_info *bmi)
{ {
struct bootm_headers *images = bmi->images;
/* No need for those on ARC */ /* No need for those on ARC */
if ((flag & BOOTM_STATE_OS_BD_T) || (flag & BOOTM_STATE_OS_CMDLINE)) if ((flag & BOOTM_STATE_OS_BD_T) || (flag & BOOTM_STATE_OS_CMDLINE))
return -1; return -1;

View file

@ -12,6 +12,7 @@
*/ */
#include <common.h> #include <common.h>
#include <bootm.h>
#include <bootstage.h> #include <bootstage.h>
#include <command.h> #include <command.h>
#include <cpu_func.h> #include <cpu_func.h>
@ -378,9 +379,10 @@ static void boot_jump_linux(struct bootm_headers *images, int flag)
* DIFFERENCE: Instead of calling prep and go at the end * DIFFERENCE: Instead of calling prep and go at the end
* they are called if subcommand is equal 0. * they are called if subcommand is equal 0.
*/ */
int do_bootm_linux(int flag, int argc, char *const argv[], int do_bootm_linux(int flag, struct bootm_info *bmi)
struct bootm_headers *images)
{ {
struct bootm_headers *images = bmi->images;
/* No need for those on ARM */ /* No need for those on ARM */
if (flag & BOOTM_STATE_OS_BD_T || flag & BOOTM_STATE_OS_CMDLINE) if (flag & BOOTM_STATE_OS_BD_T || flag & BOOTM_STATE_OS_CMDLINE)
return -1; return -1;

View file

@ -4,6 +4,7 @@
* Wolfgang Denk, DENX Software Engineering, wd@denx.de. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*/ */
#include <bootm.h>
#include <bootstage.h> #include <bootstage.h>
#include <command.h> #include <command.h>
#include <env.h> #include <env.h>
@ -34,9 +35,9 @@ void arch_lmb_reserve(struct lmb *lmb)
arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 1024); arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 1024);
} }
int do_bootm_linux(int flag, int argc, char *const argv[], int do_bootm_linux(int flag, struct bootm_info *bmi)
struct bootm_headers *images)
{ {
struct bootm_headers *images = bmi->images;
int ret; int ret;
struct bd_info *kbd; struct bd_info *kbd;
void (*kernel) (struct bd_info *, ulong, ulong, ulong, ulong); void (*kernel) (struct bd_info *, ulong, ulong, ulong, ulong);

View file

@ -7,6 +7,7 @@
* Yasushi SHOJI <yashi@atmark-techno.com> * Yasushi SHOJI <yashi@atmark-techno.com>
*/ */
#include <bootm.h>
#include <bootstage.h> #include <bootstage.h>
#include <command.h> #include <command.h>
#include <cpu_func.h> #include <cpu_func.h>
@ -81,9 +82,10 @@ static void boot_prep_linux(struct bootm_headers *images)
} }
} }
int do_bootm_linux(int flag, int argc, char *const argv[], int do_bootm_linux(int flag, struct bootm_info *bmi)
struct bootm_headers *images)
{ {
struct bootm_headers *images = bmi->images;
images->cmdline_start = (ulong)env_get("bootargs"); images->cmdline_start = (ulong)env_get("bootargs");
/* cmdline init is the part of 'prep' and nothing to do for 'bdt' */ /* cmdline init is the part of 'prep' and nothing to do for 'bdt' */

View file

@ -4,6 +4,7 @@
* Wolfgang Denk, DENX Software Engineering, wd@denx.de. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*/ */
#include <bootm.h>
#include <bootstage.h> #include <bootstage.h>
#include <env.h> #include <env.h>
#include <image.h> #include <image.h>
@ -300,9 +301,10 @@ static void boot_jump_linux(struct bootm_headers *images)
linux_extra); linux_extra);
} }
int do_bootm_linux(int flag, int argc, char *const argv[], int do_bootm_linux(int flag, struct bootm_info *bmi)
struct bootm_headers *images)
{ {
struct bootm_headers *images = bmi->images;
/* No need for those on MIPS */ /* No need for those on MIPS */
if (flag & BOOTM_STATE_OS_BD_T) if (flag & BOOTM_STATE_OS_BD_T)
return -1; return -1;

View file

@ -5,6 +5,7 @@
*/ */
#include <common.h> #include <common.h>
#include <bootm.h>
#include <cpu_func.h> #include <cpu_func.h>
#include <env.h> #include <env.h>
#include <image.h> #include <image.h>
@ -16,9 +17,9 @@ DECLARE_GLOBAL_DATA_PTR;
#define NIOS_MAGIC 0x534f494e /* enable command line and initrd passing */ #define NIOS_MAGIC 0x534f494e /* enable command line and initrd passing */
int do_bootm_linux(int flag, int argc, char *const argv[], int do_bootm_linux(int flag, struct bootm_info *bmi)
struct bootm_headers *images)
{ {
struct bootm_headers *images = bmi->images;
void (*kernel)(int, int, int, char *) = (void *)images->ep; void (*kernel)(int, int, int, char *) = (void *)images->ep;
char *commandline = env_get("bootargs"); char *commandline = env_get("bootargs");
ulong initrd_start = images->rd_start; ulong initrd_start = images->rd_start;
@ -29,8 +30,9 @@ int do_bootm_linux(int flag, int argc, char *const argv[],
if (images->ft_len) if (images->ft_len)
of_flat_tree = images->ft_addr; of_flat_tree = images->ft_addr;
#endif #endif
if (!of_flat_tree && argc > 1) /* TODO: Clean this up - the DT should already be set up */
of_flat_tree = (char *)hextoul(argv[1], NULL); if (!of_flat_tree && bmi->argc > 1)
of_flat_tree = (char *)hextoul(bmi->argv[1], NULL);
if (of_flat_tree) if (of_flat_tree)
initrd_end = (ulong)of_flat_tree; initrd_end = (ulong)of_flat_tree;

View file

@ -8,6 +8,7 @@
#include <common.h> #include <common.h>
#include <bootm.h>
#include <bootstage.h> #include <bootstage.h>
#include <cpu_func.h> #include <cpu_func.h>
#include <env.h> #include <env.h>
@ -223,9 +224,9 @@ static int boot_body_linux(struct bootm_headers *images)
return 0; return 0;
} }
noinline int do_bootm_linux(int flag, int argc, char *const argv[], int do_bootm_linux(int flag, struct bootm_info *bmi)
struct bootm_headers *images)
{ {
struct bootm_headers *images = bmi->images;
int ret; int ret;
if (flag & BOOTM_STATE_OS_CMDLINE) { if (flag & BOOTM_STATE_OS_CMDLINE) {

View file

@ -7,6 +7,7 @@
*/ */
#include <bootstage.h> #include <bootstage.h>
#include <bootm.h>
#include <command.h> #include <command.h>
#include <dm.h> #include <dm.h>
#include <fdt_support.h> #include <fdt_support.h>
@ -105,9 +106,10 @@ static void boot_jump_linux(struct bootm_headers *images, int flag)
} }
} }
int do_bootm_linux(int flag, int argc, char *const argv[], int do_bootm_linux(int flag, struct bootm_info *bmi)
struct bootm_headers *images)
{ {
struct bootm_headers *images = bmi->images;
/* No need for those on RISC-V */ /* No need for those on RISC-V */
if (flag & BOOTM_STATE_OS_BD_T || flag & BOOTM_STATE_OS_CMDLINE) if (flag & BOOTM_STATE_OS_BD_T || flag & BOOTM_STATE_OS_CMDLINE)
return -1; return -1;
@ -127,10 +129,9 @@ int do_bootm_linux(int flag, int argc, char *const argv[],
return 0; return 0;
} }
int do_bootm_vxworks(int flag, int argc, char *const argv[], int do_bootm_vxworks(int flag, struct bootm_info *bmi)
struct bootm_headers *images)
{ {
return do_bootm_linux(flag, argc, argv, images); return do_bootm_linux(flag, bmi);
} }
static ulong get_sp(void) static ulong get_sp(void)

View file

@ -5,6 +5,7 @@
*/ */
#include <common.h> #include <common.h>
#include <bootm.h>
#include <bootstage.h> #include <bootstage.h>
#include <image.h> #include <image.h>
#include <asm/io.h> #include <asm/io.h>
@ -64,8 +65,10 @@ static int boot_prep_linux(struct bootm_headers *images)
return 0; return 0;
} }
int do_bootm_linux(int flag, int argc, char *argv[], struct bootm_headers *images) int do_bootm_linux(int flag, struct bootm_info *bmi)
{ {
struct bootm_headers *images = bmi->images;
if (flag & BOOTM_STATE_OS_PREP) if (flag & BOOTM_STATE_OS_PREP)
return boot_prep_linux(images); return boot_prep_linux(images);

View file

@ -8,6 +8,7 @@
*/ */
#include <common.h> #include <common.h>
#include <bootm.h>
#include <command.h> #include <command.h>
#include <env.h> #include <env.h>
#include <image.h> #include <image.h>
@ -39,9 +40,10 @@ static unsigned long sh_check_cmd_arg(char *cmdline, char *key, int base)
return val; return val;
} }
int do_bootm_linux(int flag, int argc, char *const argv[], int do_bootm_linux(int flag, struct bootm_info *bmi)
struct bootm_headers *images)
{ {
struct bootm_headers *images = bmi->images;
/* Linux kernel load address */ /* Linux kernel load address */
void (*kernel) (void) = (void (*)(void))images->ep; void (*kernel) (void) = (void (*)(void))images->ep;
/* empty_zero_page */ /* empty_zero_page */

View file

@ -8,6 +8,7 @@
*/ */
#include <common.h> #include <common.h>
#include <bootm.h>
#include <bootstage.h> #include <bootstage.h>
#include <command.h> #include <command.h>
#include <efi.h> #include <efi.h>
@ -237,9 +238,10 @@ static int boot_jump_linux(struct bootm_headers *images)
images->os.arch == IH_ARCH_X86_64); images->os.arch == IH_ARCH_X86_64);
} }
int do_bootm_linux(int flag, int argc, char *const argv[], int do_bootm_linux(int flag, struct bootm_info *bmi)
struct bootm_headers *images)
{ {
struct bootm_headers *images = bmi->images;
/* No need for those on x86 */ /* No need for those on x86 */
if (flag & BOOTM_STATE_OS_BD_T || flag & BOOTM_STATE_OS_CMDLINE) if (flag & BOOTM_STATE_OS_BD_T || flag & BOOTM_STATE_OS_CMDLINE)
return -1; return -1;

View file

@ -5,6 +5,7 @@
*/ */
#include <common.h> #include <common.h>
#include <bootm.h>
#include <bootstage.h> #include <bootstage.h>
#include <command.h> #include <command.h>
#include <cpu_func.h> #include <cpu_func.h>
@ -134,8 +135,9 @@ static struct bp_tag *setup_fdt_tag(struct bp_tag *params, void *fdt_start)
* Boot Linux. * Boot Linux.
*/ */
int do_bootm_linux(int flag, int argc, char *argv[], struct bootm_headers *images) int do_bootm_linux(int flag, struct bootm_info *bmi)
{ {
struct bootm_headers *images = bmi->images;
struct bp_tag *params, *params_start; struct bp_tag *params, *params_start;
ulong initrd_start, initrd_end; ulong initrd_start, initrd_end;
char *commandline = env_get("bootargs"); char *commandline = env_get("bootargs");

View file

@ -6,6 +6,7 @@
#ifndef USE_HOSTCC #ifndef USE_HOSTCC
#include <common.h> #include <common.h>
#include <bootm.h>
#include <bootstage.h> #include <bootstage.h>
#include <cli.h> #include <cli.h>
#include <command.h> #include <command.h>
@ -1018,6 +1019,7 @@ int do_bootm_states(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[], int states, struct bootm_headers *images, char *const argv[], int states, struct bootm_headers *images,
int boot_progress) int boot_progress)
{ {
struct bootm_info bmi;
boot_os_fn *boot_fn; boot_os_fn *boot_fn;
ulong iflag = 0; ulong iflag = 0;
int ret = 0, need_boot_fn; int ret = 0, need_boot_fn;
@ -1096,12 +1098,15 @@ int do_bootm_states(struct cmd_tbl *cmdtp, int flag, int argc,
return 1; return 1;
} }
bmi.images = images;
bmi.argc = argc;
bmi.argv = argv;
/* Call various other states that are not generally used */ /* Call various other states that are not generally used */
if (!ret && (states & BOOTM_STATE_OS_CMDLINE)) if (!ret && (states & BOOTM_STATE_OS_CMDLINE))
ret = boot_fn(BOOTM_STATE_OS_CMDLINE, argc, argv, images); ret = boot_fn(BOOTM_STATE_OS_CMDLINE, &bmi);
if (!ret && (states & BOOTM_STATE_OS_BD_T)) if (!ret && (states & BOOTM_STATE_OS_BD_T))
ret = boot_fn(BOOTM_STATE_OS_BD_T, argc, argv, images); ret = boot_fn(BOOTM_STATE_OS_BD_T, &bmi);
if (!ret && (states & BOOTM_STATE_OS_PREP)) { if (!ret && (states & BOOTM_STATE_OS_PREP)) {
ret = bootm_process_cmdline_env(images->os.os == IH_OS_LINUX); ret = bootm_process_cmdline_env(images->os.os == IH_OS_LINUX);
if (ret) { if (ret) {
@ -1109,7 +1114,7 @@ int do_bootm_states(struct cmd_tbl *cmdtp, int flag, int argc,
ret = CMD_RET_FAILURE; ret = CMD_RET_FAILURE;
goto err; goto err;
} }
ret = boot_fn(BOOTM_STATE_OS_PREP, argc, argv, images); ret = boot_fn(BOOTM_STATE_OS_PREP, &bmi);
} }
#ifdef CONFIG_TRACE #ifdef CONFIG_TRACE

View file

@ -23,9 +23,9 @@
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
static int do_bootm_standalone(int flag, int argc, char *const argv[], static int do_bootm_standalone(int flag, struct bootm_info *bmi)
struct bootm_headers *images)
{ {
struct bootm_headers *images = bmi->images;
int (*appl)(int, char *const[]); int (*appl)(int, char *const[]);
if (!env_get_autostart()) { if (!env_get_autostart()) {
@ -33,7 +33,7 @@ static int do_bootm_standalone(int flag, int argc, char *const argv[],
return 0; return 0;
} }
appl = (int (*)(int, char * const []))images->ep; appl = (int (*)(int, char * const []))images->ep;
appl(argc, argv); appl(bmi->argc, bmi->argv);
return 0; return 0;
} }
@ -64,9 +64,9 @@ static void __maybe_unused fit_unsupported_reset(const char *msg)
} }
#ifdef CONFIG_BOOTM_NETBSD #ifdef CONFIG_BOOTM_NETBSD
static int do_bootm_netbsd(int flag, int argc, char *const argv[], static int do_bootm_netbsd(int flag, struct bootm_info *bmi)
struct bootm_headers *images)
{ {
struct bootm_headers *images = bmi->images;
void (*loader)(struct bd_info *bd, struct legacy_img_hdr *hdr, void (*loader)(struct bd_info *bd, struct legacy_img_hdr *hdr,
char *console, char *cmdline); char *console, char *cmdline);
struct legacy_img_hdr *os_hdr, *hdr; struct legacy_img_hdr *os_hdr, *hdr;
@ -102,14 +102,14 @@ static int do_bootm_netbsd(int flag, int argc, char *const argv[],
os_hdr = hdr; os_hdr = hdr;
} }
if (argc > 0) { if (bmi->argc > 0) {
ulong len; ulong len;
int i; int i;
for (i = 0, len = 0; i < argc; i += 1) for (i = 0, len = 0; i < bmi->argc; i += 1)
len += strlen(argv[i]) + 1; len += strlen(bmi->argv[i]) + 1;
cmdline = malloc(len); cmdline = malloc(len);
copy_args(cmdline, argc, argv, ' '); copy_args(cmdline, bmi->argc, bmi->argv, ' ');
} else { } else {
cmdline = env_get("bootargs"); cmdline = env_get("bootargs");
if (cmdline == NULL) if (cmdline == NULL)
@ -137,9 +137,9 @@ static int do_bootm_netbsd(int flag, int argc, char *const argv[],
#endif /* CONFIG_BOOTM_NETBSD*/ #endif /* CONFIG_BOOTM_NETBSD*/
#ifdef CONFIG_BOOTM_RTEMS #ifdef CONFIG_BOOTM_RTEMS
static int do_bootm_rtems(int flag, int argc, char *const argv[], static int do_bootm_rtems(int flag, struct bootm_info *bmi)
struct bootm_headers *images)
{ {
struct bootm_headers *images = bmi->images;
void (*entry_point)(struct bd_info *); void (*entry_point)(struct bd_info *);
if (flag != BOOTM_STATE_OS_GO) if (flag != BOOTM_STATE_OS_GO)
@ -170,9 +170,9 @@ static int do_bootm_rtems(int flag, int argc, char *const argv[],
#endif /* CONFIG_BOOTM_RTEMS */ #endif /* CONFIG_BOOTM_RTEMS */
#if defined(CONFIG_BOOTM_OSE) #if defined(CONFIG_BOOTM_OSE)
static int do_bootm_ose(int flag, int argc, char *const argv[], static int do_bootm_ose(int flag, struct bootm_info *bmi)
struct bootm_headers *images)
{ {
struct bootm_headers *images = bmi->images;
void (*entry_point)(void); void (*entry_point)(void);
if (flag != BOOTM_STATE_OS_GO) if (flag != BOOTM_STATE_OS_GO)
@ -203,9 +203,9 @@ static int do_bootm_ose(int flag, int argc, char *const argv[],
#endif /* CONFIG_BOOTM_OSE */ #endif /* CONFIG_BOOTM_OSE */
#if defined(CONFIG_BOOTM_PLAN9) #if defined(CONFIG_BOOTM_PLAN9)
static int do_bootm_plan9(int flag, int argc, char *const argv[], static int do_bootm_plan9(int flag, struct bootm_info *bmi)
struct bootm_headers *images)
{ {
struct bootm_headers *images = bmi->images;
void (*entry_point)(void); void (*entry_point)(void);
char *s; char *s;
@ -224,8 +224,8 @@ static int do_bootm_plan9(int flag, int argc, char *const argv[],
if (s != NULL) { if (s != NULL) {
char *confaddr = (char *)hextoul(s, NULL); char *confaddr = (char *)hextoul(s, NULL);
if (argc > 0) { if (bmi->argc) {
copy_args(confaddr, argc, argv, '\n'); copy_args(confaddr, bmi->argc, bmi->argv, '\n');
} else { } else {
s = env_get("bootargs"); s = env_get("bootargs");
if (s != NULL) if (s != NULL)
@ -311,9 +311,10 @@ static void do_bootvx_fdt(struct bootm_headers *images)
puts("## vxWorks terminated\n"); puts("## vxWorks terminated\n");
} }
static int do_bootm_vxworks_legacy(int flag, int argc, char *const argv[], static int do_bootm_vxworks_legacy(int flag, struct bootm_info *bmi)
struct bootm_headers *images)
{ {
struct bootm_headers *images = bmi->images;
if (flag != BOOTM_STATE_OS_GO) if (flag != BOOTM_STATE_OS_GO)
return 0; return 0;
@ -322,8 +323,7 @@ static int do_bootm_vxworks_legacy(int flag, int argc, char *const argv[],
return 1; return 1;
} }
int do_bootm_vxworks(int flag, int argc, char *const argv[], int do_bootm_vxworks(int flag, struct bootm_info *bmi)
struct bootm_headers *images)
{ {
char *bootargs; char *bootargs;
int pos; int pos;
@ -348,19 +348,19 @@ int do_bootm_vxworks(int flag, int argc, char *const argv[],
if (std_dtb) { if (std_dtb) {
if (flag & BOOTM_STATE_OS_PREP) if (flag & BOOTM_STATE_OS_PREP)
printf(" Using standard DTB\n"); printf(" Using standard DTB\n");
return do_bootm_linux(flag, argc, argv, images); return do_bootm_linux(flag, bmi);
} else { } else {
if (flag & BOOTM_STATE_OS_PREP) if (flag & BOOTM_STATE_OS_PREP)
printf(" !!! WARNING !!! Using legacy DTB\n"); printf(" !!! WARNING !!! Using legacy DTB\n");
return do_bootm_vxworks_legacy(flag, argc, argv, images); return do_bootm_vxworks_legacy(flag, bmi);
} }
} }
#endif #endif
#if defined(CONFIG_CMD_ELF) #if defined(CONFIG_CMD_ELF)
static int do_bootm_qnxelf(int flag, int argc, char *const argv[], static int do_bootm_qnxelf(int flag, struct bootm_info *bmi)
struct bootm_headers *images)
{ {
struct bootm_headers *images = bmi->images;
char *local_args[2]; char *local_args[2];
char str[16]; char str[16];
int dcache; int dcache;
@ -376,7 +376,7 @@ static int do_bootm_qnxelf(int flag, int argc, char *const argv[],
#endif #endif
sprintf(str, "%lx", images->ep); /* write entry-point into string */ sprintf(str, "%lx", images->ep); /* write entry-point into string */
local_args[0] = argv[0]; local_args[0] = bmi->argv[0];
local_args[1] = str; /* and provide it via the arguments */ local_args[1] = str; /* and provide it via the arguments */
/* /*
@ -396,9 +396,9 @@ static int do_bootm_qnxelf(int flag, int argc, char *const argv[],
#endif #endif
#ifdef CONFIG_INTEGRITY #ifdef CONFIG_INTEGRITY
static int do_bootm_integrity(int flag, int argc, char *const argv[], static int do_bootm_integrity(int flag, struct bootm_info *bmi)
struct bootm_headers *images)
{ {
struct bootm_headers *images = bmi->images;
void (*entry_point)(void); void (*entry_point)(void);
if (flag != BOOTM_STATE_OS_GO) if (flag != BOOTM_STATE_OS_GO)
@ -429,9 +429,9 @@ static int do_bootm_integrity(int flag, int argc, char *const argv[],
#endif #endif
#ifdef CONFIG_BOOTM_OPENRTOS #ifdef CONFIG_BOOTM_OPENRTOS
static int do_bootm_openrtos(int flag, int argc, char *const argv[], static int do_bootm_openrtos(int flag, struct bootm_info *bmi)
struct bootm_headers *images)
{ {
struct bootm_headers *images = bmi->images;
void (*entry_point)(void); void (*entry_point)(void);
if (flag != BOOTM_STATE_OS_GO) if (flag != BOOTM_STATE_OS_GO)
@ -455,9 +455,9 @@ static int do_bootm_openrtos(int flag, int argc, char *const argv[],
#endif #endif
#ifdef CONFIG_BOOTM_OPTEE #ifdef CONFIG_BOOTM_OPTEE
static int do_bootm_tee(int flag, int argc, char *const argv[], static int do_bootm_tee(int flag, struct bootm_info *bmi)
struct bootm_headers *images)
{ {
struct bootm_headers *images = bmi->images;
int ret; int ret;
/* Validate OPTEE header */ /* Validate OPTEE header */
@ -468,14 +468,14 @@ static int do_bootm_tee(int flag, int argc, char *const argv[],
return ret; return ret;
/* From here we can run the regular linux boot path */ /* From here we can run the regular linux boot path */
return do_bootm_linux(flag, argc, argv, images); return do_bootm_linux(flag, bmi);
} }
#endif #endif
#ifdef CONFIG_BOOTM_EFI #ifdef CONFIG_BOOTM_EFI
static int do_bootm_efi(int flag, int argc, char *const argv[], static int do_bootm_efi(int flag, struct bootm_info *bmi)
struct bootm_headers *images)
{ {
struct bootm_headers *images = bmi->images;
efi_status_t efi_ret; efi_status_t efi_ret;
void *image_buf; void *image_buf;
@ -569,9 +569,14 @@ __weak void board_preboot_os(void)
int boot_selected_os(int argc, char *const argv[], int state, int boot_selected_os(int argc, char *const argv[], int state,
struct bootm_headers *images, boot_os_fn *boot_fn) struct bootm_headers *images, boot_os_fn *boot_fn)
{ {
struct bootm_info bmi;
arch_preboot_os(); arch_preboot_os();
board_preboot_os(); board_preboot_os();
boot_fn(state, argc, argv, images);
bmi.argc = argc;
bmi.argv = argv;
bmi.images = images;
boot_fn(state, &bmi);
/* Stand-alone may return when 'autostart' is 'no' */ /* Stand-alone may return when 'autostart' is 'no' */
if (images->os.type == IH_TYPE_STANDALONE || if (images->os.type == IH_TYPE_STANDALONE ||

View file

@ -39,16 +39,11 @@ struct bootm_info {
* - disabled interrupts. * - disabled interrupts.
* *
* @flag: Flags indicating what to do (BOOTM_STATE_...) * @flag: Flags indicating what to do (BOOTM_STATE_...)
* @argc: Number of arguments. Note that the arguments are shifted down * bmi: Bootm information
* so that 0 is the first argument not processed by U-Boot, and
* argc is adjusted accordingly. This avoids confusion as to how
* many arguments are available for the OS.
* @images: Pointers to os/initrd/fdt
* Return: 1 on error. On success the OS boots so this function does * Return: 1 on error. On success the OS boots so this function does
* not return. * not return.
*/ */
typedef int boot_os_fn(int flag, int argc, char *const argv[], typedef int boot_os_fn(int flag, struct bootm_info *bmi);
struct bootm_headers *images);
extern boot_os_fn do_bootm_linux; extern boot_os_fn do_bootm_linux;
extern boot_os_fn do_bootm_vxworks; extern boot_os_fn do_bootm_vxworks;