summaryrefslogtreecommitdiff
path: root/arch/arm/cpu/armv8/sec_firmware_asm.S
blob: 0c6a46249a262b9619067bc133b135c8c1fd2f76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
 * Copyright 2016 NXP Semiconductor, Inc.
 *
 * SPDX-License-Identifier:	GPL-2.0+
 */

#include <config.h>
#include <linux/linkage.h>
#include <asm/system.h>
#include <asm/macro.h>

WEAK(_sec_firmware_entry)
	/*
	 * x0: Secure Firmware entry point
	 * x1: Exception return address Low
	 * x2: Exception return address High
	 */

	/* Save stack pointer for EL2 */
	mov	x3, sp
	msr	sp_el2, x3

	/* Set exception return address hold pointer */
        adr	x4, 1f
        mov	x3, x4
#ifdef SEC_FIRMWARE_ERET_ADDR_REVERT
        rev	w3, w3
#endif
        str	w3, [x1]
        lsr	x3, x4, #32
#ifdef SEC_FIRMWARE_ERET_ADDR_REVERT
        rev	w3, w3
#endif
        str	w3, [x2]

	/* Call SEC monitor */
        br	x0

1:
        mov	x0, #0
        ret
ENDPROC(_sec_firmware_entry)

#ifdef CONFIG_ARMV8_PSCI
ENTRY(_sec_firmware_support_psci_version)
	mov	x0, 0x84000000
	mov	x1, 0x0
	mov	x2, 0x0
	mov	x3, 0x0
	smc	#0
	ret
ENDPROC(_sec_firmware_support_psci_version)
#endif