xref: /openbmc/u-boot/arch/arm/cpu/armv7/smccc-call.S (revision 224f7452)
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (c) 2015, Linaro Limited
4 */
5#include <linux/linkage.h>
6
7#include <asm/opcodes-sec.h>
8#include <asm/opcodes-virt.h>
9
10	.section	.text.efi_runtime
11
12#define UNWIND(x...)
13	/*
14	 * Wrap c macros in asm macros to delay expansion until after the
15	 * SMCCC asm macro is expanded.
16	 */
17	.macro SMCCC_SMC
18	__SMC(0)
19	.endm
20
21	.macro SMCCC_HVC
22	__HVC(0)
23	.endm
24
25	.macro SMCCC instr
26UNWIND(	.fnstart)
27	mov	r12, sp
28	push	{r4-r7}
29UNWIND(	.save	{r4-r7})
30	ldm	r12, {r4-r7}
31	\instr
32	pop	{r4-r7}
33	ldr	r12, [sp, #(4 * 4)]
34	stm	r12, {r0-r3}
35	bx	lr
36UNWIND(	.fnend)
37	.endm
38
39/*
40 * void smccc_smc(unsigned long a0, unsigned long a1, unsigned long a2,
41 *		  unsigned long a3, unsigned long a4, unsigned long a5,
42 *		  unsigned long a6, unsigned long a7, struct arm_smccc_res *res,
43 *		  struct arm_smccc_quirk *quirk)
44 */
45ENTRY(__arm_smccc_smc)
46	SMCCC SMCCC_SMC
47ENDPROC(__arm_smccc_smc)
48
49/*
50 * void smccc_hvc(unsigned long a0, unsigned long a1, unsigned long a2,
51 *		  unsigned long a3, unsigned long a4, unsigned long a5,
52 *		  unsigned long a6, unsigned long a7, struct arm_smccc_res *res,
53 *		  struct arm_smccc_quirk *quirk)
54 */
55ENTRY(__arm_smccc_hvc)
56	SMCCC SMCCC_HVC
57ENDPROC(__arm_smccc_hvc)
58