1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
/*
* Copyright (c) 2012 Samsung Electronics.
*
* EXYNOS - SMC Call
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef __SMC_H__
#define __SMC_H__
/* For Power Management */
#define SMC_CMD_SLEEP (-3)
#define SMC_CMD_CPU1BOOT (-4)
#define SMC_CMD_CPU0AFTR (-5)
#define SMC_CMD_SAVE (-6)
#define SMC_CMD_SHUTDOWN (-7)
#define SMC_CMD_CPUMAP (-10)
/* For Accessing CP15/SFR (General) */
#define SMC_CMD_REG (-101)
/* For setting memory for debug */
#define SMC_CMD_SET_DEBUG_MEM (-120)
#define SMC_CMD_GET_LOCKUP_REASON (-121)
#define SMC_CMD_KERNEL_PANIC_NOTICE (-122)
#define SMC_CMD_SET_SEH_ADDRESS (-123)
#define SMC_CMD_LOCKUP_NOTICE (0x8200007C)
/* For protecting kernel text area */
#define SMC_CMD_PROTECT_KERNEL_TEXT (-125)
/* For Security Dump Manager */
#define SMC_CMD_DUMP_SECURE_REGION (-130)
#define SMC_CMD_FLUSH_SECDRAM (-131)
/* For D-GPIO/D-TZPC */
#define SMC_CMD_PREAPRE_PD_ONOFF (0x82000410)
/* For FMP/SMU Ctrl */
#define SMC_CMD_FMP_SECURITY (0xC2001810)
#define SMC_CMD_FMP_DISK_KEY_STORED (0xC2001820)
#define SMC_CMD_FMP_DISK_KEY_SET (0xC2001830)
#define SMC_CMD_FMP_DISK_KEY_CLEAR (0xC2001840)
#define SMC_CMD_SMU (0xC2001850)
#define SMC_CMD_FMP_SMU_RESUME (0xC2001860)
#define SMC_CMD_FMP_SMU_DUMP (0xC2001870)
#define SMC_CMD_UFS_LOG (0xC2001880)
/* Command ID for smc */
#define SMC_PROTECTION_SET (0x82002010)
#define SMC_DRM_FW_LOADING (0x82002011)
#define SMC_DCPP_SUPPORT (0x82002012)
#define SMC_DRM_SECBUF_PROT (0x82002020)
#define SMC_DRM_SECBUF_UNPROT (0x82002021)
#define SMC_DRM_G2D_CMD_DATA (0x8200202d)
#define SMC_DRM_SECBUF_CFW_PROT (0x82002030)
#define SMC_DRM_SECBUF_CFW_UNPROT (0x82002031)
#define SMC_DRM_PPMP_PROT (0x82002110)
#define SMC_DRM_PPMP_UNPROT (0x82002111)
#define SMC_DRM_PPMP_MFCFW_PROT (0x82002112)
#define SMC_DRM_PPMP_MFCFW_UNPROT (0x82002113)
#define MC_FC_SET_CFW_PROT (0x82002040)
#define SMC_DRM_SEC_SMMU_INFO (0x820020D0)
/* PPMPU */
#define SMC_PPMPU_PR_VIOLATION (0x820020DE)
#define SMC_PPMPU_GET_PROT (0x820020DF)
#define MC_FC_DRM_SET_CFW_PROT (0x10000000)
#define SMC_SRPMB_WSM (0x82003811)
/* Deprecated */
#define SMC_DRM_MAKE_PGTABLE (0x81000003)
#define SMC_DRM_CLEAR_PGTABLE (0x81000004)
#define SMC_MEM_PROT_SET (0x81000005)
#define SMC_DRM_SECMEM_INFO (0x81000006)
#define SMC_DRM_VIDEO_PROC (0x81000007)
/* Parameter for smc */
#define SMC_PROTECTION_ENABLE (1)
#define SMC_PROTECTION_DISABLE (0)
/* For DTRNG Access */
#ifdef CONFIG_EXYRNG_USE_CRYPTOMANAGER
#define SMC_CMD_RANDOM (0x82001012)
#else
#define SMC_CMD_RANDOM (0x81000030)
#endif
/* For Secure log information */
#define SMC_CMD_SEC_LOG_INFO (0x82000610)
/* MACRO for SMC_CMD_REG */
#define SMC_REG_CLASS_CP15 (0x0 << 30)
#define SMC_REG_CLASS_SFR_W (0x1 << 30)
#define SMC_REG_CLASS_SFR_R (0x3 << 30)
#define SMC_REG_CLASS_MASK (0x3 << 30)
#define SMC_REG_ID_SFR_W(ADDR) (SMC_REG_CLASS_SFR_W | ((ADDR) >> 2))
#define SMC_REG_ID_SFR_R(ADDR) (SMC_REG_CLASS_SFR_R | ((ADDR) >> 2))
/* op type for SMC_CMD_SAVE and SMC_CMD_SHUTDOWN */
#define OP_TYPE_CORE (0x0)
#define OP_TYPE_CLUSTER (0x1)
/* Power State required for SMC_CMD_SAVE and SMC_CMD_SHUTDOWN */
#define SMC_POWERSTATE_SLEEP (0x0)
#define SMC_POWERSTATE_IDLE (0x1)
#define SMC_POWERSTATE_SWITCH (0x2)
/*
* For SMC CMD for SRPMB
*/
#define SMC_SRPMB_WSM (0x82003811)
/* For DTRNG Access */
#define HWRNG_INIT (0x0)
#define HWRNG_EXIT (0x1)
#define HWRNG_GET_DATA (0x2)
#define HWRNG_RESUME (0x3)
/* For CFW group */
#define CFW_DISP_RW (3)
#define CFW_VPP0 (5)
#define CFW_VPP1 (6)
#define SMC_TZPC_OK (2)
#define PROT_MFC (0)
#define PROT_MSCL0 (1)
#define PROT_MSCL1 (2)
#define PROT_G0 (3)
#define PROT_G1 (4)
#define PROT_VG0 (5)
#define PROT_VG1 (6)
#define PROT_G2 (7)
#define PROT_G3 (8)
#define PROT_VGR0 (9)
#define PROT_VGRF (10)
#define PROT_WB1 (11)
#define PROT_G3D (12)
#define PROT_JPEG (13)
#define PROT_G2D (14)
#ifndef __ASSEMBLY__
/* secure SysMMU SFR access */
enum sec_sysmmu_sfr_access_t {
SEC_SMMU_SFR_READ,
SEC_SMMU_SFR_WRITE,
};
/* Return value from DRM LDFW */
enum drmdrv_result_t {
DRMDRV_OK = 0x0000,
/* Error lists for common driver */
E_DRMDRV_INVALID = 0x1001,
E_DRMDRV_INVALID_ADDR_ALIGN = 0x1002,
E_DRMDRV_INVALID_SIZE_ALIGN = 0x1003,
E_DRMDRV_INVALID_MEMCPY_LENGTH = 0x1004,
E_DRMDRV_ADDR_OUT_OF_DRAM = 0x1005,
E_DRMDRV_ADDR_OUT_OF_SECMEM = 0x1006,
E_DRMDRV_INVALID_ADDR = 0x1007,
E_DRMDRV_INVALID_SIZE = 0x1008,
E_DRMDRV_INVALID_CMD = 0x1009,
E_DRMDRV_ADDR_OVERFLOWED = 0x100A,
E_DRMDRV_ADDR_OVERLAP_SECOS = 0x100B,
/* Error lists for TZASC driver */
E_DRMDRV_TZASC_ALIGN_CHECK = 0x2001,
E_DRMDRV_TZASC_CONTIG_CHECK = 0x2002,
E_DRMDRV_TZASC_GET_ORDER = 0x2003,
E_DRMDRV_TZASC_INVALID_INDEX = 0x2004,
E_DRMDRV_TZASC_INVALID_ENABLED = 0x2005,
E_DRMDRV_TZASC_NOT_PROTECTED = 0x2006,
/* Erorr lists for media driver */
E_DRMDRV_MEDIA_CHECK_POWER = 0x3001,
E_DRMDRV_MEDIA_CHECK_CLOCK = 0x3002,
E_DRMDRV_MEDIA_CHECK_SMMU_CLOCK = 0x3003,
E_DRMDRV_MEDIA_CHECK_SMMU_ENABLED = 0x3004,
E_DRMDRV_WB_CHECK_FAILED = 0x3005,
E_DRMDRV_HDMI_WITH_NO_HDCP_FAILED = 0x3006,
E_DRMDRV_MSCL_LOCAL_PATH_FAILED = 0x3007,
E_DRMDRV_HDMI_POWER_OFF = 0x3008,
E_DRMDRV_HDMI_CLOCK_OFF = 0x3009,
E_DRMDRV_INVALID_REFCOUNT = 0x300A,
/* Error lists for g2d driver */
E_DRMDRV_G2D_INVALID_PARAM = 0x4001,
E_DRMDRV_G2D_BLIT_TIMEOUT = 0x4002,
/* Error lists for RTC driver */
E_DRMDRV_GET_RTC_TIME = 0x5001,
E_DRMDRV_SET_RTC_TIME = 0x5002,
E_DRMDRV_GET_RTC_TICK_TIME = 0x5003,
E_DRMDRV_SET_RTC_TICK_TIME = 0x5004,
/* Error lists for CFW driver */
E_DRMDRV_CFW_ERROR = 0x6001,
E_DRMDRV_CFW_BUFFER_LIST_FULL = 0x6002,
E_DRMDRV_CFW_NOT_PROTECTED_BUFFER = 0x6003,
E_DRMDRV_CFW_INVALID_DEV_ARG = 0x6004,
E_DRMDRV_CFW_INIT_FAIL = 0x6005,
E_DRMDRV_CFW_PROT_FAIL = 0x6006,
E_DRMDRV_CFW_ENABLED_ALREADY = 0x6007,
E_DRMDRV_CFW_NOT_EXIST_IN_CFW_BUFF_LIST = 0x6008,
E_DRMDRV_CFW_DUPLICATED_BUFFER = 0x6009,
E_DRMDRV_CFW_BUFFER_IS_OVERLAPPED = 0x600A,
/* Error lists for Secure Buffer */
E_DRMDRV_DUPLICATED_BUFFER = 0x7001,
E_DRMDRV_BUFFER_LIST_FULL = 0x7002,
E_DRMDRV_NOT_EXIST_IN_SEC_BUFFER_LIST = 0x7003,
E_DRMDRV_OVERLAP_RESERVED_ASP_REGION = 0x7004,
E_DRMDRV_INVALID_BUFFER_TYPE = 0x7005,
/* Error lists for MFC FW */
E_DRMDRV_MFC_FW_IS_NOT_PROTECTED = 0x8001,
E_DRMDRV_MFC_FW_ARG_IS_NULL = 0x8002,
E_DRMDRV_MFC_FW_INVALID_SIZE = 0x8003,
};
extern int __exynos_smc(unsigned long cmd, unsigned long arg1, unsigned long arg2, unsigned long arg3);
extern int exynos_smc(unsigned long cmd, unsigned long arg1, unsigned long arg2, unsigned long arg3);
extern int exynos_smc_readsfr(unsigned long addr, unsigned long* val);
#endif
#endif /* __SMC_H__ */
|