Thomas Gleixner | 1802d0b | 2019-05-27 08:55:21 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Jens Wiklander | 1445745 | 2016-01-04 15:44:32 +0100 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2015, Linaro Limited |
Jens Wiklander | 1445745 | 2016-01-04 15:44:32 +0100 | [diff] [blame] | 4 | */ |
| 5 | #include <linux/linkage.h> |
Andy Gross | 82bcd08 | 2017-02-01 11:28:28 -0600 | [diff] [blame] | 6 | #include <linux/arm-smccc.h> |
Mark Rutland | 23fe04c | 2018-12-07 18:08:18 +0000 | [diff] [blame] | 7 | |
Jens Wiklander | 1445745 | 2016-01-04 15:44:32 +0100 | [diff] [blame] | 8 | #include <asm/asm-offsets.h> |
Mark Rutland | 23fe04c | 2018-12-07 18:08:18 +0000 | [diff] [blame] | 9 | #include <asm/assembler.h> |
Jens Wiklander | 1445745 | 2016-01-04 15:44:32 +0100 | [diff] [blame] | 10 | |
| 11 | .macro SMCCC instr |
| 12 | .cfi_startproc |
| 13 | \instr #0 |
| 14 | ldr x4, [sp] |
| 15 | stp x0, x1, [x4, #ARM_SMCCC_RES_X0_OFFS] |
| 16 | stp x2, x3, [x4, #ARM_SMCCC_RES_X2_OFFS] |
Andy Gross | 82bcd08 | 2017-02-01 11:28:28 -0600 | [diff] [blame] | 17 | ldr x4, [sp, #8] |
| 18 | cbz x4, 1f /* no quirk structure */ |
| 19 | ldr x9, [x4, #ARM_SMCCC_QUIRK_ID_OFFS] |
| 20 | cmp x9, #ARM_SMCCC_QUIRK_QCOM_A6 |
| 21 | b.ne 1f |
| 22 | str x6, [x4, ARM_SMCCC_QUIRK_STATE_OFFS] |
| 23 | 1: ret |
Jens Wiklander | 1445745 | 2016-01-04 15:44:32 +0100 | [diff] [blame] | 24 | .cfi_endproc |
| 25 | .endm |
| 26 | |
| 27 | /* |
| 28 | * void arm_smccc_smc(unsigned long a0, unsigned long a1, unsigned long a2, |
| 29 | * unsigned long a3, unsigned long a4, unsigned long a5, |
Andy Gross | 680a087 | 2017-02-01 11:28:27 -0600 | [diff] [blame] | 30 | * unsigned long a6, unsigned long a7, struct arm_smccc_res *res, |
| 31 | * struct arm_smccc_quirk *quirk) |
Jens Wiklander | 1445745 | 2016-01-04 15:44:32 +0100 | [diff] [blame] | 32 | */ |
Andy Gross | 680a087 | 2017-02-01 11:28:27 -0600 | [diff] [blame] | 33 | ENTRY(__arm_smccc_smc) |
Jens Wiklander | 1445745 | 2016-01-04 15:44:32 +0100 | [diff] [blame] | 34 | SMCCC smc |
Andy Gross | 680a087 | 2017-02-01 11:28:27 -0600 | [diff] [blame] | 35 | ENDPROC(__arm_smccc_smc) |
Mark Rutland | 23fe04c | 2018-12-07 18:08:18 +0000 | [diff] [blame] | 36 | EXPORT_SYMBOL(__arm_smccc_smc) |
Jens Wiklander | 1445745 | 2016-01-04 15:44:32 +0100 | [diff] [blame] | 37 | |
| 38 | /* |
| 39 | * void arm_smccc_hvc(unsigned long a0, unsigned long a1, unsigned long a2, |
| 40 | * unsigned long a3, unsigned long a4, unsigned long a5, |
Andy Gross | 680a087 | 2017-02-01 11:28:27 -0600 | [diff] [blame] | 41 | * unsigned long a6, unsigned long a7, struct arm_smccc_res *res, |
| 42 | * struct arm_smccc_quirk *quirk) |
Jens Wiklander | 1445745 | 2016-01-04 15:44:32 +0100 | [diff] [blame] | 43 | */ |
Andy Gross | 680a087 | 2017-02-01 11:28:27 -0600 | [diff] [blame] | 44 | ENTRY(__arm_smccc_hvc) |
Jens Wiklander | 1445745 | 2016-01-04 15:44:32 +0100 | [diff] [blame] | 45 | SMCCC hvc |
Andy Gross | 680a087 | 2017-02-01 11:28:27 -0600 | [diff] [blame] | 46 | ENDPROC(__arm_smccc_hvc) |
Mark Rutland | 23fe04c | 2018-12-07 18:08:18 +0000 | [diff] [blame] | 47 | EXPORT_SYMBOL(__arm_smccc_hvc) |