1 /*
2  * Copyright (c) 2016-2021, STMicroelectronics - All Rights Reserved
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef STM32MP1_SMC_H
8 #define STM32MP1_SMC_H
9 
10 /*
11  * SMC function IDs for STM32 Service queries
12  * STM32 SMC services use the space between 0x82000000 and 0x8200FFFF
13  * like this is defined in SMC calling Convention by ARM
14  * for SiP (silicon Partner)
15  * https://developer.arm.com/docs/den0028/latest
16  */
17 
18 /* Secure Service access from Non-secure */
19 
20 /*
21  * STM32_SMC_BSEC call API
22  *
23  * Argument a0: (input) SMCC ID
24  *		(output) status return code
25  * Argument a1: (input) Service ID (STM32_SMC_BSEC_xxx)
26  * Argument a2: (input) OTP index
27  *		(output) OTP read value, if applicable
28  * Argument a3: (input) OTP value if applicable
29  */
30 #define STM32_SMC_BSEC			0x82001003
31 
32 /*
33  * STM32_SIP_SMC_SCMI_AGENT0
34  * STM32_SIP_SMC_SCMI_AGENT1
35  * Process SCMI message pending in SCMI shared memory buffer.
36  *
37  * Argument a0: (input) SMCC ID
38  */
39 #define STM32_SIP_SMC_SCMI_AGENT0	0x82002000
40 #define STM32_SIP_SMC_SCMI_AGENT1	0x82002001
41 
42 /* SMC function IDs for SiP Service queries */
43 #define STM32_SIP_SVC_CALL_COUNT	0x8200ff00
44 #define STM32_SIP_SVC_UID		0x8200ff01
45 /*					0x8200ff02 is reserved */
46 #define STM32_SIP_SVC_VERSION		0x8200ff03
47 
48 /* STM32 SiP Service Calls version numbers */
49 #define STM32_SIP_SVC_VERSION_MAJOR	0x0
50 #define STM32_SIP_SVC_VERSION_MINOR	0x1
51 
52 /* Number of STM32 SiP Calls implemented */
53 #define STM32_COMMON_SIP_NUM_CALLS	3
54 
55 /* Service for BSEC */
56 #define STM32_SMC_READ_SHADOW		0x01
57 #define STM32_SMC_PROG_OTP		0x02
58 #define STM32_SMC_WRITE_SHADOW		0x03
59 #define STM32_SMC_READ_OTP		0x04
60 
61 /* SMC error codes */
62 #define STM32_SMC_OK			0x00000000U
63 #define STM32_SMC_NOT_SUPPORTED		0xFFFFFFFFU
64 #define STM32_SMC_FAILED		0xFFFFFFFEU
65 #define STM32_SMC_INVALID_PARAMS	0xFFFFFFFDU
66 
67 #endif /* STM32MP1_SMC_H */
68