diff options
author | Tom Rini <trini@konsulko.com> | 2022-07-11 10:18:13 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-07-11 14:58:57 -0400 |
commit | 36b661dc919da318c163a45f4a220d2e3d9db608 (patch) | |
tree | 268703050f58280feb3287d48eb0cedc974730e1 /cmd | |
parent | e092e3250270a1016c877da7bdd9384f14b1321e (diff) | |
parent | 05a4859637567b13219efd6f1707fb236648b1b7 (diff) | |
download | u-boot-36b661dc919da318c163a45f4a220d2e3d9db608.zip u-boot-36b661dc919da318c163a45f4a220d2e3d9db608.tar.gz u-boot-36b661dc919da318c163a45f4a220d2e3d9db608.tar.bz2 |
Merge branch 'next'
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/Kconfig | 46 | ||||
-rw-r--r-- | cmd/bootefi.c | 12 | ||||
-rw-r--r-- | cmd/cpu.c | 39 | ||||
-rw-r--r-- | cmd/dm.c | 110 | ||||
-rw-r--r-- | cmd/load.c | 48 | ||||
-rw-r--r-- | cmd/misc.c | 6 | ||||
-rw-r--r-- | cmd/qfw.c | 10 |
7 files changed, 169 insertions, 102 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig index 09193b6..d5f8421 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -71,6 +71,23 @@ config SYS_PROMPT_HUSH_PS2 printed when the command interpreter needs more input to complete a command. Usually "> ". +config SYS_MAXARGS + int "Maximum number arguments accepted by commands" + default 16 + +config SYS_CBSIZE + int "Console input buffer size" + default 2048 if ARCH_TEGRA || ARCH_VERSAL || ARCH_ZYNQ || ARCH_ZYNQMP || \ + RCAR_GEN3 || TARGET_SOCFPGA_SOC64 + default 512 if ARCH_MX5 || ARCH_MX6 || ARCH_MX7 || FSL_LSCH2 || \ + FSL_LSCH3 || X86 + default 256 if M68K || PPC + default 1024 + +config SYS_PBSIZE + int "Buffer size for console output" + default 1044 + config SYS_XTRACE bool "Command execution tracer" depends on CMDLINE @@ -318,6 +335,16 @@ config BOOTM_VXWORKS help Support booting VxWorks images via the bootm command. +config SYS_BOOTM_LEN + hex "Maximum size of a decompresed OS image" + depends on CMD_BOOTM || CMD_BOOTI || CMD_BOOTZ + default 0x4000000 if PPC || ARM64 + default 0x1000000 if X86 || ARCH_MX6 || ARCH_MX7 + default 0x800000 + help + This is the maximum size of the buffer that is used to decompress the OS + image in to, if passing a compressed image to bootm/booti/bootz. + config CMD_BOOTEFI bool "bootefi" depends on EFI_LOADER @@ -1143,6 +1170,11 @@ config CMD_LOADB help Load a binary file over serial line. +config CMD_LOADM + bool "loadm" + help + Load a binary over memory mapped. + config CMD_LOADS bool "loads" default y @@ -1276,6 +1308,10 @@ config CMD_ONENAND and erasing blocks. It allso provides a way to show and change bad blocks, and test the device. +config USE_ONENAND_BOARD_INIT + bool "Call onenand_board_init() in the onenand command" + depends on CMD_ONENAND + config CMD_OSD bool "osd" help @@ -1715,6 +1751,15 @@ config NFS_TIMEOUT "ERROR: Cannot umount" in nfs command, try longer timeout such as 10000. +config SYS_DISABLE_AUTOLOAD + bool "Disable automatically loading files over the network" + depends on CMD_BOOTP || CMD_DHCP || CMD_NFS || CMD_RARP + help + Typically, commands such as "dhcp" will attempt to automatically + load a file from the network, once the initial network configuration + is complete. Enable this option to disable this behavior and instead + require files to be loaded over the network by subsequent commands. + config CMD_MII bool "mii" imply CMD_MDIO @@ -2552,6 +2597,7 @@ config CMD_UBIFS depends on CMD_UBI default y if CMD_UBI select LZO + select GZIP help UBIFS is a file system for flash devices which works on top of UBI. diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 827fcd9..37ce659 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -35,6 +35,18 @@ static void *image_addr; static size_t image_size; /** + * efi_get_image_parameters() - return image parameters + * + * @img_addr: address of loaded image in memory + * @img_size: size of loaded image + */ +void efi_get_image_parameters(void **img_addr, size_t *img_size) +{ + *img_addr = image_addr; + *img_size = image_size; +} + +/** * efi_clear_bootdev() - clear boot device */ static void efi_clear_bootdev(void) @@ -82,36 +82,13 @@ static int do_cpu_detail(struct cmd_tbl *cmdtp, int flag, int argc, return 0; } -static struct cmd_tbl cmd_cpu_sub[] = { - U_BOOT_CMD_MKENT(list, 2, 1, do_cpu_list, "", ""), - U_BOOT_CMD_MKENT(detail, 4, 0, do_cpu_detail, "", ""), -}; - -/* - * Process a cpu sub-command - */ -static int do_cpu(struct cmd_tbl *cmdtp, int flag, int argc, - char *const argv[]) -{ - struct cmd_tbl *c = NULL; - - /* Strip off leading 'cpu' command argument */ - argc--; - argv++; - - if (argc) - c = find_cmd_tbl(argv[0], cmd_cpu_sub, - ARRAY_SIZE(cmd_cpu_sub)); - - if (c) - return c->cmd(cmdtp, flag, argc, argv); - else - return CMD_RET_USAGE; -} - -U_BOOT_CMD( - cpu, 2, 1, do_cpu, - "display information about CPUs", +#if CONFIG_IS_ENABLED(SYS_LONGHELP) +static char cpu_help_text[] = "list - list available CPUs\n" "cpu detail - show CPU detail" -); + ; +#endif + +U_BOOT_CMD_WITH_SUBCMDS(cpu, "display information about CPUs", cpu_help_text, + U_BOOT_SUBCMD_MKENT(list, 1, 1, do_cpu_list), + U_BOOT_SUBCMD_MKENT(detail, 1, 0, do_cpu_detail)); @@ -8,26 +8,13 @@ #include <common.h> #include <command.h> -#include <dm.h> -#include <malloc.h> -#include <mapmem.h> -#include <errno.h> -#include <asm/io.h> #include <dm/root.h> #include <dm/util.h> -static int do_dm_dump_all(struct cmd_tbl *cmdtp, int flag, int argc, - char *const argv[]) -{ - dm_dump_all(); - - return 0; -} - -static int do_dm_dump_uclass(struct cmd_tbl *cmdtp, int flag, int argc, - char *const argv[]) +static int do_dm_dump_driver_compat(struct cmd_tbl *cmdtp, int flag, int argc, + char * const argv[]) { - dm_dump_uclass(); + dm_dump_driver_compat(); return 0; } @@ -48,71 +35,68 @@ static int do_dm_dump_drivers(struct cmd_tbl *cmdtp, int flag, int argc, return 0; } -static int do_dm_dump_driver_compat(struct cmd_tbl *cmdtp, int flag, int argc, - char * const argv[]) +#if CONFIG_IS_ENABLED(DM_STATS) +static int do_dm_dump_mem(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) { - dm_dump_driver_compat(); + struct dm_stats mem; + + dm_get_mem(&mem); + dm_dump_mem(&mem); return 0; } +#endif /* DM_STATS */ -static int do_dm_dump_static_driver_info(struct cmd_tbl *cmdtp, int flag, int argc, - char * const argv[]) +static int do_dm_dump_static_driver_info(struct cmd_tbl *cmdtp, int flag, + int argc, char * const argv[]) { dm_dump_static_driver_info(); return 0; } -static struct cmd_tbl test_commands[] = { - U_BOOT_CMD_MKENT(tree, 0, 1, do_dm_dump_all, "", ""), - U_BOOT_CMD_MKENT(uclass, 1, 1, do_dm_dump_uclass, "", ""), - U_BOOT_CMD_MKENT(devres, 1, 1, do_dm_dump_devres, "", ""), - U_BOOT_CMD_MKENT(drivers, 1, 1, do_dm_dump_drivers, "", ""), - U_BOOT_CMD_MKENT(compat, 1, 1, do_dm_dump_driver_compat, "", ""), - U_BOOT_CMD_MKENT(static, 1, 1, do_dm_dump_static_driver_info, "", ""), -}; - -static __maybe_unused void dm_reloc(void) +static int do_dm_dump_tree(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) { - static int relocated; + dm_dump_tree(); - if (!relocated) { - fixup_cmdtable(test_commands, ARRAY_SIZE(test_commands)); - relocated = 1; - } + return 0; } -static int do_dm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) +static int do_dm_dump_uclass(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) { - struct cmd_tbl *test_cmd; - int ret; - -#ifdef CONFIG_NEEDS_MANUAL_RELOC - dm_reloc(); -#endif - - if (argc < 2) - return CMD_RET_USAGE; - test_cmd = find_cmd_tbl(argv[1], test_commands, - ARRAY_SIZE(test_commands)); - argc -= 2; - argv += 2; - if (!test_cmd || argc > test_cmd->maxargs) - return CMD_RET_USAGE; - - ret = test_cmd->cmd(test_cmd, flag, argc, argv); + dm_dump_uclass(); - return cmd_process_error(test_cmd, ret); + return 0; } -U_BOOT_CMD( - dm, 3, 1, do_dm, - "Driver model low level access", - "tree Dump driver model tree ('*' = activated)\n" - "dm uclass Dump list of instances for each uclass\n" +#if CONFIG_IS_ENABLED(DM_STATS) +#define DM_MEM_HELP "dm mem Provide a summary of memory usage\n" +#define DM_MEM U_BOOT_SUBCMD_MKENT(mem, 1, 1, do_dm_dump_mem), +#else +#define DM_MEM_HELP +#define DM_MEM +#endif + +#if CONFIG_IS_ENABLED(SYS_LONGHELP) +static char dm_help_text[] = + "compat Dump list of drivers with compatibility strings\n" "dm devres Dump list of device resources for each device\n" "dm drivers Dump list of drivers with uclass and instances\n" - "dm compat Dump list of drivers with compatibility strings\n" - "dm static Dump list of drivers with static platform data" -); + DM_MEM_HELP + "dm static Dump list of drivers with static platform data\n" + "dn tree Dump tree of driver model devices ('*' = activated)\n" + "dm uclass Dump list of instances for each uclass" + ; +#endif + +U_BOOT_CMD_WITH_SUBCMDS(dm, "Driver model low level access", dm_help_text, + U_BOOT_SUBCMD_MKENT(compat, 1, 1, do_dm_dump_driver_compat), + U_BOOT_SUBCMD_MKENT(devres, 1, 1, do_dm_dump_devres), + U_BOOT_SUBCMD_MKENT(drivers, 1, 1, do_dm_dump_drivers), + DM_MEM + U_BOOT_SUBCMD_MKENT(static, 1, 1, do_dm_dump_static_driver_info), + U_BOOT_SUBCMD_MKENT(tree, 1, 1, do_dm_dump_tree), + U_BOOT_SUBCMD_MKENT(uclass, 1, 1, do_dm_dump_uclass)); @@ -1063,6 +1063,44 @@ static ulong load_serial_ymodem(ulong offset, int mode) #endif +#if defined(CONFIG_CMD_LOADM) +static int do_load_memory_bin(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + ulong addr, dest, size; + void *src, *dst; + + if (argc != 4) + return CMD_RET_USAGE; + + addr = simple_strtoul(argv[1], NULL, 16); + + dest = simple_strtoul(argv[2], NULL, 16); + + size = simple_strtoul(argv[3], NULL, 16); + + if (!size) { + printf("loadm: can not load zero bytes\n"); + return 1; + } + + src = map_sysmem(addr, size); + dst = map_sysmem(dest, size); + + memcpy(dst, src, size); + + unmap_sysmem(src); + unmap_sysmem(dst); + + if (IS_ENABLED(CONFIG_CMD_BOOTEFI)) + efi_set_bootdev("Mem", "", "", map_sysmem(dest, 0), size); + + printf("loaded bin to memory: size: %lu\n", size); + + return 0; +} +#endif + /* -------------------------------------------------------------------- */ #if defined(CONFIG_CMD_LOADS) @@ -1137,3 +1175,13 @@ U_BOOT_CMD( ); #endif /* CONFIG_CMD_LOADB */ + +#if defined(CONFIG_CMD_LOADM) +U_BOOT_CMD( + loadm, 4, 0, do_load_memory_bin, + "load binary blob from source address to destination address", + "[src_addr] [dst_addr] [size]\n" + " - load a binary blob from one memory location to other" + " from src_addr to dst_addr by size bytes" +); +#endif /* CONFIG_CMD_LOADM */ @@ -44,7 +44,6 @@ static int do_misc_list(struct cmd_tbl *cmdtp, int flag, static int do_misc_op(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[], enum misc_op op) { - int (*misc_op)(struct udevice *, int, void *, int); struct udevice *dev; int offset; void *buf; @@ -62,11 +61,10 @@ static int do_misc_op(struct cmd_tbl *cmdtp, int flag, size = hextoul(argv[3], NULL); if (op == MISC_OP_READ) - misc_op = misc_read; + ret = misc_read(dev, offset, buf, size); else - misc_op = misc_write; + ret = misc_write(dev, offset, buf, size); - ret = misc_op(dev, offset, buf, size); if (ret < 0) { if (ret == -ENOSYS) { printf("The device does not support %s\n", @@ -25,15 +25,17 @@ static int qemu_fwcfg_cmd_setup_kernel(void *load_addr, void *initrd_addr) qfw_read_entry(qfw_dev, FW_CFG_SETUP_SIZE, 4, &setup_size); qfw_read_entry(qfw_dev, FW_CFG_KERNEL_SIZE, 4, &kernel_size); - if (setup_size == 0 || kernel_size == 0) { + if (kernel_size == 0) { printf("warning: no kernel available\n"); return -1; } data_addr = load_addr; - qfw_read_entry(qfw_dev, FW_CFG_SETUP_DATA, - le32_to_cpu(setup_size), data_addr); - data_addr += le32_to_cpu(setup_size); + if (setup_size != 0) { + qfw_read_entry(qfw_dev, FW_CFG_SETUP_DATA, + le32_to_cpu(setup_size), data_addr); + data_addr += le32_to_cpu(setup_size); + } qfw_read_entry(qfw_dev, FW_CFG_KERNEL_DATA, le32_to_cpu(kernel_size), data_addr); |