• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 #ifndef MTK_SIP_SVC_H
7 #define MTK_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 /* VCORE */
35 #define MTK_SIP_VCORE_CONTROL_ARCH32		0x82000506
36 #define MTK_SIP_VCORE_CONTROL_ARCH64		0xC2000506
37 
38 /* APUSYS SMC call */
39 #define MTK_SIP_APUSYS_CONTROL_AARCH32		0x8200051E
40 #define MTK_SIP_APUSYS_CONTROL_AARCH64		0xC200051E
41 
42 /* Mediatek SiP Calls error code */
43 enum {
44 	MTK_SIP_E_SUCCESS = 0,
45 	MTK_SIP_E_INVALID_PARAM = -1,
46 	MTK_SIP_E_NOT_SUPPORTED = -2,
47 	MTK_SIP_E_INVALID_RANGE = -3,
48 	MTK_SIP_E_PERMISSION_DENY = -4,
49 	MTK_SIP_E_LOCK_FAIL = -5
50 };
51 
52 /*
53  * This function should be implemented in Mediatek SOC directory. It fullfills
54  * MTK_SIP_SET_AUTHORIZED_SECURE_REG SiP call by checking the sreg with the
55  * predefined secure register list, if a match was found, set val to sreg.
56  *
57  * Return MTK_SIP_E_SUCCESS on success, and MTK_SIP_E_INVALID_PARAM on failure.
58  */
59 uint64_t mt_sip_set_authorized_sreg(uint32_t sreg, uint32_t val);
60 
61 #endif /* MTK_SIP_SVC_H */
62