
From: Marek Vasut marek.vasut+renesas@gmail.com
In case U-Boot starts with GD_FLG_SKIP_RELOC, the U-Boot code is not relocated, however the stack and heap is at the end of DRAM after relocation. Reserve a LMB area for the non-relocated U-Boot code so it won't be overwritten.
Signed-off-by: Marek Vasut marek.vasut+renesas@gmail.com Cc: Simon Glass sjg@chromium.org Cc: Tom Rini trini@konsulko.com --- arch/arm/lib/stack.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/arch/arm/lib/stack.c b/arch/arm/lib/stack.c index 656084c7e5..d2e2715ecf 100644 --- a/arch/arm/lib/stack.c +++ b/arch/arm/lib/stack.c @@ -14,6 +14,7 @@ #include <init.h> #include <lmb.h> #include <asm/global_data.h> +#include <asm/sections.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -46,4 +47,12 @@ static ulong get_sp(void) void arch_lmb_reserve(struct lmb *lmb) { arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 16384); + +#ifdef CONFIG_ARM + if (gd->flags & GD_FLG_SKIP_RELOC) { + lmb_reserve(lmb, (phys_addr_t)__image_copy_start, + (phys_addr_t)__image_copy_end - + (phys_addr_t)__image_copy_start); + } +#endif }