diff options
author | Andreas Bießmann <andreas.devel@googlemail.com> | 2015-02-06 23:06:45 +0100 |
---|---|---|
committer | Andreas Bießmann <andreas.devel@googlemail.com> | 2015-02-17 22:52:42 +0100 |
commit | 68145d4c7b3aa83d74c2dc904a39fab17cee1691 (patch) | |
tree | a4b3b7204d322654ecd5afe9cc05a5f043adfa9f /common | |
parent | 4db896236cdac37db17b215ba3ff2d2701bddb49 (diff) | |
download | u-boot-imx-68145d4c7b3aa83d74c2dc904a39fab17cee1691.zip u-boot-imx-68145d4c7b3aa83d74c2dc904a39fab17cee1691.tar.gz u-boot-imx-68145d4c7b3aa83d74c2dc904a39fab17cee1691.tar.bz2 |
common/board_f: factor out reserve_stacks
Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.
Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/board_f.c | 44 |
1 files changed, 9 insertions, 35 deletions
diff --git a/common/board_f.c b/common/board_f.c index 2c10215..ef3f036 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -573,48 +573,22 @@ static int reserve_fdt(void) return 0; } -static int reserve_stacks(void) +int arch_reserve_stacks(void) { -#ifdef CONFIG_SPL_BUILD -# ifdef CONFIG_ARM - gd->start_addr_sp -= 128; /* leave 32 words for abort-stack */ - gd->irq_sp = gd->start_addr_sp; -# endif -#else -# ifdef CONFIG_PPC - ulong *s; -# endif + return 0; +} - /* setup stack pointer for exceptions */ +static int reserve_stacks(void) +{ + /* make stack pointer 16-byte aligned */ gd->start_addr_sp -= 16; gd->start_addr_sp &= ~0xf; - gd->irq_sp = gd->start_addr_sp; /* - * Handle architecture-specific things here - * TODO(sjg@chromium.org): Perhaps create arch_reserve_stack() - * to handle this and put in arch/xxx/lib/stack.c + * let the architecture specific code tailor gd->start_addr_sp and + * gd->irq_sp */ -# if defined(CONFIG_ARM) && !defined(CONFIG_ARM64) -# ifdef CONFIG_USE_IRQ - gd->start_addr_sp -= (CONFIG_STACKSIZE_IRQ + CONFIG_STACKSIZE_FIQ); - debug("Reserving %zu Bytes for IRQ stack at: %08lx\n", - CONFIG_STACKSIZE_IRQ + CONFIG_STACKSIZE_FIQ, gd->start_addr_sp); - - /* 8-byte alignment for ARM ABI compliance */ - gd->start_addr_sp &= ~0x07; -# endif - /* leave 3 words for abort-stack, plus 1 for alignment */ - gd->start_addr_sp -= 16; -# elif defined(CONFIG_PPC) - /* Clear initial stack frame */ - s = (ulong *) gd->start_addr_sp; - *s = 0; /* Terminate back chain */ - *++s = 0; /* NULL return address */ -# endif /* Architecture specific code */ - - return 0; -#endif + return arch_reserve_stacks(); } static int display_new_sp(void) |