blob: 54655273d1e0ba9e619953e9ce4d3bbfd73426da [file] [log] [blame]
Thomas Gleixner1802d0b2019-05-27 08:55:21 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Jens Wiklander14457452016-01-04 15:44:32 +01002/*
3 * Copyright (c) 2015, Linaro Limited
Jens Wiklander14457452016-01-04 15:44:32 +01004 */
5#include <linux/linkage.h>
Andy Gross82bcd082017-02-01 11:28:28 -06006#include <linux/arm-smccc.h>
Mark Rutland23fe04c2018-12-07 18:08:18 +00007
Jens Wiklander14457452016-01-04 15:44:32 +01008#include <asm/asm-offsets.h>
Mark Rutland23fe04c2018-12-07 18:08:18 +00009#include <asm/assembler.h>
Jens Wiklander14457452016-01-04 15:44:32 +010010
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 Gross82bcd082017-02-01 11:28:28 -060017 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]
231: ret
Jens Wiklander14457452016-01-04 15:44:32 +010024 .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 Gross680a0872017-02-01 11:28:27 -060030 * unsigned long a6, unsigned long a7, struct arm_smccc_res *res,
31 * struct arm_smccc_quirk *quirk)
Jens Wiklander14457452016-01-04 15:44:32 +010032 */
Andy Gross680a0872017-02-01 11:28:27 -060033ENTRY(__arm_smccc_smc)
Jens Wiklander14457452016-01-04 15:44:32 +010034 SMCCC smc
Andy Gross680a0872017-02-01 11:28:27 -060035ENDPROC(__arm_smccc_smc)
Mark Rutland23fe04c2018-12-07 18:08:18 +000036EXPORT_SYMBOL(__arm_smccc_smc)
Jens Wiklander14457452016-01-04 15:44:32 +010037
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 Gross680a0872017-02-01 11:28:27 -060041 * unsigned long a6, unsigned long a7, struct arm_smccc_res *res,
42 * struct arm_smccc_quirk *quirk)
Jens Wiklander14457452016-01-04 15:44:32 +010043 */
Andy Gross680a0872017-02-01 11:28:27 -060044ENTRY(__arm_smccc_hvc)
Jens Wiklander14457452016-01-04 15:44:32 +010045 SMCCC hvc
Andy Gross680a0872017-02-01 11:28:27 -060046ENDPROC(__arm_smccc_hvc)
Mark Rutland23fe04c2018-12-07 18:08:18 +000047EXPORT_SYMBOL(__arm_smccc_hvc)