1 /*
2  * Copyright 2020 Carlo Caione <ccaione@baylibre.com>
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_INCLUDE_ARCH_ARM64_SMCCC_H_
8 #define ZEPHYR_INCLUDE_ARCH_ARM64_SMCCC_H_
9 
10 /*
11  * Result from SMC/HVC call
12  * @a0-a7 result values from registers 0 to 7
13  */
14 struct arm_smccc_res {
15 	unsigned long a0;
16 	unsigned long a1;
17 	unsigned long a2;
18 	unsigned long a3;
19 	unsigned long a4;
20 	unsigned long a5;
21 	unsigned long a6;
22 	unsigned long a7;
23 };
24 
25 typedef struct arm_smccc_res arm_smccc_res_t;
26 
27 enum arm_smccc_conduit {
28 	SMCCC_CONDUIT_NONE,
29 	SMCCC_CONDUIT_SMC,
30 	SMCCC_CONDUIT_HVC,
31 };
32 
33 /*
34  * @brief Make HVC calls
35  *
36  * @param a0 function identifier
37  * @param a1-a7 parameters registers
38  * @param res results
39  */
40 void arm_smccc_hvc(unsigned long a0, unsigned long a1,
41 		   unsigned long a2, unsigned long a3,
42 		   unsigned long a4, unsigned long a5,
43 		   unsigned long a6, unsigned long a7,
44 		   struct arm_smccc_res *res);
45 
46 /*
47  * @brief Make SMC calls
48  *
49  * @param a0 function identifier
50  * @param a1-a7 parameters registers
51  * @param res results
52  */
53 void arm_smccc_smc(unsigned long a0, unsigned long a1,
54 		   unsigned long a2, unsigned long a3,
55 		   unsigned long a4, unsigned long a5,
56 		   unsigned long a6, unsigned long a7,
57 		   struct arm_smccc_res *res);
58 
59 #endif /* ZEPHYR_INCLUDE_ARCH_ARM64_SMCCC_H_ */
60