From 05f0c746069fc950243c108ac90bc1a221c903c5 Mon Sep 17 00:00:00 2001 From: Etienne Carriere Date: Fri, 5 Jun 2020 09:22:11 +0200 Subject: [PATCH 1/5] optee: fix copy of optee reserved-memory node Fix the loop that parses FDT for a reserved memory node named "optee". Before this change, if at least one subnode was found in the reserved-memory node, the function endlessly looped since instruction continue returned back in the loop without updating variable subnode. This change fixes the issue by using a for loop. Fixes: 6ccb05eae01b ("image: fdt: copy possible optee nodes to a loaded devicetree") Signed-off-by: Etienne Carriere Signed-off-by: Patrick Delaunay --- lib/optee/optee.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/optee/optee.c b/lib/optee/optee.c index e59b5766e7..457d4cca8a 100644 --- a/lib/optee/optee.c +++ b/lib/optee/optee.c @@ -156,8 +156,9 @@ int optee_copy_fdt_nodes(const void *old_blob, void *new_blob) /* optee inserts its memory regions as reserved-memory nodes */ nodeoffset = fdt_subnode_offset(old_blob, 0, "reserved-memory"); if (nodeoffset >= 0) { - subnode = fdt_first_subnode(old_blob, nodeoffset); - while (subnode >= 0) { + for (subnode = fdt_first_subnode(old_blob, nodeoffset); + subnode >= 0; + subnode = fdt_next_subnode(old_blob, subnode)) { const char *name = fdt_get_name(old_blob, subnode, NULL); if (!name) @@ -197,8 +198,6 @@ int optee_copy_fdt_nodes(const void *old_blob, void *new_blob) if (ret < 0) return ret; } - - subnode = fdt_next_subnode(old_blob, subnode); } } From a633a804a2a32693180ef156ed1a2dbc70b6d392 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Fri, 5 Jun 2020 11:45:12 +0200 Subject: [PATCH 2/5] trivial: Fix booot occurences s/booot/boot/g The first ase is booot instead of boot and second u-booot instead of u-boot. Signed-off-by: Michal Simek Reviewed-by: Jaehoon Chung --- board/freescale/p1010rdb/README.P1010RDB-PA | 2 +- cmd/mmc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/board/freescale/p1010rdb/README.P1010RDB-PA b/board/freescale/p1010rdb/README.P1010RDB-PA index 46c61237c7..0cb950d845 100644 --- a/board/freescale/p1010rdb/README.P1010RDB-PA +++ b/board/freescale/p1010rdb/README.P1010RDB-PA @@ -88,7 +88,7 @@ Note: 1 stands for 'on', 0 stands for 'off' Setting of hwconfig =================== If FlexCAN or TDM is needed, please set "fsl_p1010mux:tdm_can=can" or -"fsl_p1010mux:tdm_can=tdm" explicitly in u-booot prompt as below for example: +"fsl_p1010mux:tdm_can=tdm" explicitly in u-boot prompt as below for example: setenv hwconfig "fsl_p1010mux:tdm_can=tdm;usb1:dr_mode=host,phy_type=utmi" By default, don't set fsl_p1010mux:tdm_can, in this case, spi chip selection is set to spi-flash instead of to SLIC/TDM/DAC and tdm_can_sel is set to TDM diff --git a/cmd/mmc.c b/cmd/mmc.c index 97e5d91859..1c252e0502 100644 --- a/cmd/mmc.c +++ b/cmd/mmc.c @@ -1004,7 +1004,7 @@ U_BOOT_CMD( "mmc part - lists available partition on current mmc device\n" "mmc dev [dev] [part] - show or set current mmc device [partition]\n" "mmc list - lists available devices\n" - "mmc wp - power on write protect booot partitions\n" + "mmc wp - power on write protect boot partitions\n" #if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING) "mmc hwpartition [args...] - does hardware partitioning\n" " arguments (sizes in 512-byte blocks):\n" From 1fae74125b644bb7f21e4afef3b9084c58e7863a Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Sun, 7 Jun 2020 01:36:45 -0400 Subject: [PATCH 3/5] Revert "lib: Improve _parse_integer_fixup_radix base 16 detection" This reverts commit 0486497e2b5f4d36fa968a1a60fea358cbf70b65. The strtoul has well-defined semantics. It is defined by the C standard and POSIX. To quote the relevant section of the man pages, > If base is zero or 16, the string may then include a "0x" prefix, and the > number will be read in base 16; otherwise, a zero base is taken as 10 > (decimal) unless the next character is '0', in which case it is taken as > 8 (octal). Keeping these semantics is important for several reasons. First, it is very surprising for standard library functions to behave differently than usual. Every other implementation of strtoul has different semantics than the implementation in U-Boot at the moment. Second, it can result in very surprising results from small changes. For example, changing the string "1f" to "20" causes the parsed value to *decrease*. Forcing use of the "0x" prefix to specify hexidecimal numbers is a feature, not a bug. Lastly, this is slightly less performant, since the entire number is parsed twice. This fixes the str_simple_strtoul test failing with test/str_ut.c:29, run_strtoul(): expect_val == val: Expected 0x44b (1099), got 0x1099ab (1087915) test/str_ut.c:46, str_simple_strtoul(): 0 == run_strtoul(uts, str2, 0, 1099, 4): Expected 0x0 (0), got 0x1 (1) Signed-off-by: Sean Anderson CC: Michal Simek CC: Shiril Tichkule Reviewed-by: Simon Glass --- lib/strto.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/lib/strto.c b/lib/strto.c index 3d77115d4d..c00bb5895d 100644 --- a/lib/strto.c +++ b/lib/strto.c @@ -22,25 +22,9 @@ static const char *_parse_integer_fixup_radix(const char *s, unsigned int *base) *base = 16; else *base = 8; - } else { - int i = 0; - char var; - + } else *base = 10; - - do { - var = tolower(s[i++]); - if (var >= 'a' && var <= 'f') { - *base = 16; - break; - } - - if (!(var >= '0' && var <= '9')) - break; - } while (var); - } } - if (*base == 16 && s[0] == '0' && tolower(s[1]) == 'x') s += 2; return s; From 5b60326b6e52a59c13e3a8f94622cb5ebbecb54c Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 7 Jun 2020 11:54:00 +0200 Subject: [PATCH 4/5] config: qemu: increase SYS_MALLOC_F_LEN Several configutation options require additional memory before relocation: * CONSOLE_RECORD * LOG * RSA The current default of 0x400 is too small to encompass them all. Increase the value of SYS_MALLOC_F_LEN to 0x2000 for ARCH_QEMU. Signed-off-by: Heinrich Schuchardt --- Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kconfig b/Kconfig index 0e7ccc0b07..8f3fba085a 100644 --- a/Kconfig +++ b/Kconfig @@ -146,7 +146,7 @@ config SYS_MALLOC_F_LEN default 0x2000 if (ARCH_IMX8 || ARCH_IMX8M || ARCH_MX7 || \ ARCH_MX7ULP || ARCH_MX6 || ARCH_MX5 || \ ARCH_LS1012A || ARCH_LS1021A || ARCH_LS1043A || \ - ARCH_LS1046A) + ARCH_LS1046A || ARCH_QEMU) default 0x400 help Before relocation, memory is very limited on many platforms. Still, From 35c2683f46bdea96f1dfce404aee4369a824b68e Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Wed, 10 Jun 2020 19:28:42 +0200 Subject: [PATCH 5/5] env: Kconfig: cosmetics: update comment for SYS_RELOC_GD_ENV_ADDR Update the comment for SYS_RELOC_GD_ENV_ADDR as gd->env_addr is updated in board_r.c::initr_reloc_global_data() under the compilation flags CONFIG_SYS_RELOC_GD_ENV_ADDR Signed-off-by: Patrick Delaunay Reviewed-by: Tom Rini --- env/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/env/Kconfig b/env/Kconfig index ca7fef682b..38e7fadbb9 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -562,7 +562,7 @@ config ENV_UBI_VID_OFFSET UBI VID offset for environment. If 0, no custom VID offset is used. config SYS_RELOC_GD_ENV_ADDR - bool "Relocate gd->en_addr" + bool "Relocate gd->env_addr" help Relocate the early env_addr pointer so we know it is not inside the binary. Some systems need this and for the rest, it doesn't hurt.