From af033ec8b4ebe28dd5e45b19f3abe213b1f4def3 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 5 Nov 2020 01:29:06 +0100 Subject: [PATCH 01/34] test: test/lib/test_print.c depends on CONSOLE_RECORD The tests in test/lib/test_print.c fail without CONFIG_CONSOLE_RECORD=y. Add a build dependency. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- test/lib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/lib/Makefile b/test/lib/Makefile index 98a9abf40e..97c11e35a8 100644 --- a/test/lib/Makefile +++ b/test/lib/Makefile @@ -7,7 +7,7 @@ obj-$(CONFIG_EFI_LOADER) += efi_device_path.o obj-$(CONFIG_EFI_SECURE_BOOT) += efi_image_region.o obj-y += hexdump.o obj-y += lmb.o -obj-y += test_print.o +obj-$(CONFIG_CONSOLE_RECORD) += test_print.o obj-$(CONFIG_SSCANF) += sscanf.o obj-y += string.o obj-$(CONFIG_ERRNO_STR) += test_errno_str.o From 622178d923d5e5767d33df242a09bc7dae500976 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 5 Nov 2020 00:29:11 +0100 Subject: [PATCH 02/34] cmd: CMD_CPU depends on CPU Compiling with CONFIG_CMD_CPU=y and CONFIG_CPU=n fails with: aarch64-linux-gnu-ld.bfd: cmd/built-in.o: in function `print_cpu_list': /home/user/u-boot/cmd/cpu.c:34: undefined reference to `cpu_get_desc' aarch64-linux-gnu-ld.bfd: /home/user/u-boot/cmd/cpu.c:39: undefined reference to `cpu_get_info' Segmentation fault (core dumped) make: *** [Makefile:1757: u-boot] Error 139 make: *** Deleting file 'u-boot' See error report in https://stackoverflow.com/questions/64678347. Add the missing build dependency. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- cmd/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/Kconfig b/cmd/Kconfig index 0107c0fa3e..1b53e5be5a 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -122,6 +122,7 @@ config CMD_CONSOLE config CMD_CPU bool "cpu" + depends on CPU help Print information about available CPUs. This normally shows the number of CPUs, type (e.g. manufacturer, architecture, product or From 9a3122f769d2e0bd0bc213b98bc251f92e3ff979 Mon Sep 17 00:00:00 2001 From: Marcin Juszkiewicz Date: Thu, 5 Nov 2020 17:30:26 +0100 Subject: [PATCH 03/34] Kconfig: simple panel requires backlight During build of simple panel driver backlight is needed so let's enable it: aarch64-linux-gnu-ld.bfd: drivers/built-in.o: in function `simple_panel_set_backlight': u-boot/drivers/video/simple_panel.c:43: undefined reference to `backlight_set_brightness' aarch64-linux-gnu-ld.bfd: drivers/built-in.o: in function `simple_panel_enable_backlight': u-boot/drivers/video/simple_panel.c:28: undefined reference to `backlight_enable' Signed-off-by: Marcin Juszkiewicz --- drivers/video/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index d39d9b2291..d782eb806a 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -199,7 +199,7 @@ config PANEL config SIMPLE_PANEL bool "Enable simple panel support" - depends on PANEL + depends on PANEL && BACKLIGHT default y help This turns on a simple panel driver that enables a compatible From 12fc1f3bb2237c6eee7bc775599c14df5c997534 Mon Sep 17 00:00:00 2001 From: Corneliu Doban Date: Mon, 9 Nov 2020 11:49:16 +0530 Subject: [PATCH 04/34] cmd: gpt: add eMMC and GPT support Add eMMC and GPT support. - GPT partition list and command to create the GPT added to u-boot environment - eMMC boot commands added to u-boot environment - new gpt commands (enumarate and setenv) that are used by broadcom update scripts and boot commands - eMMC specific u-boot configurations with environment saved in eMMC and GPT support Signed-off-by: Corneliu Doban Signed-off-by: Rayagonda Kokatanur [trini: Make gpt_setenv initialize ret to -1, given relevant return error values] Signed-off-by: Tom Rini --- cmd/gpt.c | 161 +++++++++++++++++++++++++++++++++++++++++++++++++ include/part.h | 29 +++++++++ 2 files changed, 190 insertions(+) diff --git a/cmd/gpt.c b/cmd/gpt.c index df759416c8..76a95ade6c 100644 --- a/cmd/gpt.c +++ b/cmd/gpt.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -621,6 +622,152 @@ static int gpt_verify(struct blk_desc *blk_dev_desc, const char *str_part) return ret; } +/** + * gpt_enumerate() - Enumerate partition names into environment variable. + * + * Enumerate partition names. Partition names are stored in gpt_partition_list + * environment variable. Each partition name is delimited by space. + * + * @desc: block device descriptor + * + * @Return: '0' on success and -ve error on failure + */ +static int gpt_enumerate(struct blk_desc *desc) +{ + struct part_driver *first_drv, *part_drv; + int str_len = 0, tmp_len; + char part_list[2048]; + int n_drvs; + char *ptr; + + part_list[0] = 0; + n_drvs = part_driver_get_count(); + if (!n_drvs) { + printf("Failed to get partition driver count\n"); + return -ENOENT; + } + + first_drv = part_driver_get_first(); + for (part_drv = first_drv; part_drv != first_drv + n_drvs; part_drv++) { + struct disk_partition pinfo; + int ret; + int i; + + for (i = 1; i < part_drv->max_entries; i++) { + ret = part_drv->get_info(desc, i, &pinfo); + if (ret) { + /* no more entries in table */ + break; + } + + ptr = &part_list[str_len]; + tmp_len = strlen((const char *)pinfo.name); + str_len += tmp_len; + /* +1 for space */ + str_len++; + if (str_len > sizeof(part_list)) { + printf("Error insufficient memory\n"); + return -ENOMEM; + } + strcpy(ptr, (const char *)pinfo.name); + /* One byte for space(" ") delimiter */ + ptr[tmp_len] = ' '; + } + } + if (*part_list) + part_list[strlen(part_list) - 1] = 0; + debug("setenv gpt_partition_list %s\n", part_list); + + return env_set("gpt_partition_list", part_list); +} + +/** + * gpt_setenv_part_variables() - setup partition environmental variables + * + * Setup the gpt_partition_name, gpt_partition_entry, gpt_partition_addr + * and gpt_partition_size environment variables. + * + * @pinfo: pointer to disk partition + * @i: partition entry + * + * @Return: '0' on success and -ENOENT on failure + */ +static int gpt_setenv_part_variables(struct disk_partition *pinfo, int i) +{ + int ret; + + ret = env_set_hex("gpt_partition_addr", pinfo->start); + if (ret) + goto fail; + + ret = env_set_hex("gpt_partition_size", pinfo->size); + if (ret) + goto fail; + + ret = env_set_ulong("gpt_partition_entry", i); + if (ret) + goto fail; + + ret = env_set("gpt_partition_name", (const char *)pinfo->name); + if (ret) + goto fail; + + return 0; + +fail: + return -ENOENT; +} + +/** + * gpt_setenv() - Dynamically setup environment variables. + * + * Dynamically setup environment variables for name, index, offset and size + * for partition in GPT table after running "gpt setenv" for a partition name. + * + * @desc: block device descriptor + * @name: partition name + * + * @Return: '0' on success and -ve err on failure + */ +static int gpt_setenv(struct blk_desc *desc, const char *name) +{ + struct part_driver *first_drv, *part_drv; + int n_drvs; + int ret = -1; + + n_drvs = part_driver_get_count(); + if (!n_drvs) { + printf("Failed to get partition driver count\n"); + goto fail; + } + + first_drv = part_driver_get_first(); + for (part_drv = first_drv; part_drv != first_drv + n_drvs; part_drv++) { + struct disk_partition pinfo; + int i; + + for (i = 1; i < part_drv->max_entries; i++) { + ret = part_drv->get_info(desc, i, &pinfo); + if (ret) { + /* no more entries in table */ + break; + } + + if (!strcmp(name, (const char *)pinfo.name)) { + /* match found, setup environment variables */ + ret = gpt_setenv_part_variables(&pinfo, i); + if (ret) + goto fail; + + return 0; + } + } + } + +fail: + return ret; +} + static int do_disk_guid(struct blk_desc *dev_desc, char * const namestr) { int ret; @@ -827,6 +974,10 @@ static int do_gpt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) } else if ((strcmp(argv[1], "verify") == 0)) { ret = gpt_verify(blk_dev_desc, argv[4]); printf("Verify GPT: "); + } else if ((strcmp(argv[1], "setenv") == 0)) { + ret = gpt_setenv(blk_dev_desc, argv[4]); + } else if ((strcmp(argv[1], "enumerate") == 0)) { + ret = gpt_enumerate(blk_dev_desc); } else if (strcmp(argv[1], "guid") == 0) { ret = do_disk_guid(blk_dev_desc, argv[4]); #ifdef CONFIG_CMD_GPT_RENAME @@ -857,7 +1008,17 @@ U_BOOT_CMD(gpt, CONFIG_SYS_MAXARGS, 1, do_gpt, " to interface\n" " Example usage:\n" " gpt write mmc 0 $partitions\n" + " - write the GPT to device\n" " gpt verify mmc 0 $partitions\n" + " - verify the GPT on device against $partitions\n" + " gpt setenv mmc 0 $name\n" + " - setup environment variables for partition $name:\n" + " gpt_partition_addr, gpt_partition_size,\n" + " gpt_partition_name, gpt_partition_entry\n" + " gpt enumerate mmc 0\n" + " - store list of partitions to gpt_partition_list environment variable\n" + " read \n" + " - read GPT into a data structure for manipulation\n" " gpt guid \n" " - print disk GUID\n" " gpt guid \n" diff --git a/include/part.h b/include/part.h index fac36364bd..815515aa80 100644 --- a/include/part.h +++ b/include/part.h @@ -9,6 +9,7 @@ #include #include #include +#include #include struct block_drvr { @@ -481,5 +482,33 @@ int layout_mbr_partitions(struct disk_partition *p, int count, #endif +#ifdef CONFIG_PARTITIONS +/** + * part_driver_get_count() - get partition driver count + * + * @return - number of partition drivers + */ +static inline int part_driver_get_count(void) +{ + return ll_entry_count(struct part_driver, part_driver); +} + +/** + * part_driver_get_first() - get first partition driver + * + * @return - pointer to first partition driver on success, otherwise NULL + */ +static inline struct part_driver *part_driver_get_first(void) +{ + return ll_entry_start(struct part_driver, part_driver); +} + +#else +static inline int part_driver_get_count(void) +{ return 0; } + +static inline struct part_driver *part_driver_get_first(void) +{ return NULL; } +#endif /* CONFIG_PARTITIONS */ #endif /* _PART_H */ From ef7e264944a21c0a78378bf4d28db5bcacbc5b45 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 8 Nov 2020 21:08:43 -0700 Subject: [PATCH 05/34] test: Avoid assuming sandbox board for bloblist test This tests assumes it is running on sandbox. Add a few functions to handle silencing the console on any board and use those instead. Reported-by: Kever Yang Signed-off-by: Simon Glass --- include/test/ut.h | 18 ++++++++++++++++++ test/bloblist.c | 13 ++++--------- test/ut.c | 18 ++++++++++++++++++ 3 files changed, 40 insertions(+), 9 deletions(-) diff --git a/include/test/ut.h b/include/test/ut.h index 3f2ee7514b..17400c73ea 100644 --- a/include/test/ut.h +++ b/include/test/ut.h @@ -338,4 +338,22 @@ ulong ut_check_free(void); */ long ut_check_delta(ulong last); +/** + * ut_silence_console() - Silence the console if requested by the user + * + * This stops test output from appear on the console. It is the default on + * sandbox, unless the -v flag is given. For other boards, this does nothing. + * + * @uts: Test state (in case in future we want to keep state here) + */ +void ut_silence_console(struct unit_test_state *uts); + +/** + * ut_unsilence_console() - Unsilence the console after a test + * + * This restarts console output again and turns off console recording. This + * happens on all boards, including sandbox. + */ +void ut_unsilence_console(struct unit_test_state *uts); + #endif diff --git a/test/bloblist.c b/test/bloblist.c index 0bb9e2d81e..900299dd68 100644 --- a/test/bloblist.c +++ b/test/bloblist.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -240,7 +239,6 @@ BLOBLIST_TEST(bloblist_test_checksum, 0); /* Test the 'bloblist info' command */ static int bloblist_test_cmd_info(struct unit_test_state *uts) { - struct sandbox_state *state = state_get_current(); struct bloblist_hdr *hdr; char *data, *data2; @@ -250,8 +248,7 @@ static int bloblist_test_cmd_info(struct unit_test_state *uts) data2 = bloblist_ensure(TEST_TAG2, TEST_SIZE2); console_record_reset_enable(); - if (!state->show_test_output) - gd->flags |= GD_FLG_SILENT; + ut_silence_console(uts); console_record_reset(); run_command("bloblist info", 0); ut_assert_nextline("base: %lx", (ulong)map_to_sysmem(hdr)); @@ -259,7 +256,7 @@ static int bloblist_test_cmd_info(struct unit_test_state *uts) ut_assert_nextline("alloced: 70 112 Bytes"); ut_assert_nextline("free: 390 912 Bytes"); ut_assert_console_end(); - gd->flags &= ~(GD_FLG_SILENT | GD_FLG_RECORD); + ut_unsilence_console(uts); return 0; } @@ -268,7 +265,6 @@ BLOBLIST_TEST(bloblist_test_cmd_info, 0); /* Test the 'bloblist list' command */ static int bloblist_test_cmd_list(struct unit_test_state *uts) { - struct sandbox_state *state = state_get_current(); struct bloblist_hdr *hdr; char *data, *data2; @@ -278,8 +274,7 @@ static int bloblist_test_cmd_list(struct unit_test_state *uts) data2 = bloblist_ensure(TEST_TAG2, TEST_SIZE2); console_record_reset_enable(); - if (!state->show_test_output) - gd->flags |= GD_FLG_SILENT; + ut_silence_console(uts); console_record_reset(); run_command("bloblist list", 0); ut_assert_nextline("Address Size Tag Name"); @@ -288,7 +283,7 @@ static int bloblist_test_cmd_list(struct unit_test_state *uts) ut_assert_nextline("%08lx %8x 2 SPL hand-off", (ulong)map_to_sysmem(data2), TEST_SIZE2); ut_assert_console_end(); - gd->flags &= ~(GD_FLG_SILENT | GD_FLG_RECORD); + ut_unsilence_console(uts); return 0; } diff --git a/test/ut.c b/test/ut.c index 95bdd66de6..44ed1ba2d3 100644 --- a/test/ut.c +++ b/test/ut.c @@ -8,6 +8,9 @@ #include #include #include +#ifdef CONFIG_SANDBOX +#include +#endif #include #include @@ -114,3 +117,18 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes) return upto == total_bytes ? 0 : 1; } + +void ut_silence_console(struct unit_test_state *uts) +{ +#ifdef CONFIG_SANDBOX + struct sandbox_state *state = state_get_current(); + + if (!state->show_test_output) + gd->flags |= GD_FLG_SILENT; +#endif +} + +void ut_unsilence_console(struct unit_test_state *uts) +{ + gd->flags &= ~(GD_FLG_SILENT | GD_FLG_RECORD); +} From 6ea5df39e8d072fbacc1c99645b8df63923f744d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 8 Nov 2020 21:08:44 -0700 Subject: [PATCH 06/34] test: Only enable bloblist test when supported This test cannot work unless CONFIG_BLOBLIST is enabled. Update it to add that condition. Reported-by: Kever Yang Signed-off-by: Simon Glass --- test/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Makefile b/test/Makefile index d4323f9963..3c7bc8b549 100644 --- a/test/Makefile +++ b/test/Makefile @@ -2,7 +2,7 @@ # # (C) Copyright 2012 The Chromium Authors -ifneq ($(CONFIG_SANDBOX),) +ifneq ($(CONFIG_$(SPL_)BLOBLIST),) obj-$(CONFIG_$(SPL_)CMDLINE) += bloblist.o endif obj-$(CONFIG_$(SPL_)CMDLINE) += bootm.o From 353df8d3c3ca876704d54a9d2cb94970197ad62f Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Thu, 19 Nov 2020 10:08:42 +0100 Subject: [PATCH 07/34] test: correct the test prefix in ut cmd_mem Align the prefix used in cmd_ut_category function and name of tests for ut mem. This patch solves the issues detected by "make qcheck" after previous patch. Fixes: 550a9e7902ce ("cmd: Update the memory-search command") Signed-off-by: Patrick Delaunay Reviewed-by: Simon Glass --- test/cmd/mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cmd/mem.c b/test/cmd/mem.c index fa6770e8c0..fbaa8a4b3c 100644 --- a/test/cmd/mem.c +++ b/test/cmd/mem.c @@ -15,6 +15,6 @@ int do_ut_mem(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) struct unit_test *tests = ll_entry_start(struct unit_test, mem_test); const int n_ents = ll_entry_count(struct unit_test, mem_test); - return cmd_ut_category("cmd_mem", "cmd_mem_", tests, n_ents, argc, + return cmd_ut_category("cmd_mem", "mem_test_", tests, n_ents, argc, argv); } From 76fde138832c82d87db0a29f62379bdcf21a5442 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Thu, 19 Nov 2020 10:08:43 +0100 Subject: [PATCH 08/34] test: correct the test prefix in ut str Align the prefix used in cmd_ut_category function and name of tests for ut str. This patch solves the issues detected by "make qcheck" after previous patch. Fixes: fdc79a6b125d ("lib: Add a function to convert a string to upper case") Signed-off-by: Patrick Delaunay Reviewed-by: Simon Glass --- test/str_ut.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/str_ut.c b/test/str_ut.c index ef1205dbbd..cd5045516d 100644 --- a/test/str_ut.c +++ b/test/str_ut.c @@ -19,7 +19,7 @@ static const char str3[] = "0xbI'm sorry you're alive."; /* Declare a new str test */ #define STR_TEST(_name, _flags) UNIT_TEST(_name, _flags, str_test) -static int str_test_upper(struct unit_test_state *uts) +static int str_upper(struct unit_test_state *uts) { char out[TEST_STR_SIZE]; @@ -55,7 +55,7 @@ static int str_test_upper(struct unit_test_state *uts) return 0; } -STR_TEST(str_test_upper, 0); +STR_TEST(str_upper, 0); static int run_strtoul(struct unit_test_state *uts, const char *str, int base, ulong expect_val, int expect_endp_offset, bool upper) From 2d572ede1185db2129685e8cedfb690a5e3c4d3d Mon Sep 17 00:00:00 2001 From: Nishanth Menon Date: Thu, 19 Nov 2020 22:10:54 -0600 Subject: [PATCH 09/34] power: regulator: Kconfig: add a dependency for POWER_SUPPORT for SPL power/regulator will not be built if just CONFIG_SPL_DM_REGULATOR is enabled. It needs CONFIG_SPL_POWER_SUPPORT to be enabled as well. For example, if we just need a GPIO regulator in SPL: CONFIG_DM_REGULATOR=y CONFIG_SPL_DM_REGULATOR=y CONFIG_DM_REGULATOR_GPIO=y CONFIG_SPL_DM_REGULATOR_GPIO=y Will not suffice, since the entire regulator build for SPL depends on CONFIG_SPL_POWER_SUPPORT. Elaborate that information in the Kconfig dependency. Signed-off-by: Nishanth Menon Reviewed-by: Jaehoon Chung --- drivers/power/regulator/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/power/regulator/Kconfig b/drivers/power/regulator/Kconfig index d431102462..fbbea18c7d 100644 --- a/drivers/power/regulator/Kconfig +++ b/drivers/power/regulator/Kconfig @@ -18,7 +18,7 @@ config DM_REGULATOR config SPL_DM_REGULATOR bool "Enable regulators for SPL" - depends on DM_REGULATOR + depends on DM_REGULATOR && SPL_POWER_SUPPORT ---help--- Regulators are seldom needed in SPL. Even if they are accessed, some code space can be saved by accessing the PMIC registers directly. From 31ce367cd10087b532431c023e4a95513ecdee5d Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Fri, 20 Nov 2020 11:45:35 +0100 Subject: [PATCH 10/34] lib/uuid.c: change prototype of uuid_guid_get_str() There's no reason to require an appropriately sized output parameter for the string, that's error-prone should the table ever grow an element with a longer string. We can just return the const char* pointer directly. Update the only caller accordingly, and get rid of pointless ifdeffery in the header so that the compiler always sees a declaration and can thus do type-checking, whether or not PARTITION_TYPE_GUID is enabled or not. Signed-off-by: Rasmus Villemoes --- disk/part_efi.c | 9 +++++---- include/uuid.h | 4 +--- lib/uuid.c | 11 +++++------ 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/disk/part_efi.c b/disk/part_efi.c index 60b1c1d761..2f922662e6 100644 --- a/disk/part_efi.c +++ b/disk/part_efi.c @@ -247,10 +247,11 @@ void part_print_efi(struct blk_desc *dev_desc) uuid_bin = (unsigned char *)gpt_pte[i].partition_type_guid.b; uuid_bin_to_str(uuid_bin, uuid, UUID_STR_FORMAT_GUID); printf("\ttype:\t%s\n", uuid); -#ifdef CONFIG_PARTITION_TYPE_GUID - if (!uuid_guid_get_str(uuid_bin, uuid)) - printf("\ttype:\t%s\n", uuid); -#endif + if (CONFIG_IS_ENABLED(PARTITION_TYPE_GUID)) { + const char *type = uuid_guid_get_str(uuid_bin); + if (type) + printf("\ttype:\t%s\n", type); + } uuid_bin = (unsigned char *)gpt_pte[i].unique_partition_guid.b; uuid_bin_to_str(uuid_bin, uuid, UUID_STR_FORMAT_GUID); printf("\tguid:\t%s\n", uuid); diff --git a/include/uuid.h b/include/uuid.h index 73c5a89ec7..0c653cb087 100644 --- a/include/uuid.h +++ b/include/uuid.h @@ -39,10 +39,8 @@ int uuid_str_to_bin(const char *uuid_str, unsigned char *uuid_bin, int str_format); void uuid_bin_to_str(const unsigned char *uuid_bin, char *uuid_str, int str_format); -#ifdef CONFIG_PARTITION_TYPE_GUID int uuid_guid_get_bin(const char *guid_str, unsigned char *guid_bin); -int uuid_guid_get_str(const unsigned char *guid_bin, char *guid_str); -#endif +const char *uuid_guid_get_str(const unsigned char *guid_bin); void gen_rand_uuid(unsigned char *uuid_bin); void gen_rand_uuid_str(char *uuid_str, int str_format); #endif diff --git a/lib/uuid.c b/lib/uuid.c index e62d5ca264..6cfb6cd449 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -122,20 +122,19 @@ int uuid_guid_get_bin(const char *guid_str, unsigned char *guid_bin) * uuid_guid_get_str() - this function get string for GUID. * * @param guid_bin - pointer to string with partition type guid [16B] - * @param guid_str - pointer to allocated partition type string [7B] + * + * Returns NULL if the type GUID is not known. */ -int uuid_guid_get_str(const unsigned char *guid_bin, char *guid_str) +const char *uuid_guid_get_str(const unsigned char *guid_bin) { int i; - *guid_str = 0; for (i = 0; i < ARRAY_SIZE(list_guid); i++) { if (!memcmp(list_guid[i].guid.b, guid_bin, 16)) { - strcpy(guid_str, list_guid[i].string); - return 0; + return list_guid[i].string; } } - return -ENODEV; + return NULL; } #endif From c0364ce1c6957c5295e933b95802e6966e00b08f Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Fri, 20 Nov 2020 11:45:36 +0100 Subject: [PATCH 11/34] doc/README.gpt: define partition type GUID for U-Boot environment When setting aside a GPT partition for holding the U-Boot environment, having a partition type GUID [1] indicating "Linux filesystem" (as most tools default to) is somewhat misleading - and there's no other well-known type GUID that is better suited. So to have a canonical value to put into the type field, define 3de21764-95bd-54bd-a5c3-4abe786f38a8 to mean a partition holding a U-Boot environment. This is a v5 namespace-name GUID [2], generated [3] from a namespace of "25cbcde0-8642-47c6-a298-1a3a57cd256b" and name "U-Boot environment". Should future type GUIDs be defined in the context of U-Boot, it's sensible to use that same namespace GUID. [1] https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs [2] https://en.wikipedia.org/wiki/Universally_unique_identifier#Versions_3_and_5_(namespace_name-based) [3] https://www.uuidtools.com/v5 Signed-off-by: Rasmus Villemoes --- doc/README.gpt | 2 ++ include/part_efi.h | 3 +++ lib/uuid.c | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/README.gpt b/doc/README.gpt index facd7afc3a..9e0d2221ef 100644 --- a/doc/README.gpt +++ b/doc/README.gpt @@ -267,6 +267,8 @@ Some strings can be also used at the place of known GUID : (0657FD6D-A4AB-43C4-84E5-0933C84B4F4F) "lvm" = PARTITION_LINUX_LVM_GUID (E6D6D379-F507-44C2-A23C-238F2A3DF928) + "u-boot-env" = PARTITION_U_BOOT_ENVIRONMENT + (3DE21764-95BD-54BD-A5C3-4ABE786F38A8) "uuid_disk=...;name=u-boot,size=60MiB,uuid=...; name=kernel,size=60MiB,uuid=...,type=linux;" diff --git a/include/part_efi.h b/include/part_efi.h index 1929e4400f..c68529b4da 100644 --- a/include/part_efi.h +++ b/include/part_efi.h @@ -56,6 +56,9 @@ #define PARTITION_LINUX_LVM_GUID \ EFI_GUID( 0xe6d6d379, 0xf507, 0x44c2, \ 0xa2, 0x3c, 0x23, 0x8f, 0x2a, 0x3d, 0xf9, 0x28) +#define PARTITION_U_BOOT_ENVIRONMENT \ + EFI_GUID( 0x3de21764, 0x95bd, 0x54bd, \ + 0xa5, 0xc3, 0x4a, 0xbe, 0x78, 0x6f, 0x38, 0xa8) /* linux/include/efi.h */ typedef u16 efi_char16_t; diff --git a/lib/uuid.c b/lib/uuid.c index 6cfb6cd449..54a93aacc9 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -96,7 +96,8 @@ static const struct { {"linux", PARTITION_LINUX_FILE_SYSTEM_DATA_GUID}, {"raid", PARTITION_LINUX_RAID_GUID}, {"swap", PARTITION_LINUX_SWAP_GUID}, - {"lvm", PARTITION_LINUX_LVM_GUID} + {"lvm", PARTITION_LINUX_LVM_GUID}, + {"u-boot-env", PARTITION_U_BOOT_ENVIRONMENT}, }; /* From 214cc199b475586bb0ac00794deac18ad27af4eb Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Fri, 20 Nov 2020 11:45:37 +0100 Subject: [PATCH 12/34] doc/README.gpt: reflow partition type GUID table The previous patch made the table look bad. Fix it, and leave some space for a future element being a bit longer than the current maximum. Signed-off-by: Rasmus Villemoes --- doc/README.gpt | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/doc/README.gpt b/doc/README.gpt index 9e0d2221ef..ac975f66b8 100644 --- a/doc/README.gpt +++ b/doc/README.gpt @@ -251,22 +251,22 @@ can specify a other partition type guid: type=0FC63DAF-8483-4772-8E79-3D69D8477DE4;" Some strings can be also used at the place of known GUID : - "system" = PARTITION_SYSTEM_GUID - (C12A7328-F81F-11D2-BA4B-00A0C93EC93B) - "mbr" = LEGACY_MBR_PARTITION_GUID - (024DEE41-33E7-11D3-9D69-0008C781F39F) - "msft" = PARTITION_MSFT_RESERVED_GUID - (E3C9E316-0B5C-4DB8-817D-F92DF00215AE) - "data" = PARTITION_BASIC_DATA_GUID - (EBD0A0A2-B9E5-4433-87C0-68B6B72699C7) - "linux" = PARTITION_LINUX_FILE_SYSTEM_DATA_GUID - (0FC63DAF-8483-4772-8E79-3D69D8477DE4) - "raid" = PARTITION_LINUX_RAID_GUID - (A19D880F-05FC-4D3B-A006-743F0F84911E) - "swap" = PARTITION_LINUX_SWAP_GUID - (0657FD6D-A4AB-43C4-84E5-0933C84B4F4F) - "lvm" = PARTITION_LINUX_LVM_GUID - (E6D6D379-F507-44C2-A23C-238F2A3DF928) + "system" = PARTITION_SYSTEM_GUID + (C12A7328-F81F-11D2-BA4B-00A0C93EC93B) + "mbr" = LEGACY_MBR_PARTITION_GUID + (024DEE41-33E7-11D3-9D69-0008C781F39F) + "msft" = PARTITION_MSFT_RESERVED_GUID + (E3C9E316-0B5C-4DB8-817D-F92DF00215AE) + "data" = PARTITION_BASIC_DATA_GUID + (EBD0A0A2-B9E5-4433-87C0-68B6B72699C7) + "linux" = PARTITION_LINUX_FILE_SYSTEM_DATA_GUID + (0FC63DAF-8483-4772-8E79-3D69D8477DE4) + "raid" = PARTITION_LINUX_RAID_GUID + (A19D880F-05FC-4D3B-A006-743F0F84911E) + "swap" = PARTITION_LINUX_SWAP_GUID + (0657FD6D-A4AB-43C4-84E5-0933C84B4F4F) + "lvm" = PARTITION_LINUX_LVM_GUID + (E6D6D379-F507-44C2-A23C-238F2A3DF928) "u-boot-env" = PARTITION_U_BOOT_ENVIRONMENT (3DE21764-95BD-54BD-A5C3-4ABE786F38A8) From 652b504ff2dc41313ad7f38a00e1d5730966f164 Mon Sep 17 00:00:00 2001 From: Joel Peshkin Date: Sat, 21 Nov 2020 17:18:59 -0800 Subject: [PATCH 13/34] Add optional salt to AUTOBOOT_STOP_STR_SHA256 Adds an optional SALT value to AUTOBOOT_STOP_STR_SHA256. If a string followed by a ":" is prepended to the sha256, the portion to the left of the colon will be used as a salt and the password will be appended to the salt before the sha256 is computed and compared. Signed-off-by: Joel Peshkin Cc: Simon Glass Cc: Bin Meng Cc: Patrick Delaunay Cc: Heiko Schocher Cc: Heinrich Schuchardt Cc: Joel Peshkin To: u-boot@lists.denx.de Reviewed-by: Simon Glass Reviewed-by: Heiko Schocher --- common/Kconfig.boot | 5 ++++- common/autoboot.c | 12 ++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/common/Kconfig.boot b/common/Kconfig.boot index 58e98548de..4525a12ab4 100644 --- a/common/Kconfig.boot +++ b/common/Kconfig.boot @@ -819,7 +819,10 @@ config AUTOBOOT_STOP_STR_SHA256 This option adds the feature to only stop the autobooting, and therefore boot into the U-Boot prompt, when the input string / password matches a values that is encypted via - a SHA256 hash and saved in the environment. + a SHA256 hash and saved in the environment variable + "bootstopkeysha256". If the value in that variable + includes a ":", the portion prior to the ":" will be treated + as a salt value. config AUTOBOOT_USE_MENUKEY bool "Allow a specify key to run a menu from the environment" diff --git a/common/autoboot.c b/common/autoboot.c index e628baffb8..ddb6246be3 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -25,7 +25,7 @@ DECLARE_GLOBAL_DATA_PTR; -#define MAX_DELAY_STOP_STR 32 +#define MAX_DELAY_STOP_STR 64 #ifndef DEBUG_BOOTKEYS #define DEBUG_BOOTKEYS 0 @@ -80,6 +80,7 @@ static int passwd_abort_sha256(uint64_t etime) u8 sha_env[SHA256_SUM_LEN]; u8 *sha; char *presskey; + char *c; const char *algo_name = "sha256"; u_int presskey_len = 0; int abort = 0; @@ -89,6 +90,14 @@ static int passwd_abort_sha256(uint64_t etime) if (sha_env_str == NULL) sha_env_str = AUTOBOOT_STOP_STR_SHA256; + presskey = malloc_cache_aligned(MAX_DELAY_STOP_STR); + c = strstr(sha_env_str, ":"); + if (c && (c - sha_env_str < MAX_DELAY_STOP_STR)) { + /* preload presskey with salt */ + memcpy(presskey, sha_env_str, c - sha_env_str); + presskey_len = c - sha_env_str; + sha_env_str = c + 1; + } /* * Generate the binary value from the environment hash value * so that we can compare this value with the computed hash @@ -100,7 +109,6 @@ static int passwd_abort_sha256(uint64_t etime) return 0; } - presskey = malloc_cache_aligned(MAX_DELAY_STOP_STR); sha = malloc_cache_aligned(SHA256_SUM_LEN); size = SHA256_SUM_LEN; /* From d2e64d29c44dee6d455f7705dd1cf1af8674ad9a Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Sun, 22 Nov 2020 14:58:45 +1000 Subject: [PATCH 14/34] cli_readline: Only insert printable chars There should be no need to insert non-printable characters and this prevents line editing getting confused. Signed-off-by: Steve Bennett --- common/cli_readline.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/cli_readline.c b/common/cli_readline.c index 47b876285c..5c158d03b4 100644 --- a/common/cli_readline.c +++ b/common/cli_readline.c @@ -493,8 +493,10 @@ static int cread_line(const char *const prompt, char *buf, unsigned int *len, } #endif default: - cread_add_char(ichar, insert, &num, &eol_num, buf, - *len); + if (ichar >= ' ' && ichar <= '~') { + cread_add_char(ichar, insert, &num, &eol_num, + buf, *len); + } break; } } From c61b2bf30c090b19cb2e84a7cf6e29de8773a411 Mon Sep 17 00:00:00 2001 From: Philippe Reynes Date: Tue, 24 Nov 2020 16:15:05 +0100 Subject: [PATCH 15/34] common: spl: spl_fit.c: report an error on hash check fail When the hash check fails on a loadable image, the SPL/TPL simply jump to the next one. This commit changes this behaviour, when the hash check fails on a loadable image, the function spl_load_simple_fit stops and report an error. Signed-off-by: Philippe Reynes Reviewed-by: Simon Glass --- common/spl/spl_fit.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 795e2922ce..a6ad094e91 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -684,8 +684,11 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, ret = spl_load_fit_image(info, sector, fit, base_offset, node, &image_info); - if (ret < 0) - continue; + if (ret < 0) { + printf("%s: can't load image loadables index %d (ret = %d)\n", + __func__, index, ret); + return ret; + } if (!spl_fit_image_get_os(fit, node, &os_type)) debug("Loadable is %s\n", genimg_get_os_name(os_type)); From 7cf5b4053b433ae0dbb0462e58fd426b43fc69fd Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 26 Nov 2020 20:46:37 +0100 Subject: [PATCH 16/34] common: always compile fixup_cmdtable() With our optimization settings the linker eliminates unused functions. But for debugging it is better to compile with -Og or -O0. With -O0 compiling the sandbox fails due to the missing function fixup_cmdtable() called by dm_reloc() and others. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- common/command.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/common/command.c b/common/command.c index 068cb55b4c..3fe6791eda 100644 --- a/common/command.c +++ b/common/command.c @@ -16,6 +16,8 @@ #include #include +DECLARE_GLOBAL_DATA_PTR; + /* * Use puts() instead of printf() to avoid printf buffer overflow * for long help messages @@ -488,9 +490,6 @@ int cmd_get_data_size(char* arg, int default_size) } #endif -#if defined(CONFIG_NEEDS_MANUAL_RELOC) -DECLARE_GLOBAL_DATA_PTR; - void fixup_cmdtable(struct cmd_tbl *cmdtp, int size) { int i; @@ -535,7 +534,6 @@ void fixup_cmdtable(struct cmd_tbl *cmdtp, int size) cmdtp++; } } -#endif int cmd_always_repeatable(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[], int *repeatable) From 449efce69a7b7aa5d399d750a5ed12273d0ca851 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Wed, 2 Dec 2020 15:16:13 +0100 Subject: [PATCH 17/34] console: cosmetics: remove #if 0 Remove the #if 0 present since the first version of console.c Signed-off-by: Patrick Delaunay Reviewed-by: Simon Glass --- common/console.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/common/console.c b/common/console.c index b15f732ccb..f3cc45cab5 100644 --- a/common/console.c +++ b/common/console.c @@ -1029,11 +1029,6 @@ done: gd->flags |= GD_FLG_DEVINIT; /* device initialization completed */ -#if 0 - /* If nothing usable installed, use only the initial console */ - if ((stdio_devices[stdin] == NULL) && (stdio_devices[stdout] == NULL)) - return 0; -#endif print_pre_console_buffer(flushpoint); return 0; } @@ -1105,11 +1100,6 @@ int console_init_r(void) gd->flags |= GD_FLG_DEVINIT; /* device initialization completed */ -#if 0 - /* If nothing usable installed, use only the initial console */ - if ((stdio_devices[stdin] == NULL) && (stdio_devices[stdout] == NULL)) - return 0; -#endif print_pre_console_buffer(flushpoint); return 0; } From a59153dfebb065663fef64827e73aa771c683960 Mon Sep 17 00:00:00 2001 From: Vabhav Sharma Date: Wed, 9 Dec 2020 10:42:03 +0530 Subject: [PATCH 18/34] dm: core: add function uclass_probe_all() to probe all devices Support a common method to probe all devices associated with uclass. This includes data structures and code for finding the first device and looping for remaining devices associated with uclasses (groups of devices with the same purpose, e.g. all SERIAL ports will be in the same uclass). An example is SBSA compliant PL011 UART IP, where firmware does the serial port initialization and prepare uart device to let the kernel use it for sending and reveiving the characters.SERIAL uclass will use this function to initialize PL011 UART ports. The feature is enabled with CONFIG_DM. Signed-off-by: Vabhav Sharma Reviewed-by: Stefan Roese Reviewed-by: Simon Glass Reviewed-by: Sean Anderson --- drivers/core/uclass.c | 19 +++++++++++++++++++ include/dm/uclass.h | 11 +++++++++++ 2 files changed, 30 insertions(+) diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index cdb975d5b3..f38122d54b 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -757,6 +757,25 @@ int uclass_pre_remove_device(struct udevice *dev) } #endif +int uclass_probe_all(enum uclass_id id) +{ + struct udevice *dev; + int ret; + + ret = uclass_first_device(id, &dev); + if (ret || !dev) + return ret; + + /* Scanning uclass to probe all devices */ + while (dev) { + ret = uclass_next_device(&dev); + if (ret) + return ret; + } + + return 0; +} + UCLASS_DRIVER(nop) = { .id = UCLASS_NOP, .name = "nop", diff --git a/include/dm/uclass.h b/include/dm/uclass.h index b5f066dbf4..d95683740c 100644 --- a/include/dm/uclass.h +++ b/include/dm/uclass.h @@ -376,6 +376,17 @@ int uclass_next_device_check(struct udevice **devp); int uclass_first_device_drvdata(enum uclass_id id, ulong driver_data, struct udevice **devp); +/** + * uclass_probe_all() - Probe all devices based on an uclass ID + * + * This function probes all devices associated with a uclass by + * looking for its ID. + * + * @id: uclass ID to look up + * @return 0 if OK, other -ve on error + */ +int uclass_probe_all(enum uclass_id id); + /** * uclass_id_foreach_dev() - Helper function to iteration through devices * From 67b2ed024373f830ffe10fd19b2533d093664ec8 Mon Sep 17 00:00:00 2001 From: Vabhav Sharma Date: Wed, 9 Dec 2020 10:42:04 +0530 Subject: [PATCH 19/34] drivers: serial: probe all uart devices U-Boot DM model probe only single device at a time which is enabled and configured using device tree or platform data method. PL011 UART IP is SBSA compliant and firmware does the serial port set-up, initialization and let the kernel use UART port for sending and receiving characters. Normally software talk to one serial port time but some LayerScape platform require all the UART devices enabled in Linux for various use case. Adding support to probe all enabled serial devices like SBSA compliant PL011 UART ports probe and initialization by firmware. Signed-off-by: Vabhav Sharma Reviewed-by: Stefan Roese Reviewed-by: Simon Glass Reviewed-by: Sean Anderson --- drivers/serial/Kconfig | 16 ++++++++++++++++ drivers/serial/serial-uclass.c | 9 +++++++++ 2 files changed, 25 insertions(+) diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index b4805a2e4e..129494322c 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -134,6 +134,22 @@ config SERIAL_SEARCH_ALL If unsure, say N. +config SERIAL_PROBE_ALL + bool "Probe all available serial devices" + depends on DM_SERIAL + default n + help + The serial subsystem only probes for a single serial device, + but does not probe for other remaining serial devices. + With this option set, we make probing and searching for + all available devices optional. + Normally, U-Boot talks to one serial port at a time, but SBSA + compliant UART devices like PL011 require initialization + by firmware and to let the kernel use serial port for sending + and receiving the characters. + + If unsure, say N. + config SPL_DM_SERIAL bool "Enable Driver Model for serial drivers in SPL" depends on DM_SERIAL && SPL_DM diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index 58a6541d8c..ead0193ad4 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -172,6 +172,15 @@ int serial_init(void) /* Called after relocation */ int serial_initialize(void) { + /* Scanning uclass to probe devices */ + if (IS_ENABLED(CONFIG_SERIAL_PROBE_ALL)) { + int ret; + + ret = uclass_probe_all(UCLASS_SERIAL); + if (ret) + return ret; + } + return serial_init(); } From 976a68a20d366e6497253bad9fe0d7a8e42a611c Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Fri, 11 Dec 2020 14:59:23 +0100 Subject: [PATCH 20/34] string: Use memcpy() within memmove() when we can A common use of memmove() can be handled by memcpy(). Also memcpy() includes an optimization for large sizes: it copies a word at a time. So we can get a speed-up by calling memcpy() to handle our move in this case. Update memmove() to call also memcpy() if the source don't overlap the destination (src + count <= dest). Signed-off-by: Patrick Delaunay --- lib/string.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/string.c b/lib/string.c index ae7835f600..73b984123d 100644 --- a/lib/string.c +++ b/lib/string.c @@ -567,7 +567,19 @@ void * memmove(void * dest,const void *src,size_t count) { char *tmp, *s; - if (dest <= src) { + if (dest <= src || (src + count) <= dest) { + /* + * Use the fast memcpy implementation (ARCH optimized or lib/string.c) when it is possible: + * - when dest is before src (assuming that memcpy is doing forward-copying) + * - when destination don't overlap the source buffer (src + count <= dest) + * + * WARNING: the first optimisation cause an issue, when __HAVE_ARCH_MEMCPY is defined, + * __HAVE_ARCH_MEMMOVE is not defined and if the memcpy ARCH-specific + * implementation is not doing a forward-copying. + * + * No issue today because memcpy is doing a forward-copying in lib/string.c and for ARM32 + * architecture; no other arches use __HAVE_ARCH_MEMCPY without __HAVE_ARCH_MEMMOVE. + */ memcpy(dest, src, count); } else { tmp = (char *) dest + count; From 83a287a613f3f50aceaf8f0131402b5093368009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Sun, 27 Dec 2020 01:04:38 +0100 Subject: [PATCH 21/34] bootmenu: Allow to quit it via ESC/CTRL+C MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When ESC/CTRL+C is pressed interrupt bootmenu and jump into U-Boot console. As the last entry in bootmenu is always U-Boot console just choose the last entry when ESC or CTRL+C is pressed. ESC key is detected when either no other character appears after '\e' within 10ms or when non-'[' appears after '\e'. It is useful when bootmenu is part of boot process and you want to interrupt boot process by scripts which control U-Boot (serial) console. Signed-off-by: Pali Rohár Reviewed-by: Simon Glass --- cmd/bootmenu.c | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c index 1ba7b622e5..409ef9a848 100644 --- a/cmd/bootmenu.c +++ b/cmd/bootmenu.c @@ -45,6 +45,7 @@ enum bootmenu_key { KEY_UP, KEY_DOWN, KEY_SELECT, + KEY_QUIT, }; static char *bootmenu_getoption(unsigned short int n) @@ -109,6 +110,9 @@ static void bootmenu_autoboot_loop(struct bootmenu_data *menu, case '\r': *key = KEY_SELECT; break; + case 0x3: /* ^C */ + *key = KEY_QUIT; + break; default: *key = KEY_NONE; break; @@ -136,13 +140,25 @@ static void bootmenu_loop(struct bootmenu_data *menu, { int c; - while (!tstc()) { - WATCHDOG_RESET(); - mdelay(10); + if (*esc == 1) { + if (tstc()) { + c = getchar(); + } else { + WATCHDOG_RESET(); + mdelay(10); + if (tstc()) + c = getchar(); + else + c = '\e'; + } + } else { + while (!tstc()) { + WATCHDOG_RESET(); + mdelay(10); + } + c = getchar(); } - c = getchar(); - switch (*esc) { case 0: /* First char of ANSI escape sequence '\e' */ @@ -157,7 +173,9 @@ static void bootmenu_loop(struct bootmenu_data *menu, *esc = 2; *key = KEY_NONE; } else { - *esc = 0; + /* Alone ESC key was pressed */ + *key = KEY_QUIT; + *esc = (c == '\e') ? 1 : 0; } break; case 2: @@ -187,6 +205,10 @@ static void bootmenu_loop(struct bootmenu_data *menu, /* enter key was pressed */ if (c == '\r') *key = KEY_SELECT; + + /* ^C was pressed */ + if (c == 0x3) + *key = KEY_QUIT; } static char *bootmenu_choice_entry(void *data) @@ -222,6 +244,12 @@ static char *bootmenu_choice_entry(void *data) for (i = 0; i < menu->active; ++i) iter = iter->next; return iter->key; + case KEY_QUIT: + /* Quit by choosing the last entry - U-Boot console */ + iter = menu->first; + while (iter->next) + iter = iter->next; + return iter->key; default: break; } @@ -389,7 +417,7 @@ static void menu_display_statusline(struct menu *m) 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(" Press UP/DOWN to move, ENTER to select, ESC/CTRL+C to quit"); puts(ANSI_CLEAR_LINE_TO_END); printf(ANSI_CURSOR_POSITION, menu->count + 7, 1); puts(ANSI_CLEAR_LINE); From 1d55eb1544f7fcbbc8b39d6f445ba74788bf94bf Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sun, 27 Dec 2020 21:34:43 +0100 Subject: [PATCH 22/34] dts: Log name of expected .dtb file Make it more obvious what .dts file was expected by the build system. When adding support for a new board, I kept getting this error message, assuming I passed a wrong DEVICE_TREE parameter. However, what was really the mistake was that the entry in `arch/arm/dts/Makefile` was missing, and u-boot didn't like not being able to find the .dtb file that should have been produced. Simply logging the expected .dtb file name should make it easier to spot such mistakes. Signed-off-by: Florian Klink --- dts/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dts/Makefile b/dts/Makefile index 94967cf656..cb31113829 100644 --- a/dts/Makefile +++ b/dts/Makefile @@ -33,7 +33,7 @@ targets += dt.dtb $(DTB): arch-dtbs $(Q)test -e $@ || ( \ echo >&2; \ - echo >&2 "Device Tree Source is not correctly specified."; \ + echo >&2 "Device Tree Source ($@) is not correctly specified."; \ echo >&2 "Please define 'CONFIG_DEFAULT_DEVICE_TREE'"; \ echo >&2 "or build with 'DEVICE_TREE=' argument"; \ echo >&2; \ From 52e77726ef94f6c800be52a725072b738a452273 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Mon, 28 Dec 2020 20:13:11 +0800 Subject: [PATCH 23/34] common: Makefile: drop duplicated line obj-$(CONFIG_$(SPL_TPL_)YMODEM_SUPPORT) += xyzModem.o is there, no need obj-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o Signed-off-by: Peng Fan Reviewed-by: Simon Glass --- common/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/common/Makefile b/common/Makefile index bcf352d016..daeea67cf2 100644 --- a/common/Makefile +++ b/common/Makefile @@ -68,7 +68,6 @@ obj-$(CONFIG_DFU_OVER_USB) += dfu.o endif obj-$(CONFIG_SPL_HASH_SUPPORT) += hash.o obj-$(CONFIG_TPL_HASH_SUPPORT) += hash.o -obj-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o obj-$(CONFIG_SPL_LOAD_FIT) += common_fit.o obj-$(CONFIG_SPL_NET_SUPPORT) += miiphyutil.o obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += fdt_support.o From 0634b374aeb96f8e1b0c76e77de3b247577254e8 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Mon, 28 Dec 2020 20:13:13 +0800 Subject: [PATCH 24/34] armv8: Makefile: build cache files when needed If no need cache support, not build the cache files, such as in SPL. Signed-off-by: Peng Fan --- arch/arm/cpu/armv8/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/cpu/armv8/Makefile b/arch/arm/cpu/armv8/Makefile index f7b4a5ee46..d85ddde430 100644 --- a/arch/arm/cpu/armv8/Makefile +++ b/arch/arm/cpu/armv8/Makefile @@ -9,14 +9,16 @@ obj-y += cpu.o ifndef CONFIG_$(SPL_TPL_)TIMER obj-$(CONFIG_SYS_ARCH_TIMER) += generic_timer.o endif +ifndef CONFIG_$(SPL_)SYS_DCACHE_OFF obj-y += cache_v8.o +obj-y += cache.o +endif ifdef CONFIG_SPL_BUILD obj-$(CONFIG_ARMV8_SPL_EXCEPTION_VECTORS) += exceptions.o else obj-y += exceptions.o obj-y += exception_level.o endif -obj-y += cache.o obj-y += tlb.o obj-y += transition.o ifndef CONFIG_ARMV8_PSCI From 3e50deece014bc6e3dc57e85dc2b903630f7f69a Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 28 Dec 2020 17:56:27 +0100 Subject: [PATCH 25/34] lib: aes: build failure with DEBUG=1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Building fails with DEBUG=1: lib/aes.c: In function ‘debug_print_vector’: lib/aes.c:622:45: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] 622 | printf("%s [%d] @0x%08x", name, num_bytes, (u32)data); Pointers can only be cast to (uintptr_t). But anyway we have %p for printing pointers. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- lib/aes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/aes.c b/lib/aes.c index c998aecb3c..05ec235702 100644 --- a/lib/aes.c +++ b/lib/aes.c @@ -619,7 +619,7 @@ void aes_decrypt(u32 key_len, u8 *in, u8 *expkey, u8 *out) static void debug_print_vector(char *name, u32 num_bytes, u8 *data) { #ifdef DEBUG - printf("%s [%d] @0x%08x", name, num_bytes, (u32)data); + printf("%s [%d] @0x%p", name, num_bytes, data); print_buffer(0, data, 1, num_bytes, 16); #endif } From 834427d46365e5e76ec5b23eca40063f7881c493 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 28 Dec 2020 21:31:43 +0100 Subject: [PATCH 26/34] lib: zlib: include ctype.h Our ctype.h is in include/linux/ Signed-off-by: Heinrich Schuchardt --- lib/zlib/trees.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/zlib/trees.c b/lib/zlib/trees.c index 3e09517ed0..700c62f6d7 100644 --- a/lib/zlib/trees.c +++ b/lib/zlib/trees.c @@ -38,7 +38,7 @@ #include "deflate.h" #ifdef DEBUG -# include +# include #endif /* =========================================================================== From 986c841c8b41ba3dc8d8bc4ce3802779cf69bfc0 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 28 Dec 2020 21:41:40 +0100 Subject: [PATCH 27/34] lib: zlib: our putc() takes only one argument In contrast to the C99 standard [1] our putc() takes only one argument. [1] ISO/IEC 9899:1999 Signed-off-by: Heinrich Schuchardt --- lib/zlib/deflate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/zlib/deflate.c b/lib/zlib/deflate.c index 1fe58d5da6..63473359e4 100644 --- a/lib/zlib/deflate.c +++ b/lib/zlib/deflate.c @@ -1284,7 +1284,7 @@ local void check_match(s, start, match, length) } if (z_verbose > 1) { fprintf(stderr,"\\[%d,%d]", start-match, length); - do { putc(s->window[start++], stderr); } while (--length != 0); + do { putc(s->window[start++]); } while (--length != 0); } } #else From bcb0203c616b907ee39a131693a8718eef338c7b Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 3 Jan 2021 16:10:45 +0100 Subject: [PATCH 28/34] mtd: misplaced log.h and dm/devres.h log.h and dm/devres.h are U-Boot includes. So placing them behind #ifndef __UBOOT__ does not make any sense. Fixes: f7ae49fc4f36 ("common: Drop log.h from common header") Fixes: 61b29b826838 ("dm: core: Require users of devres to include the header") Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- drivers/mtd/mtdcore.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 1a4dec34d9..0d1f94c6cb 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -9,8 +9,6 @@ */ #ifndef __UBOOT__ -#include -#include #include #include #include From f5abd8a616d1e8d9ff6c1fbd5d10496ab5dcf1ea Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 4 Jan 2021 08:02:52 +0100 Subject: [PATCH 29/34] ram: k3-j721e: rename BIT_MASK() The macro BIT_MASK is already defined in include/linux/bitops.h. To avoid name collisions rename BIT_MASK() in drivers/ram/k3-j721e/lpddr4_private.h to LPDDR4_BIT_MASK(). Remove superfluous parantheses. Remove superfluous comparison to 0. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- drivers/ram/k3-j721e/lpddr4.c | 14 +++++++------- drivers/ram/k3-j721e/lpddr4_private.h | 20 ++++++++++++-------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/drivers/ram/k3-j721e/lpddr4.c b/drivers/ram/k3-j721e/lpddr4.c index fc80fb1e2c..68043d7cb6 100644 --- a/drivers/ram/k3-j721e/lpddr4.c +++ b/drivers/ram/k3-j721e/lpddr4.c @@ -719,7 +719,7 @@ uint32_t lpddr4_checkctlinterrupt(const lpddr4_privatedata * pd, /* MISRA compliance (Shifting operation) check */ if (fieldshift < WORD_SHIFT) { - if (((ctlirqstatus >> fieldshift) & BIT_MASK) > 0U) { + if ((ctlirqstatus >> fieldshift) & LPDDR4_BIT_MASK) { *irqstatus = true; } else { *irqstatus = false; @@ -746,11 +746,11 @@ uint32_t lpddr4_ackctlinterrupt(const lpddr4_privatedata * pd, if (localinterrupt > WORD_SHIFT) { localinterrupt = (localinterrupt - (uint32_t) WORD_SHIFT); - regval = ((uint32_t) BIT_MASK << localinterrupt); + regval = (uint32_t)LPDDR4_BIT_MASK << localinterrupt; CPS_REG_WRITE(&(ctlregbase->LPDDR4__INT_ACK_1__REG), regval); } else { - regval = ((uint32_t) BIT_MASK << localinterrupt); + regval = (uint32_t)LPDDR4_BIT_MASK << localinterrupt; CPS_REG_WRITE(&(ctlregbase->LPDDR4__INT_ACK_0__REG), regval); } @@ -823,7 +823,7 @@ uint32_t lpddr4_checkphyindepinterrupt(const lpddr4_privatedata * pd, phyindepirqstatus = CPS_REG_READ(&(ctlregbase->LPDDR4__PI_INT_STATUS__REG)); *irqstatus = - (((phyindepirqstatus >> (uint32_t) intr) & BIT_MASK) > 0U); + !!((phyindepirqstatus >> (uint32_t)intr) & LPDDR4_BIT_MASK); } return result; } @@ -841,7 +841,7 @@ uint32_t lpddr4_ackphyindepinterrupt(const lpddr4_privatedata * pd, lpddr4_ctlregs *ctlregbase = (lpddr4_ctlregs *) pd->ctlbase; /* Write 1 to the requested bit to ACk the interrupt */ - regval = ((uint32_t) BIT_MASK << ui32shiftinterrupt); + regval = (uint32_t)LPDDR4_BIT_MASK << ui32shiftinterrupt; CPS_REG_WRITE(&(ctlregbase->LPDDR4__PI_INT_ACK__REG), regval); } @@ -894,7 +894,7 @@ static void lpddr4_checkwrlvlerror(lpddr4_ctlregs * ctlregbase, (volatile uint32_t *)(&(ctlregbase->LPDDR4__PHY_WRLVL_ERROR_OBS_0__REG)); /* PHY_WRLVL_ERROR_OBS_X[1:0] should be zero */ - errbitmask = (BIT_MASK << 1) | (BIT_MASK); + errbitmask = (LPDDR4_BIT_MASK << 1) | LPDDR4_BIT_MASK; for (snum = 0U; snum < DSLICE_NUM; snum++) { regval = CPS_REG_READ(regaddress); if ((regval & errbitmask) != 0U) { @@ -1054,7 +1054,7 @@ static void lpddr4_seterrors(lpddr4_ctlregs * ctlregbase, lpddr4_debuginfo * debuginfo, bool * errfoundptr) { - uint32_t errbitmask = (BIT_MASK << 0x1U) | (BIT_MASK); + uint32_t errbitmask = (LPDDR4_BIT_MASK << 0x1U) | LPDDR4_BIT_MASK; /* Check PLL observation registers for PLL lock errors */ debuginfo->pllerror = diff --git a/drivers/ram/k3-j721e/lpddr4_private.h b/drivers/ram/k3-j721e/lpddr4_private.h index 42c923464a..3d5017ea47 100644 --- a/drivers/ram/k3-j721e/lpddr4_private.h +++ b/drivers/ram/k3-j721e/lpddr4_private.h @@ -14,9 +14,9 @@ #define VERSION_0 (0x54d5da40U) #define VERSION_1 (0xc1865a1U) -#define BIT_MASK (0x1U) -#define BYTE_MASK (0xffU) -#define NIBBLE_MASK (0xfU) +#define LPDDR4_BIT_MASK (0x1U) +#define BYTE_MASK (0xffU) +#define NIBBLE_MASK (0xfU) #define WORD_SHIFT (32U) #define WORD_MASK (0xffffffffU) @@ -46,11 +46,15 @@ #define IO_CALIB_DONE ((uint32_t)0x1U << 23U) #define IO_CALIB_FIELD ((uint32_t)NIBBLE_MASK << 28U) #define IO_CALIB_STATE ((uint32_t)0xBU << 28U) -#define RX_CAL_DONE ((uint32_t)BIT_MASK << 4U) -#define CA_TRAIN_RL (((uint32_t)BIT_MASK << 5U) | ((uint32_t)BIT_MASK << 4U)) +#define RX_CAL_DONE ((uint32_t)LPDDR4_BIT_MASK << 4U) +#define CA_TRAIN_RL (((uint32_t)LPDDR4_BIT_MASK << 5U) | \ + ((uint32_t)LPDDR4_BIT_MASK << 4U)) #define WR_LVL_STATE (((uint32_t)NIBBLE_MASK) << 13U) -#define GATE_LVL_ERROR_FIELDS (((uint32_t)BIT_MASK << 7U) | ((uint32_t)BIT_MASK << 6U)) -#define READ_LVL_ERROR_FIELDS ((((uint32_t)NIBBLE_MASK) << 28U) | (((uint32_t)BYTE_MASK) << 16U)) -#define DQ_LVL_STATUS (((uint32_t)BIT_MASK << 26U) | (((uint32_t)BYTE_MASK) << 18U)) +#define GATE_LVL_ERROR_FIELDS (((uint32_t)LPDDR4_BIT_MASK << 7U) | \ + ((uint32_t)LPDDR4_BIT_MASK << 6U)) +#define READ_LVL_ERROR_FIELDS ((((uint32_t)NIBBLE_MASK) << 28U) | \ + (((uint32_t)BYTE_MASK) << 16U)) +#define DQ_LVL_STATUS (((uint32_t)LPDDR4_BIT_MASK << 26U) | \ + (((uint32_t)BYTE_MASK) << 18U)) #endif /* LPDDR4_PRIV_H */ From 5176365a6bdadd25afdf293eada911443466931d Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 4 Jan 2021 08:02:53 +0100 Subject: [PATCH 30/34] log: make debug_cond() function like Change debug_cond() such that it can be used instead of a function like debug(). Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- include/log.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/include/log.h b/include/log.h index 6bce560648..40ab551f37 100644 --- a/include/log.h +++ b/include/log.h @@ -217,10 +217,9 @@ static inline int _log_nop(enum log_category_t cat, enum log_level_t level, #if !_DEBUG && CONFIG_IS_ENABLED(LOG) #define debug_cond(cond, fmt, args...) \ - do { \ - if (1) \ - log(LOG_CATEGORY, LOGL_DEBUG, fmt, ##args); \ - } while (0) +({ \ + log(LOG_CATEGORY, LOGL_DEBUG, fmt, ##args); \ +}) #else /* _DEBUG */ @@ -229,11 +228,11 @@ static inline int _log_nop(enum log_category_t cat, enum log_level_t level, * computed by a preprocessor in the best case, allowing for the best * optimization. */ -#define debug_cond(cond, fmt, args...) \ - do { \ - if (cond) \ - printf(pr_fmt(fmt), ##args); \ - } while (0) +#define debug_cond(cond, fmt, args...) \ +({ \ + if (cond) \ + printf(pr_fmt(fmt), ##args); \ +}) #endif /* _DEBUG */ From 249679658750d7174bb954598fa10cbfe9195766 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 4 Jan 2021 08:02:54 +0100 Subject: [PATCH 31/34] log: provide missing macros With commit d094a0734cee ("log: allow for message continuation") we have defined a special log level and category for message continuation. Let's have a macro for using these. If logging is enabled log_cont() will create a continuation log output with the same logging level and category as the previous message. If logging is not enabled, log_cont() will print like printf(). Provide macros for logging levels LOG_EMERG, LOG_ALERT, LOG_CRIT. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- include/log.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/log.h b/include/log.h index 40ab551f37..2d27f9f657 100644 --- a/include/log.h +++ b/include/log.h @@ -156,6 +156,9 @@ static inline int _log_nop(enum log_category_t cat, enum log_level_t level, */ #if CONFIG_IS_ENABLED(LOG) #define _LOG_MAX_LEVEL CONFIG_VAL(LOG_MAX_LEVEL) +#define log_emer(_fmt...) log(LOG_CATEGORY, LOGL_EMERG, ##_fmt) +#define log_alert(_fmt...) log(LOG_CATEGORY, LOGL_ALERT, ##_fmt) +#define log_crit(_fmt...) log(LOG_CATEGORY, LOGL_CRIT, ##_fmt) #define log_err(_fmt...) log(LOG_CATEGORY, LOGL_ERR, ##_fmt) #define log_warning(_fmt...) log(LOG_CATEGORY, LOGL_WARNING, ##_fmt) #define log_notice(_fmt...) log(LOG_CATEGORY, LOGL_NOTICE, ##_fmt) @@ -163,12 +166,17 @@ static inline int _log_nop(enum log_category_t cat, enum log_level_t level, #define log_debug(_fmt...) log(LOG_CATEGORY, LOGL_DEBUG, ##_fmt) #define log_content(_fmt...) log(LOG_CATEGORY, LOGL_DEBUG_CONTENT, ##_fmt) #define log_io(_fmt...) log(LOG_CATEGORY, LOGL_DEBUG_IO, ##_fmt) +#define log_cont(_fmt...) log(LOGC_CONT, LOGL_CONT, ##_fmt) #else #define _LOG_MAX_LEVEL LOGL_INFO +#define log_emerg(_fmt, ...) printf(_fmt, ##__VA_ARGS__) +#define log_alert(_fmt, ...) printf(_fmt, ##__VA_ARGS__) +#define log_crit(_fmt, ...) printf(_fmt, ##__VA_ARGS__) #define log_err(_fmt, ...) printf(_fmt, ##__VA_ARGS__) #define log_warning(_fmt, ...) printf(_fmt, ##__VA_ARGS__) #define log_notice(_fmt, ...) printf(_fmt, ##__VA_ARGS__) #define log_info(_fmt, ...) printf(_fmt, ##__VA_ARGS__) +#define log_cont(_fmt, ...) printf(_fmt, ##__VA_ARGS__) #define log_debug(_fmt, ...) debug(_fmt, ##__VA_ARGS__) #define log_content(_fmt...) log_nop(LOG_CATEGORY, \ LOGL_DEBUG_CONTENT, ##_fmt) From c548a3886eafa5a018d5f1c8f232510ca53be9a2 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 4 Jan 2021 08:02:56 +0100 Subject: [PATCH 32/34] test: unit test for pr_err(), pr_cont() Provide a unit test for printing via pr_err() and pr_cont(). Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- test/log/Makefile | 1 + test/log/pr_cont_test.c | 45 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 test/log/pr_cont_test.c diff --git a/test/log/Makefile b/test/log/Makefile index 88bc573e9f..afdafa502a 100644 --- a/test/log/Makefile +++ b/test/log/Makefile @@ -8,6 +8,7 @@ obj-$(CONFIG_CMD_LOG) += log_filter.o ifdef CONFIG_UT_LOG obj-y += test-main.o +obj-y += pr_cont_test.o ifdef CONFIG_SANDBOX obj-$(CONFIG_LOG_SYSLOG) += syslog_test.o diff --git a/test/log/pr_cont_test.c b/test/log/pr_cont_test.c new file mode 100644 index 0000000000..236eff4b33 --- /dev/null +++ b/test/log/pr_cont_test.c @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2021, Heinrich Schuchardt + * + * Test continuation of log messages using pr_cont(). + */ + +#include +#include +#include +#include +#include +#include +#include + +#define BUFFSIZE 64 + +#undef CONFIG_LOGLEVEL +#define CONFIG_LOGLEVEL 4 + +DECLARE_GLOBAL_DATA_PTR; + +static int log_test_pr_cont(struct unit_test_state *uts) +{ + int log_fmt; + int log_level; + + log_fmt = gd->log_fmt; + log_level = gd->default_log_level; + + /* Write two messages, the second continuing the first */ + gd->log_fmt = BIT(LOGF_MSG); + gd->default_log_level = LOGL_INFO; + console_record_reset_enable(); + pr_err("ea%d ", 1); + pr_cont("cc%d\n", 2); + gd->default_log_level = log_level; + gd->log_fmt = log_fmt; + gd->flags &= ~GD_FLG_RECORD; + ut_assertok(ut_check_console_line(uts, "ea1 cc2")); + ut_assertok(ut_check_console_end(uts)); + + return 0; +} +LOG_TEST(log_test_pr_cont); From 6205bbb1e04ee2f8e503581201cc1c7c3179b070 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Mon, 4 Jan 2021 15:33:28 +0100 Subject: [PATCH 33/34] lib: cosmetic update of CONFIG_LIB_ELF description Change 2 typo error in CONFIG_LIB_ELF description: - Supoort => Support - fir => for Signed-off-by: Patrick Delaunay Reviewed-by: Simon Glass --- lib/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Kconfig b/lib/Kconfig index a704568443..88c43a38c3 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -695,8 +695,8 @@ config LIB_DATE config LIB_ELF bool help - Supoort basic elf loading/validating functions. - This supports fir 32 bit and 64 bit versions. + Support basic elf loading/validating functions. + This supports for 32 bit and 64 bit versions. endmenu From ad80a8d0877922db95fd0410314504c840d9d850 Mon Sep 17 00:00:00 2001 From: Ravik Hasija Date: Fri, 8 Jan 2021 09:55:58 -0800 Subject: [PATCH 34/34] cmd: disk: Remove fit_print_contents API fit_print_contents prints similar fit information as printed in bootm stages. Removing this API reduces redundancy & provides improvement in boottime. Signed-off-by: Ravik Hasija Reviewed-by: Simon Glass --- cmd/disk.c | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/disk.c b/cmd/disk.c index 8060e753eb..0bc3808dfe 100644 --- a/cmd/disk.c +++ b/cmd/disk.c @@ -120,7 +120,6 @@ int common_diskboot(struct cmd_tbl *cmdtp, const char *intf, int argc, return 1; } bootstage_mark(BOOTSTAGE_ID_IDE_FIT_READ_OK); - fit_print_contents(fit_hdr); } #endif