1/* 2 * Copyright 2016 NXP Semiconductor, Inc. 3 * 4 * SPDX-License-Identifier: GPL-2.0+ 5 */ 6 7#include <config.h> 8#include <linux/linkage.h> 9#include <asm/system.h> 10#include <asm/macro.h> 11 12WEAK(_sec_firmware_entry) 13 /* 14 * x0: Secure Firmware entry point 15 * x1: Exception return address Low 16 * x2: Exception return address High 17 */ 18 19 /* Save stack pointer for EL2 */ 20 mov x3, sp 21 msr sp_el2, x3 22 23 /* Set exception return address hold pointer */ 24 adr x4, 1f 25 mov x3, x4 26#ifdef SEC_FIRMWARE_ERET_ADDR_REVERT 27 rev w3, w3 28#endif 29 str w3, [x1] 30 lsr x3, x4, #32 31#ifdef SEC_FIRMWARE_ERET_ADDR_REVERT 32 rev w3, w3 33#endif 34 str w3, [x2] 35 36 /* Call SEC monitor */ 37 br x0 38 391: 40 mov x0, #0 41 ret 42ENDPROC(_sec_firmware_entry) 43 44#ifdef CONFIG_ARMV8_PSCI 45ENTRY(_sec_firmware_support_psci_version) 46 mov x0, 0x84000000 47 mov x1, 0x0 48 mov x2, 0x0 49 mov x3, 0x0 50 smc #0 51 ret 52ENDPROC(_sec_firmware_support_psci_version) 53 54/* 55 * Switch from AArch64 EL2 to AArch32 EL2 56 * @param inputs: 57 * x0: argument, zero 58 * x1: machine nr 59 * x2: fdt address 60 * x3: kernel entry point 61 * @param outputs for secure firmware: 62 * x0: function id 63 * x1: kernel entry point 64 * x2: machine nr 65 * x3: fdt address 66*/ 67ENTRY(armv8_el2_to_aarch32) 68 mov x0, x3 69 mov x3, x2 70 mov x2, x1 71 mov x1, x0 72 ldr x0, =0xc000ff04 73 smc #0 74 ret 75ENDPROC(armv8_el2_to_aarch32) 76#endif 77