From d30fbabadebd8b08e2a509a86ff6d4b59ed89f8a Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Wed, 3 May 2023 18:29:58 -0400 Subject: [PATCH 01/12] bk4r1: Enable LTO In order to allow for general platform growth due to fixes, enable LTO here to give us more room. Signed-off-by: Tom Rini --- configs/bk4r1_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/bk4r1_defconfig b/configs/bk4r1_defconfig index 66adeac725c..95f0c30cde6 100644 --- a/configs/bk4r1_defconfig +++ b/configs/bk4r1_defconfig @@ -18,6 +18,7 @@ CONFIG_TARGET_BK4R1=y CONFIG_SYS_LOAD_ADDR=0x82000000 CONFIG_SYS_MEMTEST_START=0x80010000 CONFIG_SYS_MEMTEST_END=0x87c00000 +CONFIG_LTO=y CONFIG_HAS_BOARD_SIZE_LIMIT=y CONFIG_BOARD_SIZE_LIMIT=520192 CONFIG_FIT=y From 930ef109928969fa17b8ccf2a05aa4aeff10f3e3 Mon Sep 17 00:00:00 2001 From: Stefan Herbrechtsmeier Date: Mon, 3 Apr 2023 15:50:00 +0200 Subject: [PATCH 02/12] common: cli_hush: Restore clear local variable support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The u-boot hush shell doesn’t support the unset command to clear a variable and therefore an empty value ("c=") should be a valid value for the set_local_var function to clear the variable. This partial reverts commit aa722529635c ("common: cli_hush: avoid dead code") and only checks for a `=` in the string. Additionally explicit call the unset_local_var function to remove the variable if the value is empty. Signed-off-by: Stefan Herbrechtsmeier Reviewed-by: Simon Glass --- common/cli_hush.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common/cli_hush.c b/common/cli_hush.c index 1ad7a509dfa..171069f5f49 100644 --- a/common/cli_hush.c +++ b/common/cli_hush.c @@ -2171,12 +2171,18 @@ int set_local_var(const char *s, int flg_export) * NAME=VALUE format. So the first order of business is to * split 's' on the '=' into 'name' and 'value' */ value = strchr(name, '='); - if (value == NULL || *(value + 1) == 0) { + if (!value) { free(name); return -1; } *value++ = 0; + if (!*value) { + unset_local_var(name); + free(name); + return 0; + } + for(cur = top_vars; cur; cur = cur->next) { if(strcmp(cur->name, name)==0) break; From 2ac800a66f996da045d61ee5cff1f6694e893949 Mon Sep 17 00:00:00 2001 From: Stefan Herbrechtsmeier Date: Mon, 3 Apr 2023 15:50:01 +0200 Subject: [PATCH 03/12] test: hush_if_test: Add hush variable test Add a test for the hush shell variable assignment and clear. Signed-off-by: Stefan Herbrechtsmeier Reviewed-by: Simon Glass --- test/py/tests/test_hush_if_test.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/py/tests/test_hush_if_test.py b/test/py/tests/test_hush_if_test.py index 37c1608bb22..3b4b6fcaf40 100644 --- a/test/py/tests/test_hush_if_test.py +++ b/test/py/tests/test_hush_if_test.py @@ -182,3 +182,16 @@ def test_hush_if_test_host_file_exists(u_boot_console): expr = 'test -e hostfs - ' + test_file exec_hush_if(u_boot_console, expr, False) + +def test_hush_var(u_boot_console): + """Test the set and unset of variables""" + u_boot_console.run_command('ut_var_nonexistent=') + u_boot_console.run_command('ut_var_exists=1') + u_boot_console.run_command('ut_var_unset=1') + exec_hush_if(u_boot_console, 'test -z "$ut_var_nonexistent"', True) + exec_hush_if(u_boot_console, 'test -z "$ut_var_exists"', False) + exec_hush_if(u_boot_console, 'test -z "$ut_var_unset"', False) + exec_hush_if(u_boot_console, 'ut_var_unset=', True) + exec_hush_if(u_boot_console, 'test -z "$ut_var_unset"', True) + u_boot_console.run_command('ut_var_exists=') + u_boot_console.run_command('ut_var_unset=') From 5fd10846572cc76c6e6d0f9839ed54ff10537691 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 20 Apr 2023 20:03:43 +0200 Subject: [PATCH 04/12] tools: fix TestFdtUtil() Variable old_outdir cannot be used before assignment. The assignment must occur before the try block. tools/dtoc/test_fdt.py:796:26: E0601: Using variable 'old_outdir' before assignment (used-before-assignment) Add missing space in assignment. Fixes: a004f29464d1 ("binman: Tidy up _SetupDtb() to use its own temporary file") Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- tools/dtoc/test_fdt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py index 32fa69cbb01..4fe8d12c403 100755 --- a/tools/dtoc/test_fdt.py +++ b/tools/dtoc/test_fdt.py @@ -784,8 +784,8 @@ class TestFdtUtil(unittest.TestCase): def test_ensure_compiled_tmpdir(self): """Test providing a temporary directory""" + old_outdir = tools.outdir try: - old_outdir = tools.outdir tools.outdir= None tmpdir = tempfile.mkdtemp(prefix='test_fdt.') dtb = fdt_util.EnsureCompiled(find_dtb_file('dtoc_test_simple.dts'), @@ -793,7 +793,7 @@ class TestFdtUtil(unittest.TestCase): self.assertEqual(tmpdir, os.path.dirname(dtb)) shutil.rmtree(tmpdir) finally: - tools.outdir= old_outdir + tools.outdir = old_outdir def test_get_phandle_name_offset(self): val = fdt_util.GetPhandleNameOffset(self.node, 'missing') From 55922ed5fa03c3ce2ca6c1c504d86dcf2c80c5f7 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 22 Apr 2023 15:01:31 +0200 Subject: [PATCH 05/12] cmd: bdinfo: Map fdt_blob and new_fdt to sysmem Map fdt_blob and new_fdt to sysmem, otherwise $fdtcontroladdr and bdinfo output do not match and the bdinfo output address is not a valid address accessible via sandbox memory accessors. Signed-off-by: Marek Vasut Reviewed-by: Simon Glass --- cmd/bdinfo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index f709904c516..78cb41f0760 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -128,8 +129,8 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) print_eth(0); printf("IP addr = %s\n", env_get("ipaddr")); } - bdinfo_print_num_l("fdt_blob", (ulong)gd->fdt_blob); - bdinfo_print_num_l("new_fdt", (ulong)gd->new_fdt); + bdinfo_print_num_l("fdt_blob", (ulong)map_to_sysmem(gd->fdt_blob)); + bdinfo_print_num_l("new_fdt", (ulong)map_to_sysmem(gd->new_fdt)); bdinfo_print_num_l("fdt_size", (ulong)gd->fdt_size); if (IS_ENABLED(CONFIG_VIDEO)) show_video_info(); From d8eb4e2c05406dcaad30b36fa2a69a63dff376a4 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 22 Apr 2023 15:01:32 +0200 Subject: [PATCH 06/12] cmd: bdinfo: Wrap network information printing into print_eth() Move all the network information printing into print_eth(), no functional change. Signed-off-by: Marek Vasut Reviewed-by: Simon Glass --- cmd/bdinfo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 78cb41f0760..71a122466b0 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -52,7 +52,10 @@ static void print_eth(int idx) val = env_get(name); if (!val) val = "(not set)"; + + printf("current eth = %s\n", eth_get_name()); printf("%-12s= %s\n", name, val); + printf("IP addr = %s\n", env_get("ipaddr")); } void bdinfo_print_mhz(const char *name, unsigned long hz) @@ -124,11 +127,8 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) bdinfo_print_num_l("relocaddr", gd->relocaddr); bdinfo_print_num_l("reloc off", gd->reloc_off); printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8); - if (IS_ENABLED(CONFIG_CMD_NET)) { - printf("current eth = %s\n", eth_get_name()); + if (IS_ENABLED(CONFIG_CMD_NET)) print_eth(0); - printf("IP addr = %s\n", env_get("ipaddr")); - } bdinfo_print_num_l("fdt_blob", (ulong)map_to_sysmem(gd->fdt_blob)); bdinfo_print_num_l("new_fdt", (ulong)map_to_sysmem(gd->new_fdt)); bdinfo_print_num_l("fdt_size", (ulong)gd->fdt_size); From a76315052b93e73444c4703b610660ccbd38deda Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 22 Apr 2023 15:01:33 +0200 Subject: [PATCH 07/12] cmd: bdinfo: Print ethaddr of current MAC Instead of always printing ethaddr of MAC 0, print eth%daddr of the current MAC. Signed-off-by: Marek Vasut Reviewed-by: Simon Glass --- cmd/bdinfo.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 71a122466b0..365357ca545 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -42,19 +42,25 @@ void bdinfo_print_num_ll(const char *name, unsigned long long value) printf("%-12s= 0x%.*llx\n", name, 2 * (int)sizeof(ulong), value); } -static void print_eth(int idx) +static void print_eth(void) { - char name[10], *val; + const int idx = eth_get_dev_index(); + uchar enetaddr[6]; + char name[10]; + int ret; + if (idx) sprintf(name, "eth%iaddr", idx); else strcpy(name, "ethaddr"); - val = env_get(name); - if (!val) - val = "(not set)"; + + ret = eth_env_get_enetaddr_by_index("eth", idx, enetaddr); printf("current eth = %s\n", eth_get_name()); - printf("%-12s= %s\n", name, val); + if (!ret) + printf("%-12s= (not set)\n", name); + else + printf("%-12s= %pM\n", name, enetaddr); printf("IP addr = %s\n", env_get("ipaddr")); } @@ -128,7 +134,7 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) bdinfo_print_num_l("reloc off", gd->reloc_off); printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8); if (IS_ENABLED(CONFIG_CMD_NET)) - print_eth(0); + print_eth(); bdinfo_print_num_l("fdt_blob", (ulong)map_to_sysmem(gd->fdt_blob)); bdinfo_print_num_l("new_fdt", (ulong)map_to_sysmem(gd->new_fdt)); bdinfo_print_num_l("fdt_size", (ulong)gd->fdt_size); From b42303723a5feeec027126c7b7cb962fbbd9a513 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Mon, 24 Apr 2023 16:51:12 -0400 Subject: [PATCH 08/12] boot/Kconfig: fix comments syntax error Fix comments syntax error in SPL_LOAD_FIT_APPLY_OVERLAY description. Signed-off-by: Hugo Villeneuve Reviewed-by: Simon Glass --- boot/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot/Kconfig b/boot/Kconfig index d95a2a70266..8c27f52ec3e 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -231,7 +231,7 @@ config SPL_LOAD_FIT_APPLY_OVERLAY depends on SPL_LOAD_FIT select OF_LIBFDT_OVERLAY help - The device tree is loaded from the FIT image. Allow the SPL is to + The device tree is loaded from the FIT image. Allow the SPL to also load device-tree overlays from the FIT image an apply them over the device tree. From ed356ac9300b6efca238d7058bbe8395aa9ff8c6 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Tue, 25 Apr 2023 09:46:45 -0400 Subject: [PATCH 09/12] event: fix comments syntax error Fix comments syntax error in event description: creasted -> created Signed-off-by: Hugo Villeneuve Reviewed-by: Simon Glass --- doc/develop/event.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/develop/event.rst b/doc/develop/event.rst index 4ff59348371..e60cbf65691 100644 --- a/doc/develop/event.rst +++ b/doc/develop/event.rst @@ -12,7 +12,7 @@ Rather than using weak functions and direct calls across subsystemss, it is often easier to use an event. An event consists of a type (e.g. EVT_DM_POST_INIT) and some optional data, -in `union event_data`. An event spy can be creasted to watch for events of a +in `union event_data`. An event spy can be created to watch for events of a particular type. When the event is created, it is sent to each spy in turn. From a7989a7cc2ee8dd61805dff62fac80659daf5c66 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Tue, 25 Apr 2023 14:34:45 -0400 Subject: [PATCH 10/12] common/Kconfig: fix comments syntax error Fix comments error in EVENT_DEBUG description: this get usefui -> this to get useful Signed-off-by: Hugo Villeneuve Reviewed-by: Simon Glass --- common/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/Kconfig b/common/Kconfig index 6345d5c4bae..a19d82f8d92 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -626,7 +626,7 @@ config EVENT_DEBUG bool "Enable event debugging assistance" default y if SANDBOX help - Enable this get usefui features for seeing what is happening with + Enable this to get useful features for seeing what is happening with events, such as event-type names. This adds to the code size of U-Boot so can be turned off for production builds. From 43bdb3b39a0984c8c6ffcbb847bf648e941c0d26 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 28 Apr 2023 13:50:48 -0600 Subject: [PATCH 11/12] buildman: Pass -Werror to the host compiler too The host compiler is not failing on warnings at present, when the -E flag is used in buildman. Add the required flag to fix this. Signed-off-by: Simon Glass Tested-by: Tom Rini --- tools/buildman/builderthread.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py index 879ff138ad7..635865c21c8 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -253,6 +253,7 @@ class BuilderThread(threading.Thread): args.extend(['-j', str(self.builder.num_jobs)]) if self.builder.warnings_as_errors: args.append('KCFLAGS=-Werror') + args.append('HOSTCFLAGS=-Werror') if self.builder.allow_missing: args.append('BINMAN_ALLOW_MISSING=1') if self.builder.no_lto: From 0d734df4a459f01fdf1e62512fb28b28022cb6a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Tue, 2 May 2023 19:53:57 +0200 Subject: [PATCH 12/12] pci: fsl: Do not access PCI BAR0 register of PCIe Root Port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Freescale PCIe Root Port has PEXCSRBAR register at position of PCI BAR0. PCIe Root Port does not have any PCIe memory, so returns zero when trying to read from PCIe Root Port BAR0 and ignore any writes. Signed-off-by: Pali Rohár --- drivers/pci/pcie_fsl.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/pci/pcie_fsl.c b/drivers/pci/pcie_fsl.c index 4600652f2b1..8d89a1e5919 100644 --- a/drivers/pci/pcie_fsl.c +++ b/drivers/pci/pcie_fsl.c @@ -58,6 +58,14 @@ static int fsl_pcie_read_config(const struct udevice *bus, pci_dev_t bdf, return 0; } + /* Skip Freescale PCIe controller's PEXCSRBAR register */ + if (PCI_BUS(bdf) - dev_seq(bus) == 0 && + PCI_DEV(bdf) == 0 && PCI_FUNC(bdf) == 0 && + (offset & ~3) == PCI_BASE_ADDRESS_0) { + *valuep = 0; + return 0; + } + val = PCI_CONF1_EXT_ADDRESS(PCI_BUS(bdf) - dev_seq(bus), PCI_DEV(bdf), PCI_FUNC(bdf), offset); @@ -95,6 +103,12 @@ static int fsl_pcie_write_config(struct udevice *bus, pci_dev_t bdf, if (fsl_pcie_addr_valid(pcie, bdf)) return 0; + /* Skip Freescale PCIe controller's PEXCSRBAR register */ + if (PCI_BUS(bdf) - dev_seq(bus) == 0 && + PCI_DEV(bdf) == 0 && PCI_FUNC(bdf) == 0 && + (offset & ~3) == PCI_BASE_ADDRESS_0) + return 0; + val = PCI_CONF1_EXT_ADDRESS(PCI_BUS(bdf) - dev_seq(bus), PCI_DEV(bdf), PCI_FUNC(bdf), offset);