diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/autoboot.c | 1 | ||||
-rw-r--r-- | common/board_f.c | 11 | ||||
-rw-r--r-- | common/board_r.c | 17 | ||||
-rw-r--r-- | common/bootm.c | 1 | ||||
-rw-r--r-- | common/bootm_os.c | 1 | ||||
-rw-r--r-- | common/bootretry.c | 1 | ||||
-rw-r--r-- | common/cli.c | 1 | ||||
-rw-r--r-- | common/cli_hush.c | 1 | ||||
-rw-r--r-- | common/cli_simple.c | 1 | ||||
-rw-r--r-- | common/command.c | 1 | ||||
-rw-r--r-- | common/console.c | 3 | ||||
-rw-r--r-- | common/fdt_support.c | 1 | ||||
-rw-r--r-- | common/hash.c | 1 | ||||
-rw-r--r-- | common/hwconfig.c | 1 | ||||
-rw-r--r-- | common/image-android.c | 1 | ||||
-rw-r--r-- | common/image-fdt.c | 1 | ||||
-rw-r--r-- | common/image.c | 3 | ||||
-rw-r--r-- | common/init/board_init.c | 20 | ||||
-rw-r--r-- | common/main.c | 1 | ||||
-rw-r--r-- | common/spl/Kconfig | 19 | ||||
-rw-r--r-- | common/spl/spl.c | 25 | ||||
-rw-r--r-- | common/spl/spl_dfu.c | 4 | ||||
-rw-r--r-- | common/spl/spl_ext.c | 1 | ||||
-rw-r--r-- | common/spl/spl_fat.c | 1 | ||||
-rw-r--r-- | common/spl/spl_fit.c | 1 | ||||
-rw-r--r-- | common/spl/spl_net.c | 1 | ||||
-rw-r--r-- | common/spl/spl_ymodem.c | 1 | ||||
-rw-r--r-- | common/splash.c | 1 | ||||
-rw-r--r-- | common/splash_source.c | 1 | ||||
-rw-r--r-- | common/update.c | 1 | ||||
-rw-r--r-- | common/usb_hub.c | 1 | ||||
-rw-r--r-- | common/usb_kbd.c | 1 |
32 files changed, 100 insertions, 26 deletions
diff --git a/common/autoboot.c b/common/autoboot.c index 7a91736a00..b28bd6823d 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -9,6 +9,7 @@ #include <bootretry.h> #include <cli.h> #include <console.h> +#include <env.h> #include <fdtdec.h> #include <hash.h> #include <memalign.h> diff --git a/common/board_f.c b/common/board_f.c index 4760d728f3..31181a9dc4 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -14,11 +14,13 @@ #include <console.h> #include <cpu.h> #include <dm.h> -#include <environment.h> +#include <env.h> +#include <env_internal.h> #include <fdtdec.h> #include <fs.h> #include <i2c.h> #include <initcall.h> +#include <lcd.h> #include <malloc.h> #include <mapmem.h> #include <os.h> @@ -425,13 +427,6 @@ static int reserve_video(void) gd->relocaddr = lcd_setmem(gd->relocaddr); gd->fb_base = gd->relocaddr; # endif /* CONFIG_FB_ADDR */ -#elif defined(CONFIG_VIDEO) && \ - (!defined(CONFIG_PPC)) && \ - !defined(CONFIG_ARM) && !defined(CONFIG_X86) && \ - !defined(CONFIG_M68K) - /* reserve memory for video display (always full pages) */ - gd->relocaddr = video_setmem(gd->relocaddr); - gd->fb_base = gd->relocaddr; #endif return 0; diff --git a/common/board_r.c b/common/board_r.c index 84aec7fc71..b7f68bba4a 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -18,7 +18,8 @@ #include <command.h> #include <console.h> #include <dm.h> -#include <environment.h> +#include <env.h> +#include <env_internal.h> #include <fdtdec.h> #include <ide.h> #include <initcall.h> @@ -447,7 +448,7 @@ static int initr_env(void) if (should_load_env()) env_relocate(); else - set_default_env(NULL, 0); + env_set_default(NULL, 0); #ifdef CONFIG_OF_CONTROL env_set_hex("fdtcontroladdr", (unsigned long)map_to_sysmem(gd->fdt_blob)); @@ -582,15 +583,6 @@ static int initr_post(void) } #endif -#if defined(CONFIG_CMD_PCMCIA) && !defined(CONFIG_IDE) -static int initr_pcmcia(void) -{ - puts("PCMCIA:"); - pcmcia_init(); - return 0; -} -#endif - #if defined(CONFIG_IDE) && !defined(CONFIG_BLK) static int initr_ide(void) { @@ -819,9 +811,6 @@ static init_fnc_t init_sequence_r[] = { #ifdef CONFIG_POST initr_post, #endif -#if defined(CONFIG_CMD_PCMCIA) && !defined(CONFIG_IDE) - initr_pcmcia, -#endif #if defined(CONFIG_IDE) && !defined(CONFIG_BLK) initr_ide, #endif diff --git a/common/bootm.c b/common/bootm.c index 4629cdd82d..02295daf79 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -7,6 +7,7 @@ #ifndef USE_HOSTCC #include <common.h> #include <bootstage.h> +#include <env.h> #include <errno.h> #include <fdt_support.h> #include <lmb.h> diff --git a/common/bootm_os.c b/common/bootm_os.c index 855c471c28..6fb7d658da 100644 --- a/common/bootm_os.c +++ b/common/bootm_os.c @@ -6,6 +6,7 @@ #include <common.h> #include <bootm.h> +#include <env.h> #include <fdt_support.h> #include <linux/libfdt.h> #include <malloc.h> diff --git a/common/bootretry.c b/common/bootretry.c index 072055b010..47aaaa8220 100644 --- a/common/bootretry.c +++ b/common/bootretry.c @@ -7,6 +7,7 @@ #include <common.h> #include <bootretry.h> #include <cli.h> +#include <env.h> #include <errno.h> #include <watchdog.h> diff --git a/common/cli.c b/common/cli.c index f4054fb1fc..49b910666b 100644 --- a/common/cli.c +++ b/common/cli.c @@ -12,6 +12,7 @@ #include <cli.h> #include <cli_hush.h> #include <console.h> +#include <env.h> #include <fdtdec.h> #include <malloc.h> diff --git a/common/cli_hush.c b/common/cli_hush.c index 955e8fe536..8f86e4aa4a 100644 --- a/common/cli_hush.c +++ b/common/cli_hush.c @@ -75,6 +75,7 @@ #define __U_BOOT__ #ifdef __U_BOOT__ +#include <env.h> #include <malloc.h> /* malloc, free, realloc*/ #include <linux/ctype.h> /* isalpha, isdigit */ #include <common.h> /* readline */ diff --git a/common/cli_simple.c b/common/cli_simple.c index 311880ad56..6c881c133c 100644 --- a/common/cli_simple.c +++ b/common/cli_simple.c @@ -12,6 +12,7 @@ #include <bootretry.h> #include <cli.h> #include <console.h> +#include <env.h> #include <linux/ctype.h> #define DEBUG_PARSER 0 /* set to 1 to debug */ diff --git a/common/command.c b/common/command.c index db25bf54e0..4b887a267f 100644 --- a/common/command.c +++ b/common/command.c @@ -11,6 +11,7 @@ #include <common.h> #include <command.h> #include <console.h> +#include <env.h> #include <linux/ctype.h> /* diff --git a/common/console.c b/common/console.c index d086feabb1..89b1e9590c 100644 --- a/common/console.c +++ b/common/console.c @@ -8,6 +8,7 @@ #include <console.h> #include <debug_uart.h> #include <dm.h> +#include <env.h> #include <stdarg.h> #include <iomux.h> #include <malloc.h> @@ -16,7 +17,7 @@ #include <serial.h> #include <stdio_dev.h> #include <exports.h> -#include <environment.h> +#include <env_internal.h> #include <watchdog.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/common/fdt_support.c b/common/fdt_support.c index 86de5b8f05..baf7924ff6 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -7,6 +7,7 @@ */ #include <common.h> +#include <env.h> #include <mapmem.h> #include <stdio_dev.h> #include <linux/ctype.h> diff --git a/common/hash.c b/common/hash.c index 413a5bfcda..d33e329897 100644 --- a/common/hash.c +++ b/common/hash.c @@ -12,6 +12,7 @@ #ifndef USE_HOSTCC #include <common.h> #include <command.h> +#include <env.h> #include <malloc.h> #include <mapmem.h> #include <hw_sha.h> diff --git a/common/hwconfig.c b/common/hwconfig.c index e9e956a322..72f3c4e0fa 100644 --- a/common/hwconfig.c +++ b/common/hwconfig.c @@ -11,6 +11,7 @@ #ifndef HWCONFIG_TEST #include <config.h> #include <common.h> +#include <env.h> #include <exports.h> #include <hwconfig.h> #include <linux/types.h> diff --git a/common/image-android.c b/common/image-android.c index 6c9568a655..264bf90007 100644 --- a/common/image-android.c +++ b/common/image-android.c @@ -4,6 +4,7 @@ */ #include <common.h> +#include <env.h> #include <image.h> #include <android_image.h> #include <malloc.h> diff --git a/common/image-fdt.c b/common/image-fdt.c index e70da3dcb3..4247dcee0c 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -11,6 +11,7 @@ #include <common.h> #include <fdt_support.h> #include <fdtdec.h> +#include <env.h> #include <errno.h> #include <image.h> #include <linux/libfdt.h> diff --git a/common/image.c b/common/image.c index 495883185d..84e859a30f 100644 --- a/common/image.c +++ b/common/image.c @@ -8,6 +8,7 @@ #ifndef USE_HOSTCC #include <common.h> +#include <env.h> #include <watchdog.h> #ifdef CONFIG_SHOW_BOOT_PROGRESS @@ -16,7 +17,7 @@ #include <rtc.h> -#include <environment.h> +#include <gzip.h> #include <image.h> #include <mapmem.h> diff --git a/common/init/board_init.c b/common/init/board_init.c index 526fee35ff..e52106966d 100644 --- a/common/init/board_init.c +++ b/common/init/board_init.c @@ -18,6 +18,23 @@ __weak void arch_setup_gd(struct global_data *gd_ptr) } #endif /* !CONFIG_X86 && !CONFIG_ARM */ +/** + * This function is called after the position of the initial stack is + * determined in gd->start_addr_sp. Boards can override it to set up + * stack-checking markers. + */ +__weak void board_init_f_init_stack_protection(void) +{ +#if CONFIG_IS_ENABLED(SYS_REPORT_STACK_F_USAGE) + ulong stack_bottom = gd->start_addr_sp - + CONFIG_VAL(SIZE_LIMIT_PROVIDE_STACK); + + /* substact some safety margin (0x20) since stack is in use here */ + memset((void *)stack_bottom, CONFIG_VAL(SYS_STACK_F_CHECK_BYTE), + CONFIG_VAL(SIZE_LIMIT_PROVIDE_STACK) - 0x20); +#endif +} + /* * Allocate reserved space for use as 'globals' from 'top' address and * return 'bottom' address of allocated space @@ -126,6 +143,9 @@ void board_init_f_init_reserve(ulong base) /* next alloc will be higher by one 'early malloc arena' size */ base += CONFIG_VAL(SYS_MALLOC_F_LEN); #endif + + if (CONFIG_IS_ENABLED(SYS_REPORT_STACK_F_USAGE)) + board_init_f_init_stack_protection(); } /* diff --git a/common/main.c b/common/main.c index ce39c8d189..3a657c3d9a 100644 --- a/common/main.c +++ b/common/main.c @@ -10,6 +10,7 @@ #include <autoboot.h> #include <cli.h> #include <console.h> +#include <env.h> #include <version.h> /* diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 54154b93c9..630491699c 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -62,6 +62,25 @@ config SPL_SIZE_LIMIT_PROVIDE_STACK of SRAM available for SPL when the stack required before reolcation uses this SRAM, too. +config SPL_SYS_STACK_F_CHECK_BYTE + hex + default 0xaa + help + Constant used to check the stack + +config SPL_SYS_REPORT_STACK_F_USAGE + depends on SPL_SIZE_LIMIT_PROVIDE_STACK != 0 + bool "Check and report stack usage in SPL before relocation" + help + If this option is enabled, the initial SPL stack is filled with 0xaa + very early, up to the size configured with + SPL_SIZE_LIMIT_PROVIDE_STACK. + Later when SPL is done using this initial stack and switches to a + stack in DRAM, the actually used size of this initial stack is + reported by examining the memory and searching for the lowest + occurrence of non 0xaa bytes. + This default implementation works for stacks growing down only. + menu "PowerPC SPL Boot options" depends on PPC && (SUPPORT_SPL && !SPL_FRAMEWORK) diff --git a/common/spl/spl.c b/common/spl/spl.c index c182705b3f..2c696f2a79 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -710,6 +710,28 @@ void preloader_console_init(void) #endif /** + * This function is called before the stack is changed from initial stack to + * relocated stack. It tries to dump the stack size used + */ +__weak void spl_relocate_stack_check(void) +{ +#if CONFIG_IS_ENABLED(SYS_REPORT_STACK_F_USAGE) + ulong init_sp = gd->start_addr_sp; + ulong stack_bottom = init_sp - CONFIG_VAL(SIZE_LIMIT_PROVIDE_STACK); + u8 *ptr = (u8 *)stack_bottom; + ulong i; + + for (i = 0; i < CONFIG_VAL(SIZE_LIMIT_PROVIDE_STACK); i++) { + if (*ptr != CONFIG_VAL(SYS_STACK_F_CHECK_BYTE)) + break; + ptr++; + } + printf("SPL initial stack usage: %lu bytes\n", + CONFIG_VAL(SIZE_LIMIT_PROVIDE_STACK) - i); +#endif +} + +/** * spl_relocate_stack_gd() - Relocate stack ready for board_init_r() execution * * Sometimes board_init_f() runs with a stack in SRAM but we want to use SDRAM @@ -733,6 +755,9 @@ ulong spl_relocate_stack_gd(void) gd_t *new_gd; ulong ptr = CONFIG_SPL_STACK_R_ADDR; + if (CONFIG_IS_ENABLED(SYS_REPORT_STACK_F_USAGE)) + spl_relocate_stack_check(); + #if defined(CONFIG_SPL_SYS_MALLOC_SIMPLE) && CONFIG_VAL(SYS_MALLOC_F_LEN) if (CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN) { debug("SPL malloc() before relocation used 0x%lx bytes (%ld KB)\n", diff --git a/common/spl/spl_dfu.c b/common/spl/spl_dfu.c index c0225dc4e1..5728d43ad3 100644 --- a/common/spl/spl_dfu.c +++ b/common/spl/spl_dfu.c @@ -6,6 +6,7 @@ * Ravi B <ravibabu@ti.com> */ #include <common.h> +#include <env.h> #include <spl.h> #include <linux/compiler.h> #include <errno.h> @@ -14,7 +15,6 @@ #include <g_dnl.h> #include <usb.h> #include <dfu.h> -#include <environment.h> static int run_dfu(int usb_index, char *interface, char *devstring) { @@ -38,7 +38,7 @@ int spl_dfu_cmd(int usbctrl, char *dfu_alt_info, char *interface, char *devstr) int ret; /* set default environment */ - set_default_env(NULL, 0); + env_set_default(NULL, 0); str_env = env_get(dfu_alt_info); if (!str_env) { pr_err("\"%s\" env variable not defined!\n", dfu_alt_info); diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c index fe05223605..2a6252229c 100644 --- a/common/spl/spl_ext.c +++ b/common/spl/spl_ext.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ #include <common.h> +#include <env.h> #include <spl.h> #include <asm/u-boot.h> #include <ext4fs.h> diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c index 163e540622..aa371ab52c 100644 --- a/common/spl/spl_fat.c +++ b/common/spl/spl_fat.c @@ -9,6 +9,7 @@ */ #include <common.h> +#include <env.h> #include <spl.h> #include <asm/u-boot.h> #include <fat.h> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 969f7775c1..2e2e09eafb 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -7,6 +7,7 @@ #include <common.h> #include <errno.h> #include <fpga.h> +#include <gzip.h> #include <image.h> #include <linux/libfdt.h> #include <spl.h> diff --git a/common/spl/spl_net.c b/common/spl/spl_net.c index c91ad2b6dd..803303249c 100644 --- a/common/spl/spl_net.c +++ b/common/spl/spl_net.c @@ -7,6 +7,7 @@ * Ilya Yanok <ilya.yanok@gmail.com> */ #include <common.h> +#include <env.h> #include <errno.h> #include <spl.h> #include <net.h> diff --git a/common/spl/spl_ymodem.c b/common/spl/spl_ymodem.c index fa539ecd7a..20f4260062 100644 --- a/common/spl/spl_ymodem.c +++ b/common/spl/spl_ymodem.c @@ -9,6 +9,7 @@ * Matt Porter <mporter@ti.com> */ #include <common.h> +#include <gzip.h> #include <spl.h> #include <xyzModem.h> #include <asm/u-boot.h> diff --git a/common/splash.c b/common/splash.c index 79d50577ee..e15cc847b6 100644 --- a/common/splash.c +++ b/common/splash.c @@ -21,6 +21,7 @@ */ #include <common.h> +#include <env.h> #include <splash.h> #include <lcd.h> diff --git a/common/splash_source.c b/common/splash_source.c index 8f276a34ca..d37b4b304c 100644 --- a/common/splash_source.c +++ b/common/splash_source.c @@ -7,6 +7,7 @@ #include <common.h> #include <bmp_layout.h> +#include <env.h> #include <errno.h> #include <fs.h> #include <fdt_support.h> diff --git a/common/update.c b/common/update.c index f237ea53bb..457b29f42a 100644 --- a/common/update.c +++ b/common/update.c @@ -17,6 +17,7 @@ #endif #include <command.h> +#include <env.h> #include <flash.h> #include <net.h> #include <net/tftp.h> diff --git a/common/usb_hub.c b/common/usb_hub.c index 9069f4b33a..25c2ac4345 100644 --- a/common/usb_hub.c +++ b/common/usb_hub.c @@ -24,6 +24,7 @@ #include <common.h> #include <command.h> #include <dm.h> +#include <env.h> #include <errno.h> #include <memalign.h> #include <asm/processor.h> diff --git a/common/usb_kbd.c b/common/usb_kbd.c index cc99c6be07..3873737461 100644 --- a/common/usb_kbd.c +++ b/common/usb_kbd.c @@ -9,6 +9,7 @@ #include <common.h> #include <console.h> #include <dm.h> +#include <env.h> #include <errno.h> #include <malloc.h> #include <memalign.h> |