1 /*
2  * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 #ifndef __PLAT_SIP_SVC_H__
7 #define __PLAT_SIP_SVC_H__
8 
9 #include <stdint.h>
10 
11 /* SMC function IDs for SiP Service queries */
12 #define SIP_SVC_CALL_COUNT		0x8200ff00
13 #define SIP_SVC_UID			0x8200ff01
14 /*					0x8200ff02 is reserved */
15 #define SIP_SVC_VERSION			0x8200ff03
16 
17 /* Mediatek SiP Service Calls version numbers */
18 #define MTK_SIP_SVC_VERSION_MAJOR	0x0
19 #define MTK_SIP_SVC_VERSION_MINOR	0x1
20 
21 #define SMC_AARCH64_BIT		0x40000000
22 
23 /* Number of Mediatek SiP Calls implemented */
24 #define MTK_COMMON_SIP_NUM_CALLS	4
25 
26 /* Mediatek SiP Service Calls function IDs */
27 #define MTK_SIP_SET_AUTHORIZED_SECURE_REG	0x82000001
28 
29 /* For MTK SMC from Secure OS */
30 /* 0x82000000 - 0x820000FF & 0xC2000000 - 0xC20000FF */
31 #define MTK_SIP_KERNEL_BOOT_AARCH32		0x82000200
32 #define MTK_SIP_KERNEL_BOOT_AARCH64		0xC2000200
33 
34 /* Mediatek SiP Calls error code */
35 enum {
36 	MTK_SIP_E_SUCCESS = 0,
37 	MTK_SIP_E_INVALID_PARAM = -1,
38 	MTK_SIP_E_NOT_SUPPORTED = -2,
39 	MTK_SIP_E_INVALID_RANGE = -3,
40 	MTK_SIP_E_PERMISSION_DENY = -4,
41 	MTK_SIP_E_LOCK_FAIL = -5
42 };
43 
44 /*
45  * This function should be implemented in Mediatek SOC directory. It fullfills
46  * MTK_SIP_SET_AUTHORIZED_SECURE_REG SiP call by checking the sreg with the
47  * predefined secure register list, if a match was found, set val to sreg.
48  *
49  * Return MTK_SIP_E_SUCCESS on success, and MTK_SIP_E_INVALID_PARAM on failure.
50  */
51 uint64_t mt_sip_set_authorized_sreg(uint32_t sreg, uint32_t val);
52 
53 #endif /* __PLAT_SIP_SVC_H__ */
54