Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Masahiro Yamada | a93297e | 2017-04-14 11:10:22 +0900 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2015, Linaro Limited |
Masahiro Yamada | a93297e | 2017-04-14 11:10:22 +0900 | [diff] [blame] | 4 | */ |
| 5 | #include <linux/linkage.h> |
| 6 | |
| 7 | #include <asm/opcodes-sec.h> |
| 8 | #include <asm/opcodes-virt.h> |
Masahiro Yamada | a93297e | 2017-04-14 11:10:22 +0900 | [diff] [blame] | 9 | |
Alexander Graf | 449c8b2 | 2019-02-11 15:07:17 +0100 | [diff] [blame] | 10 | #ifdef CONFIG_EFI_LOADER |
Heinrich Schuchardt | 26f09d0 | 2018-10-18 12:29:40 +0200 | [diff] [blame] | 11 | .section .text.efi_runtime |
Alexander Graf | 449c8b2 | 2019-02-11 15:07:17 +0100 | [diff] [blame] | 12 | #endif |
Heinrich Schuchardt | 26f09d0 | 2018-10-18 12:29:40 +0200 | [diff] [blame] | 13 | |
Masahiro Yamada | e8ead73 | 2017-04-14 11:10:23 +0900 | [diff] [blame] | 14 | #define UNWIND(x...) |
Masahiro Yamada | a93297e | 2017-04-14 11:10:22 +0900 | [diff] [blame] | 15 | /* |
| 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 |
| 28 | UNWIND( .fnstart) |
| 29 | mov r12, sp |
| 30 | push {r4-r7} |
| 31 | UNWIND( .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 |
| 38 | UNWIND( .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 | */ |
| 47 | ENTRY(__arm_smccc_smc) |
| 48 | SMCCC SMCCC_SMC |
| 49 | ENDPROC(__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 | */ |
| 57 | ENTRY(__arm_smccc_hvc) |
| 58 | SMCCC SMCCC_HVC |
| 59 | ENDPROC(__arm_smccc_hvc) |