summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorStefano Babic <sbabic@denx.de>2020-05-10 13:03:56 +0200
committerStefano Babic <sbabic@denx.de>2020-05-10 13:03:56 +0200
commitb77d0292ca9f3ca69259dca7e2c5e193a403b289 (patch)
tree0af352de3e405f839188aad7acaa9930d18afdd8 /cmd
parent8142a97d541ef1473925b3677d6bf86bcddb69ac (diff)
parentc5c657644bc35fd6b3d6e5517698721e90646b8d (diff)
Merge branch 'master' of git://git.denx.de/u-boot
Diffstat (limited to 'cmd')
-rw-r--r--cmd/Kconfig16
-rw-r--r--cmd/bdinfo.c20
-rw-r--r--cmd/bedbug.c4
-rw-r--r--cmd/bootefi.c4
-rw-r--r--cmd/bootmenu.c61
-rw-r--r--cmd/cache.c5
-rw-r--r--cmd/efidebug.c40
-rw-r--r--cmd/gpt.c6
-rw-r--r--cmd/mem.c9
-rw-r--r--cmd/mvebu/bubt.c4
-rw-r--r--cmd/nvedit_efi.c2
-rw-r--r--cmd/pxe_utils.c2
12 files changed, 103 insertions, 70 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 157a33081f..f9be1988f6 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -750,6 +750,22 @@ config SYS_ALT_MEMTEST
help
Use a more complete alternative memory test.
+config SYS_MEMTEST_START
+ hex "default start address for mtest"
+ default 0
+ help
+ This is the default start address for mtest for simple read/write
+ test. If no arguments are given to mtest, default address is used
+ as start address.
+
+config SYS_MEMTEST_END
+ hex "default end address for mtest"
+ default 0x1000
+ help
+ This is the default end address for mtest for simple read/write
+ test. If no arguments are given to mtest, default address is used
+ as end address.
+
endif
config CMD_SHA1SUM
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index d6a7175b37..9edcf8d74e 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -15,6 +15,11 @@
DECLARE_GLOBAL_DATA_PTR;
+__maybe_unused void print_cpu_word_size(void)
+{
+ printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8);
+}
+
__maybe_unused
static void print_num(const char *name, ulong value)
{
@@ -208,6 +213,8 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_baudrate();
print_num("relocaddr", gd->relocaddr);
board_detail();
+ print_cpu_word_size();
+
return 0;
}
@@ -227,6 +234,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_eth_ip_addr();
print_baudrate();
+ print_cpu_word_size();
return 0;
}
@@ -252,6 +260,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_num("fdt_blob", (ulong)gd->fdt_blob);
print_num("new_fdt", (ulong)gd->new_fdt);
print_num("fdt_size", (ulong)gd->fdt_size);
+ print_cpu_word_size();
return 0;
}
@@ -283,6 +292,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#endif
print_eth_ip_addr();
print_baudrate();
+ print_cpu_word_size();
return 0;
}
@@ -294,6 +304,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_std_bdinfo(gd->bd);
print_num("relocaddr", gd->relocaddr);
print_num("reloc off", gd->reloc_off);
+ print_cpu_word_size();
return 0;
}
@@ -354,6 +365,7 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
#endif
if (gd->fdt_blob)
print_num("fdt_blob", (ulong)gd->fdt_blob);
+ print_cpu_word_size();
return 0;
}
@@ -368,6 +380,8 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_bi_flash(bd);
print_eth_ip_addr();
print_baudrate();
+ print_cpu_word_size();
+
return 0;
}
@@ -388,6 +402,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_mhz("ethspeed", bd->bi_ethspeed);
#endif
print_baudrate();
+ print_cpu_word_size();
return 0;
}
@@ -405,6 +420,8 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
print_num("FB base ", gd->fb_base);
#endif
+ print_cpu_word_size();
+
return 0;
}
@@ -419,6 +436,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_bi_dram(bd);
print_eth_ip_addr();
print_baudrate();
+ print_cpu_word_size();
return 0;
}
@@ -435,6 +453,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_num("reloc off", gd->reloc_off);
print_eth_ip_addr();
print_baudrate();
+ print_cpu_word_size();
return 0;
}
@@ -448,6 +467,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_bi_mem(bd);
print_eth_ip_addr();
print_baudrate();
+ print_cpu_word_size();
return 0;
}
diff --git a/cmd/bedbug.c b/cmd/bedbug.c
index 9fee528830..d3e31212ea 100644
--- a/cmd/bedbug.c
+++ b/cmd/bedbug.c
@@ -44,10 +44,10 @@ int bedbug_puts (const char *str)
* settings.
* ====================================================================== */
-void bedbug_init (void)
+int bedbug_init(void)
{
/* -------------------------------------------------- */
- return;
+ return 0;
} /* bedbug_init */
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 54b4b8f984..06573b14e9 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -127,13 +127,13 @@ static efi_status_t copy_fdt(void **fdtp)
new_fdt_addr = (uintptr_t)map_sysmem(fdt_ram_start + 0x7f00000 +
fdt_size, 0);
ret = efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS,
- EFI_BOOT_SERVICES_DATA, fdt_pages,
+ EFI_ACPI_RECLAIM_MEMORY, fdt_pages,
&new_fdt_addr);
if (ret != EFI_SUCCESS) {
/* If we can't put it there, put it somewhere */
new_fdt_addr = (ulong)memalign(EFI_PAGE_SIZE, fdt_size);
ret = efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS,
- EFI_BOOT_SERVICES_DATA, fdt_pages,
+ EFI_ACPI_RECLAIM_MEMORY, fdt_pages,
&new_fdt_addr);
if (ret != EFI_SUCCESS) {
printf("ERROR: Failed to reserve space for FDT\n");
diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c
index 3dc2c854ac..f1562883f5 100644
--- a/cmd/bootmenu.c
+++ b/cmd/bootmenu.c
@@ -365,6 +365,34 @@ cleanup:
return NULL;
}
+static void menu_display_statusline(struct menu *m)
+{
+ struct bootmenu_entry *entry;
+ struct bootmenu_data *menu;
+
+ if (menu_default_choice(m, (void *)&entry) < 0)
+ return;
+
+ menu = entry->menu;
+
+ printf(ANSI_CURSOR_POSITION, 1, 1);
+ puts(ANSI_CLEAR_LINE);
+ printf(ANSI_CURSOR_POSITION, 2, 1);
+ puts(" *** U-Boot Boot Menu ***");
+ puts(ANSI_CLEAR_LINE_TO_END);
+ printf(ANSI_CURSOR_POSITION, 3, 1);
+ puts(ANSI_CLEAR_LINE);
+
+ /* First 3 lines are bootmenu header + 2 empty lines between entries */
+ printf(ANSI_CURSOR_POSITION, menu->count + 5, 1);
+ puts(ANSI_CLEAR_LINE);
+ printf(ANSI_CURSOR_POSITION, menu->count + 6, 1);
+ puts(" Press UP/DOWN to move, ENTER to select");
+ puts(ANSI_CLEAR_LINE_TO_END);
+ printf(ANSI_CURSOR_POSITION, menu->count + 7, 1);
+ puts(ANSI_CLEAR_LINE);
+}
+
static void bootmenu_show(int delay)
{
int init = 0;
@@ -396,8 +424,9 @@ static void bootmenu_show(int delay)
if (!bootmenu)
return;
- menu = menu_create(NULL, bootmenu->delay, 1, bootmenu_print_entry,
- bootmenu_choice_entry, bootmenu);
+ menu = menu_create(NULL, bootmenu->delay, 1, menu_display_statusline,
+ bootmenu_print_entry, bootmenu_choice_entry,
+ bootmenu);
if (!menu) {
bootmenu_destroy(bootmenu);
return;
@@ -445,34 +474,6 @@ cleanup:
#endif
}
-void menu_display_statusline(struct menu *m)
-{
- struct bootmenu_entry *entry;
- struct bootmenu_data *menu;
-
- if (menu_default_choice(m, (void *)&entry) < 0)
- return;
-
- menu = entry->menu;
-
- printf(ANSI_CURSOR_POSITION, 1, 1);
- puts(ANSI_CLEAR_LINE);
- printf(ANSI_CURSOR_POSITION, 2, 1);
- puts(" *** U-Boot Boot Menu ***");
- puts(ANSI_CLEAR_LINE_TO_END);
- printf(ANSI_CURSOR_POSITION, 3, 1);
- puts(ANSI_CLEAR_LINE);
-
- /* First 3 lines are bootmenu header + 2 empty lines between entries */
- printf(ANSI_CURSOR_POSITION, menu->count + 5, 1);
- puts(ANSI_CLEAR_LINE);
- printf(ANSI_CURSOR_POSITION, menu->count + 6, 1);
- puts(" Press UP/DOWN to move, ENTER to select");
- puts(ANSI_CLEAR_LINE_TO_END);
- printf(ANSI_CURSOR_POSITION, menu->count + 7, 1);
- puts(ANSI_CLEAR_LINE);
-}
-
#ifdef CONFIG_AUTOBOOT_MENU_SHOW
int menu_show(int bootdelay)
{
diff --git a/cmd/cache.c b/cmd/cache.c
index 27dcec0931..7678615dd8 100644
--- a/cmd/cache.c
+++ b/cmd/cache.c
@@ -20,6 +20,10 @@ void __weak invalidate_icache_all(void)
puts("No arch specific invalidate_icache_all available!\n");
}
+__weak void noncached_set_region(void)
+{
+}
+
static int do_icache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
switch (argc) {
@@ -64,6 +68,7 @@ static int do_dcache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
break;
case 1:
dcache_enable();
+ noncached_set_region();
break;
case 2:
flush_dcache_all();
diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index d4030fee64..d8a76d78a3 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -17,7 +17,6 @@
#include <linux/ctype.h>
#define BS systab.boottime
-#define RT systab.runtime
/**
* efi_get_device_handle_info() - get information of UEFI device
@@ -69,7 +68,7 @@ static int do_efi_show_devices(cmd_tbl_t *cmdtp, int flag,
u16 *dev_path_text;
efi_status_t ret;
- ret = EFI_CALL(BS->locate_handle_buffer(ALL_HANDLES, NULL, NULL,
+ ret = EFI_CALL(efi_locate_handle_buffer(ALL_HANDLES, NULL, NULL,
&num, &handles));
if (ret != EFI_SUCCESS)
return CMD_RET_FAILURE;
@@ -86,7 +85,7 @@ static int do_efi_show_devices(cmd_tbl_t *cmdtp, int flag,
}
}
- EFI_CALL(BS->free_pool(handles));
+ efi_free_pool(handles);
return CMD_RET_SUCCESS;
}
@@ -148,7 +147,7 @@ static int do_efi_show_drivers(cmd_tbl_t *cmdtp, int flag,
u16 *driver_name, *image_path_text;
efi_status_t ret;
- ret = EFI_CALL(BS->locate_handle_buffer(
+ ret = EFI_CALL(efi_locate_handle_buffer(
BY_PROTOCOL, &efi_guid_driver_binding_protocol,
NULL, &num, &handles));
if (ret != EFI_SUCCESS)
@@ -170,12 +169,12 @@ static int do_efi_show_drivers(cmd_tbl_t *cmdtp, int flag,
else
printf("%p %-20ls <built-in>\n",
handles[i], driver_name);
- EFI_CALL(BS->free_pool(driver_name));
- EFI_CALL(BS->free_pool(image_path_text));
+ efi_free_pool(driver_name);
+ efi_free_pool(image_path_text);
}
}
- EFI_CALL(BS->free_pool(handles));
+ efi_free_pool(handles);
return CMD_RET_SUCCESS;
}
@@ -321,7 +320,7 @@ static int do_efi_show_handles(cmd_tbl_t *cmdtp, int flag,
const char *guid_text;
efi_status_t ret;
- ret = EFI_CALL(BS->locate_handle_buffer(ALL_HANDLES, NULL, NULL,
+ ret = EFI_CALL(efi_locate_handle_buffer(ALL_HANDLES, NULL, NULL,
&num, &handles));
if (ret != EFI_SUCCESS)
return CMD_RET_FAILURE;
@@ -355,7 +354,7 @@ static int do_efi_show_handles(cmd_tbl_t *cmdtp, int flag,
putc('\n');
}
- EFI_CALL(BS->free_pool(handles));
+ efi_free_pool(handles);
return CMD_RET_SUCCESS;
}
@@ -463,18 +462,17 @@ static int do_efi_show_memmap(cmd_tbl_t *cmdtp, int flag,
int i;
efi_status_t ret;
- ret = EFI_CALL(BS->get_memory_map(&map_size, memmap, NULL, NULL, NULL));
+ ret = efi_get_memory_map(&map_size, memmap, NULL, NULL, NULL);
if (ret == EFI_BUFFER_TOO_SMALL) {
map_size += sizeof(struct efi_mem_desc); /* for my own */
- ret = EFI_CALL(BS->allocate_pool(EFI_LOADER_DATA,
- map_size, (void *)&memmap));
+ ret = efi_allocate_pool(EFI_LOADER_DATA, map_size,
+ (void *)&memmap);
if (ret != EFI_SUCCESS)
return CMD_RET_FAILURE;
- ret = EFI_CALL(BS->get_memory_map(&map_size, memmap,
- NULL, NULL, NULL));
+ ret = efi_get_memory_map(&map_size, memmap, NULL, NULL, NULL);
}
if (ret != EFI_SUCCESS) {
- EFI_CALL(BS->free_pool(memmap));
+ efi_free_pool(memmap);
return CMD_RET_FAILURE;
}
@@ -501,7 +499,7 @@ static int do_efi_show_memmap(cmd_tbl_t *cmdtp, int flag,
putc('\n');
}
- EFI_CALL(BS->free_pool(memmap));
+ efi_free_pool(memmap);
return CMD_RET_SUCCESS;
}
@@ -615,7 +613,7 @@ static int do_efi_boot_add(cmd_tbl_t *cmdtp, int flag,
goto out;
}
- ret = EFI_CALL(RT->set_variable(var_name16, &guid,
+ ret = EFI_CALL(efi_set_variable(var_name16, &guid,
EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
@@ -670,7 +668,7 @@ static int do_efi_boot_rm(cmd_tbl_t *cmdtp, int flag,
p = var_name16;
utf8_utf16_strncpy(&p, var_name, 9);
- ret = EFI_CALL(RT->set_variable(var_name16, &guid, 0, 0, NULL));
+ ret = EFI_CALL(efi_set_variable(var_name16, &guid, 0, 0, NULL));
if (ret) {
printf("Cannot remove %ls\n", var_name16);
return CMD_RET_FAILURE;
@@ -864,7 +862,7 @@ static int show_efi_boot_order(void)
efi_status_t ret;
size = 0;
- ret = EFI_CALL(RT->get_variable(L"BootOrder", &efi_global_variable_guid,
+ ret = EFI_CALL(efi_get_variable(L"BootOrder", &efi_global_variable_guid,
NULL, &size, NULL));
if (ret != EFI_BUFFER_TOO_SMALL) {
if (ret == EFI_NOT_FOUND) {
@@ -975,7 +973,7 @@ static int do_efi_boot_next(cmd_tbl_t *cmdtp, int flag,
guid = efi_global_variable_guid;
size = sizeof(u16);
- ret = EFI_CALL(RT->set_variable(L"BootNext", &guid,
+ ret = EFI_CALL(efi_set_variable(L"BootNext", &guid,
EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
@@ -1036,7 +1034,7 @@ static int do_efi_boot_order(cmd_tbl_t *cmdtp, int flag,
}
guid = efi_global_variable_guid;
- ret = EFI_CALL(RT->set_variable(L"BootOrder", &guid,
+ ret = EFI_CALL(efi_set_variable(L"BootOrder", &guid,
EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
diff --git a/cmd/gpt.c b/cmd/gpt.c
index b94f0051cd..b8d11c167d 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -772,11 +772,9 @@ static int do_rename_gpt_parts(struct blk_desc *dev_desc, char *subcomm,
out:
del_gpt_info();
#ifdef CONFIG_RANDOM_UUID
- if (str_disk_guid)
- free(str_disk_guid);
+ free(str_disk_guid);
#endif
- if (new_partitions)
- free(new_partitions);
+ free(new_partitions);
free(partitions_list);
return ret;
}
diff --git a/cmd/mem.c b/cmd/mem.c
index 009b7b58f3..18f0510098 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -25,10 +25,6 @@
DECLARE_GLOBAL_DATA_PTR;
-#ifndef CONFIG_SYS_MEMTEST_SCRATCH
-#define CONFIG_SYS_MEMTEST_SCRATCH 0
-#endif
-
static int mod_mem(cmd_tbl_t *, int, int, int, char * const []);
/* Display values from last command.
@@ -922,7 +918,8 @@ static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
ulong start, end;
- vu_long *buf, *dummy;
+ vu_long scratch_space;
+ vu_long *buf, *dummy = &scratch_space;
ulong iteration_limit = 0;
ulong count = 0;
ulong errs = 0; /* number of errors, or -1 if interrupted */
@@ -958,7 +955,6 @@ static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
start, end);
buf = map_sysmem(start, end - start);
- dummy = map_sysmem(CONFIG_SYS_MEMTEST_SCRATCH, sizeof(vu_long));
for (iteration = 0;
!iteration_limit || iteration < iteration_limit;
iteration++) {
@@ -988,7 +984,6 @@ static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
}
unmap_sysmem((void *)buf);
- unmap_sysmem((void *)dummy);
if (errs == -1UL) {
/* Memory test was aborted - write a newline to finish off */
diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c
index dc0ce01c35..ef53153c46 100644
--- a/cmd/mvebu/bubt.c
+++ b/cmd/mvebu/bubt.c
@@ -730,8 +730,8 @@ static int bubt_check_boot_mode(const struct bubt_dev *dst)
for (int i = 0; i < ARRAY_SIZE(a38x_boot_modes); i++) {
if (a38x_boot_modes[i].id == hdr->blockid) {
- printf("Error: A38x image meant to be "
- "booted from \"%s\", not \"%s\"!\n",
+ printf("Error: A38x image meant to be booted from "
+ "\"%s\", not \"%s\"!\n",
a38x_boot_modes[i].name, dst->name);
return -ENOEXEC;
}
diff --git a/cmd/nvedit_efi.c b/cmd/nvedit_efi.c
index 837e39e021..6f69a84fea 100644
--- a/cmd/nvedit_efi.c
+++ b/cmd/nvedit_efi.c
@@ -298,7 +298,7 @@ int do_env_print_efi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return CMD_RET_USAGE;
/* -a already specified */
- if (!default_guid & guid_any)
+ if (!default_guid && guid_any)
return CMD_RET_USAGE;
argc--;
diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c
index 53af04d7dc..c244bfb10d 100644
--- a/cmd/pxe_utils.c
+++ b/cmd/pxe_utils.c
@@ -1237,7 +1237,7 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg)
* Create a menu and add items for all the labels.
*/
m = menu_create(cfg->title, DIV_ROUND_UP(cfg->timeout, 10),
- cfg->prompt, label_print, NULL, NULL);
+ cfg->prompt, NULL, label_print, NULL, NULL);
if (!m)
return NULL;