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