xref: /aosp_15_r20/external/coreboot/src/arch/arm64/include/armv8/arch/smc.h (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef ARM_ARM64_SMC_H
4 #define ARM_ARM64_SMC_H
5 
6 #include <types.h>
7 
8 uint64_t smc(uint32_t function_id, uint64_t arg1, uint64_t arg2, uint64_t arg3,
9 		uint64_t arg4, uint64_t arg5, uint64_t arg6, uint64_t arg7);
10 
11 #define smc_call0(function_id)			smc(function_id, 0, 0, 0, 0, 0, 0, 0)
12 #define smc_call1(function_id, a1)		smc(function_id, a1, 0, 0, 0, 0, 0, 0)
13 #define smc_call2(function_id, a1, a2)		smc(function_id, a1, a2, 0, 0, 0, 0, 0)
14 #define smc_call3(function_id, a1, a2, a3)	smc(function_id, a1, a2, a3, 0, 0, 0, 0)
15 
16 /* Documented in https://developer.arm.com/documentation/den0022/ */
17 enum psci_return_values {
18 	PSCI_SUCCESS = 0,
19 	PSCI_NOT_SUPPORTED = -1,
20 	PSCI_INVALID_PARAMETERS = -2,
21 	PSCI_DENIED = -3,
22 	PSCI_ALREADY_ON = -4,
23 	PSCI_ON_PENDING = -5,
24 	PSCI_INTERNAL_FAILURE = -6,
25 	PSCI_NOT_PRESENT = -7,
26 	PSCI_DISABLED = -8,
27 	PSCI_INVALID_ADDRESS = -9,
28 };
29 
30 /* PSCI functions */
31 #define PSCI_VERSION		0x84000000
32 #define PSCI_FEATURES		0x8400000a
33 
34 /* Documented in https://developer.arm.com/documentation/den0028/ */
35 enum smccc_return_values {
36 	SMC_SUCCESS = 0,
37 	SMC_NOT_SUPPORTED = -1,
38 	SMC_NOT_REQUIRED = -2,
39 	SMC_INVALID_PARAMETER = -3,
40 };
41 
42 /* SMCCC functions */
43 #define SMCCC_VERSION		0x80000000
44 #define SMCCC_ARCH_FEATURES	0x80000001
45 #define SMCCC_ARCH_SOC_ID	0x80000002
46 #define  SMCCC_GET_SOC_VERSION	0
47 #define  SMCCC_GET_SOC_REVISION	1
48 
49 uint8_t smccc_supports_arch_soc_id(void);
50 enum cb_err smccc_arch_soc_id(uint32_t *jep106code, uint32_t *soc_revision);
51 
52 #endif /* ARM_ARM64_SMC_H */
53