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