From 2289629f27f743003254d0a31ae9ed6175d1dd63 Mon Sep 17 00:00:00 2001 From: Hannu Lounento Date: Mon, 18 Oct 2021 08:49:03 +0300 Subject: [PATCH 01/20] image.h: make image_sign_info.fit point to const The data blob apparently does not need to be modified through the fit field of the image_sign_info struct so make it point to const to avoid the need to cast away constness in functions that assign a pointer to const data to the field. fit_image_setup_verify already had to cast away constness as it assigned a const void * argument to the field. The cast can now be removed. Signed-off-by: Hannu Lounento Reviewed-by: Simon Glass --- common/image-fit-sig.c | 2 +- include/image.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/image-fit-sig.c b/common/image-fit-sig.c index 4edebbf2d3..63e5423c92 100644 --- a/common/image-fit-sig.c +++ b/common/image-fit-sig.c @@ -85,7 +85,7 @@ static int fit_image_setup_verify(struct image_sign_info *info, memset(info, '\0', sizeof(*info)); info->keyname = fdt_getprop(fit, noffset, FIT_KEY_HINT, NULL); - info->fit = (void *)fit; + info->fit = fit; info->node_offset = noffset; info->name = algo_name; info->checksum = image_get_checksum_algo(algo_name); diff --git a/include/image.h b/include/image.h index 34d13ada84..fd662e74b4 100644 --- a/include/image.h +++ b/include/image.h @@ -1159,7 +1159,7 @@ struct image_sign_info { const char *keydir; /* Directory conaining keys */ const char *keyname; /* Name of key to use */ const char *keyfile; /* Filename of private or public key */ - void *fit; /* Pointer to FIT blob */ + const void *fit; /* Pointer to FIT blob */ int node_offset; /* Offset of signature node */ const char *name; /* Algorithm name */ struct checksum_algo *checksum; /* Checksum algorithm information */ From b2dfe8382d9dff1f06ac703e736c1633b09bfca2 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 18 Oct 2021 12:13:15 -0600 Subject: [PATCH 02/20] binman: Allow timeout to occur in the image or its section MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit At present testThreadTimeout() assumes that the expected timeout happens first when building the section, but it can just as easily happen at the top-level image. Update the test to cope with both. Signed-off-by: Simon Glass Reviewed-by: Marek Behún --- tools/binman/ftest.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index cea3ebf2b9..8199a4fc7e 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -4565,8 +4565,7 @@ class TestFunctional(unittest.TestCase): with self.assertRaises(ValueError) as e: self._DoTestFile('202_section_timeout.dts', test_section_timeout=True) - self.assertIn("Node '/binman/section@0': Timed out obtaining contents", - str(e.exception)) + self.assertIn("Timed out obtaining contents", str(e.exception)) def testTiming(self): """Test output of timing information""" From 286a1595fbf5e3d984fc400a3995dd32bc7aa54f Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Tue, 19 Oct 2021 21:16:55 -0400 Subject: [PATCH 03/20] sandbox: Migrate ARCH_MAP_SYSMEM to Kconfig Move this from a hard-coded define in config.mk to Kconfig. Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- arch/sandbox/Kconfig | 3 +++ arch/sandbox/config.mk | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig index f83282d9d5..7606469c94 100644 --- a/arch/sandbox/Kconfig +++ b/arch/sandbox/Kconfig @@ -1,6 +1,9 @@ menu "Sandbox architecture" depends on SANDBOX +config ARCH_MAP_SYSMEM + def_bool y + config SYS_ARCH default "sandbox" diff --git a/arch/sandbox/config.mk b/arch/sandbox/config.mk index 1f8cb61c8b..2b1b657831 100644 --- a/arch/sandbox/config.mk +++ b/arch/sandbox/config.mk @@ -2,7 +2,6 @@ # Copyright (c) 2011 The Chromium OS Authors. PLATFORM_CPPFLAGS += -D__SANDBOX__ -U_FORTIFY_SOURCE -PLATFORM_CPPFLAGS += -DCONFIG_ARCH_MAP_SYSMEM PLATFORM_CPPFLAGS += -fPIC PLATFORM_LIBS += -lrt SDL_CONFIG ?= sdl2-config From 58772283210e15f8d803db4aa67c877d668db867 Mon Sep 17 00:00:00 2001 From: Alistair Delva Date: Wed, 20 Oct 2021 21:31:33 +0000 Subject: [PATCH 04/20] x86: Fix linking u-boot with ld.lld When linking the final u-boot binary with LLD, the following link errors are seen: ld.lld: error: can't create dynamic relocation R_386_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output >>> defined in arch/x86/cpu/start.o >>> referenced by arch/x86/cpu/start.o:(.text.start+0x32) [...] >>> defined in arch/x86/cpu/start16.o >>> referenced by arch/x86/cpu/start16.o:(.start16+0x1C) According to Nick Desaulniers: "This is a known difference between GNU and LLVM linkers; the GNU linkers permit relocations in readonly segments (making them not read only), LLVM does not (by default)." Since U-Boot apparently seems to use relocations in readonly segments, change the global linker flags to permit them when linking with LLD by specifying '-z notext'. Signed-off-by: Alistair Delva Cc: Nick Desaulniers Cc: Simon Glass Cc: Bin Meng Reviewed-by: Simon Glass --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index c0ea933cb6..286757986c 100644 --- a/Makefile +++ b/Makefile @@ -997,6 +997,9 @@ LDFLAGS_u-boot += $(LDFLAGS_FINAL) # Avoid 'Not enough room for program headers' error on binutils 2.28 onwards. LDFLAGS_u-boot += $(call ld-option, --no-dynamic-linker) +# ld.lld support +LDFLAGS_u-boot += -z notext + LDFLAGS_u-boot += --build-id=none ifeq ($(CONFIG_ARC)$(CONFIG_NIOS2)$(CONFIG_X86)$(CONFIG_XTENSA),) From 9ab30d2bafa0ee98e9048afcb575b6013f933f3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Fri, 22 Oct 2021 15:47:12 +0200 Subject: [PATCH 05/20] env: sf: Cosmetic fix in env_sf_init_addr() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the if clause we use tabs and in the else clause spaces. Let's use spaces in the if clause too. Signed-off-by: Marek Behún Reviewed-by: Simon Glass --- env/sf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/env/sf.c b/env/sf.c index e4b7ca9e04..4096e18387 100644 --- a/env/sf.c +++ b/env/sf.c @@ -338,8 +338,8 @@ static int env_sf_init_addr(void) env_t *env_ptr = (env_t *)env_sf_get_env_addr(); if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) { - gd->env_addr = (ulong)&(env_ptr->data); - gd->env_valid = 1; + gd->env_addr = (ulong)&(env_ptr->data); + gd->env_valid = 1; } else { gd->env_addr = (ulong)&default_environment[0]; gd->env_valid = 1; From 87221bd66c2646671450ca8eb97007f2d6e01c5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Fri, 22 Oct 2021 15:47:13 +0200 Subject: [PATCH 06/20] env: sf: Use ENV_VALID enum names instead of literals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The function env_sf_init_addr() assigns number literals (1) instead of ENV_VALID to gd->env_valid. Fix this. Signed-off-by: Marek Behún Reviewed-by: Simon Glass --- env/sf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/env/sf.c b/env/sf.c index 4096e18387..c251d076d7 100644 --- a/env/sf.c +++ b/env/sf.c @@ -339,10 +339,10 @@ static int env_sf_init_addr(void) if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) { gd->env_addr = (ulong)&(env_ptr->data); - gd->env_valid = 1; + gd->env_valid = ENV_VALID; } else { gd->env_addr = (ulong)&default_environment[0]; - gd->env_valid = 1; + gd->env_valid = ENV_VALID; } return 0; From af8149e9ac40dbb596fb2f5b72b82feb54476f68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Fri, 22 Oct 2021 15:47:14 +0200 Subject: [PATCH 07/20] env: sf: Put ENV_INVALID into gd->env_valid on CRC failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit env_sf_init_addr() says the environment is valid even if it is assigning default environment due to CRC failure. Change this to ENV_INVALID and let the generic env_init() function, which calls this initializer, assign the default environment. Signed-off-by: Marek Behún Reviewed-by: Simon Glass --- env/sf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/env/sf.c b/env/sf.c index c251d076d7..6a4bb756f0 100644 --- a/env/sf.c +++ b/env/sf.c @@ -341,8 +341,7 @@ static int env_sf_init_addr(void) gd->env_addr = (ulong)&(env_ptr->data); gd->env_valid = ENV_VALID; } else { - gd->env_addr = (ulong)&default_environment[0]; - gd->env_valid = ENV_VALID; + gd->env_valid = ENV_INVALID; } return 0; From 07dcd82546ea1b1e3bbb139254d7ac3f531a1caf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Fri, 22 Oct 2021 15:47:15 +0200 Subject: [PATCH 08/20] env: nand: Put ENV_INVALID into gd->env_valid if default environment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit env_nand_init() says the environment is valid even if it is assigning default environment due to not being able to access nand pre-reloaction (determined by macro values). Change this to ENV_INVALID and let the generic env_init() function, which calls this initializer, assign the default environment. Signed-off-by: Marek Behún Reviewed-by: Simon Glass --- env/nand.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/env/nand.c b/env/nand.c index be82e97d69..21aa367d5b 100644 --- a/env/nand.c +++ b/env/nand.c @@ -107,8 +107,7 @@ static int env_nand_init(void) gd->env_addr = (ulong)env_ptr->data; #else /* ENV_IS_EMBEDDED || CONFIG_NAND_ENV_DST */ - gd->env_addr = (ulong)&default_environment[0]; - gd->env_valid = ENV_VALID; + gd->env_valid = ENV_INVALID; #endif /* ENV_IS_EMBEDDED || CONFIG_NAND_ENV_DST */ return 0; From 4735de4ffce0d3698222f31206bc82120c07a52e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Fri, 22 Oct 2021 15:47:16 +0200 Subject: [PATCH 09/20] env: nvram: Let generic env_init() assign default environment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit env_nvram_init() assigns default environment if ENV_INVALID, but this is done in the generic env_init() function, which calls this initializer, so drop it from here. Signed-off-by: Marek Behún Reviewed-by: Simon Glass --- env/nvram.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/env/nvram.c b/env/nvram.c index 261b31edfb..297573c4ed 100644 --- a/env/nvram.c +++ b/env/nvram.c @@ -94,8 +94,7 @@ static int env_nvram_init(void) #endif gd->env_valid = ENV_VALID; } else { - gd->env_addr = (ulong)&default_environment[0]; - gd->env_valid = ENV_INVALID; + gd->env_valid = ENV_INVALID; } return 0; From a73c1f006ce89e362120bba5fa980ebb52f96283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Fri, 22 Oct 2021 15:47:17 +0200 Subject: [PATCH 10/20] env: nvram: Cosmetic fix in env_nvram_init() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use spaces consistently in assignments instead of tabs. Signed-off-by: Marek Behún Reviewed-by: Simon Glass --- env/nvram.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/env/nvram.c b/env/nvram.c index 297573c4ed..fb265235af 100644 --- a/env/nvram.c +++ b/env/nvram.c @@ -87,10 +87,10 @@ static int env_nvram_init(void) nvram_read(data, CONFIG_ENV_ADDR + sizeof(ulong), ENV_SIZE); if (crc32(0, data, ENV_SIZE) == crc) { - gd->env_addr = (ulong)CONFIG_ENV_ADDR + sizeof(long); + gd->env_addr = (ulong)CONFIG_ENV_ADDR + sizeof(long); #else if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) { - gd->env_addr = (ulong)&env_ptr->data; + gd->env_addr = (ulong)&env_ptr->data; #endif gd->env_valid = ENV_VALID; } else { From 5aab7f5dec8ff7679bdfe36a99364f2a7f6948f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Fri, 22 Oct 2021 15:47:18 +0200 Subject: [PATCH 11/20] env: nowhere: Let generic env_init() assign default environment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit env_nowhere_init() assigns default environment if ENV_INVALID, but this is done in the generic env_init() function, which calls this initializer, so drop it from here. Signed-off-by: Marek Behún Reviewed-by: Simon Glass --- env/nowhere.c | 1 - 1 file changed, 1 deletion(-) diff --git a/env/nowhere.c b/env/nowhere.c index 1fcf503453..dc93b6f2e4 100644 --- a/env/nowhere.c +++ b/env/nowhere.c @@ -22,7 +22,6 @@ DECLARE_GLOBAL_DATA_PTR; */ static int env_nowhere_init(void) { - gd->env_addr = (ulong)&default_environment[0]; gd->env_valid = ENV_INVALID; return 0; From 9fc310621942d75a0865e25af6933eaed55d2337 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Fri, 22 Oct 2021 15:47:19 +0200 Subject: [PATCH 12/20] env: nowhere: Cosmetic fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use spaces instead of tabs in assignments, since there are no lines to align assignment values to. Signed-off-by: Marek Behún Reviewed-by: Simon Glass --- env/nowhere.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/env/nowhere.c b/env/nowhere.c index dc93b6f2e4..9ebc357dbd 100644 --- a/env/nowhere.c +++ b/env/nowhere.c @@ -22,7 +22,7 @@ DECLARE_GLOBAL_DATA_PTR; */ static int env_nowhere_init(void) { - gd->env_valid = ENV_INVALID; + gd->env_valid = ENV_INVALID; return 0; } @@ -37,7 +37,7 @@ static int env_nowhere_load(void) if (!IS_ENABLED(CONFIG_SPL_BUILD)) env_set_default(NULL, 0); - gd->env_valid = ENV_INVALID; + gd->env_valid = ENV_INVALID; return 0; } From cf89c5180a1fc871ea172392b476325f284996bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Fri, 22 Oct 2021 15:47:20 +0200 Subject: [PATCH 13/20] env: flash: Let generic env_init() assign default environment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit env_flash_init() (both implementations) assigns default environment if ENV_INVALID, but this is done in the generic env_init() function, which calls this initializer, so drop it from here. Signed-off-by: Marek Behún Reviewed-by: Simon Glass --- env/flash.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/env/flash.c b/env/flash.c index 473e82454d..b3230fd611 100644 --- a/env/flash.c +++ b/env/flash.c @@ -77,7 +77,6 @@ static int env_flash_init(void) uchar flag1 = flash_addr->flags; uchar flag2 = flash_addr_new->flags; - ulong addr_default = (ulong)&default_environment[0]; ulong addr1 = (ulong)&(flash_addr->data); ulong addr2 = (ulong)&(flash_addr_new->data); @@ -92,7 +91,6 @@ static int env_flash_init(void) gd->env_addr = addr2; gd->env_valid = ENV_VALID; } else if (!crc1_ok && !crc2_ok) { - gd->env_addr = addr_default; gd->env_valid = ENV_INVALID; } else if (flag1 == ENV_REDUND_ACTIVE && flag2 == ENV_REDUND_OBSOLETE) { @@ -230,7 +228,6 @@ static int env_flash_init(void) return 0; } - gd->env_addr = (ulong)&default_environment[0]; gd->env_valid = ENV_INVALID; return 0; } From ee483902aeed69025586c38bfb73e6400bf0f9f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Fri, 22 Oct 2021 15:47:21 +0200 Subject: [PATCH 14/20] env: flash: Cosmetic fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change tab to space in env_flash_init(). Signed-off-by: Marek Behún Reviewed-by: Simon Glass --- env/flash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/env/flash.c b/env/flash.c index b3230fd611..9c8abfa016 100644 --- a/env/flash.c +++ b/env/flash.c @@ -228,7 +228,7 @@ static int env_flash_init(void) return 0; } - gd->env_valid = ENV_INVALID; + gd->env_valid = ENV_INVALID; return 0; } #endif From 535870f3b0fb09ee9b2885409f05304111464643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Fri, 22 Oct 2021 15:47:22 +0200 Subject: [PATCH 15/20] board: synquacer: developerbox: Don't set gd->env_addr to default_environment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This board sets gd->env_addr to default_environment in board_init(), but the board has environment in SPI flash according to defconfig. Let the env API handle environment automatically. Signed-off-by: Marek Behún Cc: Masami Hiramatsu Reviewed-by: Simon Glass --- board/socionext/developerbox/developerbox.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/board/socionext/developerbox/developerbox.c b/board/socionext/developerbox/developerbox.c index 9552bfcdc3..31b1349514 100644 --- a/board/socionext/developerbox/developerbox.c +++ b/board/socionext/developerbox/developerbox.c @@ -82,8 +82,6 @@ int board_init(void) { gd->bd->bi_boot_params = CONFIG_SYS_LOAD_ADDR + LOAD_OFFSET; - gd->env_addr = (ulong)&default_environment[0]; - synquacer_setup_scbm_smmu(); return 0; From b26334824b58150e82a8b202380169a9276cd161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Fri, 22 Oct 2021 15:47:23 +0200 Subject: [PATCH 16/20] board: freescale: various boards: Let env subsystem set gd->env_addr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Various freescale boards set gd->env_addr to default_environment in board_init(), conditional on CONFIG_ENV_IS_NOWHERE, but this is redundant, since it is done by env_init() before board_init() is called. Let the env subsystem handle this. Signed-off-by: Marek Behún Cc: Ramon Fried Cc: Priyanka Jain Cc: Mian Yousaf Kaukab Reviewed-by: Simon Glass --- board/freescale/ls1012afrdm/ls1012afrdm.c | 4 ---- board/freescale/ls1012aqds/ls1012aqds.c | 4 ---- board/freescale/ls1012ardb/ls1012ardb.c | 4 ---- board/freescale/ls1028a/ls1028a.c | 4 ---- board/freescale/ls1088a/ls1088a.c | 4 ---- board/freescale/ls2080aqds/ls2080aqds.c | 3 --- board/freescale/ls2080ardb/ls2080ardb.c | 3 --- board/freescale/lx2160a/lx2160a.c | 3 --- 8 files changed, 29 deletions(-) diff --git a/board/freescale/ls1012afrdm/ls1012afrdm.c b/board/freescale/ls1012afrdm/ls1012afrdm.c index 6473ee0572..5dd19cfcd9 100644 --- a/board/freescale/ls1012afrdm/ls1012afrdm.c +++ b/board/freescale/ls1012afrdm/ls1012afrdm.c @@ -172,10 +172,6 @@ int board_init(void) if (current_el() == 3) out_le32(&cci->ctrl_ord, CCI400_CTRLORD_EN_BARRIER); -#ifdef CONFIG_ENV_IS_NOWHERE - gd->env_addr = (ulong)&default_environment[0]; -#endif - #ifdef CONFIG_FSL_CAAM sec_init(); #endif diff --git a/board/freescale/ls1012aqds/ls1012aqds.c b/board/freescale/ls1012aqds/ls1012aqds.c index 6e21040601..68578e81a5 100644 --- a/board/freescale/ls1012aqds/ls1012aqds.c +++ b/board/freescale/ls1012aqds/ls1012aqds.c @@ -150,10 +150,6 @@ int board_init(void) erratum_a010315(); #endif -#ifdef CONFIG_ENV_IS_NOWHERE - gd->env_addr = (ulong)&default_environment[0]; -#endif - #ifdef CONFIG_FSL_CAAM sec_init(); #endif diff --git a/board/freescale/ls1012ardb/ls1012ardb.c b/board/freescale/ls1012ardb/ls1012ardb.c index 62e8af48cf..064fb4d39f 100644 --- a/board/freescale/ls1012ardb/ls1012ardb.c +++ b/board/freescale/ls1012ardb/ls1012ardb.c @@ -173,10 +173,6 @@ int board_init(void) erratum_a010315(); #endif -#ifdef CONFIG_ENV_IS_NOWHERE - gd->env_addr = (ulong)&default_environment[0]; -#endif - #ifdef CONFIG_FSL_CAAM sec_init(); #endif diff --git a/board/freescale/ls1028a/ls1028a.c b/board/freescale/ls1028a/ls1028a.c index 461c571b36..486a544d35 100644 --- a/board/freescale/ls1028a/ls1028a.c +++ b/board/freescale/ls1028a/ls1028a.c @@ -73,10 +73,6 @@ u32 get_lpuart_clk(void) int board_init(void) { -#ifdef CONFIG_ENV_IS_NOWHERE - gd->env_addr = (ulong)&default_environment[0]; -#endif - #ifdef CONFIG_FSL_CAAM sec_init(); #endif diff --git a/board/freescale/ls1088a/ls1088a.c b/board/freescale/ls1088a/ls1088a.c index 2f422634d5..7046fbaeb5 100644 --- a/board/freescale/ls1088a/ls1088a.c +++ b/board/freescale/ls1088a/ls1088a.c @@ -810,10 +810,6 @@ int board_init(void) select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT, 0); board_retimer_init(); -#ifdef CONFIG_ENV_IS_NOWHERE - gd->env_addr = (ulong)&default_environment[0]; -#endif - #if defined(CONFIG_TARGET_LS1088ARDB) && defined(CONFIG_FSL_MC_ENET) /* invert AQR105 IRQ pins polarity */ out_le32(irq_ccsr + IRQCR_OFFSET / 4, AQR105_IRQ_MASK); diff --git a/board/freescale/ls2080aqds/ls2080aqds.c b/board/freescale/ls2080aqds/ls2080aqds.c index 62658c4702..2f0139edef 100644 --- a/board/freescale/ls2080aqds/ls2080aqds.c +++ b/board/freescale/ls2080aqds/ls2080aqds.c @@ -211,9 +211,6 @@ int board_init(void) FSL_QIXIS_BRDCFG9_QSPI); #endif -#ifdef CONFIG_ENV_IS_NOWHERE - gd->env_addr = (ulong)&default_environment[0]; -#endif select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT, 0); #ifdef CONFIG_RTC_ENABLE_32KHZ_OUTPUT diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c index 58b852383e..bf660a8e65 100644 --- a/board/freescale/ls2080ardb/ls2080ardb.c +++ b/board/freescale/ls2080ardb/ls2080ardb.c @@ -281,9 +281,6 @@ int board_init(void) init_final_memctl_regs(); -#ifdef CONFIG_ENV_IS_NOWHERE - gd->env_addr = (ulong)&default_environment[0]; -#endif select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT, 0); #ifdef CONFIG_FSL_QIXIS diff --git a/board/freescale/lx2160a/lx2160a.c b/board/freescale/lx2160a/lx2160a.c index e61289d228..bd5abb677a 100644 --- a/board/freescale/lx2160a/lx2160a.c +++ b/board/freescale/lx2160a/lx2160a.c @@ -588,9 +588,6 @@ int board_init(void) #if defined(CONFIG_FSL_MC_ENET) && defined(CONFIG_TARGET_LX2160ARDB) u32 __iomem *irq_ccsr = (u32 __iomem *)ISC_BASE; #endif -#ifdef CONFIG_ENV_IS_NOWHERE - gd->env_addr = (ulong)&default_environment[0]; -#endif select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT, 0); From c5cbbe35fd7b3d05273f4d3f273c9e613bd38d7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Fri, 22 Oct 2021 15:47:24 +0200 Subject: [PATCH 17/20] env: Always use char for default_environment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sometimes we use uchar and sometimes char for the default environment array. By always using char, we can get rid of some explicit casts. Signed-off-by: Marek Behún Reviewed-by: Simon Glass --- board/Marvell/mvebu_armada-37xx/board.c | 2 +- env/common.c | 6 +++--- include/env_default.h | 4 ++-- include/env_internal.h | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c index 2de9c2ac17..d7b6ecafbf 100644 --- a/board/Marvell/mvebu_armada-37xx/board.c +++ b/board/Marvell/mvebu_armada-37xx/board.c @@ -87,7 +87,7 @@ int board_init(void) #ifdef CONFIG_BOARD_LATE_INIT int board_late_init(void) { - char *ptr = (char *)&default_environment[0]; + char *ptr = &default_environment[0]; struct udevice *dev; struct mmc *mmc_dev; bool ddr4, emmc; diff --git a/env/common.c b/env/common.c index db213b7748..664d2e688e 100644 --- a/env/common.c +++ b/env/common.c @@ -162,7 +162,7 @@ int env_get_f(const char *name, char *buf, unsigned len) name_len = strlen(name); if (gd->env_valid == ENV_INVALID) - env = (const char *)default_environment; + env = default_environment; else env = (const char *)gd->env_addr; @@ -264,7 +264,7 @@ void env_set_default(const char *s, int flags) } flags |= H_DEFAULT; - if (himport_r(&env_htab, (char *)default_environment, + if (himport_r(&env_htab, default_environment, sizeof(default_environment), '\0', flags, 0, 0, NULL) == 0) pr_err("## Error: Environment import failed: errno = %d\n", @@ -283,7 +283,7 @@ int env_set_default_vars(int nvars, char * const vars[], int flags) * (and use \0 as a separator) */ flags |= H_NOCLEAR | H_DEFAULT; - return himport_r(&env_htab, (const char *)default_environment, + return himport_r(&env_htab, default_environment, sizeof(default_environment), '\0', flags, 0, nvars, vars); } diff --git a/include/env_default.h b/include/env_default.h index 66e203eb6e..a6724719ec 100644 --- a/include/env_default.h +++ b/include/env_default.h @@ -20,9 +20,9 @@ env_t embedded_environment __UBOOT_ENV_SECTION__(environment) = { #elif defined(DEFAULT_ENV_INSTANCE_STATIC) static char default_environment[] = { #elif defined(DEFAULT_ENV_IS_RW) -uchar default_environment[] = { +char default_environment[] = { #else -const uchar default_environment[] = { +const char default_environment[] = { #endif #ifndef CONFIG_USE_DEFAULT_ENV_FILE #ifdef CONFIG_ENV_CALLBACK_LIST_DEFAULT diff --git a/include/env_internal.h b/include/env_internal.h index b7bddcb00d..f74927cd64 100644 --- a/include/env_internal.h +++ b/include/env_internal.h @@ -112,9 +112,9 @@ extern env_t embedded_environment; #endif /* ENV_IS_EMBEDDED */ #ifdef DEFAULT_ENV_IS_RW -extern unsigned char default_environment[]; +extern char default_environment[]; #else -extern const unsigned char default_environment[]; +extern const char default_environment[]; #endif #ifndef DO_DEPS_ONLY From 37f3758a250d4c590ffac671f100d9b5ec73b417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Fri, 22 Oct 2021 15:47:25 +0200 Subject: [PATCH 18/20] env: Use static_assert() to check if default_environment is too large MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Check sizeof(default_environment) against ENV_SIZE in a static_assert() instead of runtime. Only check if !USE_HOSTCC (for in fw_env tool ENV_SIZE expands to a variable, and cannot be checked statically) nad !DEFAULT_ENV_INSTANCE_EMBEDDED, for in that case the default_environment variable is not set. Signed-off-by: Marek Behún Reviewed-by: Simon Glass --- env/common.c | 5 ----- include/env_default.h | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/env/common.c b/env/common.c index 664d2e688e..99729ca002 100644 --- a/env/common.c +++ b/env/common.c @@ -247,11 +247,6 @@ char *env_get_default(const char *name) void env_set_default(const char *s, int flags) { - if (sizeof(default_environment) > ENV_SIZE) { - puts("*** Error - default environment is too large\n\n"); - return; - } - if (s) { if ((flags & H_INTERACTIVE) == 0) { printf("*** Warning - %s, " diff --git a/include/env_default.h b/include/env_default.h index a6724719ec..23430dc70d 100644 --- a/include/env_default.h +++ b/include/env_default.h @@ -121,3 +121,9 @@ const char default_environment[] = { } #endif }; + +#if !defined(USE_HOSTCC) && !defined(DEFAULT_ENV_INSTANCE_EMBEDDED) +#include +static_assert(sizeof(default_environment) <= ENV_SIZE, + "Default environment is too large"); +#endif From 082c119af98153fd558f57c7a66d660b7ca6c6c9 Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Fri, 22 Oct 2021 19:07:04 -0400 Subject: [PATCH 19/20] patman: Add "postfix" support to patch subjects In some communities, it may be necessary to append something after PATCH in the subject line. For example, the Linux networking subsystem expects [1] patch subject prefixes like [RFC PATCH net-next 0/99]. This adds support for such "postfix"s to patman. Although entirely cosmetic, it is still nice to have. [1] https://www.kernel.org/doc/html/latest/networking/netdev-FAQ.html#how-do-i-indicate-which-tree-net-vs-net-next-my-patch-should-be-in Signed-off-by: Sean Anderson Reviewed-by: Simon Glass --- tools/patman/README | 5 +++++ tools/patman/func_test.py | 6 ++++-- tools/patman/patchstream.py | 2 ++ tools/patman/series.py | 9 +++++++-- tools/patman/test/test01.txt | 1 + 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/tools/patman/README b/tools/patman/README index 53f55ce95d..e3466e6085 100644 --- a/tools/patman/README +++ b/tools/patman/README @@ -188,6 +188,11 @@ Series-prefix: prefix well. If your format.subjectprefix is set to InternalProject, then the patch shows like: [InternalProject][RFC/RESEND PATCH] +Series-postfix: postfix + Sets the subject "postfix". Normally empty, but can be the name of a + tree such as net or net-next if that needs to be specified. The patch + subject is like [PATCH net] or [PATCH net-next]. + Series-name: name Sets the name of the series. You don't need to have a name, and patman does not yet use it, but it is convenient to put the branch diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py index 2493e527f5..9f4e03e882 100644 --- a/tools/patman/func_test.py +++ b/tools/patman/func_test.py @@ -122,6 +122,7 @@ class TestFunctional(unittest.TestCase): Series-to: u-boot Series-prefix: RFC + Series-postfix: some-branch Series-cc: Stefan Brüns Cover-letter-cc: Lord Mëlchett Series-version: 3 @@ -176,7 +177,7 @@ class TestFunctional(unittest.TestCase): - each patch has the correct subject - dry-run information prints out correctly - unicode is handled correctly - - Series-to, Series-cc, Series-prefix, Cover-letter + - Series-to, Series-cc, Series-prefix, Series-postfix, Cover-letter - Cover-letter-cc, Series-version, Series-changes, Series-notes - Commit-notes """ @@ -235,6 +236,7 @@ class TestFunctional(unittest.TestCase): self.assertEqual('Cc: %s' % stefan, next(lines)) self.assertEqual('Version: 3', next(lines)) self.assertEqual('Prefix:\t RFC', next(lines)) + self.assertEqual('Postfix:\t some-branch', next(lines)) self.assertEqual('Cover: 4 lines', next(lines)) self.assertEqual(' Cc: %s' % self.fred, next(lines)) self.assertEqual(' Cc: %s' % self.leb, @@ -285,7 +287,7 @@ Simon Glass (2): ''' lines = open(cover_fname, encoding='utf-8').read().splitlines() self.assertEqual( - 'Subject: [RFC PATCH v3 0/2] test: A test patch series', + 'Subject: [RFC PATCH some-branch v3 0/2] test: A test patch series', lines[3]) self.assertEqual(expected.splitlines(), lines[7:]) diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py index 2439fb18e4..1da9d53b65 100644 --- a/tools/patman/patchstream.py +++ b/tools/patman/patchstream.py @@ -596,6 +596,8 @@ class PatchStream: # These seem like they would be nice to include. if 'prefix' in self.series: parts.append(self.series['prefix']) + if 'postfix' in self.series: + parts.append(self.serties['postfix']) if 'version' in self.series: parts.append("v%s" % self.series['version']) diff --git a/tools/patman/series.py b/tools/patman/series.py index 8ae218d3a4..da734d92cf 100644 --- a/tools/patman/series.py +++ b/tools/patman/series.py @@ -16,7 +16,7 @@ from patman import tools # Series-xxx tags that we understand valid_series = ['to', 'cc', 'version', 'changes', 'prefix', 'notes', 'name', - 'cover_cc', 'process_log', 'links', 'patchwork_url'] + 'cover_cc', 'process_log', 'links', 'patchwork_url', 'postfix'] class Series(dict): """Holds information about a patch series, including all tags. @@ -133,6 +133,7 @@ class Series(dict): print('Cc:\t ', item) print('Version: ', self.get('version')) print('Prefix:\t ', self.get('prefix')) + print('Postfix:\t ', self.get('postfix')) if self.cover: print('Cover: %d lines' % len(self.cover)) cover_cc = gitutil.BuildEmailList(self.get('cover_cc', '')) @@ -322,4 +323,8 @@ class Series(dict): prefix = '' if self.get('prefix'): prefix = '%s ' % self['prefix'] - return '%s%sPATCH%s' % (git_prefix, prefix, version) + + postfix = '' + if self.get('postfix'): + postfix = ' %s' % self['postfix'] + return '%s%sPATCH%s%s' % (git_prefix, prefix, postfix, version) diff --git a/tools/patman/test/test01.txt b/tools/patman/test/test01.txt index de2d9e4d28..fc3066e50b 100644 --- a/tools/patman/test/test01.txt +++ b/tools/patman/test/test01.txt @@ -44,6 +44,7 @@ Date: Sat Apr 15 15:39:08 2017 -0600 Signed-off-by: Simon Glass Series-to: u-boot Series-prefix: RFC + Series-postfix: some-branch Series-cc: Stefan Brüns Cover-letter-cc: Lord Mëlchett Series-version: 3 From b55881ddb455af31b64038cf3b67f781909971cc Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 23 Oct 2021 03:06:03 +0200 Subject: [PATCH 20/20] bootstage: Add SPL support Allow usage of the bootstage facilities in SPL. Signed-off-by: Marek Vasut Cc: Simon Glass Reviewed-by: Simon Glass --- arch/x86/cpu/cpu.c | 2 +- board/siemens/iot2050/board.c | 2 +- common/Kconfig.boot | 9 +++++++++ common/init/board_init.c | 2 +- common/spl/spl.c | 2 +- include/bootstage.h | 2 +- 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c index 01dece5769..86f53e78d2 100644 --- a/arch/x86/cpu/cpu.c +++ b/arch/x86/cpu/cpu.c @@ -178,7 +178,7 @@ int default_print_cpuinfo(void) return 0; } -#if CONFIG_IS_ENABLED(BOOTSTAGE) +#if CONFIG_IS_ENABLED(SHOW_BOOT_PROGRESS) void show_boot_progress(int val) { outb(val, POST_PORT); diff --git a/board/siemens/iot2050/board.c b/board/siemens/iot2050/board.c index b2110978ae..16ae2ffc17 100644 --- a/board/siemens/iot2050/board.c +++ b/board/siemens/iot2050/board.c @@ -250,7 +250,7 @@ void spl_board_init(void) { } -#if CONFIG_IS_ENABLED(LED) && CONFIG_IS_ENABLED(BOOTSTAGE) +#if CONFIG_IS_ENABLED(LED) && CONFIG_IS_ENABLED(SHOW_BOOT_PROGRESS) /* * Indicate any error or (accidental?) entering of CLI via the red status LED. */ diff --git a/common/Kconfig.boot b/common/Kconfig.boot index c948d58094..a8d4be23a9 100644 --- a/common/Kconfig.boot +++ b/common/Kconfig.boot @@ -703,6 +703,15 @@ config SHOW_BOOT_PROGRESS -150 common/cmd_nand.c Incorrect FIT image format 151 common/cmd_nand.c FIT image format OK +config SPL_SHOW_BOOT_PROGRESS + bool "Show boot progress in a board-specific manner" + depends on SPL + help + Defining this option allows to add some board-specific code (calling + a user-provided function show_boot_progress(int) that enables you to + show the system's boot progress on some display (for example, some + LEDs) on your board. For details see SHOW_BOOT_PROGRESS. + endmenu menu "Boot media" diff --git a/common/init/board_init.c b/common/init/board_init.c index 0965b96fa3..eab5ee1395 100644 --- a/common/init/board_init.c +++ b/common/init/board_init.c @@ -166,7 +166,7 @@ void board_init_f_init_reserve(ulong base) board_init_f_init_stack_protection(); } -#if CONFIG_IS_ENABLED(BOOTSTAGE) +#if CONFIG_IS_ENABLED(SHOW_BOOT_PROGRESS) /* * Board-specific Platform code can reimplement show_boot_progress () if needed */ diff --git a/common/spl/spl.c b/common/spl/spl.c index 0c08da06e8..99cde6609c 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -61,7 +61,7 @@ binman_sym_declare(ulong, spl, size); /* Define board data structure */ static struct bd_info bdata __attribute__ ((section(".data"))); -#if CONFIG_IS_ENABLED(BOOTSTAGE) +#if CONFIG_IS_ENABLED(SHOW_BOOT_PROGRESS) /* * Board-specific Platform code can reimplement show_boot_progress () if needed */ diff --git a/include/bootstage.h b/include/bootstage.h index f837a387c8..8d1989ac0e 100644 --- a/include/bootstage.h +++ b/include/bootstage.h @@ -220,7 +220,7 @@ enum bootstage_id { */ ulong timer_get_boot_us(void); -#if defined(USE_HOSTCC) || !CONFIG_IS_ENABLED(BOOTSTAGE) +#if defined(USE_HOSTCC) || !CONFIG_IS_ENABLED(SHOW_BOOT_PROGRESS) #define show_boot_progress(val) do {} while (0) #else /**