* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
*/
+#include <bootm.h>
#include <bootstage.h>
#include <env.h>
#include <image.h>
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 */
if ((flag & BOOTM_STATE_OS_BD_T) || (flag & BOOTM_STATE_OS_CMDLINE))
return -1;
*/
#include <common.h>
+#include <bootm.h>
#include <bootstage.h>
#include <command.h>
#include <cpu_func.h>
* DIFFERENCE: Instead of calling prep and go at the end
* they are called if subcommand is equal 0.
*/
-int do_bootm_linux(int flag, int argc, char *const 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 ARM */
if (flag & BOOTM_STATE_OS_BD_T || flag & BOOTM_STATE_OS_CMDLINE)
return -1;
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*/
+#include <bootm.h>
#include <bootstage.h>
#include <command.h>
#include <env.h>
arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 1024);
}
-int do_bootm_linux(int flag, int argc, char *const argv[],
- struct bootm_headers *images)
+int do_bootm_linux(int flag, struct bootm_info *bmi)
{
+ struct bootm_headers *images = bmi->images;
int ret;
struct bd_info *kbd;
void (*kernel) (struct bd_info *, ulong, ulong, ulong, ulong);
* Yasushi SHOJI <yashi@atmark-techno.com>
*/
+#include <bootm.h>
#include <bootstage.h>
#include <command.h>
#include <cpu_func.h>
}
}
-int do_bootm_linux(int flag, int argc, char *const argv[],
- struct bootm_headers *images)
+int do_bootm_linux(int flag, struct bootm_info *bmi)
{
+ struct bootm_headers *images = bmi->images;
+
images->cmdline_start = (ulong)env_get("bootargs");
/* cmdline init is the part of 'prep' and nothing to do for 'bdt' */
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*/
+#include <bootm.h>
#include <bootstage.h>
#include <env.h>
#include <image.h>
linux_extra);
}
-int do_bootm_linux(int flag, int argc, char *const 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 MIPS */
if (flag & BOOTM_STATE_OS_BD_T)
return -1;
*/
#include <common.h>
+#include <bootm.h>
#include <cpu_func.h>
#include <env.h>
#include <image.h>
#define NIOS_MAGIC 0x534f494e /* enable command line and initrd passing */
-int do_bootm_linux(int flag, int argc, char *const argv[],
- struct bootm_headers *images)
+int do_bootm_linux(int flag, struct bootm_info *bmi)
{
+ struct bootm_headers *images = bmi->images;
void (*kernel)(int, int, int, char *) = (void *)images->ep;
char *commandline = env_get("bootargs");
ulong initrd_start = images->rd_start;
if (images->ft_len)
of_flat_tree = images->ft_addr;
#endif
- if (!of_flat_tree && argc > 1)
- of_flat_tree = (char *)hextoul(argv[1], NULL);
+ /* TODO: Clean this up - the DT should already be set up */
+ if (!of_flat_tree && bmi->argc > 1)
+ of_flat_tree = (char *)hextoul(bmi->argv[1], NULL);
if (of_flat_tree)
initrd_end = (ulong)of_flat_tree;
#include <common.h>
+#include <bootm.h>
#include <bootstage.h>
#include <cpu_func.h>
#include <env.h>
return 0;
}
-noinline int do_bootm_linux(int flag, int argc, char *const argv[],
- struct bootm_headers *images)
+int do_bootm_linux(int flag, struct bootm_info *bmi)
{
+ struct bootm_headers *images = bmi->images;
int ret;
if (flag & BOOTM_STATE_OS_CMDLINE) {
*/
#include <bootstage.h>
+#include <bootm.h>
#include <command.h>
#include <dm.h>
#include <fdt_support.h>
}
}
-int do_bootm_linux(int flag, int argc, char *const 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 RISC-V */
if (flag & BOOTM_STATE_OS_BD_T || flag & BOOTM_STATE_OS_CMDLINE)
return -1;
return 0;
}
-int do_bootm_vxworks(int flag, int argc, char *const argv[],
- struct bootm_headers *images)
+int do_bootm_vxworks(int flag, struct bootm_info *bmi)
{
- return do_bootm_linux(flag, argc, argv, images);
+ return do_bootm_linux(flag, bmi);
}
static ulong get_sp(void)
*/
#include <common.h>
+#include <bootm.h>
#include <bootstage.h>
#include <image.h>
#include <asm/io.h>
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)
return boot_prep_linux(images);
*/
#include <common.h>
+#include <bootm.h>
#include <command.h>
#include <env.h>
#include <image.h>
return val;
}
-int do_bootm_linux(int flag, int argc, char *const argv[],
- struct bootm_headers *images)
+int do_bootm_linux(int flag, struct bootm_info *bmi)
{
+ struct bootm_headers *images = bmi->images;
+
/* Linux kernel load address */
void (*kernel) (void) = (void (*)(void))images->ep;
/* empty_zero_page */
*/
#include <common.h>
+#include <bootm.h>
#include <bootstage.h>
#include <command.h>
#include <efi.h>
images->os.arch == IH_ARCH_X86_64);
}
-int do_bootm_linux(int flag, int argc, char *const 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 x86 */
if (flag & BOOTM_STATE_OS_BD_T || flag & BOOTM_STATE_OS_CMDLINE)
return -1;
*/
#include <common.h>
+#include <bootm.h>
#include <bootstage.h>
#include <command.h>
#include <cpu_func.h>
* 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;
ulong initrd_start, initrd_end;
char *commandline = env_get("bootargs");
#ifndef USE_HOSTCC
#include <common.h>
+#include <bootm.h>
#include <bootstage.h>
#include <cli.h>
#include <command.h>
char *const argv[], int states, struct bootm_headers *images,
int boot_progress)
{
+ struct bootm_info bmi;
boot_os_fn *boot_fn;
ulong iflag = 0;
int ret = 0, need_boot_fn;
return 1;
}
+ bmi.images = images;
+ bmi.argc = argc;
+ bmi.argv = argv;
/* Call various other states that are not generally used */
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))
- 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)) {
ret = bootm_process_cmdline_env(images->os.os == IH_OS_LINUX);
if (ret) {
ret = CMD_RET_FAILURE;
goto err;
}
- ret = boot_fn(BOOTM_STATE_OS_PREP, argc, argv, images);
+ ret = boot_fn(BOOTM_STATE_OS_PREP, &bmi);
}
#ifdef CONFIG_TRACE
DECLARE_GLOBAL_DATA_PTR;
-static int do_bootm_standalone(int flag, int argc, char *const argv[],
- struct bootm_headers *images)
+static int do_bootm_standalone(int flag, struct bootm_info *bmi)
{
+ struct bootm_headers *images = bmi->images;
int (*appl)(int, char *const[]);
if (!env_get_autostart()) {
return 0;
}
appl = (int (*)(int, char * const []))images->ep;
- appl(argc, argv);
+ appl(bmi->argc, bmi->argv);
return 0;
}
}
#ifdef CONFIG_BOOTM_NETBSD
-static int do_bootm_netbsd(int flag, int argc, char *const argv[],
- struct bootm_headers *images)
+static int do_bootm_netbsd(int flag, struct bootm_info *bmi)
{
+ struct bootm_headers *images = bmi->images;
void (*loader)(struct bd_info *bd, struct legacy_img_hdr *hdr,
char *console, char *cmdline);
struct legacy_img_hdr *os_hdr, *hdr;
os_hdr = hdr;
}
- if (argc > 0) {
+ if (bmi->argc > 0) {
ulong len;
int i;
- for (i = 0, len = 0; i < argc; i += 1)
- len += strlen(argv[i]) + 1;
+ for (i = 0, len = 0; i < bmi->argc; i += 1)
+ len += strlen(bmi->argv[i]) + 1;
cmdline = malloc(len);
- copy_args(cmdline, argc, argv, ' ');
+ copy_args(cmdline, bmi->argc, bmi->argv, ' ');
} else {
cmdline = env_get("bootargs");
if (cmdline == NULL)
#endif /* CONFIG_BOOTM_NETBSD*/
#ifdef CONFIG_BOOTM_RTEMS
-static int do_bootm_rtems(int flag, int argc, char *const argv[],
- struct bootm_headers *images)
+static int do_bootm_rtems(int flag, struct bootm_info *bmi)
{
+ struct bootm_headers *images = bmi->images;
void (*entry_point)(struct bd_info *);
if (flag != BOOTM_STATE_OS_GO)
#endif /* CONFIG_BOOTM_RTEMS */
#if defined(CONFIG_BOOTM_OSE)
-static int do_bootm_ose(int flag, int argc, char *const argv[],
- struct bootm_headers *images)
+static int do_bootm_ose(int flag, struct bootm_info *bmi)
{
+ struct bootm_headers *images = bmi->images;
void (*entry_point)(void);
if (flag != BOOTM_STATE_OS_GO)
#endif /* CONFIG_BOOTM_OSE */
#if defined(CONFIG_BOOTM_PLAN9)
-static int do_bootm_plan9(int flag, int argc, char *const argv[],
- struct bootm_headers *images)
+static int do_bootm_plan9(int flag, struct bootm_info *bmi)
{
+ struct bootm_headers *images = bmi->images;
void (*entry_point)(void);
char *s;
if (s != NULL) {
char *confaddr = (char *)hextoul(s, NULL);
- if (argc > 0) {
- copy_args(confaddr, argc, argv, '\n');
+ if (bmi->argc) {
+ copy_args(confaddr, bmi->argc, bmi->argv, '\n');
} else {
s = env_get("bootargs");
if (s != NULL)
puts("## vxWorks terminated\n");
}
-static int do_bootm_vxworks_legacy(int flag, int argc, char *const argv[],
- struct bootm_headers *images)
+static int do_bootm_vxworks_legacy(int flag, struct bootm_info *bmi)
{
+ struct bootm_headers *images = bmi->images;
+
if (flag != BOOTM_STATE_OS_GO)
return 0;
return 1;
}
-int do_bootm_vxworks(int flag, int argc, char *const argv[],
- struct bootm_headers *images)
+int do_bootm_vxworks(int flag, struct bootm_info *bmi)
{
char *bootargs;
int pos;
if (std_dtb) {
if (flag & BOOTM_STATE_OS_PREP)
printf(" Using standard DTB\n");
- return do_bootm_linux(flag, argc, argv, images);
+ return do_bootm_linux(flag, bmi);
} else {
if (flag & BOOTM_STATE_OS_PREP)
printf(" !!! WARNING !!! Using legacy DTB\n");
- return do_bootm_vxworks_legacy(flag, argc, argv, images);
+ return do_bootm_vxworks_legacy(flag, bmi);
}
}
#endif
#if defined(CONFIG_CMD_ELF)
-static int do_bootm_qnxelf(int flag, int argc, char *const argv[],
- struct bootm_headers *images)
+static int do_bootm_qnxelf(int flag, struct bootm_info *bmi)
{
+ struct bootm_headers *images = bmi->images;
char *local_args[2];
char str[16];
int dcache;
#endif
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 */
/*
#endif
#ifdef CONFIG_INTEGRITY
-static int do_bootm_integrity(int flag, int argc, char *const argv[],
- struct bootm_headers *images)
+static int do_bootm_integrity(int flag, struct bootm_info *bmi)
{
+ struct bootm_headers *images = bmi->images;
void (*entry_point)(void);
if (flag != BOOTM_STATE_OS_GO)
#endif
#ifdef CONFIG_BOOTM_OPENRTOS
-static int do_bootm_openrtos(int flag, int argc, char *const argv[],
- struct bootm_headers *images)
+static int do_bootm_openrtos(int flag, struct bootm_info *bmi)
{
+ struct bootm_headers *images = bmi->images;
void (*entry_point)(void);
if (flag != BOOTM_STATE_OS_GO)
#endif
#ifdef CONFIG_BOOTM_OPTEE
-static int do_bootm_tee(int flag, int argc, char *const argv[],
- struct bootm_headers *images)
+static int do_bootm_tee(int flag, struct bootm_info *bmi)
{
+ struct bootm_headers *images = bmi->images;
int ret;
/* Validate OPTEE header */
return ret;
/* 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
#ifdef CONFIG_BOOTM_EFI
-static int do_bootm_efi(int flag, int argc, char *const argv[],
- struct bootm_headers *images)
+static int do_bootm_efi(int flag, struct bootm_info *bmi)
{
+ struct bootm_headers *images = bmi->images;
efi_status_t efi_ret;
void *image_buf;
int boot_selected_os(int argc, char *const argv[], int state,
struct bootm_headers *images, boot_os_fn *boot_fn)
{
+ struct bootm_info bmi;
arch_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' */
if (images->os.type == IH_TYPE_STANDALONE ||
* - disabled interrupts.
*
* @flag: Flags indicating what to do (BOOTM_STATE_...)
- * @argc: Number of arguments. Note that the arguments are shifted down
- * 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
+ * bmi: Bootm information
* Return: 1 on error. On success the OS boots so this function does
* not return.
*/
-typedef int boot_os_fn(int flag, int argc, char *const argv[],
- struct bootm_headers *images);
+typedef int boot_os_fn(int flag, struct bootm_info *bmi);
extern boot_os_fn do_bootm_linux;
extern boot_os_fn do_bootm_vxworks;