From: Peng Fan <peng....@nxp.com>

Implement armv8_el2_to_aarch32 for aarch64 U-Boot booting aarch32 SMP
linux. It will trap to ATF to let ATF handle the mode switching.

Signed-off-by: Peng Fan <peng....@nxp.com>
---
 arch/arm/mach-imx/lowlevel.S | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/arch/arm/mach-imx/lowlevel.S b/arch/arm/mach-imx/lowlevel.S
index 158fdb7d87..c500aa8123 100644
--- a/arch/arm/mach-imx/lowlevel.S
+++ b/arch/arm/mach-imx/lowlevel.S
@@ -20,3 +20,26 @@ ENTRY(lowlevel_init)
        isb
        ret
 ENDPROC(lowlevel_init)
+
+/*
+ * Switch from AArch64 EL2 to AArch32 EL2
+ * @param inputs:
+ * x0: argument, zero
+ * x1: machine nr
+ * x2: fdt address
+ * x3: input argument
+ * x4: kernel entry point
+ * @param outputs for secure firmware:
+ * x0: function id
+ * x1: kernel entry point
+ * x2: machine nr
+ * x3: fdt address
+*/
+.global armv8_el2_to_aarch32
+armv8_el2_to_aarch32:
+       mov     x3, x2
+       mov     x2, x1
+       mov     x1, x4
+       ldr     x0, =0xc20000fd
+       smc     #0
+       ret
-- 
2.28.0

Reply via email to