summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/Kconfig20
-rw-r--r--cmd/Makefile2
-rw-r--r--cmd/bdinfo.c7
-rw-r--r--cmd/boot.c6
-rw-r--r--cmd/bootefi.c13
-rw-r--r--cmd/bootmenu.c6
-rw-r--r--cmd/conitrace.c4
-rw-r--r--cmd/eficonfig.c12
-rw-r--r--cmd/eficonfig_sbkey.c4
-rw-r--r--cmd/efidebug.c5
-rw-r--r--cmd/fastboot.c4
-rw-r--r--cmd/fpga.c2
-rw-r--r--cmd/nvedit_efi.c10
-rw-r--r--cmd/part.c12
-rw-r--r--cmd/ufetch.c2
-rw-r--r--cmd/usb_mass_storage.c11
16 files changed, 64 insertions, 56 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 9b8a13c3446..c71c6824a19 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -47,6 +47,14 @@ config HUSH_SELECTABLE
default y if HUSH_OLD_PARSER && HUSH_MODERN_PARSER
endmenu
+config CMDLINE_FLUSH_STDIN
+ bool "Enable flushing input before starting cli"
+ help
+ When this option is enabled the stdin buffer will be flushed before
+ starting the CLI. This is useful when stdin is changed during boot
+ (e.g. from nulldev to serial) and junk characters may be pending
+ in the buffer.
+
config CMDLINE_EDITING
bool "Enable command line editing"
default y
@@ -1946,7 +1954,7 @@ config CMD_XXD
endmenu
-if NET || NET_LWIP
+if NET
menuconfig CMD_NET
bool "Network commands"
@@ -1954,7 +1962,7 @@ menuconfig CMD_NET
if CMD_NET
-if NET
+if NET_LEGACY
config CMD_BOOTP
bool "bootp"
@@ -2198,12 +2206,12 @@ config CMD_WOL
help
Wait for wake-on-lan Magic Packet
-endif # if NET
+endif # if NET_LEGACY
config CMD_DHCP
bool "dhcp"
select PROT_DHCP_LWIP if NET_LWIP
- select CMD_BOOTP if NET
+ select CMD_BOOTP if NET_LEGACY
help
Boot image via network using DHCP/TFTP protocol
@@ -2259,7 +2267,7 @@ config CMD_PING
config CMD_SNTP
bool "sntp"
- select PROT_UDP if NET
+ select PROT_UDP if NET_LEGACY
select PROT_UDP_LWIP if NET_LWIP
help
Synchronize RTC via network
@@ -2329,7 +2337,7 @@ config CMD_PXE
endif # if CMD_NET
-endif # NET || NET_LWIP
+endif # NET
menu "Misc commands"
diff --git a/cmd/Makefile b/cmd/Makefile
index 6b69da1f2b0..bbbdfcc4ded 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -131,7 +131,7 @@ obj-y += legacy-mtd-utils.o
endif
obj-$(CONFIG_CMD_MUX) += mux.o
obj-$(CONFIG_CMD_NAND) += nand.o
-ifdef CONFIG_NET
+ifdef CONFIG_NET_LEGACY
obj-$(CONFIG_CMD_NET) += net.o net-common.o
else ifdef CONFIG_NET_LWIP
obj-$(CONFIG_CMD_NET) += net-common.o
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index dc7c2c3c853..ddf77303735 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -152,7 +152,7 @@ static int bdinfo_print_all(struct bd_info *bd)
bdinfo_print_num_l("relocaddr", gd->relocaddr);
bdinfo_print_num_l("reloc off", gd->reloc_off);
printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8);
- if (IS_ENABLED(CONFIG_NET) || IS_ENABLED(CONFIG_NET_LWIP))
+ if (IS_ENABLED(CONFIG_NET))
print_eth();
bdinfo_print_num_l("fdt_blob", (ulong)map_to_sysmem(gd->fdt_blob));
if (IS_ENABLED(CONFIG_VIDEO))
@@ -194,8 +194,7 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
case 'a':
return bdinfo_print_all(bd);
case 'e':
- if (!IS_ENABLED(CONFIG_NET) &&
- !IS_ENABLED(CONFIG_NET_LWIP))
+ if (!IS_ENABLED(CONFIG_NET))
return CMD_RET_USAGE;
print_eth();
return CMD_RET_SUCCESS;
@@ -221,7 +220,7 @@ U_BOOT_CMD(
" - print all Board Info structure"
#if CONFIG_IS_ENABLED(GETOPT)
"\n"
-#if IS_ENABLED(CONFIG_NET) || IS_ENABLED(CONFIG_NET_LWIP)
+#if IS_ENABLED(CONFIG_NET)
"bdinfo -e\n"
" - print Board Info related to network\n"
#endif
diff --git a/cmd/boot.c b/cmd/boot.c
index 23496cafdf5..29cdf4a9a81 100644
--- a/cmd/boot.c
+++ b/cmd/boot.c
@@ -60,6 +60,12 @@ U_BOOT_CMD(
reset, 2, 0, do_reset,
"Perform RESET of the CPU",
"- cold boot without level specifier\n"
+#if IS_ENABLED(CONFIG_SYSRESET_CMD_RESET_ARGS)
+// All options handled by sysreset drivers via their sysreset_ops.request_arg callback
+#ifdef CONFIG_SYSRESET_QCOM_PSCI
+ "reset -edl - Boot to Emergency DownLoad mode\n"
+#endif
+#endif
"reset -w - warm reset if implemented"
);
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 85f41c3b0a0..37165f1a7fd 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -142,6 +142,11 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 2)
return CMD_RET_USAGE;
+ /* Initialize EFI drivers */
+ ret = efi_init_obj_list();
+ if (ret != EFI_SUCCESS)
+ return CMD_RET_FAILURE;
+
if (argc > 2) {
ulong rd_addr = 0;
char *end = strchr(argv[2], ':');
@@ -179,14 +184,6 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc,
if (IS_ENABLED(CONFIG_CMD_BOOTEFI_SELFTEST) &&
!strcmp(argv[1], "selftest")) {
- /* Initialize EFI drivers */
- ret = efi_init_obj_list();
- if (ret != EFI_SUCCESS) {
- log_err("Error: Cannot initialize UEFI sub-system, r = %lu\n",
- ret & ~EFI_ERROR_MASK);
- return CMD_RET_FAILURE;
- }
-
ret = efi_install_fdt(fdt);
if (ret != EFI_SUCCESS)
return CMD_RET_FAILURE;
diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c
index d3108778c6f..528afd221d0 100644
--- a/cmd/bootmenu.c
+++ b/cmd/bootmenu.c
@@ -505,12 +505,8 @@ static void handle_uefi_bootnext(void)
/* Initialize EFI drivers */
ret = efi_init_obj_list();
- if (ret != EFI_SUCCESS) {
- log_err("Error: Cannot initialize UEFI sub-system, r = %lu\n",
- ret & ~EFI_ERROR_MASK);
-
+ if (ret != EFI_SUCCESS)
return;
- }
/* If UEFI BootNext variable is set, boot the BootNext load option */
size = sizeof(u16);
diff --git a/cmd/conitrace.c b/cmd/conitrace.c
index 6cc113328eb..aef094e03df 100644
--- a/cmd/conitrace.c
+++ b/cmd/conitrace.c
@@ -6,6 +6,7 @@
* Copyright (c) 2018, Heinrich Schuchardt <[email protected]>
*/
#include <command.h>
+#include <console.h>
#include <linux/delay.h>
static int do_conitrace(struct cmd_tbl *cmdtp, int flag, int argc,
@@ -17,8 +18,7 @@ static int do_conitrace(struct cmd_tbl *cmdtp, int flag, int argc,
printf("To terminate type 'x'\n");
/* Empty input buffer */
- while (tstc())
- getchar();
+ console_flush_stdin();
for (;;) {
int c = getchar();
diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c
index d8d946c87ac..4d060e3007c 100644
--- a/cmd/eficonfig.c
+++ b/cmd/eficonfig.c
@@ -6,8 +6,9 @@
*/
#include <ansi.h>
-#include <cli.h>
#include <charset.h>
+#include <cli.h>
+#include <console.h>
#include <efi_device_path.h>
#include <efi_loader.h>
#include <efi_load_initrd.h>
@@ -167,8 +168,7 @@ static void eficonfig_menu_adjust(struct efimenu *efi_menu, bool add)
void eficonfig_print_msg(char *msg)
{
/* Flush input */
- while (tstc())
- getchar();
+ console_flush_stdin();
printf(ANSI_CURSOR_HIDE
ANSI_CLEAR_CONSOLE
@@ -2466,12 +2466,8 @@ static int do_eficonfig(struct cmd_tbl *cmdtp, int flag, int argc, char *const a
return CMD_RET_USAGE;
ret = efi_init_obj_list();
- if (ret != EFI_SUCCESS) {
- log_err("Error: Cannot initialize UEFI sub-system, r = %lu\n",
- ret & ~EFI_ERROR_MASK);
-
+ if (ret != EFI_SUCCESS)
return CMD_RET_FAILURE;
- }
ret = eficonfig_init();
if (ret != EFI_SUCCESS)
diff --git a/cmd/eficonfig_sbkey.c b/cmd/eficonfig_sbkey.c
index b3325a540f9..a6c5416d3a5 100644
--- a/cmd/eficonfig_sbkey.c
+++ b/cmd/eficonfig_sbkey.c
@@ -7,6 +7,7 @@
#include <ansi.h>
#include <charset.h>
+#include <console.h>
#include <hexdump.h>
#include <log.h>
#include <malloc.h>
@@ -288,8 +289,7 @@ static efi_status_t eficonfig_process_show_siglist(void *data)
}
}
- while (tstc())
- getchar();
+ console_flush_stdin();
printf("\n\n Press any key to continue");
getchar();
diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index 7b733119c82..a6faa36b500 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -1669,11 +1669,8 @@ static int do_efidebug(struct cmd_tbl *cmdtp, int flag,
/* Initialize UEFI drivers */
r = efi_init_obj_list();
- if (r != EFI_SUCCESS) {
- printf("Error: Cannot initialize UEFI sub-system, r = %lu\n",
- r & ~EFI_ERROR_MASK);
+ if (r != EFI_SUCCESS)
return CMD_RET_FAILURE;
- }
cp = find_cmd_tbl(argv[0], cmd_efidebug_sub,
ARRAY_SIZE(cmd_efidebug_sub));
diff --git a/cmd/fastboot.c b/cmd/fastboot.c
index be84a482b81..e71f873527b 100644
--- a/cmd/fastboot.c
+++ b/cmd/fastboot.c
@@ -16,7 +16,7 @@
#include <linux/printk.h>
#include <linux/stringify.h>
-#if CONFIG_IS_ENABLED(NET)
+#if CONFIG_IS_ENABLED(NET_LEGACY)
static int do_fastboot_udp(int argc, char *const argv[],
uintptr_t buf_addr, size_t buf_size)
{
@@ -162,7 +162,7 @@ NXTARG:
fastboot_init((void *)buf_addr, buf_size);
-#if CONFIG_IS_ENABLED(NET)
+#if CONFIG_IS_ENABLED(NET_LEGACY)
if (!strcmp(argv[1], "udp"))
return do_fastboot_udp(argc, argv, buf_addr, buf_size);
if (!strcmp(argv[1], "tcp"))
diff --git a/cmd/fpga.c b/cmd/fpga.c
index d51c380d7b3..d347a700290 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -417,7 +417,7 @@ U_BOOT_CMD(fpga, 6, 1, do_fpga_wrapper,
"info [dev] List known device information\n"
"fpga dump <dev> <address> <size> Load device to memory buffer\n"
"fpga load <dev> <address> <size> Load device from memory buffer\n"
-#if defined(CONFIG_CMD_FPGA_LOADP)
+#if defined(CONFIG_CMD_FPGA_LOADB)
"fpga loadb <dev> <address> <size> Load device from bitstream buffer\n"
#endif
#if defined(CONFIG_CMD_FPGA_LOADP)
diff --git a/cmd/nvedit_efi.c b/cmd/nvedit_efi.c
index 351ae47e870..3a36f94775b 100644
--- a/cmd/nvedit_efi.c
+++ b/cmd/nvedit_efi.c
@@ -213,11 +213,8 @@ int do_env_print_efi(struct cmd_tbl *cmdtp, int flag, int argc,
/* Initialize EFI drivers */
ret = efi_init_obj_list();
- if (ret != EFI_SUCCESS) {
- printf("Error: Cannot initialize UEFI sub-system, r = %lu\n",
- ret & ~EFI_ERROR_MASK);
+ if (ret != EFI_SUCCESS)
return CMD_RET_FAILURE;
- }
for (argc--, argv++; argc > 0 && argv[0][0] == '-'; argc--, argv++) {
if (!strcmp(argv[0], "-guid")) {
@@ -389,11 +386,8 @@ int do_env_set_efi(struct cmd_tbl *cmdtp, int flag, int argc,
/* Initialize EFI drivers */
ret = efi_init_obj_list();
- if (ret != EFI_SUCCESS) {
- printf("Error: Cannot initialize UEFI sub-system, r = %lu\n",
- ret & ~EFI_ERROR_MASK);
+ if (ret != EFI_SUCCESS)
return CMD_RET_FAILURE;
- }
/*
* attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS |
diff --git a/cmd/part.c b/cmd/part.c
index 5e520d707f3..3191d5861fd 100644
--- a/cmd/part.c
+++ b/cmd/part.c
@@ -144,6 +144,10 @@ static int do_part_info(int argc, char *const argv[], enum cmd_part_info param)
err = part_get_info(desc, part, &info);
if (err)
return 1;
+ } else if (uuid_str_valid(argv[2])) {
+ part = part_get_info_by_uuid(desc, argv[2], &info);
+ if (part < 0)
+ return 1;
} else {
part = part_get_info_by_name(desc, argv[2], &info);
if (part < 0)
@@ -517,13 +521,13 @@ U_BOOT_CMD(
" flags can be -bootable (list only bootable partitions)\n"
"part start <interface> <dev> <part> <varname>\n"
" - set environment variable to the start of the partition (in blocks)\n"
- " part can be either partition number or partition name\n"
+ " part can be either partition number, UUID or name\n"
"part size <interface> <dev> <part> <varname>\n"
" - set environment variable to the size of the partition (in blocks)\n"
- " part can be either partition number or partition name\n"
+ " part can be either partition number, UUID or name\n"
"part number <interface> <dev> <part> <varname>\n"
- " - set environment variable to the partition number using the partition name\n"
- " part must be specified as partition name\n"
+ " - set environment variable to the partition number using the partition UUID or name\n"
+ " part must be specified as partition UUID or name\n"
"part name <interface> <dev> <part> <varname>\n"
" - set environment variable to the partition name using the partition number\n"
" part must be specified as partition number\n"
diff --git a/cmd/ufetch.c b/cmd/ufetch.c
index bc5db08eee1..f8dc904bdd0 100644
--- a/cmd/ufetch.c
+++ b/cmd/ufetch.c
@@ -159,7 +159,7 @@ static int do_ufetch(struct cmd_tbl *cmdtp, int flag, int argc,
break;
case FEATURES:
printf("Features:" RESET " ");
- if (IS_ENABLED(CONFIG_NET))
+ if (IS_ENABLED(CONFIG_NET_LEGACY))
printf("Net");
if (IS_ENABLED(CONFIG_EFI_LOADER))
printf(", EFI");
diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c
index 47e8b70cd10..e8b87045bdc 100644
--- a/cmd/usb_mass_storage.c
+++ b/cmd/usb_mass_storage.c
@@ -24,6 +24,11 @@ static int ums_read_sector(struct ums *ums_dev,
{
struct blk_desc *block_dev = &ums_dev->block_dev;
lbaint_t blkstart = start + ums_dev->start_sector;
+ int ret;
+
+ ret = blk_dselect_hwpart(block_dev, ums_dev->hwpart);
+ if (ret && ret != -ENOSYS)
+ return ret;
return blk_dread(block_dev, blkstart, blkcnt, buf);
}
@@ -33,6 +38,11 @@ static int ums_write_sector(struct ums *ums_dev,
{
struct blk_desc *block_dev = &ums_dev->block_dev;
lbaint_t blkstart = start + ums_dev->start_sector;
+ int ret;
+
+ ret = blk_dselect_hwpart(block_dev, ums_dev->hwpart);
+ if (ret && ret != -ENOSYS)
+ return ret;
return blk_dwrite(block_dev, blkstart, blkcnt, buf);
}
@@ -110,6 +120,7 @@ static int ums_init(const char *devtype, const char *devnums_part_str)
snprintf(name, UMS_NAME_LEN, "UMS disk %d", ums_count);
ums[ums_count].name = name;
ums[ums_count].block_dev = *block_dev;
+ ums[ums_count].hwpart = block_dev->hwpart;
printf("UMS: LUN %d, dev %s %d, hwpart %d, sector %#x, count %#x\n",
ums_count, devtype, ums[ums_count].block_dev.devnum,