diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arc/lib/bootm.c | 5 | ||||
-rw-r--r-- | arch/arm/lib/bootm.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c | 33 | ||||
-rw-r--r-- | arch/m68k/lib/bootm.c | 5 | ||||
-rw-r--r-- | arch/m68k/lib/traps.c | 7 | ||||
-rw-r--r-- | arch/microblaze/lib/bootm.c | 6 | ||||
-rw-r--r-- | arch/mips/cpu/cpu.c | 8 | ||||
-rw-r--r-- | arch/mips/lib/bootm.c | 8 | ||||
-rw-r--r-- | arch/nios2/cpu/cpu.c | 8 | ||||
-rw-r--r-- | arch/nios2/lib/bootm.c | 10 | ||||
-rw-r--r-- | arch/powerpc/lib/bootm.c | 5 | ||||
-rw-r--r-- | arch/powerpc/lib/traps.c | 10 | ||||
-rw-r--r-- | arch/riscv/cpu/cpu.c | 13 | ||||
-rw-r--r-- | arch/riscv/lib/bootm.c | 11 | ||||
-rw-r--r-- | arch/riscv/lib/reset.c | 7 | ||||
-rw-r--r-- | arch/sandbox/cpu/cpu.c | 8 | ||||
-rw-r--r-- | arch/sandbox/lib/bootm.c | 5 | ||||
-rw-r--r-- | arch/sh/lib/bootm.c | 6 | ||||
-rw-r--r-- | arch/x86/lib/bootm.c | 6 | ||||
-rw-r--r-- | arch/xtensa/lib/bootm.c | 4 |
20 files changed, 124 insertions, 47 deletions
diff --git a/arch/arc/lib/bootm.c b/arch/arc/lib/bootm.c index 44ec586..b143392 100644 --- a/arch/arc/lib/bootm.c +++ b/arch/arc/lib/bootm.c @@ -3,6 +3,7 @@ * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved. */ +#include <bootm.h> #include <bootstage.h> #include <env.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); } -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; diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index c562857..f30a483 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -12,6 +12,7 @@ */ #include <common.h> +#include <bootm.h> #include <bootstage.h> #include <command.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 * 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; diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c index 2411bcf..adee6e0 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c @@ -4,6 +4,7 @@ */ #include <common.h> +#include <bootm.h> #include <command.h> #include <dfu.h> #include <image.h> @@ -124,35 +125,41 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc, char boot_addr_start[20]; char dtb_addr[20]; char initrd_addr[40]; - char *bootm_argv[5] = { - "bootm", boot_addr_start, "-", dtb_addr, NULL - }; + char *fdt_arg, *initrd_arg; const void *uimage = (void *)data->uimage; const void *dtb = (void *)data->dtb; const void *initrd = (void *)data->initrd; + struct bootm_info bmi; + fdt_arg = dtb_addr; if (!dtb) - bootm_argv[3] = env_get("fdtcontroladdr"); + fdt_arg = env_get("fdtcontroladdr"); else - snprintf(dtb_addr, sizeof(dtb_addr) - 1, - "0x%p", dtb); + snprintf(dtb_addr, sizeof(dtb_addr) - 1, "0x%p", dtb); snprintf(boot_addr_start, sizeof(boot_addr_start) - 1, "0x%p", uimage); + initrd_arg = NULL; if (initrd) { - snprintf(initrd_addr, sizeof(initrd_addr) - 1, "0x%p:0x%zx", - initrd, data->initrd_size); - bootm_argv[2] = initrd_addr; + snprintf(initrd_addr, sizeof(initrd_addr) - 1, + "0x%p:0x%zx", initrd, data->initrd_size); + initrd_arg = initrd_addr; } - printf("Booting kernel at %s %s %s...\n\n\n", - boot_addr_start, bootm_argv[2], bootm_argv[3]); + printf("Booting kernel at %s %s %s...\n\n\n", boot_addr_start, + initrd_arg ?: "-", fdt_arg); + + bootm_init(&bmi); + bmi.addr_img = boot_addr_start; + bmi.conf_ramdisk = initrd_arg; + bmi.conf_fdt = fdt_arg; + /* Try bootm for legacy and FIT format image */ if (genimg_get_format(uimage) != IMAGE_FORMAT_INVALID) - do_bootm(cmdtp, 0, 4, bootm_argv); + bootm_run(&bmi); else if (IS_ENABLED(CONFIG_CMD_BOOTZ)) - do_bootz(cmdtp, 0, 4, bootm_argv); + bootz_run(&bmi); } if (data->script) cmd_source_script(data->script, NULL, NULL); diff --git a/arch/m68k/lib/bootm.c b/arch/m68k/lib/bootm.c index 79d8b34..f2d02e4 100644 --- a/arch/m68k/lib/bootm.c +++ b/arch/m68k/lib/bootm.c @@ -4,6 +4,7 @@ * Wolfgang Denk, DENX Software Engineering, wd@denx.de. */ +#include <bootm.h> #include <bootstage.h> #include <command.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); } -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); diff --git a/arch/m68k/lib/traps.c b/arch/m68k/lib/traps.c index 2a025c5..e09f36f 100644 --- a/arch/m68k/lib/traps.c +++ b/arch/m68k/lib/traps.c @@ -8,6 +8,7 @@ */ #include <config.h> +#include <cpu_func.h> #include <init.h> #include <watchdog.h> #include <command.h> @@ -66,3 +67,9 @@ int arch_initr_trap(void) return 0; } + +void reset_cpu(void) +{ + /* TODO: Refactor all the do_reset calls to be reset_cpu() instead */ + do_reset(NULL, 0, 0, NULL); +} diff --git a/arch/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c index f3ec4b7..cbe9d85 100644 --- a/arch/microblaze/lib/bootm.c +++ b/arch/microblaze/lib/bootm.c @@ -7,6 +7,7 @@ * Yasushi SHOJI <yashi@atmark-techno.com> */ +#include <bootm.h> #include <bootstage.h> #include <command.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[], - 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' */ diff --git a/arch/mips/cpu/cpu.c b/arch/mips/cpu/cpu.c index acfc9dc..4434650 100644 --- a/arch/mips/cpu/cpu.c +++ b/arch/mips/cpu/cpu.c @@ -4,6 +4,7 @@ * Wolfgang Denk, DENX Software Engineering, <wd@denx.de> */ +#include <cpu_func.h> #include <command.h> #include <init.h> #include <linux/compiler.h> @@ -20,9 +21,14 @@ void __weak _machine_restart(void) /* NOP */; } -int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) +void reset_cpu(void) { _machine_restart(); +} + +int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) +{ + reset_cpu(); return 0; } diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index f1cff69..adb6b6c 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -4,6 +4,7 @@ * Wolfgang Denk, DENX Software Engineering, wd@denx.de. */ +#include <bootm.h> #include <bootstage.h> #include <env.h> #include <image.h> @@ -216,7 +217,7 @@ static int boot_reloc_fdt(struct bootm_headers *images) { /* * In case of legacy uImage's, relocation of FDT is already done - * by do_bootm_states() and should not repeated in 'bootm prep'. + * by bootm_run_states() and should not repeated in 'bootm prep'. */ if (images->state & BOOTM_STATE_FDT) { debug("## FDT already relocated\n"); @@ -300,9 +301,10 @@ static void boot_jump_linux(struct bootm_headers *images) 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; diff --git a/arch/nios2/cpu/cpu.c b/arch/nios2/cpu/cpu.c index 79a54d1..de7bfa9 100644 --- a/arch/nios2/cpu/cpu.c +++ b/arch/nios2/cpu/cpu.c @@ -35,11 +35,17 @@ int checkboard(void) } #endif -int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) +void reset_cpu(void) { disable_interrupts(); /* indirect call to go beyond 256MB limitation of toolchain */ nios2_callr(gd->arch.reset_addr); +} + +int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) +{ + reset_cpu(); + return 0; } diff --git a/arch/nios2/lib/bootm.c b/arch/nios2/lib/bootm.c index 06c094d..657a17c 100644 --- a/arch/nios2/lib/bootm.c +++ b/arch/nios2/lib/bootm.c @@ -5,6 +5,7 @@ */ #include <common.h> +#include <bootm.h> #include <cpu_func.h> #include <env.h> #include <image.h> @@ -16,9 +17,9 @@ DECLARE_GLOBAL_DATA_PTR; #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; @@ -29,8 +30,9 @@ int do_bootm_linux(int flag, int argc, char *const argv[], 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; diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c index 910121e..75c6bfd 100644 --- a/arch/powerpc/lib/bootm.c +++ b/arch/powerpc/lib/bootm.c @@ -8,6 +8,7 @@ #include <common.h> +#include <bootm.h> #include <bootstage.h> #include <cpu_func.h> #include <env.h> @@ -223,9 +224,9 @@ static int boot_body_linux(struct bootm_headers *images) 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) { diff --git a/arch/powerpc/lib/traps.c b/arch/powerpc/lib/traps.c index c7bce82..cf8da2e 100644 --- a/arch/powerpc/lib/traps.c +++ b/arch/powerpc/lib/traps.c @@ -4,6 +4,8 @@ * Wolfgang Denk, DENX Software Engineering, wd@denx.de. */ +#include <command.h> +#include <cpu_func.h> #include <init.h> #include <asm/global_data.h> @@ -17,3 +19,11 @@ int arch_initr_trap(void) return 0; } + +#ifndef CONFIG_SYSRESET +void reset_cpu(void) +{ + /* TODO: Refactor all the do_reset calls to be reset_cpu() instead */ + do_reset(NULL, 0, 0, NULL); +} +#endif diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c index ebd39cb..8445c58 100644 --- a/arch/riscv/cpu/cpu.c +++ b/arch/riscv/cpu/cpu.c @@ -3,10 +3,13 @@ * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com> */ +#include <command.h> #include <cpu.h> +#include <cpu_func.h> #include <dm.h> #include <dm/lists.h> #include <event.h> +#include <hang.h> #include <init.h> #include <log.h> #include <asm/encoding.h> @@ -162,3 +165,13 @@ int arch_early_init_r(void) __weak void harts_early_init(void) { } + +#if !CONFIG_IS_ENABLED(SYSRESET) +void reset_cpu(void) +{ + printf("resetting ...\n"); + + printf("reset not supported yet\n"); + hang(); +} +#endif diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c index f9e1e18..13cbaab 100644 --- a/arch/riscv/lib/bootm.c +++ b/arch/riscv/lib/bootm.c @@ -7,6 +7,7 @@ */ #include <bootstage.h> +#include <bootm.h> #include <command.h> #include <dm.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[], - 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; @@ -127,10 +129,9 @@ int do_bootm_linux(int flag, int argc, char *const argv[], 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) diff --git a/arch/riscv/lib/reset.c b/arch/riscv/lib/reset.c index 712e1bd..c4153c9 100644 --- a/arch/riscv/lib/reset.c +++ b/arch/riscv/lib/reset.c @@ -4,14 +4,11 @@ */ #include <command.h> -#include <hang.h> +#include <cpu_func.h> int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { - printf("resetting ...\n"); - - printf("reset not supported yet\n"); - hang(); + reset_cpu(); return 0; } diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c index d6475c9..0ed85b3 100644 --- a/arch/sandbox/cpu/cpu.c +++ b/arch/sandbox/cpu/cpu.c @@ -285,6 +285,14 @@ void sandbox_set_enable_pci_map(int enable) enable_pci_map = enable; } +void dcache_enable(void) +{ +} + +void dcache_disable(void) +{ +} + int dcache_status(void) { return 1; diff --git a/arch/sandbox/lib/bootm.c b/arch/sandbox/lib/bootm.c index 290db45..8dbcd9f 100644 --- a/arch/sandbox/lib/bootm.c +++ b/arch/sandbox/lib/bootm.c @@ -4,6 +4,7 @@ * Copyright (c) 2015 Sjoerd Simons <sjoerd.simons@collabora.co.uk> */ +#include <bootm.h> #include <bootstage.h> #include <image.h> #include <asm/io.h> @@ -63,8 +64,10 @@ static int boot_prep_linux(struct bootm_headers *images) 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); diff --git a/arch/sh/lib/bootm.c b/arch/sh/lib/bootm.c index b205e5e..05d586b 100644 --- a/arch/sh/lib/bootm.c +++ b/arch/sh/lib/bootm.c @@ -8,6 +8,7 @@ */ #include <common.h> +#include <bootm.h> #include <command.h> #include <env.h> #include <image.h> @@ -39,9 +40,10 @@ static unsigned long sh_check_cmd_arg(char *cmdline, char *key, int base) 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 */ diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c index 3196f9d..050c420 100644 --- a/arch/x86/lib/bootm.c +++ b/arch/x86/lib/bootm.c @@ -8,6 +8,7 @@ */ #include <common.h> +#include <bootm.h> #include <bootstage.h> #include <command.h> #include <efi.h> @@ -237,9 +238,10 @@ static int boot_jump_linux(struct bootm_headers *images) 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; diff --git a/arch/xtensa/lib/bootm.c b/arch/xtensa/lib/bootm.c index fee3392..9780d46 100644 --- a/arch/xtensa/lib/bootm.c +++ b/arch/xtensa/lib/bootm.c @@ -5,6 +5,7 @@ */ #include <common.h> +#include <bootm.h> #include <bootstage.h> #include <command.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. */ -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"); |