xref: /optee_os/core/arch/arm/include/sm/std_smc.h (revision fbe66cf83199aa6a2aca9f93384cf1ad9185a5f6)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2017-2023, Linaro Limited
4  */
5 #ifndef __SM_STD_SMC_H__
6 #define __SM_STD_SMC_H__
7 
8 #include <sm/sm.h>
9 
10 /* SMC function IDs for Standard Service queries */
11 
12 #define ARM_STD_SVC_CALL_COUNT		0x8400ff00
13 #define ARM_STD_SVC_UID			0x8400ff01
14 /*                                      0x8400ff02 is reserved */
15 #define ARM_STD_SVC_VERSION		0x8400ff03
16 
17 #define ARM_SMCCC_VERSION		0x80000000
18 #define ARM_SMCCC_ARCH_FEATURES		0x80000001
19 #define ARM_SMCCC_ARCH_SOC_ID		0x80000002
20 #define ARM_SMCCC_ARCH_WORKAROUND_1	0x80008000
21 #define ARM_SMCCC_ARCH_WORKAROUND_2	0x80007fff
22 
23 #define ARM_SMCCC_RET_SUCCESS		0
24 #define ARM_SMCCC_RET_NOT_SUPPORTED	0xffffffff
25 #define ARM_SMCCC_RET_NOT_REQUIRED	0xfffffffe
26 #define ARM_SMCCC_RET_INVALID_PARAMETER	0xfffffffd
27 
28 #define SMCCC_V_1_0			0x10000
29 #define SMCCC_V_1_1			0x10001
30 #define SMCCC_V_1_2			0x10002
31 
32 /* ARM Standard Service Calls version numbers */
33 #define STD_SVC_VERSION_MAJOR		0x0
34 #define STD_SVC_VERSION_MINOR		0x1
35 
36 /* The macros below are used to identify PSCI calls from the SMC function ID */
37 #define PSCI_FID_MASK			0xffe0u
38 #define PSCI_FID_VALUE			0u
39 #define is_psci_fid(_fid) \
40 	(((_fid) & PSCI_FID_MASK) == PSCI_FID_VALUE)
41 
42 void smc_std_handler(struct thread_smc_args *args, struct sm_nsec_ctx *nsec);
43 #endif
44