xref: /openbmc/u-boot/arch/arm/cpu/armv8/smccc-call.S (revision 63f7e3fca391a50a499fed828fe16325fdee45f3)
183d290c5STom Rini/* SPDX-License-Identifier: GPL-2.0 */
2c2da86f3SMasahiro Yamada/*
3c2da86f3SMasahiro Yamada * Copyright (c) 2015, Linaro Limited
4c2da86f3SMasahiro Yamada */
5c2da86f3SMasahiro Yamada#include <linux/linkage.h>
6c2da86f3SMasahiro Yamada#include <linux/arm-smccc.h>
7c54bcf68SMasahiro Yamada#include <generated/asm-offsets.h>
8c2da86f3SMasahiro Yamada
9*2f8ab121SAlexander Graf#ifdef CONFIG_EFI_LOADER
1081ea0083SHeinrich Schuchardt	.section	.text.efi_runtime
11*2f8ab121SAlexander Graf#endif
1281ea0083SHeinrich Schuchardt
13c2da86f3SMasahiro Yamada	.macro SMCCC instr
14c2da86f3SMasahiro Yamada	.cfi_startproc
15c2da86f3SMasahiro Yamada	\instr	#0
16c2da86f3SMasahiro Yamada	ldr	x4, [sp]
17c2da86f3SMasahiro Yamada	stp	x0, x1, [x4, #ARM_SMCCC_RES_X0_OFFS]
18c2da86f3SMasahiro Yamada	stp	x2, x3, [x4, #ARM_SMCCC_RES_X2_OFFS]
19c2da86f3SMasahiro Yamada	ldr	x4, [sp, #8]
20c2da86f3SMasahiro Yamada	cbz	x4, 1f /* no quirk structure */
21c2da86f3SMasahiro Yamada	ldr	x9, [x4, #ARM_SMCCC_QUIRK_ID_OFFS]
22c2da86f3SMasahiro Yamada	cmp	x9, #ARM_SMCCC_QUIRK_QCOM_A6
23c2da86f3SMasahiro Yamada	b.ne	1f
24c2da86f3SMasahiro Yamada	str	x6, [x4, ARM_SMCCC_QUIRK_STATE_OFFS]
25c2da86f3SMasahiro Yamada1:	ret
26c2da86f3SMasahiro Yamada	.cfi_endproc
27c2da86f3SMasahiro Yamada	.endm
28c2da86f3SMasahiro Yamada
29c2da86f3SMasahiro Yamada/*
30c2da86f3SMasahiro Yamada * void arm_smccc_smc(unsigned long a0, unsigned long a1, unsigned long a2,
31c2da86f3SMasahiro Yamada *		  unsigned long a3, unsigned long a4, unsigned long a5,
32c2da86f3SMasahiro Yamada *		  unsigned long a6, unsigned long a7, struct arm_smccc_res *res,
33c2da86f3SMasahiro Yamada *		  struct arm_smccc_quirk *quirk)
34c2da86f3SMasahiro Yamada */
35c2da86f3SMasahiro YamadaENTRY(__arm_smccc_smc)
36c2da86f3SMasahiro Yamada	SMCCC	smc
37c2da86f3SMasahiro YamadaENDPROC(__arm_smccc_smc)
38c2da86f3SMasahiro Yamada
39c2da86f3SMasahiro Yamada/*
40c2da86f3SMasahiro Yamada * void arm_smccc_hvc(unsigned long a0, unsigned long a1, unsigned long a2,
41c2da86f3SMasahiro Yamada *		  unsigned long a3, unsigned long a4, unsigned long a5,
42c2da86f3SMasahiro Yamada *		  unsigned long a6, unsigned long a7, struct arm_smccc_res *res,
43c2da86f3SMasahiro Yamada *		  struct arm_smccc_quirk *quirk)
44c2da86f3SMasahiro Yamada */
45c2da86f3SMasahiro YamadaENTRY(__arm_smccc_hvc)
46c2da86f3SMasahiro Yamada	SMCCC	hvc
47c2da86f3SMasahiro YamadaENDPROC(__arm_smccc_hvc)
48