diff options
author | Furquan Shaikh <furquan@google.com> | 2014-07-07 11:45:15 -0700 |
---|---|---|
committer | Marc Jones <marc.jones@se-eng.com> | 2015-03-04 19:58:30 +0100 |
commit | e5d014c29abc724e15c23c7a33a7d1742277e057 (patch) | |
tree | 08bc4dec3c2d928e64d8d16f3e6e031a8c0427b3 /src/soc/nvidia/tegra132/bootblock_asm.S | |
parent | dfe7ea2b4eb86afcb59819fc9a72a41ceede8215 (diff) |
coreboot t132: Stack init re-work
1) In order to avoid stack from overflowing during ramstage decompression,
initialize stack right at the beginning of romstage.
2) Declare different Kconfig options for stack at each stage.
3) Provide a macro that does stack seeding if required and calls appropriate
function.
BUG=None
BRANCH=None
TEST=Compiles and runs successfully on rush.
Original-Change-Id: I55d6ce59ea91affba3e86d68406921497c83fb52
Original-Signed-off-by: Furquan Shaikh <furquan@google.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/206880
Original-Tested-by: Furquan Shaikh <furquan@chromium.org>
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Original-Commit-Queue: Furquan Shaikh <furquan@chromium.org>
(cherry picked from commit 5e32d73803a2a9d222fcc4ca5f58efd3abe95d34)
Signed-off-by: Marc Jones <marc.jones@se-eng.com>
Change-Id: Ib833a1badb170a33cbf20d232019425b59db60cd
Reviewed-on: http://review.coreboot.org/8583
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@google.com>
Diffstat (limited to 'src/soc/nvidia/tegra132/bootblock_asm.S')
-rw-r--r-- | src/soc/nvidia/tegra132/bootblock_asm.S | 41 |
1 files changed, 5 insertions, 36 deletions
diff --git a/src/soc/nvidia/tegra132/bootblock_asm.S b/src/soc/nvidia/tegra132/bootblock_asm.S index ebd64a7425..1b2fbb7709 100644 --- a/src/soc/nvidia/tegra132/bootblock_asm.S +++ b/src/soc/nvidia/tegra132/bootblock_asm.S @@ -31,6 +31,8 @@ #include <arch/asm.h> +#include "stack.S" + ENTRY(_start) /* * Set the cpu to System mode with IRQ and FIQ disabled. Prefetch/Data @@ -40,40 +42,7 @@ ENTRY(_start) */ msr cpsr_cxf, #0xdf - /* - * Initialize the stack to a known value. This is used to check for - * stack overflow later in the boot process. - */ - ldr r0, .Stack - ldr r1, .Stack_size - sub r0, r0, r1 - ldr r1, .Stack - ldr r2, =0xdeadbeef -init_stack_loop: - str r2, [r0] - add r0, #4 - cmp r0, r1 - bne init_stack_loop - -/* Set stackpointer in internal RAM to call bootblock main() */ -call_bootblock: - ldr sp, .Stack /* Set up stack pointer */ - ldr r0,=0x00000000 - /* - * The current design of cpu_info places the - * struct at the top of the stack. The number of - * words pushed must be at least as large as that - * struct. - */ - push {r0-r2} - bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ - /* - * Use "bl" instead of "b" even though we do not intend to return. - * "bl" gets compiled to "blx" if we're transitioning from ARM to - * Thumb. However, "b" will not and GCC may attempt to create a - * wrapper which is currently broken. - */ - bl main + stack_init stack=.Stack size=.Stack_size seed=1 func=main ENDPROC(_start) /* we do it this way because it's a 32-bit constant and @@ -82,8 +51,8 @@ ENDPROC(_start) */ .align 2 .Stack: - .word CONFIG_STACK_TOP + .word CONFIG_BOOTBLOCK_STACK_TOP .align 2 /* create this size the same way we do in ramstage.ld: top-bottom */ .Stack_size: - .word CONFIG_STACK_TOP - CONFIG_STACK_BOTTOM + .word CONFIG_BOOTBLOCK_STACK_TOP - CONFIG_BOOTBLOCK_STACK_BOTTOM |