• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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#define UNWIND(x...)
11	/*
12	 * Wrap c macros in asm macros to delay expansion until after the
13	 * SMCCC asm macro is expanded.
14	 */
15	.macro SMCCC_SMC
16	__SMC(0)
17	.endm
18
19	.macro SMCCC_HVC
20	__HVC(0)
21	.endm
22
23	.macro SMCCC instr
24UNWIND(	.fnstart)
25	mov	r12, sp
26	push	{r4-r7}
27UNWIND(	.save	{r4-r7})
28	ldm	r12, {r4-r7}
29	\instr
30	pop	{r4-r7}
31	ldr	r12, [sp, #(4 * 4)]
32	stm	r12, {r0-r3}
33	bx	lr
34UNWIND(	.fnend)
35	.endm
36
37/*
38 * void smccc_smc(unsigned long a0, unsigned long a1, unsigned long a2,
39 *		  unsigned long a3, unsigned long a4, unsigned long a5,
40 *		  unsigned long a6, unsigned long a7, struct arm_smccc_res *res,
41 *		  struct arm_smccc_quirk *quirk)
42 */
43ENTRY(__arm_smccc_smc)
44	SMCCC SMCCC_SMC
45ENDPROC(__arm_smccc_smc)
46
47/*
48 * void smccc_hvc(unsigned long a0, unsigned long a1, unsigned long a2,
49 *		  unsigned long a3, unsigned long a4, unsigned long a5,
50 *		  unsigned long a6, unsigned long a7, struct arm_smccc_res *res,
51 *		  struct arm_smccc_quirk *quirk)
52 */
53ENTRY(__arm_smccc_hvc)
54	SMCCC SMCCC_HVC
55ENDPROC(__arm_smccc_hvc)
56