summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>2017-03-01 21:04:15 +0100
committerTom Rini <trini@konsulko.com>2017-03-01 21:28:34 -0500
commit7a70c9985ccf2e7e0016b32c367a922e01b6c1fb (patch)
tree14a5c6e489f04a8b5bcbdb3adc628afe7af45b49
parent6b4e9426834580810790ecfa924979d61c5c1987 (diff)
downloadu-boot-imx-7a70c9985ccf2e7e0016b32c367a922e01b6c1fb.zip
u-boot-imx-7a70c9985ccf2e7e0016b32c367a922e01b6c1fb.tar.gz
u-boot-imx-7a70c9985ccf2e7e0016b32c367a922e01b6c1fb.tar.bz2
armv8: spl: Call spl_relocate_stack_gd for ARMv8
As part of the startup process for boards using the SPL, we need to call spl_relocate_stack_gd. This is needed to set up malloc with its DRAM buffer. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--arch/arm/lib/crt0_64.S14
1 files changed, 12 insertions, 2 deletions
diff --git a/arch/arm/lib/crt0_64.S b/arch/arm/lib/crt0_64.S
index 19c6a98..57e728f 100644
--- a/arch/arm/lib/crt0_64.S
+++ b/arch/arm/lib/crt0_64.S
@@ -109,8 +109,18 @@ relocation_return:
*/
bl c_runtime_cpu_setup /* still call old routine */
#endif /* !CONFIG_SPL_BUILD */
-
-/* TODO: For SPL, call spl_relocate_stack_gd() to alloc stack relocation */
+#if defined(CONFIG_SPL_BUILD)
+ bl spl_relocate_stack_gd /* may return NULL */
+ /*
+ * Perform 'sp = (x0 != NULL) ? x0 : sp' while working
+ * around the constraint that conditional moves can not
+ * have 'sp' as an operand
+ */
+ mov x1, sp
+ cmp x0, #0
+ csel x0, x0, x1, ne
+ mov sp, x0
+#endif
/*
* Clear BSS section