While ARMv7 and later allow mapping the interrupt vector table at arbitrary address, older ARMs only accept 0x0000_0000 and 0xFFFF_0000 (i.e. SZ_4G - SZ_64K). For this reason, barebox grows its stack down from the last SZ_64K of the early memory bank and leaves the last 64K for MMU IVT setup. That way if the early memory bank extends till the end of the 4G address space, installing the IVT at 0xFFFF_0000 won't break anything. SZ_64K is way more than any IVT would need, so let us repurpose the last SZ_32K to be some generic scratch space for prebootloader to report data to barebox proper. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- arch/arm/include/asm/barebox-arm.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h index dd12f642d993..2dcd4153200f 100644 --- a/arch/arm/include/asm/barebox-arm.h +++ b/arch/arm/include/asm/barebox-arm.h @@ -73,6 +73,13 @@ static inline void arm_fixup_vectors(void) void *barebox_arm_boot_dtb(void); +#define __arm_mem_scratch(endmem) ((endmem) - SZ_32K) + +static inline const void *arm_mem_scratch_get(void) +{ + return (const void *)__arm_mem_scratch(arm_mem_endmem_get()); +} + #define __arm_mem_stack_top(membase, endmem) ((endmem) - SZ_64K) #if defined(CONFIG_BOOTM_OPTEE) || defined(CONFIG_PBL_OPTEE) -- 2.30.2