]>
Commit | Line | Data |
---|---|---|
9c92ab61 | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
b329f95d JW |
2 | /* |
3 | * Copyright (c) 2015, Linaro Limited | |
b329f95d JW |
4 | */ |
5 | #include <linux/linkage.h> | |
6 | ||
7 | #include <asm/opcodes-sec.h> | |
8 | #include <asm/opcodes-virt.h> | |
9 | #include <asm/unwind.h> | |
10 | ||
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 | |
24 | UNWIND( .fnstart) | |
25 | mov r12, sp | |
26 | push {r4-r7} | |
27 | UNWIND( .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 | |
34 | UNWIND( .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, | |
680a0873 AG |
40 | * unsigned long a6, unsigned long a7, struct arm_smccc_res *res, |
41 | * struct arm_smccc_quirk *quirk) | |
b329f95d | 42 | */ |
680a0873 | 43 | ENTRY(__arm_smccc_smc) |
b329f95d | 44 | SMCCC SMCCC_SMC |
680a0873 | 45 | ENDPROC(__arm_smccc_smc) |
b329f95d JW |
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, | |
680a0873 AG |
50 | * unsigned long a6, unsigned long a7, struct arm_smccc_res *res, |
51 | * struct arm_smccc_quirk *quirk) | |
b329f95d | 52 | */ |
680a0873 | 53 | ENTRY(__arm_smccc_hvc) |
b329f95d | 54 | SMCCC SMCCC_HVC |
680a0873 | 55 | ENDPROC(__arm_smccc_hvc) |