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#endif
54