xref: /openbmc/linux/arch/arm64/kernel/smccc-call.S (revision 2462bca0)
1/*
2 * Copyright (c) 2015, Linaro Limited
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License Version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 */
14#include <linux/linkage.h>
15#include <linux/arm-smccc.h>
16
17#include <asm/asm-offsets.h>
18#include <asm/assembler.h>
19
20	.macro SMCCC instr
21	.cfi_startproc
22	\instr	#0
23	ldr	x4, [sp]
24	stp	x0, x1, [x4, #ARM_SMCCC_RES_X0_OFFS]
25	stp	x2, x3, [x4, #ARM_SMCCC_RES_X2_OFFS]
26	ldr	x4, [sp, #8]
27	cbz	x4, 1f /* no quirk structure */
28	ldr	x9, [x4, #ARM_SMCCC_QUIRK_ID_OFFS]
29	cmp	x9, #ARM_SMCCC_QUIRK_QCOM_A6
30	b.ne	1f
31	str	x6, [x4, ARM_SMCCC_QUIRK_STATE_OFFS]
321:	ret
33	.cfi_endproc
34	.endm
35
36/*
37 * void arm_smccc_smc(unsigned long a0, unsigned long a1, unsigned long a2,
38 *		  unsigned long a3, unsigned long a4, unsigned long a5,
39 *		  unsigned long a6, unsigned long a7, struct arm_smccc_res *res,
40 *		  struct arm_smccc_quirk *quirk)
41 */
42ENTRY(__arm_smccc_smc)
43	SMCCC	smc
44ENDPROC(__arm_smccc_smc)
45EXPORT_SYMBOL(__arm_smccc_smc)
46
47/*
48 * void arm_smccc_hvc(unsigned long a0, unsigned long a1, unsigned long a2,
49 *		  unsigned long a3, unsigned long a4, unsigned long a5,
50 *		  unsigned long a6, unsigned long a7, struct arm_smccc_res *res,
51 *		  struct arm_smccc_quirk *quirk)
52 */
53ENTRY(__arm_smccc_hvc)
54	SMCCC	hvc
55ENDPROC(__arm_smccc_hvc)
56EXPORT_SYMBOL(__arm_smccc_hvc)
57