hc
2023-10-25 6c2073b7aa40e29d0eca7d571dd7bc590c7ecaa7
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
/*
 * Copyright (c) 2014, STMicroelectronics International N.V.
 *
 * 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.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 */
#ifndef __TEE_ARMV7_OP_H__
#define __TEE_ARMV7_OP_H__
 
enum t_issw_service_id {
   /*
    * ("SSAPI_PRE_INIT_SERV")
    */
   SSAPI_PRE_INIT_SERV = 1,
 
   /*
    * ("SSAPI_POST_SPEEDUP_INIT_SERV")
    * Reserved, Not used
    */
   SSAPI_POST_SPEEDUP_INIT_SERV = 2,
 
   /*
    * ("SSAPI_ISSW_IMPORT_SERV")
    */
   SSAPI_ISSW_IMPORT_SERV = 3,
 
   /*
    * ("SSAPI_RET_FROM_INT_SERV")
    */
   SSAPI_RET_FROM_INT_SERV = 4,
 
   /*
    * ("SSAPI_RET_FROM_RPC_SERV")
    */
   SSAPI_RET_FROM_RPC_SERV = 5,
 
   /*
    * "ISSWAPI_ISSW_EXECUTE_SERV" is linked to ROM code
    * ("SSAPI_ISSW_EXECUTE_SERV")
    */
   ISSWAPI_ISSW_EXECUTE_SERV = 6,
   ISSWAPI_PROT_APPL_MSG_SEND = 0x10000000,
   ISSWAPI_EXTERNAL_CODE_CHECK = 0x10000001,
   ISSWAPI_SECURE_LOAD = 0x10000002,
   ISSWAPI_ISSW_REIMPORT_PUB_KEYS = 0x10000003,
 
   /* Accessible only on request */
   ISSWAPI_WRITE_L2CC = 0x10000004,
   ISSWAPI_WRITE_CP15_SCTLR = 0x10000005,
   ISSWAPI_READ_CP15_SCTLR = 0x10000006,
   ISSWAPI_WRITE_CP15_ACTLR = 0x10000007,
   ISSWAPI_READ_CP15_ACTLR = 0x10000008,
   ISSWAPI_WRITE_CP15_DIAGR = 0x10000009,
   ISSWAPI_READ_CP15_DIAGR = 0x1000000A,
 
   ISSWAPI_EXECUTE_TA = 0x11000001,
   ISSWAPI_CLOSE_TA = 0x11000002,
   ISSWAPI_FLUSH_BOOT_CODE = 0x11000003,
   /* Generic, restricted to be used by u-boot */
   ISSWAPI_VERIFY_SIGNED_HEADER = 0x11000005,
   ISSWAPI_VERIFY_HASH = 0x11000006,
   /* 8500 only, restricted to be used by u-boot */
   ISSWAPI_GET_RT_FLAGS = 0x11000007,
 
   /* For TEE Client API 1.0 */
   ISSWAPI_TEEC_OPEN_SESSION = 0x11000008,
   ISSWAPI_TEEC_CLOSE_SESSION = 0x11000009,
   ISSWAPI_TEEC_INVOKE_COMMAND = 0x1100000a,
   ISSWAPI_REGISTER_RPC = 0x1100000b,    /* this is NOT a GP TEE API ! */
   ISSWAPI_SET_SEC_DDR = 0x1100000c,    /* this is NOT a GP TEE API ! */
   ISSWAPI_TEEC_CANCEL_COMMAND = 0x1100000d,
   ISSWAPI_TEEC_REGISTER_MEMORY = 0x1100000e,
   ISSWAPI_TEEC_UNREGISTER_MEMORY = 0x1100000f,
 
   /* Internal command */
   ISSWAPI_TEE_DEINIT_CPU = 0x11000010,
   ISSWAPI_TEE_CRASH_CPU = 0x11000011,
   ISSWAPI_TEE_SET_CORE_TRACE_LEVEL = 0x11000012,
   ISSWAPI_TEE_GET_CORE_TRACE_LEVEL = 0x11000013,
   ISSWAPI_TEE_SET_TA_TRACE_LEVEL = 0x11000014,
   ISSWAPI_TEE_GET_TA_TRACE_LEVEL = 0x11000015,
   ISSWAPI_TEE_GET_CORE_STATUS = 0x11000016,
   ISSWAPI_TEE_FLUSH_CACHE = 0x11000017,
 
   ISSWAPI_REGISTER_DEF_SHM = 0x11000020,
   ISSWAPI_UNREGISTER_DEF_SHM = 0x11000021,
   ISSWAPI_REGISTER_IRQFWD = 0x11000022,
   ISSWAPI_UNREGISTER_IRQFWD = 0x11000023,
   ISSWAPI_GET_SHM_START = 0x11000024,
   ISSWAPI_GET_SHM_SIZE = 0x11000025,
   ISSWAPI_GET_SHM_CACHED = 0x11000026,
 
   ISSWAPI_ENABLE_L2CC_MUTEX = 0x20000000,
   ISSWAPI_DISABLE_L2CC_MUTEX = 0x20000001,
   ISSWAPI_GET_L2CC_MUTEX = 0x20000002,
   ISSWAPI_SET_L2CC_MUTEX = 0x20000003,
 
   ISSWAPI_LOAD_TEE = 0x20000004,
 
};
 
/*
 * tee_msg_send - generic part of the msg sent to the TEE
 */
struct tee_msg_send {
   unsigned int service;
};
 
/*
 * tee_msg_recv - default strcutre of TEE service output message
 */
struct tee_msg_recv {
   int duration;
   uint32_t res;
   uint32_t origin;
};
 
/*
 * tee_register_irqfwd_xxx - (un)register callback for interrupt forwarding
 */
struct tee_register_irqfwd_send {
   struct tee_msg_send header;
   struct {
       unsigned long cb;
   } data;
};
struct tee_register_irqfwd_recv {
   struct tee_msg_recv header;
};
 
/*
 * tee_get_l2cc_mutex - input/output argument structures
 */
struct tee_get_l2cc_mutex_send {
   struct tee_msg_send header;
};
struct tee_get_l2cc_mutex_recv {
   struct tee_msg_recv header;
   struct {
       unsigned long paddr;
   } data;
};
 
/**
 * struct tee_identity - Represents the identity of the client
 * @login: Login id
 * @uuid: UUID as defined above
 */
struct tee_identity {
   uint32_t login;
   TEEC_UUID uuid;
};
 
/*
 * tee_open_session_data - input arg structure for TEE open session service
 */
struct tee_open_session_data {
   struct ta_signed_header_t *ta;
   TEEC_UUID uuid;
   uint32_t param_types;
   TEEC_Value params[TEEC_CONFIG_PAYLOAD_REF_COUNT];
   struct tee_identity client_id;
   uint32_t params_flags[TEEC_CONFIG_PAYLOAD_REF_COUNT];
};
 
/*
 * tee_open_session_send - input arg msg for TEE open session service
 */
struct tee_open_session_send {
   struct tee_msg_send header;
   struct tee_open_session_data data;
};
 
/*
 * tee_open_session_recv - output arg structure for TEE open session service
 */
struct tee_open_session_recv {
   struct tee_msg_recv header;
   uint32_t sess;
   TEEC_Value params[TEEC_CONFIG_PAYLOAD_REF_COUNT];
};
 
/*
 * tee_invoke_command_data - input arg structure for TEE invoke cmd service
 */
struct tee_invoke_command_data {
   uint32_t sess;
   uint32_t cmd;
   uint32_t param_types;
   TEEC_Value params[TEEC_CONFIG_PAYLOAD_REF_COUNT];
   uint32_t params_flags[TEEC_CONFIG_PAYLOAD_REF_COUNT];
};
 
struct tee_invoke_command_send {
   struct tee_msg_send header;
   struct tee_invoke_command_data data;
};
 
/*
 * tee_invoke_command_recv - output arg structure for TEE invoke cmd service
 */
struct tee_invoke_command_recv {
   struct tee_msg_recv header;
   TEEC_Value params[TEEC_CONFIG_PAYLOAD_REF_COUNT];
};
 
/*
 * tee_cancel_command_data - input arg structure for TEE cancel service
 */
struct tee_cancel_command_data {
   uint32_t sess;
};
 
/*
 * tee_cancel_command_send - input msg structure for TEE cancel service
 */
struct tee_cancel_command_send {
   struct tee_msg_send header;
   struct tee_cancel_command_data data;
};
 
/*
 * tee_close_session_data - input arg structure for TEE close session service
 */
struct tee_close_session_data {
   uint32_t sess;
};
 
/*
 * tee_close_session_send - input arg msg for TEE close session service
 */
struct tee_close_session_send {
   struct tee_msg_send header;
   struct tee_close_session_data data;
};
 
/*
 * tee_register_rpc_send_data - input arg structure for TEE register rpc service
 */
struct tee_register_rpc_send_data {
   uint32_t fnk;
   uint32_t bf;
   uint32_t nbr_bf;
};
 
/*
 * tee_register_rpc_send - input msg structure for TEE register rpc service
 */
struct tee_register_rpc_send {
   struct tee_msg_send header;
   struct tee_register_rpc_send_data data;
};
 
/*
 * tee_core_status_out - output arg structure for TEE status service
 */
#define TEEC_STATUS_MSG_SIZE 80
 
struct tee_core_status_out {
   struct tee_msg_recv header;
   char raw[TEEC_STATUS_MSG_SIZE];
};
 
#endif /* __TEE_ARMV7_OP_H__ */