From da7991b38e1f6d9b172a72650286be2558dc447f Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Tue, 26 Jan 2021 11:44:37 -0500 Subject: [PATCH 01/25] cmd: pwm: Rework argc sanity checking Currently, we check argc in a number of places to make sure that we have all of the required arguments for each of the pwm sub-commands. However, there's at least one place where we've got dead code as we'll never have argc == 0, due to checking that argc was at least 4 earlier and having only subtracted 3. Rework things so that when we have determined our subcommand make sure we have the right number of arguments for it, or error out. This means we can stop checking against argc again later. Reported-by: Coverity (CID: 316601) Cc: Pragnesh Patel Signed-off-by: Tom Rini --- cmd/pwm.c | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/cmd/pwm.c b/cmd/pwm.c index 5849fc57b6..e1f97c759d 100644 --- a/cmd/pwm.c +++ b/cmd/pwm.c @@ -34,11 +34,9 @@ static int do_pwm(struct cmd_tbl *cmdtp, int flag, int argc, argc -= 2; argv += 2; - if (argc > 0) { - str_pwm = *argv; - argc--; - argv++; - } + str_pwm = *argv; + argc--; + argv++; if (!str_pwm) return CMD_RET_USAGE; @@ -46,15 +44,23 @@ static int do_pwm(struct cmd_tbl *cmdtp, int flag, int argc, switch (*str_cmd) { case 'i': sub_cmd = PWM_SET_INVERT; + if (argc != 2) + return CMD_RET_USAGE; break; case 'c': sub_cmd = PWM_SET_CONFIG; + if (argc != 3) + return CMD_RET_USAGE; break; case 'e': sub_cmd = PWM_SET_ENABLE; + if (argc != 1) + return CMD_RET_USAGE; break; case 'd': sub_cmd = PWM_SET_DISABLE; + if (argc != 1) + return CMD_RET_USAGE; break; default: return CMD_RET_USAGE; @@ -67,38 +73,29 @@ static int do_pwm(struct cmd_tbl *cmdtp, int flag, int argc, return cmd_process_error(cmdtp, ret); } - if (argc > 0) { - str_channel = *argv; - channel = simple_strtoul(str_channel, NULL, 10); - argc--; - argv++; - } else { - return CMD_RET_USAGE; - } + str_channel = *argv; + channel = simple_strtoul(str_channel, NULL, 10); + argc--; + argv++; - if (sub_cmd == PWM_SET_INVERT && argc > 0) { + if (sub_cmd == PWM_SET_INVERT) { str_enable = *argv; pwm_enable = simple_strtoul(str_enable, NULL, 10); ret = pwm_set_invert(dev, channel, pwm_enable); - } else if (sub_cmd == PWM_SET_CONFIG && argc == 2) { + } else if (sub_cmd == PWM_SET_CONFIG) { str_period = *argv; argc--; argv++; period_ns = simple_strtoul(str_period, NULL, 10); - if (argc > 0) { - str_duty = *argv; - duty_ns = simple_strtoul(str_duty, NULL, 10); - } + str_duty = *argv; + duty_ns = simple_strtoul(str_duty, NULL, 10); ret = pwm_set_config(dev, channel, period_ns, duty_ns); } else if (sub_cmd == PWM_SET_ENABLE) { ret = pwm_set_enable(dev, channel, 1); } else if (sub_cmd == PWM_SET_DISABLE) { ret = pwm_set_enable(dev, channel, 0); - } else { - printf("PWM arguments missing\n"); - return CMD_RET_FAILURE; } if (ret) { From 220fa478fb1a84e51235b92506ff5d48415f0a8e Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 1 Feb 2021 03:28:48 +0100 Subject: [PATCH 02/25] fs/squashfs: NULL dereference in sqfs_closedir() sqfs_opendir() called in sqfs_size(), sqfs_read(), sqfs_exists() may fail leading to sqfs_closedir(NULL) being called. Do not dereference NULL. Signed-off-by: Heinrich Schuchardt --- fs/squashfs/sqfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index dca13bd1f1..29805c3c6f 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/sqfs.c @@ -1716,6 +1716,9 @@ void sqfs_closedir(struct fs_dir_stream *dirs) { struct squashfs_dir_stream *sqfs_dirs; + if (!dirs) + return; + sqfs_dirs = (struct squashfs_dir_stream *)dirs; free(sqfs_dirs->inode_table); free(sqfs_dirs->dir_table); From 402558b1fe604baaa4aa4b3e1c72a65692861f2a Mon Sep 17 00:00:00 2001 From: Wasim Khan Date: Thu, 4 Feb 2021 15:44:04 +0100 Subject: [PATCH 03/25] cmd: fdt: skip board specific fixup using env variable Sometimes it is useful to boot OS with already fixed-up device tree. Check for env variable 'skip_board_fixup' before calling ft_board_setup(). Current behaviour is unchanged, additionally user can set skip_board_fixup to 1 to skip the fixup. Signed-off-by: Wasim Khan --- common/image-fdt.c | 17 ++++++++++++----- scripts/checkpatch.pl | 6 ++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/common/image-fdt.c b/common/image-fdt.c index 61ce6e5779..a287b66392 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -576,11 +576,18 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob, fdt_fixup_pstore(blob); #endif if (IMAGE_OF_BOARD_SETUP) { - fdt_ret = ft_board_setup(blob, gd->bd); - if (fdt_ret) { - printf("ERROR: board-specific fdt fixup failed: %s\n", - fdt_strerror(fdt_ret)); - goto err; + const char *skip_board_fixup; + + skip_board_fixup = env_get("skip_board_fixup"); + if (skip_board_fixup && ((int)simple_strtol(skip_board_fixup, NULL, 10) == 1)) { + printf("skip board fdt fixup\n"); + } else { + fdt_ret = ft_board_setup(blob, gd->bd); + if (fdt_ret) { + printf("ERROR: board-specific fdt fixup failed: %s\n", + fdt_strerror(fdt_ret)); + goto err; + } } } if (IMAGE_OF_SYSTEM_SETUP) { diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 01ab570a16..755f4802a4 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2383,6 +2383,12 @@ sub u_boot_line { "fdt or initrd relocation disabled at boot time\n" . $herecurr); } + # make sure 'skip_board_fixup' is not + if ($rawline =~ /.*skip_board_fixup.*/) { + ERROR("SKIP_BOARD_FIXUP", + "Avoid setting skip_board_fixup env variable\n" . $herecurr); + } + # Do not use CONFIG_ prefix in CONFIG_IS_ENABLED() calls if ($line =~ /^\+.*CONFIG_IS_ENABLED\(CONFIG_\w*\).*/) { ERROR("CONFIG_IS_ENABLED_CONFIG", From e4cecb56677c42077fae48928f9cd5ce18e8a3a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Tue, 9 Feb 2021 19:05:07 +0100 Subject: [PATCH 04/25] fs: btrfs: skip xattrs in directory listing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Skip xattrs in directory listing. U-Boot filesystem drivers do not list xattrs. Signed-off-by: Marek Behún Cc: David Sterba Cc: Qu Wenruo Cc: Tom Rini Reviewed-by: Qu Wenruo --- fs/btrfs/btrfs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/btrfs.c b/fs/btrfs/btrfs.c index 346b2c4341..6b4c5feb53 100644 --- a/fs/btrfs/btrfs.c +++ b/fs/btrfs/btrfs.c @@ -29,7 +29,6 @@ static int show_dir(struct btrfs_root *root, struct extent_buffer *eb, [BTRFS_FT_FIFO] = "FIFO", [BTRFS_FT_SOCK] = "SOCK", [BTRFS_FT_SYMLINK] = "SYMLINK", - [BTRFS_FT_XATTR] = "XATTR" }; u8 type = btrfs_dir_type(eb, di); char namebuf[BTRFS_NAME_LEN]; @@ -38,6 +37,10 @@ static int show_dir(struct btrfs_root *root, struct extent_buffer *eb, time_t mtime; int ret = 0; + /* skip XATTRs in directory listing */ + if (type == BTRFS_FT_XATTR) + return 0; + btrfs_dir_item_key_to_cpu(eb, di, &key); if (key.type == BTRFS_ROOT_ITEM_KEY) { From c65365d7add59b35a4fdde5807a7afb5503e7a40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Tue, 9 Feb 2021 19:05:08 +0100 Subject: [PATCH 05/25] fs: btrfs: change directory list output to be aligned as before MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since commit 325dd1f642dd ("fs: btrfs: Use btrfs_iter_dir() to ...") when btrfs is listing a directory, the output is not aligned: 15 Wed Sep 09 13:20:03 2020 boot.scr -> @/boot/boot.scr 0 Tue Feb 02 12:42:09 2021 @ 108 Tue Feb 02 12:54:04 2021 1.info Return back to how it was displayed previously, i.e.: 15 Wed Sep 09 13:20:03 2020 boot.scr -> @/boot/boot.scr 0 Tue Feb 02 12:42:09 2021 @ < > 108 Tue Feb 02 12:54:04 2021 1.info Instead of '', print '< >', as ext4 driver. If an unknown directory item type is encountered, we will print the type number left padded with spaces, enclosed by '?', instead of '<' and '>', i.e.: ? 30? ............................. name Signed-off-by: Marek Behún Fixes: 325dd1f642dd ("fs: btrfs: Use btrfs_iter_dir() to replace ...") Cc: David Sterba Cc: Qu Wenruo Cc: Tom Rini Reviewed-by: Qu Wenruo --- fs/btrfs/btrfs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/btrfs.c b/fs/btrfs/btrfs.c index 6b4c5feb53..52a243a659 100644 --- a/fs/btrfs/btrfs.c +++ b/fs/btrfs/btrfs.c @@ -22,13 +22,13 @@ static int show_dir(struct btrfs_root *root, struct extent_buffer *eb, struct btrfs_inode_item ii; struct btrfs_key key; static const char* dir_item_str[] = { - [BTRFS_FT_REG_FILE] = "FILE", + [BTRFS_FT_REG_FILE] = " ", [BTRFS_FT_DIR] = "DIR", - [BTRFS_FT_CHRDEV] = "CHRDEV", - [BTRFS_FT_BLKDEV] = "BLKDEV", - [BTRFS_FT_FIFO] = "FIFO", - [BTRFS_FT_SOCK] = "SOCK", - [BTRFS_FT_SYMLINK] = "SYMLINK", + [BTRFS_FT_CHRDEV] = "CHR", + [BTRFS_FT_BLKDEV] = "BLK", + [BTRFS_FT_FIFO] = "FIF", + [BTRFS_FT_SOCK] = "SCK", + [BTRFS_FT_SYMLINK] = "SYM", }; u8 type = btrfs_dir_type(eb, di); char namebuf[BTRFS_NAME_LEN]; @@ -93,7 +93,7 @@ static int show_dir(struct btrfs_root *root, struct extent_buffer *eb, if (type < ARRAY_SIZE(dir_item_str) && dir_item_str[type]) printf("<%s> ", dir_item_str[type]); else - printf("DIR_ITEM.%u", type); + printf("?%3u? ", type); if (type == BTRFS_FT_CHRDEV || type == BTRFS_FT_BLKDEV) { ASSERT(key.type == BTRFS_INODE_ITEM_KEY); printf("%4llu,%5llu ", btrfs_stack_inode_rdev(&ii) >> 20, From 6ce28132b88a95eb6d4e67c594270f0825d6dad8 Mon Sep 17 00:00:00 2001 From: Klaus Heinrich Kiwi Date: Tue, 9 Feb 2021 15:41:53 -0300 Subject: [PATCH 06/25] Kconfig: SPL_FIT_SIGNATURE selects FIT_SIGNATURE Selecting SPL_FIT_SIGNATURE (without selecting U-boot proper verified boot first) breaks the build due to CONFIG_FIT_SIGNATURE_MAX_SIZE being undefined, in addition to Kconfig warnings on RSA and IMAGE_SIGN_INFO unmet dependencies. Signed-off-by: Klaus Heinrich Kiwi --- common/Kconfig.boot | 1 + 1 file changed, 1 insertion(+) diff --git a/common/Kconfig.boot b/common/Kconfig.boot index 7532e55edb..62dc410266 100644 --- a/common/Kconfig.boot +++ b/common/Kconfig.boot @@ -181,6 +181,7 @@ config SPL_FIT_FULL_CHECK config SPL_FIT_SIGNATURE bool "Enable signature verification of FIT firmware within SPL" depends on SPL_DM + select FIT_SIGNATURE select SPL_FIT select SPL_CRYPTO_SUPPORT select SPL_HASH_SUPPORT From bdb7f2632bdc3baf910c5ef547df03df0ec0dbea Mon Sep 17 00:00:00 2001 From: Klaus Heinrich Kiwi Date: Tue, 9 Feb 2021 15:41:54 -0300 Subject: [PATCH 07/25] Kconfig: SPL_FIT_SIGNATURE requires SPL_LOAD_FIT Having the ability to support firmware FIT signatures on the SPL sounds not so useful if the SPL is not supporting to load a (U-boot) firmware as a FIT image. Signed-off-by: Klaus Heinrich Kiwi --- common/Kconfig.boot | 1 + 1 file changed, 1 insertion(+) diff --git a/common/Kconfig.boot b/common/Kconfig.boot index 62dc410266..70c02b9e30 100644 --- a/common/Kconfig.boot +++ b/common/Kconfig.boot @@ -181,6 +181,7 @@ config SPL_FIT_FULL_CHECK config SPL_FIT_SIGNATURE bool "Enable signature verification of FIT firmware within SPL" depends on SPL_DM + depends on SPL_LOAD_FIT || SPL_LOAD_FIT_FULL select FIT_SIGNATURE select SPL_FIT select SPL_CRYPTO_SUPPORT From 4e040b4d245a09c4c9e2c3a9e0b023c5eb00a452 Mon Sep 17 00:00:00 2001 From: Klaus Heinrich Kiwi Date: Tue, 9 Feb 2021 15:41:55 -0300 Subject: [PATCH 08/25] Makefile: Add (default) DEVICE_TREE to SPL FIT U-boot allows the default device tree to be overridden from the build environment using the DEVICE_TREE variable. Make sure that we include it in the SPL FIT mkimage build step. This also fixes a broken image in case CONFIG_OF_LIST and CONFIG_OF_OVERLAY_LIST are unset (i.e., expected to be supplied by the DEVICE_TREE env var). Signed-off-by: Klaus Heinrich Kiwi --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 4da46dea39..079881b62a 100644 --- a/Makefile +++ b/Makefile @@ -1386,6 +1386,7 @@ MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \ -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -p $(CONFIG_FIT_EXTERNAL_OFFSET) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \ + $(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(DEVICE_TREE))) \ $(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) \ $(patsubst %,-b arch/$(ARCH)/dts/%.dtbo,$(subst ",,$(CONFIG_OF_OVERLAY_LIST))) else From a70abcff5edb63ee62976ddfe881a8496e540d12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Tue, 9 Feb 2021 21:23:47 +0100 Subject: [PATCH 09/25] cmd: pinmux: depend on PINCTRL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The pinmux command uses functions pinctrl_get_pin_*(), which are missing if PINCTRL config option is disabled. Signed-off-by: Marek Behún Cc: Simon Glass Cc: Tom Rini Reviewed-by: Simon Glass --- cmd/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/Kconfig b/cmd/Kconfig index 928a2a0a2d..4defbd9cf9 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1188,6 +1188,7 @@ config CMD_PCI config CMD_PINMUX bool "pinmux - show pins muxing" + depends on PINCTRL default y if PINCTRL help Parse all available pin-controllers and show pins muxing. This From db5f1a50eff8cadd463cebd4448e00a9a2934f40 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Wed, 10 Feb 2021 17:29:16 +0000 Subject: [PATCH 10/25] config: hikey: convert to DM_USB and DM_ETH Convert the hikey to use DM_USB and DM_ETH. Conversion based on rpi as it has a similar DWC config. Signed-off-by: Peter Robinson --- configs/hikey_defconfig | 2 ++ include/configs/hikey.h | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/hikey_defconfig b/configs/hikey_defconfig index 5fb48238ec..280a59a748 100644 --- a/configs/hikey_defconfig +++ b/configs/hikey_defconfig @@ -25,7 +25,9 @@ CONFIG_DM_MMC=y CONFIG_MMC_DW=y CONFIG_MMC_DW_K3=y CONFIG_CONS_INDEX=4 +CONFIG_DM_ETH=y CONFIG_USB=y +CONFIG_DM_USB=y CONFIG_USB_DWC2=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y diff --git a/include/configs/hikey.h b/include/configs/hikey.h index a323a0bf69..659fbee052 100644 --- a/include/configs/hikey.h +++ b/include/configs/hikey.h @@ -47,9 +47,7 @@ /* Size of malloc() pool */ #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + SZ_8M) -#ifdef CONFIG_CMD_USB -#define CONFIG_USB_DWC2_REG_ADDR 0xF72C0000 -/*#define CONFIG_DWC2_DFLT_SPEED_FULL*/ +#ifdef CONFIG_USB_DWC2 #define CONFIG_DWC2_ENABLE_DYNAMIC_FIFO #endif From c6bf4f38988996f12c69a1cb5470bf9bea7c88ce Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 10 Feb 2021 18:59:21 +0100 Subject: [PATCH 11/25] malloc: adjust memcpy() and memset() definitions. Compiling the sandbox fails on armv7 due to conflicting definitions of memcpy() and memset() in include/malloc.h and include/linux/string.h. Use linux/string.h here. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- include/malloc.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/malloc.h b/include/malloc.h index f66c2e8617..e15e528a2e 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -361,8 +361,11 @@ extern "C" { #if (__STD_C || defined(HAVE_MEMCPY)) #if __STD_C +/* U-Boot defines memset() and memcpy in /include/linux/string.h void* memset(void*, int, size_t); void* memcpy(void*, const void*, size_t); +*/ +#include #else #ifdef WIN32 /* On Win32 platforms, 'memset()' and 'memcpy()' are already declared in */ From 99078472455b8bb69ce57237bcc68ea9ac88ae38 Mon Sep 17 00:00:00 2001 From: Roger Pau Monne Date: Sat, 13 Feb 2021 11:06:31 +0100 Subject: [PATCH 12/25] scripts/check-config.sh: fix to be compatible with BSD sed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fist use extended regexp in order to drop the '\' around the parentheses which is not supported by BSD sed in regular mode. Secondly use [[:blank:]] instead of \s, as the later is a GNU extension. No functional change intended. Signed-off-by: Roger Pau Monné Reviewed-by: Simon Glass --- scripts/check-config.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/check-config.sh b/scripts/check-config.sh index 583f7d0963..cc1c9a54d9 100755 --- a/scripts/check-config.sh +++ b/scripts/check-config.sh @@ -39,14 +39,14 @@ new_adhoc="${path}.adhoc" export LC_ALL=C export LC_COLLATE=C -cat ${path} |sed -n 's/^#define \(CONFIG_[A-Za-z0-9_]*\).*/\1/p' |sort |uniq \ +cat ${path} |sed -nr 's/^#define (CONFIG_[A-Za-z0-9_]*).*/\1/p' |sort |uniq \ >${configs} comm -23 ${configs} ${whitelist} > ${suspects} -cat `find ${srctree} -name "Kconfig*"` |sed -n \ - -e 's/^\s*config *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \ - -e 's/^\s*menuconfig \([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \ +cat `find ${srctree} -name "Kconfig*"` |sed -nr \ + -e 's/^[[:blank:]]*config *([A-Za-z0-9_]*).*$/CONFIG_\1/p' \ + -e 's/^[[:blank:]]*menuconfig ([A-Za-z0-9_]*).*$/CONFIG_\1/p' \ |sort |uniq > ${ok} comm -23 ${suspects} ${ok} >${new_adhoc} if [ -s ${new_adhoc} ]; then From e420a38fa69b2d528466a4b6d40deb1fb58ea352 Mon Sep 17 00:00:00 2001 From: Roger Pau Monne Date: Sat, 13 Feb 2021 11:06:32 +0100 Subject: [PATCH 13/25] build/DTC: fix sed usage in DTC command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Current sed usage in the DTC command relies on GNU sed specific -i option which has a slightly different syntax for BSD sed and always expects an extension to be provided in order to create a backup file. Instead drop the cat concatenation done before the sed call and use sed itself to edit and concatenate the files. No functional change intended. Signed-off-by: Roger Pau Monné --- scripts/Makefile.lib | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 56e9d54242..78543c6dd1 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -326,8 +326,7 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ -d $(depfile).dtc.tmp $(dtc-tmp) || \ (echo "Check $(shell pwd)/$(pre-tmp) for errors" && false) \ ; \ - cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) ; \ - sed -i "s:$(pre-tmp):$(<):" $(depfile) + sed "s:$(pre-tmp):$(<):" $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) $(obj)/%.dtb: $(src)/%.dts FORCE $(call if_changed_dep,dtc) From 25d34b936cef12cf8b481b64fe9d02c08df12908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Stehl=C3=A9?= Date: Sun, 14 Feb 2021 19:39:04 +0100 Subject: [PATCH 14/25] virtio: fix off by one device id comparison MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit VIRTIO_ID_MAX_NUM is the largest device ID plus 1. Therefore a device id cannot be greater or equal to VIRTIO_ID_MAX_NUM. Fix the comparison accordingly. Fixes: 8fb49b4c7a82 ("dm: Add a new uclass driver for VirtIO transport devices") Signed-off-by: Vincent Stehlé Cc: Simon Glass Cc: Bin Meng --- drivers/virtio/virtio-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/virtio/virtio-uclass.c b/drivers/virtio/virtio-uclass.c index cf2cfaef2c..0379536c54 100644 --- a/drivers/virtio/virtio-uclass.c +++ b/drivers/virtio/virtio-uclass.c @@ -227,7 +227,7 @@ static int virtio_uclass_post_probe(struct udevice *udev) struct udevice *vdev; int ret; - if (uc_priv->device > VIRTIO_ID_MAX_NUM) { + if (uc_priv->device >= VIRTIO_ID_MAX_NUM) { debug("(%s): virtio device ID %d exceeds maximum num\n", udev->name, uc_priv->device); return 0; From 9abe5e68033dab0d521475090ffd0cef9cb2c581 Mon Sep 17 00:00:00 2001 From: Diego Sueiro Date: Mon, 15 Feb 2021 07:27:57 +0000 Subject: [PATCH 15/25] vexpress64_fvp: Set DRAM to 4G to match with kernel devicetree Currently, the kernel devicetree is setting the DRAM size to ~4G. Signed-off-by: Diego Sueiro --- configs/vexpress_aemv8a_semi_defconfig | 2 +- include/configs/vexpress_aemv8a.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/configs/vexpress_aemv8a_semi_defconfig b/configs/vexpress_aemv8a_semi_defconfig index a26137ef5d..2ecb7762ce 100644 --- a/configs/vexpress_aemv8a_semi_defconfig +++ b/configs/vexpress_aemv8a_semi_defconfig @@ -2,7 +2,7 @@ CONFIG_ARM=y CONFIG_TARGET_VEXPRESS64_BASE_FVP=y CONFIG_SYS_TEXT_BASE=0x88000000 CONFIG_SYS_MALLOC_F_LEN=0x2000 -CONFIG_NR_DRAM_BANKS=1 +CONFIG_NR_DRAM_BANKS=2 CONFIG_SYS_MEMTEST_START=0x80000000 CONFIG_SYS_MEMTEST_END=0xff000000 CONFIG_ENV_SIZE=0x40000 diff --git a/include/configs/vexpress_aemv8a.h b/include/configs/vexpress_aemv8a.h index 566bee5b87..7318fb6c58 100644 --- a/include/configs/vexpress_aemv8a.h +++ b/include/configs/vexpress_aemv8a.h @@ -117,6 +117,9 @@ #ifdef CONFIG_TARGET_VEXPRESS64_JUNO #define PHYS_SDRAM_2 (0x880000000) #define PHYS_SDRAM_2_SIZE 0x180000000 +#elif CONFIG_TARGET_VEXPRESS64_BASE_FVP && CONFIG_NR_DRAM_BANKS == 2 +#define PHYS_SDRAM_2 (0x880000000) +#define PHYS_SDRAM_2_SIZE 0x80000000 #endif /* Enable memtest */ From 8f684bc12034721585f6412e39155898c8db3d65 Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Tue, 16 Feb 2021 11:40:15 -0500 Subject: [PATCH 16/25] lib: rsa: Add debug message on algo mismatch Currently we fail silently if there is an algorithm mismatch. To help distinguish this failure condition. Signed-off-by: Sean Anderson --- lib/rsa/rsa-verify.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c index e34d3293d1..aee76f42d5 100644 --- a/lib/rsa/rsa-verify.c +++ b/lib/rsa/rsa-verify.c @@ -447,8 +447,11 @@ static int rsa_verify_with_keynode(struct image_sign_info *info, } algo = fdt_getprop(blob, node, "algo", NULL); - if (strcmp(info->name, algo)) + if (strcmp(info->name, algo)) { + debug("%s: Wrong algo: have %s, expected %s", __func__, + info->name, algo); return -EFAULT; + } prop.num_bits = fdtdec_get_int(blob, node, "rsa,num-bits", 0); From 872b1921d323b57e84aaa22d258ced39b32d55e8 Mon Sep 17 00:00:00 2001 From: Matthias Brugger Date: Tue, 16 Feb 2021 20:54:07 +0100 Subject: [PATCH 17/25] configs: BPI-R2: Disable EFI Grub workaround The EFI Grub workaround on BananaPi R2 slows down the boot process to the point, that the watchdog will trigger a reboot before the kernel can reset it. Fix this by disabeling the workaround. Signed-off-by: Matthias Brugger --- configs/mt7623n_bpir2_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/mt7623n_bpir2_defconfig b/configs/mt7623n_bpir2_defconfig index d36ff560cf..fb20cb1832 100644 --- a/configs/mt7623n_bpir2_defconfig +++ b/configs/mt7623n_bpir2_defconfig @@ -53,3 +53,4 @@ CONFIG_TIMER=y CONFIG_MTK_TIMER=y CONFIG_WDT_MTK=y CONFIG_LZMA=y +# CONFIG_EFI_GRUB_ARM32_WORKAROUND is not set From bc18f31e4a3f13e09b6e9d04b282c2579b519ebf Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 17 Feb 2021 12:54:31 +0100 Subject: [PATCH 18/25] lib: rsa: struct udevice build warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoid build warnings observed with gcc 10.2 In file included from lib/rsa/rsa-keyprop.c:16: include/u-boot/rsa-mod-exp.h:65:24: warning: ‘struct udevice’ declared inside parameter list will not be visible outside of this definition or declaration 65 | int rsa_mod_exp(struct udevice *dev, const uint8_t *sig, | uint32_t sig_len, | ^~~~~~~ include/u-boot/rsa-mod-exp.h:96:24: warning: ‘struct udevice’ declared inside parameter list will not be visible outside of this definition or declaration 96 | int (*mod_exp)(struct udevice *dev, const uint8_t *sig, | by defining struct udevice. Fixes: 401d1c4f5d2d ("common: Drop asm/global_data.h from common header") Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- include/u-boot/rsa-mod-exp.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/u-boot/rsa-mod-exp.h b/include/u-boot/rsa-mod-exp.h index 7b7c2915a9..fc9557c781 100644 --- a/include/u-boot/rsa-mod-exp.h +++ b/include/u-boot/rsa-mod-exp.h @@ -9,6 +9,8 @@ #include #include +struct udevice; + /** * struct key_prop - holder for a public key properties * From d5f85303bc03226ef167bf28b18faccd351f03d7 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 17 Feb 2021 12:58:14 +0100 Subject: [PATCH 19/25] test: missing dependency for test/cmd/setexpr.c test/cmd/setexpr.c cannot be linked with CONFIG_CMD_SETEXPR=n: ld.bfd: test/built-in.o: in function `setexpr_test_sub': test/cmd/setexpr.c:227: undefined reference to `setexpr_regex_sub' ld.bfd: test/built-in.o: in function `setexpr_test_backref': test/cmd/setexpr.c:267: undefined reference to `setexpr_regex_sub' Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- test/cmd/Makefile | 2 +- test/cmd_ut.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/test/cmd/Makefile b/test/cmd/Makefile index 5451e9ea90..c84df60395 100644 --- a/test/cmd/Makefile +++ b/test/cmd/Makefile @@ -8,4 +8,4 @@ endif obj-y += mem.o obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o obj-$(CONFIG_CMD_PWM) += pwm.o -obj-y += setexpr.o +obj-$(CONFIG_CMD_SETEXPR) += setexpr.o diff --git a/test/cmd_ut.c b/test/cmd_ut.c index 90674d5de5..8f3089890e 100644 --- a/test/cmd_ut.c +++ b/test/cmd_ut.c @@ -75,8 +75,10 @@ static struct cmd_tbl cmd_ut_sub[] = { U_BOOT_CMD_MKENT(log, CONFIG_SYS_MAXARGS, 1, do_ut_log, "", ""), #endif U_BOOT_CMD_MKENT(mem, CONFIG_SYS_MAXARGS, 1, do_ut_mem, "", ""), +#ifdef CONFIG_CMD_SETEXPR U_BOOT_CMD_MKENT(setexpr, CONFIG_SYS_MAXARGS, 1, do_ut_setexpr, "", ""), +#endif #ifdef CONFIG_UT_TIME U_BOOT_CMD_MKENT(time, CONFIG_SYS_MAXARGS, 1, do_ut_time, "", ""), #endif From 391a16b710dd5688bffac1dca0026f96638361b0 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Thu, 18 Feb 2021 20:06:37 +0000 Subject: [PATCH 20/25] rng: iProc rng200: Rename ..._platdata variables to just ..._plat In 8a8d24bd Simon dropped data from all the various _platdata calls but it seems this wasn't caught for the RNG200 driver from when it was posted to merged. This fixes that issue. Fixes: 537f0018 (rng: Add iProc RNG200 driver) Signed-off-by: Peter Robinson --- drivers/rng/iproc_rng200.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/rng/iproc_rng200.c b/drivers/rng/iproc_rng200.c index f71f285f53..1126bbd797 100644 --- a/drivers/rng/iproc_rng200.c +++ b/drivers/rng/iproc_rng200.c @@ -33,11 +33,11 @@ #define RNG_FIFO_COUNT_OFFSET 0x24 #define RNG_FIFO_COUNT_RNG_FIFO_COUNT_MASK 0x000000FF -struct iproc_rng200_platdata { +struct iproc_rng200_plat { fdt_addr_t base; }; -static void iproc_rng200_enable(struct iproc_rng200_platdata *pdata, bool enable) +static void iproc_rng200_enable(struct iproc_rng200_plat *pdata, bool enable) { fdt_addr_t rng_base = pdata->base; u32 val; @@ -52,7 +52,7 @@ static void iproc_rng200_enable(struct iproc_rng200_platdata *pdata, bool enable writel(val, rng_base + RNG_CTRL_OFFSET); } -static void iproc_rng200_restart(struct iproc_rng200_platdata *pdata) +static void iproc_rng200_restart(struct iproc_rng200_plat *pdata) { fdt_addr_t rng_base = pdata->base; u32 val; @@ -84,7 +84,7 @@ static void iproc_rng200_restart(struct iproc_rng200_platdata *pdata) static int iproc_rng200_read(struct udevice *dev, void *data, size_t len) { - struct iproc_rng200_platdata *priv = dev_get_plat(dev); + struct iproc_rng200_plat *priv = dev_get_plat(dev); char *buf = (char *)data; u32 num_remaining = len; u32 status; @@ -136,7 +136,7 @@ static int iproc_rng200_read(struct udevice *dev, void *data, size_t len) static int iproc_rng200_probe(struct udevice *dev) { - struct iproc_rng200_platdata *priv = dev_get_plat(dev); + struct iproc_rng200_plat *priv = dev_get_plat(dev); iproc_rng200_enable(priv, true); @@ -145,16 +145,16 @@ static int iproc_rng200_probe(struct udevice *dev) static int iproc_rng200_remove(struct udevice *dev) { - struct iproc_rng200_platdata *priv = dev_get_plat(dev); + struct iproc_rng200_plat *priv = dev_get_plat(dev); iproc_rng200_enable(priv, false); return 0; } -static int iproc_rng200_ofdata_to_platdata(struct udevice *dev) +static int iproc_rng200_of_to_plat(struct udevice *dev) { - struct iproc_rng200_platdata *pdata = dev_get_plat(dev); + struct iproc_rng200_plat *pdata = dev_get_plat(dev); pdata->base = dev_read_addr(dev); if (!pdata->base) @@ -180,6 +180,6 @@ U_BOOT_DRIVER(iproc_rng200_rng) = { .ops = &iproc_rng200_ops, .probe = iproc_rng200_probe, .remove = iproc_rng200_remove, - .plat_auto = sizeof(struct iproc_rng200_platdata), - .of_to_plat = iproc_rng200_ofdata_to_platdata, + .priv_auto = sizeof(struct iproc_rng200_plat), + .of_to_plat = iproc_rng200_of_to_plat, }; From 277b8799061df3b3aa242c5fee9b1cf6a40abe04 Mon Sep 17 00:00:00 2001 From: Siew Chin Lim Date: Fri, 19 Feb 2021 10:32:07 +0800 Subject: [PATCH 21/25] lib: sha512: include "compiler.h" Include "compiler.h" in sha512.c. This is needed by 'cpu_to_be64' macro that used in 'sha512_base_do_finalize' function. Signed-off-by: Siew Chin Lim Reviewed-by: Simon Glass --- lib/sha512.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/sha512.c b/lib/sha512.c index f1e2acf0fb..35f31e3dc5 100644 --- a/lib/sha512.c +++ b/lib/sha512.c @@ -16,6 +16,7 @@ #else #include #endif /* USE_HOSTCC */ +#include #include #include From f0bbcdef1b7fdf3e41e942fef56ceb76f7f820ac Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 20 Feb 2021 10:40:23 +0100 Subject: [PATCH 22/25] dm: ddr: socfpga: don't assign values that are not used The values of left_edge[0] and right_edge[0] are overwritten before they are used. Remove the superfluous assignments. Fixes: 285b3cb939a8 ("dm: ddr: socfpga: fix gen5 ddr driver to not use bss") Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- drivers/ddr/altera/sequencer.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/ddr/altera/sequencer.c b/drivers/ddr/altera/sequencer.c index 2dbde49a9c..6b9b2e9094 100644 --- a/drivers/ddr/altera/sequencer.c +++ b/drivers/ddr/altera/sequencer.c @@ -3202,13 +3202,6 @@ rw_mgr_mem_calibrate_writes_center(struct socfpga_sdrseq *seq, /* Centre DM */ debug_cond(DLEVEL >= 2, "%s:%d write_center: DM\n", __func__, __LINE__); - /* - * Set the left and right edge of each bit to an illegal value. - * Use (seq->iocfg->io_out1_delay_max + 1) as an illegal value. - */ - left_edge[0] = seq->iocfg->io_out1_delay_max + 1; - right_edge[0] = seq->iocfg->io_out1_delay_max + 1; - /* Search for the/part of the window with DM shift. */ search_window(seq, 1, rank_bgn, write_group, &bgn_curr, &end_curr, &bgn_best, &end_best, &win_best, 0); From 6b0431dc21050a14bf80db4b3c34444816d7652d Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 20 Feb 2021 10:42:50 +0100 Subject: [PATCH 23/25] mtd: rawnand: cortina_nand: missing initialization ca_do_bch_correction() takes a random value from the stack and starts counting bitflips from this value. Initialize the counter. This passed unnoticed as the value is finally ignored in the call hierarchy. Fixes: 161df94b3c43 ("mtd: rawnand: cortina_nand: Add Cortina CAxxxx SoC support") Signed-off-by: Heinrich Schuchardt --- drivers/mtd/nand/raw/cortina_nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/cortina_nand.c b/drivers/mtd/nand/raw/cortina_nand.c index 12bd1ded83..81fa8788a4 100644 --- a/drivers/mtd/nand/raw/cortina_nand.c +++ b/drivers/mtd/nand/raw/cortina_nand.c @@ -546,7 +546,7 @@ static int ca_do_bch_correction(struct nand_chip *chip, struct nand_drv *info = (struct nand_drv *)nand_get_controller_data(chip); unsigned int reg_v, err_loc0, err_loc1; - int k, max_bitflips; + int k, max_bitflips = 0; for (k = 0; k < (err_num + 1) / 2; k++) { reg_v = readl(&info->reg->flash_nf_bch_error_loc01 + k); From df88a0e5cd7dfc62921fd0ee3e79c47c2953b2a5 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 20 Feb 2021 10:44:04 +0100 Subject: [PATCH 24/25] net: cortina_ni: buffer overrun When copying to a u32 field we should use sizeof(u32) and not sizeof(*u32) in memcpy. On 64bit systems like cortina_presidio-asic-emmc_defconfig using sizeof(*u32) leads to a buffer overrun. Fixes: febe13b438b3 ("net: cortina_ni: Add eth support for Cortina Access CAxxxx SoCs") Signed-off-by: Heinrich Schuchardt Reviewed-By: Ramon Fried --- drivers/net/cortina_ni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/cortina_ni.c b/drivers/net/cortina_ni.c index ee424d95bc..ef6ecd88b0 100644 --- a/drivers/net/cortina_ni.c +++ b/drivers/net/cortina_ni.c @@ -713,7 +713,7 @@ static int cortina_eth_recv(struct udevice *dev, int flags, uchar **packetp) priv->rx_xram_end_adr); memcpy(&packet_status, rx_xram_ptr, - sizeof(rx_xram_ptr)); + sizeof(*rx_xram_ptr)); if (packet_status.valid == 0) { debug("%s: Invalid Packet !!, ", __func__); debug("next_link=%d\n", next_link); From 2f7aa89703738b0c37e34120319bab567a8672bd Mon Sep 17 00:00:00 2001 From: Siew Chin Lim Date: Tue, 23 Feb 2021 14:34:37 +0800 Subject: [PATCH 25/25] common: Add "ifndef __ASSEMBLY__" in asm/global_data.h Commit "common: Drop asm/global_data.h from common header" added asm/global_data.h into secure.h. However, secure.h will be included by psci.S. Adding asm/global_data.h has caused compilation failure in pcsi.S. Add "ifndef __ASSEMBLY__" in asm/global_data.h. Signed-off-by: Siew Chin Lim Reviewed-by: Simon Glass --- arch/arm/include/asm/global_data.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h index 5a935d34e2..fba655f3b9 100644 --- a/arch/arm/include/asm/global_data.h +++ b/arch/arm/include/asm/global_data.h @@ -7,6 +7,8 @@ #ifndef __ASM_GBL_DATA_H #define __ASM_GBL_DATA_H +#ifndef __ASSEMBLY__ + #include #include @@ -125,4 +127,6 @@ static inline void set_gd(volatile gd_t *gd_ptr) #endif } +#endif /* __ASSEMBLY__ */ + #endif /* __ASM_GBL_DATA_H */