blob: 0d8b59eb6b9917dd15cb51cfb5c7c20288c2f639 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0 */
Masahiro Yamadac2da86f2017-04-14 11:10:22 +09002/*
3 * Copyright (c) 2015, Linaro Limited
Masahiro Yamadac2da86f2017-04-14 11:10:22 +09004 */
5#include <linux/linkage.h>
6
7#include <asm/opcodes-sec.h>
8#include <asm/opcodes-virt.h>
Masahiro Yamadac2da86f2017-04-14 11:10:22 +09009
Masahiro Yamadac54bcf62017-04-14 11:10:23 +090010#define UNWIND(x...)
Masahiro Yamadac2da86f2017-04-14 11:10:22 +090011 /*
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)