]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ARM: armv7: Add early stack for erratum workarounds
authorAndrew F. Davis <afd@ti.com>
Mon, 19 Nov 2018 20:47:53 +0000 (14:47 -0600)
committerTom Rini <trini@konsulko.com>
Tue, 27 Nov 2018 03:52:12 +0000 (22:52 -0500)
Some erratum workarounds call into C code before the stack
is setup, this can lead to values pushed onto the stack
being lost, firewall exceptions, and other undefined behavior.

Setup a temporary stack to allow these functions to work
correctly.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Acked-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
arch/arm/cpu/armv7/start.S

index 81edec01bf32d3bf8b8698a535a27727a9875e99..0cb6dd39ccfc0584f4e6f01523fef9405c314763 100644 (file)
@@ -205,6 +205,15 @@ ENTRY(cpu_init_cp15)
        mov     r2, r3, lsl #4          @ shift variant field for combined value
        orr     r2, r4, r2              @ r2 has combined CPU variant + revision
 
+/* Early stack for ERRATA that needs into call C code */
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
+       ldr     r0, =(CONFIG_SPL_STACK)
+#else
+       ldr     r0, =(CONFIG_SYS_INIT_SP_ADDR)
+#endif
+       bic     r0, r0, #7      /* 8-byte alignment for ABI compliance */
+       mov     sp, r0
+
 #ifdef CONFIG_ARM_ERRATA_798870
        cmp     r2, #0x30               @ Applies to lower than R3p0
        bge     skip_errata_798870      @ skip if not affected rev