From e7882f65f02eca5a7d35871ba0355462bbf7362e Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 10 Apr 2020 20:54:49 +0200 Subject: [PATCH 01/23] tiny-printf: Support %i The most basic printf("%i", value) formating string was missing, add it for the sake of convenience. Signed-off-by: Marek Vasut Cc: Simon Glass Cc: Stefan Roese --- lib/tiny-printf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c index 1138c7012a..8fc7e48d99 100644 --- a/lib/tiny-printf.c +++ b/lib/tiny-printf.c @@ -242,6 +242,7 @@ static int _vprintf(struct printf_info *info, const char *fmt, va_list va) goto abort; case 'u': case 'd': + case 'i': div = 1000000000; if (islong) { num = va_arg(va, unsigned long); @@ -251,7 +252,7 @@ static int _vprintf(struct printf_info *info, const char *fmt, va_list va) num = va_arg(va, unsigned int); } - if (ch == 'd') { + if (ch != 'u') { if (islong && (long)num < 0) { num = -(long)num; out(info, '-'); From f8dc7f2f18d324343737c72e27b6bd0ee8ff728e Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Fri, 10 Apr 2020 16:02:02 +0200 Subject: [PATCH 02/23] configs: migrate CONFIG_SYS_ARM_CACHE_* in Kconfig Move CONFIG_SYS_ARM_CACHE_WRITETHROUGH and CONFIG_SYS_ARM_CACHE_WRITEALLOC into Kconfig done by moveconfig.py. Kconfig uses a choice between the 3 values supported in U-Boot, including the new configuration CONFIG_SYS_ARM_CACHE_WRITEBACK (the default configuration). The patch also avoids to select simultaneously 2 configurations. Signed-off-by: Patrick Delaunay --- arch/arm/Kconfig | 28 +++++++++++++++++++++ arch/arm/include/asm/iproc-common/configs.h | 1 - include/configs/grpeach.h | 1 - include/configs/pxa-common.h | 2 -- scripts/config_whitelist.txt | 1 - 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 8e67e1c587..8b6c6a2965 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -340,6 +340,34 @@ config SYS_CACHELINE_SIZE default 64 if SYS_CACHE_SHIFT_6 default 32 if SYS_CACHE_SHIFT_5 +choice + prompt "Select the ARM data write cache policy" + default SYS_ARM_CACHE_WRITETHROUGH if TARGET_BCMCYGNUS || \ + TARGET_BCMNSP || CPU_PXA || RZA1 + default SYS_ARM_CACHE_WRITEBACK + +config SYS_ARM_CACHE_WRITEBACK + bool "Write-back (WB)" + help + A write updates the cache only and marks the cache line as dirty. + External memory is updated only when the line is evicted or explicitly + cleaned. + +config SYS_ARM_CACHE_WRITETHROUGH + bool "Write-through (WT)" + help + A write updates both the cache and the external memory system. + This does not mark the cache line as dirty. + +config SYS_ARM_CACHE_WRITEALLOC + bool "Write allocation (WA)" + help + A cache line is allocated on a write miss. This means that executing a + store instruction on the processor might cause a burst read to occur. + There is a linefill to obtain the data for the cache line, before the + write is performed. +endchoice + config ARCH_CPU_INIT bool "Enable ARCH_CPU_INIT" help diff --git a/arch/arm/include/asm/iproc-common/configs.h b/arch/arm/include/asm/iproc-common/configs.h index 96c4f54f4a..4733c0793c 100644 --- a/arch/arm/include/asm/iproc-common/configs.h +++ b/arch/arm/include/asm/iproc-common/configs.h @@ -10,7 +10,6 @@ /* Architecture, CPU, chip, etc */ #define CONFIG_IPROC -#define CONFIG_SYS_ARM_CACHE_WRITETHROUGH /* Memory Info */ #define CONFIG_SYS_SDRAM_BASE 0x61000000 diff --git a/include/configs/grpeach.h b/include/configs/grpeach.h index f1ea729eb3..001e9d385b 100644 --- a/include/configs/grpeach.h +++ b/include/configs/grpeach.h @@ -16,7 +16,6 @@ /* Miscellaneous */ #define CONFIG_SYS_PBSIZE 256 -#define CONFIG_SYS_ARM_CACHE_WRITETHROUGH #define CONFIG_CMDLINE_TAG /* Internal RAM Size (RZ/A1=3M, RZ/A1M=5M, RZ/A1H=10M) */ diff --git a/include/configs/pxa-common.h b/include/configs/pxa-common.h index e25800a095..2632d48cc9 100644 --- a/include/configs/pxa-common.h +++ b/include/configs/pxa-common.h @@ -8,8 +8,6 @@ #ifndef __CONFIG_PXA_COMMON_H__ #define __CONFIG_PXA_COMMON_H__ -#define CONFIG_SYS_ARM_CACHE_WRITETHROUGH - /* * KGDB */ diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 12a6698958..7a5da9d822 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -1770,7 +1770,6 @@ CONFIG_SYS_AMASK4 CONFIG_SYS_AMASK5 CONFIG_SYS_AMASK6 CONFIG_SYS_AMASK7 -CONFIG_SYS_ARM_CACHE_WRITETHROUGH CONFIG_SYS_AT91_CPU_NAME CONFIG_SYS_AT91_MAIN_CLOCK CONFIG_SYS_AT91_PLLA From c8ec1e3ff505a6ce44ec36e77d0579f5d01ed6b8 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Fri, 24 Apr 2020 20:20:15 +0200 Subject: [PATCH 03/23] arm: caches: protect dram_bank_mmu_setup access to bi_dram Add protection in dram_bank_mmu_setup() to avoid access to bd->bi_dram before relocation. This patch allow to use the generic weak function dram_bank_mmu_setup to activate the MMU and the data cache in SPL or in U-Boot before relocation, when bd->bi_dram is not yet initialized. In this cases, the MMU must be initialized explicitly with mmu_set_region_dcache_behaviour function. Signed-off-by: Patrick Delaunay --- arch/arm/lib/cache-cp15.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/lib/cache-cp15.c b/arch/arm/lib/cache-cp15.c index f8d20960da..54509f11c3 100644 --- a/arch/arm/lib/cache-cp15.c +++ b/arch/arm/lib/cache-cp15.c @@ -91,6 +91,10 @@ __weak void dram_bank_mmu_setup(int bank) bd_t *bd = gd->bd; int i; + /* bd->bi_dram is available only after relocation */ + if ((gd->flags & GD_FLG_RELOC) == 0) + return; + debug("%s: bank: %d\n", __func__, bank); for (i = bd->bi_dram[bank].start >> MMU_SECTION_SHIFT; i < (bd->bi_dram[bank].start >> MMU_SECTION_SHIFT) + From 2e8d68e241b35d383a057b014287a756624a32bc Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Fri, 24 Apr 2020 20:20:16 +0200 Subject: [PATCH 04/23] arm: caches: add DCACHE_DEFAULT_OPTION Add the new flags DCACHE_DEFAULT_OPTION to define the default option to use according the compilation flags CONFIG_SYS_ARM_CACHE_*. This new compilation flag allows to simplify dram_bank_mmu_setup() and can be used as third parameter (option=dcache option to select) of mmu_set_region_dcache_behaviour function. Signed-off-by: Patrick Delaunay --- arch/arm/include/asm/system.h | 8 ++++++++ arch/arm/lib/cache-cp15.c | 11 ++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h index 81ccead112..a3147fde14 100644 --- a/arch/arm/include/asm/system.h +++ b/arch/arm/include/asm/system.h @@ -485,6 +485,14 @@ enum dcache_option { }; #endif +#if defined(CONFIG_SYS_ARM_CACHE_WRITETHROUGH) +#define DCACHE_DEFAULT_OPTION DCACHE_WRITETHROUGH +#elif defined(CONFIG_SYS_ARM_CACHE_WRITEALLOC) +#define DCACHE_DEFAULT_OPTION DCACHE_WRITEALLOC +#elif defined(CONFIG_SYS_ARM_CACHE_WRITEBACK) +#define DCACHE_DEFAULT_OPTION DCACHE_WRITEBACK +#endif + /* Size of an MMU section */ enum { #ifdef CONFIG_ARMV7_LPAE diff --git a/arch/arm/lib/cache-cp15.c b/arch/arm/lib/cache-cp15.c index 54509f11c3..d15144188b 100644 --- a/arch/arm/lib/cache-cp15.c +++ b/arch/arm/lib/cache-cp15.c @@ -99,15 +99,8 @@ __weak void dram_bank_mmu_setup(int bank) for (i = bd->bi_dram[bank].start >> MMU_SECTION_SHIFT; i < (bd->bi_dram[bank].start >> MMU_SECTION_SHIFT) + (bd->bi_dram[bank].size >> MMU_SECTION_SHIFT); - i++) { -#if defined(CONFIG_SYS_ARM_CACHE_WRITETHROUGH) - set_section_dcache(i, DCACHE_WRITETHROUGH); -#elif defined(CONFIG_SYS_ARM_CACHE_WRITEALLOC) - set_section_dcache(i, DCACHE_WRITEALLOC); -#else - set_section_dcache(i, DCACHE_WRITEBACK); -#endif - } + i++) + set_section_dcache(i, DCACHE_DEFAULT_OPTION); } /* to activate the MMU we need to set up virtual memory: use 1M areas */ From 54be09cd8f6e66f59144f9e5861b0252ed441d89 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Fri, 24 Apr 2020 20:20:17 +0200 Subject: [PATCH 05/23] arm: caches: manage phys_addr_t overflow in mmu_set_region_dcache_behaviour Solved the overflow on phys_addr_t type for start + size in mmu_set_region_dcache_behaviour() function. This overflow is avoided by dividing start and end by 2 before addition, and we only expecting that start and size are even. This patch doesn't change the current function behavior if the parameters (start or size) are not aligned on MMU_SECTION_SIZE. For example, this overflow occurs on ARM32 with: start = 0xC0000000 and size = 0x40000000 then start + size = 0x100000000 and end = 0x0. For information the function behavior change with risk of regression, if we just shift start and size before the addition. Example with 2MB section size: MMU_SECTION_SIZE 0x200000 and MMU_SECTION_SHIFT = 21 with start = 0x1000000, size = 0x1000000, - with the proposed patch, start = 0 and end = 0x1 as previously - with the more simple patch: end = (start >> MMU_SECTION_SHIFT) + (size >> MMU_SECTION_SHIFT) the value of end change: start >> 21 = 0, size >> 21 = 0 and end = 0x0 !!! Signed-off-by: Patrick Delaunay --- arch/arm/lib/cache-cp15.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/lib/cache-cp15.c b/arch/arm/lib/cache-cp15.c index d15144188b..f803d6fb8c 100644 --- a/arch/arm/lib/cache-cp15.c +++ b/arch/arm/lib/cache-cp15.c @@ -61,8 +61,11 @@ void mmu_set_region_dcache_behaviour(phys_addr_t start, size_t size, unsigned long startpt, stoppt; unsigned long upto, end; - end = ALIGN(start + size, MMU_SECTION_SIZE) >> MMU_SECTION_SHIFT; + /* div by 2 before start + size to avoid phys_addr_t overflow */ + end = ALIGN((start / 2) + (size / 2), MMU_SECTION_SIZE / 2) + >> (MMU_SECTION_SHIFT - 1); start = start >> MMU_SECTION_SHIFT; + #ifdef CONFIG_ARMV7_LPAE debug("%s: start=%pa, size=%zu, option=%llx\n", __func__, &start, size, option); From b8a42e0fcb94b335e0661ff4d2366ee3edf7f883 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Fri, 1 May 2020 15:24:50 +0200 Subject: [PATCH 06/23] rtc: pcf2127: don't add/subtract 1 to tm_mon As noted in rtc_def.h, the tm_mon field in struct rtc_time is 1-12, unlike in struct tm where it is 0-11. Currently, running "date" prints the wrong Date: 2020-04-01 (Friday) Time: 13:05:30 and setting the RTC via the date command is also broken. Signed-off-by: Rasmus Villemoes --- drivers/rtc/pcf2127.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/pcf2127.c b/drivers/rtc/pcf2127.c index f6953505a5..b34ed63bf0 100644 --- a/drivers/rtc/pcf2127.c +++ b/drivers/rtc/pcf2127.c @@ -56,7 +56,7 @@ static int pcf2127_rtc_set(struct udevice *dev, const struct rtc_time *tm) buf[i++] = tm->tm_wday & 0x07; /* month, 1 - 12 */ - buf[i++] = bin2bcd(tm->tm_mon + 1); + buf[i++] = bin2bcd(tm->tm_mon); /* year */ buf[i++] = bin2bcd(tm->tm_year % 100); @@ -83,7 +83,7 @@ static int pcf2127_rtc_get(struct udevice *dev, struct rtc_time *tm) tm->tm_min = bcd2bin(buf[PCF2127_REG_MN] & 0x7F); tm->tm_hour = bcd2bin(buf[PCF2127_REG_HR] & 0x3F); tm->tm_mday = bcd2bin(buf[PCF2127_REG_DM] & 0x3F); - tm->tm_mon = bcd2bin(buf[PCF2127_REG_MO] & 0x1F) - 1; + tm->tm_mon = bcd2bin(buf[PCF2127_REG_MO] & 0x1F); tm->tm_year = bcd2bin(buf[PCF2127_REG_YR]) + 1900; if (tm->tm_year < 1970) tm->tm_year += 100; /* assume we are in 1970...2069 */ From 932b8f8c29811fd0560c4df1221156fa498edfc5 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Fri, 24 Apr 2020 23:31:20 +0200 Subject: [PATCH 07/23] doc: describe the analysis of crash dumps Provide an overview of the analysis of U-Boot crash dumps. Signed-off-by: Heinrich Schuchardt Acked-by: Ilias Apalodimas --- doc/develop/crash_dumps.rst | 122 ++++++++++++++++++++++++++++++++++++ doc/develop/index.rst | 10 +++ doc/index.rst | 11 ++++ 3 files changed, 143 insertions(+) create mode 100644 doc/develop/crash_dumps.rst create mode 100644 doc/develop/index.rst diff --git a/doc/develop/crash_dumps.rst b/doc/develop/crash_dumps.rst new file mode 100644 index 0000000000..18696372fc --- /dev/null +++ b/doc/develop/crash_dumps.rst @@ -0,0 +1,122 @@ +.. SPDX-License-Identifier: GPL-2.0+ +.. Copyright (c) 2020 Heinrich Schuchardt + +Analyzing crash dumps +===================== + +When the CPU detects an instruction that it cannot execute it raises an +interrupt. U-Boot than writes a crash dump. This chapter describes how such +dump can be analyzed. + +Creating a crash dump voluntarily +--------------------------------- + +For describing the analysis of a crash dump we need an example. U-Boot comes +with a command 'exception' that comes in handy here. The command is enabled +by:: + + CONFIG_CMD_EXCEPTION=y + +The example output below was recorded when running qemu\_arm64\_defconfig on +QEMU:: + + => exception undefined + "Synchronous Abort" handler, esr 0x02000000 + elr: 00000000000101fc lr : 00000000000214ec (reloc) + elr: 000000007ff291fc lr : 000000007ff3a4ec + x0 : 000000007ffbd7f8 x1 : 0000000000000000 + x2 : 0000000000000001 x3 : 000000007eedce18 + x4 : 000000007ff291fc x5 : 000000007eedce50 + x6 : 0000000000000064 x7 : 000000007eedce10 + x8 : 0000000000000000 x9 : 0000000000000004 + x10: 6db6db6db6db6db7 x11: 000000000000000d + x12: 0000000000000006 x13: 000000000001869f + x14: 000000007edd7dc0 x15: 0000000000000002 + x16: 000000007ff291fc x17: 0000000000000000 + x18: 000000007eed8dc0 x19: 0000000000000000 + x20: 000000007ffbd7f8 x21: 0000000000000000 + x22: 000000007eedce10 x23: 0000000000000002 + x24: 000000007ffd4c80 x25: 0000000000000000 + x26: 0000000000000000 x27: 0000000000000000 + x28: 000000007eedce70 x29: 000000007edd7b40 + + Code: b00003c0 912ad000 940029d6 17ffff52 (e7f7defb) + Resetting CPU ... + + resetting ... + +The first line provides us with the type of interrupt that occurred. +(On ARMv8 a synchronous abort is an exception where the return address stored +in the ESR register indicates the instruction that caused the exception.) + +The second line provides the contents of the elr and the lr register after +subtracting the relocation offset. - U-Boot relocates itself after being +loaded. - The relocation offset can also be displayed using the bdinfo command. + +After the contents of the registers we get a line indicating the machine +code of the instructions preceding the crash and in parentheses the instruction +leading to the dump. + +Analyzing the code location +--------------------------- + +We can convert the instructions in the line starting with 'Code:' into mnemonics +using the objdump command. To make things easier scripts/decodecode is +supplied:: + + $echo 'Code: b00003c0 912ad000 940029d6 17ffff52 (e7f7defb)' | \ + CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 scripts/decodecode + Code: b00003c0 912ad000 940029d6 17ffff52 (e7f7defb) + All code + ======== + 0: b00003c0 adrp x0, 0x79000 + 4: 912ad000 add x0, x0, #0xab4 + 8: 940029d6 bl 0xa760 + c: 17ffff52 b 0xfffffffffffffd54 + 10:* e7f7defb .inst 0xe7f7defb ; undefined <-- trapping instruction + + Code starting with the faulting instruction + =========================================== + 0: e7f7defb .inst 0xe7f7defb ; undefined + +Now lets use the locations provided by the elr and lr registers after +subtracting the relocation offset to find out where in the code the crash +occurred and from where it was invoked. + +File u-boot.map contains the memory layout of the U-Boot binary. Here we find +these lines:: + + .text.do_undefined + 0x00000000000101fc 0xc cmd/built-in.o + .text.exception_complete + 0x0000000000010208 0x90 cmd/built-in.o + ... + .text.cmd_process + 0x00000000000213b8 0x164 common/built-in.o + 0x00000000000213b8 cmd_process + .text.cmd_process_error + 0x000000000002151c 0x40 common/built-in.o + 0x000000000002151c cmd_process_error + +So the error occurred at the start of function do\_undefined() and this +function was invoked from somewhere inside function cmd\_process(). + +If we want to dive deeper, we can disassemble the U-Boot binary:: + + $ aarch64-linux-gnu-objdump -S -D u-boot | less + + 00000000000101fc : + { + /* + * 0xe7f...f. is undefined in ARM mode + * 0xde.. is undefined in Thumb mode + */ + asm volatile (".word 0xe7f7defb\n"); + 101fc: e7f7defb .inst 0xe7f7defb ; undefined + return CMD_RET_FAILURE; + } + 10200: 52800020 mov w0, #0x1 // #1 + 10204: d65f03c0 ret + +This example is based on the ARMv8 architecture but the same procedures can be +used on other architectures as well. diff --git a/doc/develop/index.rst b/doc/develop/index.rst new file mode 100644 index 0000000000..072db63b5c --- /dev/null +++ b/doc/develop/index.rst @@ -0,0 +1,10 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Develop U-Boot +============== + + +.. toctree:: + :maxdepth: 2 + + crash_dumps diff --git a/doc/index.rst b/doc/index.rst index cd98be6cc5..fd9f10f28e 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -26,6 +26,17 @@ trying to get it to work optimally on a given system. build/index +Developer-oriented documentation +-------------------------------- + +The following manuals are written for *developers* of the U-Boot - those who +want to contribute to U-Boot. + +.. toctree:: + :maxdepth: 2 + + develop/index + Unified Extensible Firmware (UEFI) ---------------------------------- From 6609d123ce48ca5d46bb1c8e285fe009acf491ca Mon Sep 17 00:00:00 2001 From: Matthias Brugger Date: Sun, 26 Apr 2020 01:17:44 +0200 Subject: [PATCH 08/23] timer MediaTek use upstream compatible The timers compatible string in upstream is called mt6577-timer. Add this compatible to the driver. Signed-off-by: Matthias Brugger --- drivers/timer/mtk_timer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/timer/mtk_timer.c b/drivers/timer/mtk_timer.c index b5e76bd358..e99135e5be 100644 --- a/drivers/timer/mtk_timer.c +++ b/drivers/timer/mtk_timer.c @@ -71,6 +71,7 @@ static const struct timer_ops mtk_timer_ops = { static const struct udevice_id mtk_timer_ids[] = { { .compatible = "mediatek,timer" }, + { .compatible = "mediatek,mt6577-timer" }, { } }; From 2ef35fcb34b97fefc693f638be2ad18be3298d08 Mon Sep 17 00:00:00 2001 From: Matthias Brugger Date: Sun, 26 Apr 2020 01:17:45 +0200 Subject: [PATCH 09/23] watchdog MediaTek add upstream compatible The upstream compatible is called mt6589-wdt. Add this compatible to the driver. Signed-off-by: Matthias Brugger --- drivers/watchdog/mtk_wdt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c index 669a32320d..b3c597e1d0 100644 --- a/drivers/watchdog/mtk_wdt.c +++ b/drivers/watchdog/mtk_wdt.c @@ -143,6 +143,7 @@ static const struct wdt_ops mtk_wdt_ops = { static const struct udevice_id mtk_wdt_ids[] = { { .compatible = "mediatek,wdt"}, + { .compatible = "mediatek,mt6589-wdt"}, {} }; From 37f2755a00c1b3223780d88c7a82e2f6af26a18e Mon Sep 17 00:00:00 2001 From: Matthias Brugger Date: Sun, 26 Apr 2020 01:17:46 +0200 Subject: [PATCH 10/23] arm: enable distro boot for bananapi-r2 This patch enables distro boot for the bananapi-r2, based on a MediaTek mt7623n. Signed-off-by: Matthias Brugger --- configs/mt7623n_bpir2_defconfig | 3 ++- include/configs/mt7623.h | 24 ++++++++++++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/configs/mt7623n_bpir2_defconfig b/configs/mt7623n_bpir2_defconfig index 07ddade76a..fe28f37b9e 100644 --- a/configs/mt7623n_bpir2_defconfig +++ b/configs/mt7623n_bpir2_defconfig @@ -7,6 +7,7 @@ CONFIG_ENV_SIZE=0x1000 CONFIG_ENV_OFFSET=0x100000 CONFIG_TARGET_MT7623=y CONFIG_NR_DRAM_BANKS=1 +CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_FIT_VERBOSE=y CONFIG_BOOTDELAY=3 @@ -56,4 +57,4 @@ CONFIG_TIMER=y CONFIG_MTK_TIMER=y CONFIG_WDT_MTK=y CONFIG_LZMA=y -# CONFIG_EFI_LOADER is not set +CONFIG_EFI_LOADER=y diff --git a/include/configs/mt7623.h b/include/configs/mt7623.h index faab0913fc..fe436cca38 100644 --- a/include/configs/mt7623.h +++ b/include/configs/mt7623.h @@ -45,11 +45,13 @@ #define CONFIG_SYS_SDRAM_BASE 0x80000000 /* This is needed for kernel booting */ -#define FDT_HIGH "fdt_high=0xac000000\0" +#define FDT_HIGH "0xac000000" -/* Extra environment variables */ -#define CONFIG_EXTRA_ENV_SETTINGS \ - FDT_HIGH +#define ENV_MEM_LAYOUT_SETTINGS \ + "fdt_high=" FDT_HIGH "\0" \ + "kernel_addr_r=0x84000000\0" \ + "fdt_addr_r=" FDT_HIGH "\0" \ + "fdtfile=mt7623n-bananapi-bpi-r2.dtb" "\0" /* Ethernet */ #define CONFIG_IPADDR 192.168.1.1 @@ -57,4 +59,18 @@ #define CONFIG_SYS_MMC_ENV_DEV 0 +#ifdef CONFIG_DISTRO_DEFAULTS + +#define BOOT_TARGET_DEVICES(func) \ + func(MMC, mmc, 1) + +#include + +/* Extra environment variables */ +#define CONFIG_EXTRA_ENV_SETTINGS \ + ENV_MEM_LAYOUT_SETTINGS \ + BOOTENV + +#endif /* ifdef CONFIG_DISTRO_DEFAULTS*/ + #endif From fc21a88f801c41a535397a359b3b5bdc3ef8e79f Mon Sep 17 00:00:00 2001 From: Sven Roederer Date: Mon, 27 Apr 2020 02:08:38 +0200 Subject: [PATCH 11/23] tools/mkimage: fix handling long filenames The cmdline for calling the dtc was cut-off when using long filenames (e.g. 245 bytes) for output-file and datafile of "-f" parameter. For FIT-images cmd[MKIMAGE_MAX_DTC_CMDLINE_LEN] is declared (hardcoded 512 bytes), and contains some static values, the path of a tmpfile and a datafile. tmpfile is max MKIMAGE_MAX_TMPFILE_LEN (256) and datafile might be also this size. Having two very long pathname results in a truncation os the executed shell command, as the truncated datafile path will not be found. Redefine MKIMAGE_MAX_DTC_CMDLINE_LEN to "2 * MKIMAGE_MAX_TMPFILE_LEN + 35 for the parameters. This likely applies to the "-d" parameter, too. Signed-off-by: Sven Roederer --- tools/mkimage.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mkimage.h b/tools/mkimage.h index 0254af59fb..5b096a545b 100644 --- a/tools/mkimage.h +++ b/tools/mkimage.h @@ -42,6 +42,6 @@ static inline ulong map_to_sysmem(void *ptr) #define MKIMAGE_TMPFILE_SUFFIX ".tmp" #define MKIMAGE_MAX_TMPFILE_LEN 256 #define MKIMAGE_DEFAULT_DTC_OPTIONS "-I dts -O dtb -p 500" -#define MKIMAGE_MAX_DTC_CMDLINE_LEN 512 +#define MKIMAGE_MAX_DTC_CMDLINE_LEN 2 * MKIMAGE_MAX_TMPFILE_LEN + 35 #endif /* _MKIIMAGE_H_ */ From ea5d3731b843b14f1c48d0d0f2c7d2877ecbf673 Mon Sep 17 00:00:00 2001 From: Sven Roederer Date: Mon, 27 Apr 2020 02:08:39 +0200 Subject: [PATCH 12/23] tools/fit-image: print a warning when cmd-line for dtc might be truncated Signed-off-by: Sven Roederer --- tools/fit_image.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/fit_image.c b/tools/fit_image.c index 4aeabbcfe9..88ff093d05 100644 --- a/tools/fit_image.c +++ b/tools/fit_image.c @@ -17,6 +17,7 @@ #include "fit_common.h" #include "mkimage.h" #include +#include #include #include #include @@ -744,6 +745,9 @@ static int fit_handle_file(struct image_tool_params *params) snprintf(cmd, sizeof(cmd), "cp \"%s\" \"%s\"", params->imagefile, tmpfile); } + if (strlen(cmd) >= MKIMAGE_MAX_DTC_CMDLINE_LEN - 1) { + fprintf(stderr, "WARNING: command-line for FIT creation might be truncated and will probably fail.\n"); + } if (*cmd && system(cmd) == -1) { fprintf (stderr, "%s: system(%s) failed: %s\n", From b142d0ac1946701f4d592869c2d81e42afe2e294 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 28 Apr 2020 21:40:13 +0200 Subject: [PATCH 13/23] cmd/gpt: avoid NULL check before free() free() checks if its argument is NULL. Do not duplicate this in the calling code. Signed-off-by: Heinrich Schuchardt Reviewed-by: Tom Rini --- cmd/gpt.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cmd/gpt.c b/cmd/gpt.c index b94f0051cd..b8d11c167d 100644 --- a/cmd/gpt.c +++ b/cmd/gpt.c @@ -772,11 +772,9 @@ static int do_rename_gpt_parts(struct blk_desc *dev_desc, char *subcomm, out: del_gpt_info(); #ifdef CONFIG_RANDOM_UUID - if (str_disk_guid) - free(str_disk_guid); + free(str_disk_guid); #endif - if (new_partitions) - free(new_partitions); + free(new_partitions); free(partitions_list); return ret; } From 4fb0f55fd294aca02407ef1def74a22612fa041b Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 28 Apr 2020 21:50:02 +0200 Subject: [PATCH 14/23] fs: ext4: avoid NULL check before free() free() checks if its argument is NULL. Don't duplicate this in the calling code. Signed-off-by: Heinrich Schuchardt --- fs/ext4/ext4_journal.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/fs/ext4/ext4_journal.c b/fs/ext4/ext4_journal.c index f8524e5a99..0ceb73d9c9 100644 --- a/fs/ext4/ext4_journal.c +++ b/fs/ext4/ext4_journal.c @@ -107,22 +107,18 @@ void ext4fs_free_journal(void) for (i = 0; i < MAX_JOURNAL_ENTRIES; i++) { if (dirty_block_ptr[i]->blknr == -1) break; - if (dirty_block_ptr[i]->buf) - free(dirty_block_ptr[i]->buf); + free(dirty_block_ptr[i]->buf); } for (i = 0; i < MAX_JOURNAL_ENTRIES; i++) { if (journal_ptr[i]->blknr == -1) break; - if (journal_ptr[i]->buf) - free(journal_ptr[i]->buf); + free(journal_ptr[i]->buf); } for (i = 0; i < MAX_JOURNAL_ENTRIES; i++) { - if (journal_ptr[i]) - free(journal_ptr[i]); - if (dirty_block_ptr[i]) - free(dirty_block_ptr[i]); + free(journal_ptr[i]); + free(dirty_block_ptr[i]); } gindex = 0; gd_index = 0; @@ -272,8 +268,7 @@ void ext4fs_free_revoke_blks(void) struct revoke_blk_list *next_node = NULL; while (tmp_node != NULL) { - if (tmp_node->content) - free(tmp_node->content); + free(tmp_node->content); tmp_node = tmp_node->next; } From f4070e6f6c680034d67f13b878f0da55b3b51f92 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 28 Apr 2020 21:56:10 +0200 Subject: [PATCH 15/23] hush: avoid NULL check before free() free() checks if its argument is NULL. Don't duplicate this in the calling code. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- common/cli_hush.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/cli_hush.c b/common/cli_hush.c index cf1e273485..a62af07cc5 100644 --- a/common/cli_hush.c +++ b/common/cli_hush.c @@ -1849,8 +1849,7 @@ static int run_list_real(struct pipe *pi) continue; } else { /* insert new value from list for variable */ - if (pi->progs->argv[0]) - free(pi->progs->argv[0]); + free(pi->progs->argv[0]); pi->progs->argv[0] = *list++; #ifndef __U_BOOT__ pi->progs->glob_result.gl_pathv[0] = From eb7690e81f527ae36ecc05e567848606ccebde01 Mon Sep 17 00:00:00 2001 From: Philippe Reynes Date: Wed, 29 Apr 2020 15:26:16 +0200 Subject: [PATCH 16/23] test/py: vboot: add a test to check fit signature on fit with padding The pytest vboot does all his tests on fit without padding. We add the same tests on fit with padding. Reviewed-by: Simon Glass Signed-off-by: Philippe Reynes --- test/py/tests/test_vboot.py | 52 +++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/test/py/tests/test_vboot.py b/test/py/tests/test_vboot.py index e67f2b3d0f..6b998cfd70 100644 --- a/test/py/tests/test_vboot.py +++ b/test/py/tests/test_vboot.py @@ -30,11 +30,16 @@ import u_boot_utils as util import vboot_forge TESTDATA = [ - ['sha1', '', False], - ['sha1', '-pss', False], - ['sha256', '', False], - ['sha256', '-pss', False], - ['sha256', '-pss', True], + ['sha1', '', None, False], + ['sha1', '', '-E -p 0x10000', False], + ['sha1', '-pss', None, False], + ['sha1', '-pss', '-E -p 0x10000', False], + ['sha256', '', None, False], + ['sha256', '', '-E -p 0x10000', False], + ['sha256', '-pss', None, False], + ['sha256', '-pss', '-E -p 0x10000', False], + ['sha256', '-pss', None, True], + ['sha256', '-pss', '-E -p 0x10000', True], ] @pytest.mark.boardspec('sandbox') @@ -43,8 +48,8 @@ TESTDATA = [ @pytest.mark.requiredtool('fdtget') @pytest.mark.requiredtool('fdtput') @pytest.mark.requiredtool('openssl') -@pytest.mark.parametrize("sha_algo,padding,required", TESTDATA) -def test_vboot(u_boot_console, sha_algo, padding, required): +@pytest.mark.parametrize("sha_algo,padding,sign_options,required", TESTDATA) +def test_vboot(u_boot_console, sha_algo, padding, sign_options, required): """Test verified boot signing with mkimage and verification with 'bootm'. This works using sandbox only as it needs to update the device tree used @@ -104,7 +109,7 @@ def test_vboot(u_boot_console, sha_algo, padding, required): util.run_and_log(cons, [mkimage, '-D', dtc_args, '-f', '%s%s' % (datadir, its), fit]) - def sign_fit(sha_algo): + def sign_fit(sha_algo, options): """Sign the FIT Signs the FIT and writes the signature into it. It also writes the @@ -113,10 +118,13 @@ def test_vboot(u_boot_console, sha_algo, padding, required): Args: sha_algo: Either 'sha1' or 'sha256', to select the algorithm to use. + options: Options to provide to mkimage. """ + args = [mkimage, '-F', '-k', tmpdir, '-K', dtb, '-r', fit] + if options: + args += options.split(' ') cons.log.action('%s: Sign images' % sha_algo) - util.run_and_log(cons, [mkimage, '-F', '-k', tmpdir, '-K', dtb, - '-r', fit]) + util.run_and_log(cons, args) def replace_fit_totalsize(size): """Replace FIT header's totalsize with something greater. @@ -154,7 +162,7 @@ def test_vboot(u_boot_console, sha_algo, padding, required): util.run_and_log(cons, 'openssl req -batch -new -x509 -key %s%s.key ' '-out %s%s.crt' % (tmpdir, name, tmpdir, name)) - def test_with_algo(sha_algo, padding): + def test_with_algo(sha_algo, padding, sign_options): """Test verified boot with the given hash algorithm. This is the main part of the test code. The same procedure is followed @@ -163,6 +171,9 @@ def test_vboot(u_boot_console, sha_algo, padding, required): Args: sha_algo: Either 'sha1' or 'sha256', to select the algorithm to use. + padding: Either '' or '-pss', to select the padding to use for the + rsa signature algorithm. + sign_options: Options to mkimage when signing a fit image. """ # Compile our device tree files for kernel and U-Boot. These are # regenerated here since mkimage will modify them (by adding a @@ -176,7 +187,7 @@ def test_vboot(u_boot_console, sha_algo, padding, required): run_bootm(sha_algo, 'unsigned images', 'dev-', True) # Sign images with our dev keys - sign_fit(sha_algo) + sign_fit(sha_algo, sign_options) run_bootm(sha_algo, 'signed images', 'dev+', True) # Create a fresh .dtb without the public keys @@ -187,7 +198,7 @@ def test_vboot(u_boot_console, sha_algo, padding, required): run_bootm(sha_algo, 'unsigned config', '%s+ OK' % sha_algo, True) # Sign images with our dev keys - sign_fit(sha_algo) + sign_fit(sha_algo, sign_options) run_bootm(sha_algo, 'signed config', 'dev+', True) cons.log.action('%s: Check signed config on the host' % sha_algo) @@ -209,7 +220,7 @@ def test_vboot(u_boot_console, sha_algo, padding, required): # Create a new properly signed fit and replace header bytes make_fit('sign-configs-%s%s.its' % (sha_algo, padding)) - sign_fit(sha_algo) + sign_fit(sha_algo, sign_options) bcfg = u_boot_console.config.buildconfig max_size = int(bcfg.get('config_fit_signature_max_size', 0x10000000), 0) existing_size = replace_fit_totalsize(max_size + 1) @@ -240,7 +251,7 @@ def test_vboot(u_boot_console, sha_algo, padding, required): cons, [fit_check_sign, '-f', fit, '-k', dtb], 1, 'Failed to verify required signature') - def test_required_key(sha_algo, padding): + def test_required_key(sha_algo, padding, sign_options): """Test verified boot with the given hash algorithm. This function tests if U-Boot rejects an image when a required key isn't @@ -248,6 +259,9 @@ def test_vboot(u_boot_console, sha_algo, padding, required): Args: sha_algo: Either 'sha1' or 'sha256', to select the algorithm to use + padding: Either '' or '-pss', to select the padding to use for the + rsa signature algorithm. + sign_options: Options to mkimage when signing a fit image. """ # Compile our device tree files for kernel and U-Boot. These are # regenerated here since mkimage will modify them (by adding a @@ -260,12 +274,12 @@ def test_vboot(u_boot_console, sha_algo, padding, required): # Build the FIT with prod key (keys required) and sign it. This puts the # signature into sandbox-u-boot.dtb, marked 'required' make_fit('sign-configs-%s%s-prod.its' % (sha_algo, padding)) - sign_fit(sha_algo) + sign_fit(sha_algo, sign_options) # Build the FIT with dev key (keys NOT required). This adds the # signature into sandbox-u-boot.dtb, NOT marked 'required'. make_fit('sign-configs-%s%s.its' % (sha_algo, padding)) - sign_fit(sha_algo) + sign_fit(sha_algo, sign_options) # So now sandbox-u-boot.dtb two signatures, for the prod and dev keys. # Only the prod key is set as 'required'. But FIT we just built has @@ -297,9 +311,9 @@ def test_vboot(u_boot_console, sha_algo, padding, required): old_dtb = cons.config.dtb cons.config.dtb = dtb if required: - test_required_key(sha_algo, padding) + test_required_key(sha_algo, padding, sign_options) else: - test_with_algo(sha_algo, padding) + test_with_algo(sha_algo, padding, sign_options) finally: # Go back to the original U-Boot with the correct dtb. cons.config.dtb = old_dtb From c522949a29d44d728517cc2579ed719747da3e5d Mon Sep 17 00:00:00 2001 From: Philippe Reynes Date: Wed, 29 Apr 2020 15:26:17 +0200 Subject: [PATCH 17/23] rsa: sig: fix config signature check for fit with padding The signature check on config node is broken on fit with padding. To compute the signature for config node, U-Boot compute the signature on all properties of requested node for this config, except for the property "data". But, when padding is used for binary in a fit, there isn't a property "data" but two properties: "data-offset" and "data-size". So to fix the check of signature, we also don't use the properties "data-offset" and "data-size" when checking the signature on config node. Reviewed-by: Simon Glass Signed-off-by: Philippe Reynes --- common/image-fit-sig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/image-fit-sig.c b/common/image-fit-sig.c index 3e73578594..a3a0c61bcb 100644 --- a/common/image-fit-sig.c +++ b/common/image-fit-sig.c @@ -249,7 +249,7 @@ static int fit_config_check_sig(const void *fit, int noffset, int required_keynode, int conf_noffset, char **err_msgp) { - char * const exc_prop[] = {"data"}; + char * const exc_prop[] = {"data", "data-size", "data-position"}; const char *prop, *end, *name; struct image_sign_info info; const uint32_t *strings; From 9297e366d6a847f7ac64f4ec7102b236d8ebe1f4 Mon Sep 17 00:00:00 2001 From: Marek Bykowski Date: Wed, 29 Apr 2020 18:23:07 +0200 Subject: [PATCH 18/23] malloc: dlmalloc: add an ability for the malloc to be re-init/init multiple times Malloc gets initialized with a call to mem_malloc_init() with the address the allocation starts to and its size. Currently it is not possible to move the malloc from one memory area to another as the malloc would eventually fail. This patch adds in the ability to re-init the malloc with the updated start address and the size. One of the use cases of this feature is SPL U-Boot running from within the static memory and calling to malloc init from within board_init_f(): arch/arm/cpu/armv8/start.S:reset vector arch/arm/cpu/armv8/start.S:main() arch/arm/lib/crt0_64.S:board_init_f() board//common/spl.c:board_init_f() board//common/spl.c:mem_malloc_init((ulong)CONFIG_SYS_SPL_MALLOC_START, CONFIG_SYS_SPL_MALLOC_SIZE); Shortly after the DDR (main) memory is init and ready we call to malloc init again but this time with the start address in the DDR memory and a much greater size for moving the allocation off the static to the DDR memory: board//common/spl.c:mem_malloc_init((ulong)CONFIG_SPL_MALLOC_OFFSET, CONFIG_SPL_MALLOC_SIZE); Where CONFIG_SYS_SPL_MALLOC_START and CONFIG_SPL_MALLOC_OFFSET are the start addresses of the malloc in the static and DDR memories respectively and CONFIG_SYS_SPL_MALLOC_SIZE=SZ_16K and CONFIG_SPL_MALLOC_SIZE=SZ_2M are the sizes of the mallocs in these memories. Note, now we have a much greater memory, enlarging from 16K to 2M, available for allocation. There is an alternative approach already existing in U-Boot with the use of an early (simplified) malloc and the proper (dlamalloc) malloc however necessitating managing the two mallocs whereas this approach proposes using a single dlmalloc. Signed-off-by: Marek Bykowski --- Kconfig | 14 ++++++++++++++ common/dlmalloc.c | 41 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/Kconfig b/Kconfig index 9a5e600753..15f1a75c61 100644 --- a/Kconfig +++ b/Kconfig @@ -209,6 +209,20 @@ if EXPERT When disabling this, please check if malloc calls, maybe should be replaced by calloc - if one expects zeroed memory. +config SYS_MALLOC_DEFAULT_TO_INIT + bool "Default malloc to init while reserving the memory for it" + default n + help + It may happen that one needs to move the dynamic allocation + from one to another memory range, eg. when moving the malloc + from the limited static to a potentially large dynamic (DDR) + memory. + + If so then on top of setting the updated memory aside one + needs to bring the malloc init. + + If such a scenario is sought choose yes. + config TOOLS_DEBUG bool "Enable debug information for tools" help diff --git a/common/dlmalloc.c b/common/dlmalloc.c index db5ab55ed3..e8f07f14f9 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -280,6 +280,7 @@ nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Unused space (may be 0 bytes long) . . . . | + nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ `foot:' | Size of chunk, in bytes | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ @@ -574,6 +575,10 @@ static void malloc_bin_reloc(void) static inline void malloc_bin_reloc(void) {} #endif +#ifdef CONFIG_SYS_MALLOC_DEFAULT_TO_INIT +static void malloc_init(void); +#endif + ulong mem_malloc_start = 0; ulong mem_malloc_end = 0; ulong mem_malloc_brk = 0; @@ -604,6 +609,10 @@ void mem_malloc_init(ulong start, ulong size) mem_malloc_end = start + size; mem_malloc_brk = start; +#ifdef CONFIG_SYS_MALLOC_DEFAULT_TO_INIT + malloc_init(); +#endif + debug("using memory %#lx-%#lx for malloc()\n", mem_malloc_start, mem_malloc_end); #ifdef CONFIG_SYS_MALLOC_CLEAR_ON_INIT @@ -708,7 +717,36 @@ static unsigned int max_n_mmaps = 0; static unsigned long max_mmapped_mem = 0; #endif +#ifdef CONFIG_SYS_MALLOC_DEFAULT_TO_INIT +static void malloc_init(void) +{ + int i, j; + debug("bins (av_ array) are at %p\n", (void *)av_); + + av_[0] = NULL; av_[1] = NULL; + for (i = 2, j = 2; i < NAV * 2 + 2; i += 2, j++) { + av_[i] = bin_at(j - 2); + av_[i + 1] = bin_at(j - 2); + + /* Just print the first few bins so that + * we can see there are alright. + */ + if (i < 10) + debug("av_[%d]=%lx av_[%d]=%lx\n", + i, (ulong)av_[i], + i + 1, (ulong)av_[i + 1]); + } + + /* Init the static bookkeeping as well */ + sbrk_base = (char *)(-1); + max_sbrked_mem = 0; + max_total_mem = 0; +#ifdef DEBUG + memset((void *)¤t_mallinfo, 0, sizeof(struct mallinfo)); +#endif +} +#endif /* Debugging support @@ -1051,9 +1089,6 @@ static mchunkptr mremap_chunk(p, new_size) mchunkptr p; size_t new_size; #endif /* HAVE_MMAP */ - - - /* Extend the top-most chunk by obtaining memory from system. Main interface to sbrk (but see also malloc_trim). From 5cf9e3b237f24e66ff1a657e954ffe3dc92e09eb Mon Sep 17 00:00:00 2001 From: Ovidiu Panait Date: Mon, 20 Apr 2020 10:31:44 +0300 Subject: [PATCH 19/23] common/board_r: arm: Merge initr_enable_interrupts into interrupts_init initr_enable_interrupts() is an ARM-specific wrapper over enable_interrupts(), which is run during the common init sequence. It can be eliminated by moving the enable_interrupts() call to the end of interrupt_init() function, in arch/arm/lib/interrupts*.c. Signed-off-by: Ovidiu Panait Reviewed-by: Simon Glass --- arch/arm/lib/interrupts.c | 2 ++ arch/arm/lib/interrupts_64.c | 2 ++ arch/arm/lib/interrupts_m.c | 2 ++ common/board_r.c | 12 ------------ 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/arch/arm/lib/interrupts.c b/arch/arm/lib/interrupts.c index 6dbf03b00c..36299d6e54 100644 --- a/arch/arm/lib/interrupts.c +++ b/arch/arm/lib/interrupts.c @@ -34,6 +34,8 @@ int interrupt_init(void) */ IRQ_STACK_START_IN = gd->irq_sp + 8; + enable_interrupts(); + return 0; } diff --git a/arch/arm/lib/interrupts_64.c b/arch/arm/lib/interrupts_64.c index dffdf57aa2..a2df7cf193 100644 --- a/arch/arm/lib/interrupts_64.c +++ b/arch/arm/lib/interrupts_64.c @@ -13,6 +13,8 @@ DECLARE_GLOBAL_DATA_PTR; int interrupt_init(void) { + enable_interrupts(); + return 0; } diff --git a/arch/arm/lib/interrupts_m.c b/arch/arm/lib/interrupts_m.c index 1f6fdf2995..2ae1c5ba76 100644 --- a/arch/arm/lib/interrupts_m.c +++ b/arch/arm/lib/interrupts_m.c @@ -31,6 +31,8 @@ struct autosave_regs { int interrupt_init(void) { + enable_interrupts(); + return 0; } diff --git a/common/board_r.c b/common/board_r.c index 0bbeaa7594..bdb0389e31 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -518,15 +518,6 @@ static int initr_api(void) } #endif -/* enable exceptions */ -#ifdef CONFIG_ARM -static int initr_enable_interrupts(void) -{ - enable_interrupts(); - return 0; -} -#endif - #ifdef CONFIG_CMD_NET static int initr_ethaddr(void) { @@ -813,9 +804,6 @@ static init_fnc_t init_sequence_r[] = { initr_kgdb, #endif interrupt_init, -#ifdef CONFIG_ARM - initr_enable_interrupts, -#endif #if defined(CONFIG_MICROBLAZE) || defined(CONFIG_M68K) timer_init, /* initialize timer */ #endif From 5fb292f20f0d28bf916b4e480c9ab4a24713116c Mon Sep 17 00:00:00 2001 From: Ovidiu Panait Date: Mon, 20 Apr 2020 10:31:45 +0300 Subject: [PATCH 20/23] cmd/bedbug.c: Make bedbug_init have a return value Do this as a preparation for removing initr_bedbug wrapper from common/board_r.c. Signed-off-by: Ovidiu Panait Reviewed-by: Simon Glass --- cmd/bedbug.c | 4 ++-- include/bedbug/type.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/bedbug.c b/cmd/bedbug.c index 9fee528830..d3e31212ea 100644 --- a/cmd/bedbug.c +++ b/cmd/bedbug.c @@ -44,10 +44,10 @@ int bedbug_puts (const char *str) * settings. * ====================================================================== */ -void bedbug_init (void) +int bedbug_init(void) { /* -------------------------------------------------- */ - return; + return 0; } /* bedbug_init */ diff --git a/include/bedbug/type.h b/include/bedbug/type.h index b7b447b1fe..3754c7f2b2 100644 --- a/include/bedbug/type.h +++ b/include/bedbug/type.h @@ -3,7 +3,7 @@ /* Supporting routines */ int bedbug_puts (const char *); -void bedbug_init (void); +int bedbug_init(void); void bedbug860_init (void); void do_bedbug_breakpoint (struct pt_regs *); void bedbug_main_loop (unsigned long, struct pt_regs *); From 1a4c077b751475cc3a6e77d2216990feccc068dd Mon Sep 17 00:00:00 2001 From: Ovidiu Panait Date: Mon, 20 Apr 2020 10:31:46 +0300 Subject: [PATCH 21/23] common/board_r: Drop initr_bedbug wrapper Drop initr_bedbug wrapper and call bedbug_init directly during the init sequence. Signed-off-by: Ovidiu Panait Reviewed-by: Simon Glass --- common/board_r.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/common/board_r.c b/common/board_r.c index bdb0389e31..d9015cd057 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -637,15 +637,6 @@ int initr_mem(void) } #endif -#ifdef CONFIG_CMD_BEDBUG -static int initr_bedbug(void) -{ - bedbug_init(); - - return 0; -} -#endif - static int run_main_loop(void) { #ifdef CONFIG_SANDBOX @@ -848,7 +839,7 @@ static init_fnc_t init_sequence_r[] = { #endif #ifdef CONFIG_CMD_BEDBUG INIT_FUNC_WATCHDOG_RESET - initr_bedbug, + bedbug_init, #endif #if defined(CONFIG_PRAM) initr_mem, From 36c2f020f2b633bdc6c75f4f836bbef900b8b78c Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Fri, 1 May 2020 10:52:11 -0400 Subject: [PATCH 22/23] actions: Fix syntax for enabling SYS_RELOC_GD_ENV_ADDR The correct syntax is 'select SYS_...' and not 'select CONFIG_SYS...' Fixes: d5c819b885c2 ("actions: Move defconfig options to Kconfig") Signed-off-by: Tom Rini --- arch/arm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 8b6c6a2965..b494bcae95 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -909,7 +909,7 @@ config ARCH_OWL select CLK select CLK_OWL select OF_CONTROL - select CONFIG_SYS_RELOC_GD_ENV_ADDR + select SYS_RELOC_GD_ENV_ADDR imply CMD_DM config ARCH_QEMU From 14b7004532a41cbb2dc82cc1a5687e8e88e1ba0d Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Fri, 1 May 2020 22:06:17 +0200 Subject: [PATCH 23/23] .readthedocs.yml: fix type docs/ Out documentation directory is doc/ and not docs/. Signed-off-by: Heinrich Schuchardt --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index f3fb5ed51b..44949ea239 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -7,7 +7,7 @@ version: 2 # Build documentation in the docs/ directory with Sphinx sphinx: - configuration: docs/conf.py + configuration: doc/conf.py # Optionally build your docs in additional formats such as PDF and ePub formats: []