blob: f70728f2c4af21bc61d1ba761cf0e4d4a1a87f0e [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0 */
Masahiro Yamadaa93297e2017-04-14 11:10:22 +09002/*
3 * Copyright (c) 2015, Linaro Limited
Masahiro Yamadaa93297e2017-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 Yamadaa93297e2017-04-14 11:10:22 +09009
Alexander Graf449c8b22019-02-11 15:07:17 +010010#ifdef CONFIG_EFI_LOADER
Heinrich Schuchardt26f09d02018-10-18 12:29:40 +020011 .section .text.efi_runtime
Alexander Graf449c8b22019-02-11 15:07:17 +010012#endif
Heinrich Schuchardt26f09d02018-10-18 12:29:40 +020013
Masahiro Yamadae8ead732017-04-14 11:10:23 +090014#define UNWIND(x...)
Masahiro Yamadaa93297e2017-04-14 11:10:22 +090015 /*
16 * Wrap c macros in asm macros to delay expansion until after the
17 * SMCCC asm macro is expanded.
18 */
19 .macro SMCCC_SMC
20 __SMC(0)
21 .endm
22
23 .macro SMCCC_HVC
24 __HVC(0)
25 .endm
26
27 .macro SMCCC instr
28UNWIND( .fnstart)
29 mov r12, sp
30 push {r4-r7}
31UNWIND( .save {r4-r7})
32 ldm r12, {r4-r7}
33 \instr
34 pop {r4-r7}
35 ldr r12, [sp, #(4 * 4)]
36 stm r12, {r0-r3}
37 bx lr
38UNWIND( .fnend)
39 .endm
40
41/*
42 * void smccc_smc(unsigned long a0, unsigned long a1, unsigned long a2,
43 * unsigned long a3, unsigned long a4, unsigned long a5,
44 * unsigned long a6, unsigned long a7, struct arm_smccc_res *res,
45 * struct arm_smccc_quirk *quirk)
46 */
47ENTRY(__arm_smccc_smc)
48 SMCCC SMCCC_SMC
49ENDPROC(__arm_smccc_smc)
50
51/*
52 * void smccc_hvc(unsigned long a0, unsigned long a1, unsigned long a2,
53 * unsigned long a3, unsigned long a4, unsigned long a5,
54 * unsigned long a6, unsigned long a7, struct arm_smccc_res *res,
55 * struct arm_smccc_quirk *quirk)
56 */
57ENTRY(__arm_smccc_hvc)
58 SMCCC SMCCC_HVC
59ENDPROC(__arm_smccc_hvc)