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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
|
/**********************************************************************
*
* Copyright (C) Imagination Technologies Ltd. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful but, except
* as otherwise stated in writing, 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.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*
* The full GNU General Public License is included in this distribution in
* the file called "COPYING".
*
* Contact Information:
* Imagination Technologies Ltd. <gpl-support@imgtec.com>
* Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
*
******************************************************************************/
#if !defined (__SGXINFO_H__)
#define __SGXINFO_H__
#include "sgxscript.h"
#include "servicesint.h"
#include "services.h"
#if !defined (SUPPORT_SID_INTERFACE)
#include "sgxapi_km.h"
#endif
#include "sgx_mkif_km.h"
#define SGX_MAX_DEV_DATA 24
#define SGX_MAX_INIT_MEM_HANDLES 18
typedef struct _SGX_BRIDGE_INFO_FOR_SRVINIT
{
IMG_DEV_PHYADDR sPDDevPAddr;
PVRSRV_HEAP_INFO asHeapInfo[PVRSRV_MAX_CLIENT_HEAPS];
} SGX_BRIDGE_INFO_FOR_SRVINIT;
typedef enum _SGXMKIF_CMD_TYPE_
{
SGXMKIF_CMD_TA = 0,
SGXMKIF_CMD_TRANSFER = 1,
SGXMKIF_CMD_2D = 2,
SGXMKIF_CMD_POWER = 3,
SGXMKIF_CMD_CONTEXTSUSPEND = 4,
SGXMKIF_CMD_CLEANUP = 5,
SGXMKIF_CMD_GETMISCINFO = 6,
SGXMKIF_CMD_PROCESS_QUEUES = 7,
SGXMKIF_CMD_DATABREAKPOINT = 8,
SGXMKIF_CMD_SETHWPERFSTATUS = 9,
SGXMKIF_CMD_FLUSHPDCACHE = 10,
SGXMKIF_CMD_MAX = 11,
SGXMKIF_CMD_FORCE_I32 = -1,
} SGXMKIF_CMD_TYPE;
typedef struct _SGX_BRIDGE_INIT_INFO_
{
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID hKernelCCBMemInfo;
IMG_SID hKernelCCBCtlMemInfo;
IMG_SID hKernelCCBEventKickerMemInfo;
IMG_SID hKernelSGXHostCtlMemInfo;
IMG_SID hKernelSGXTA3DCtlMemInfo;
#if defined(FIX_HW_BRN_31272) || defined(FIX_HW_BRN_31780) || defined(FIX_HW_BRN_33920)
IMG_SID hKernelSGXPTLAWriteBackMemInfo;
#endif
IMG_SID hKernelSGXMiscMemInfo;
#else
IMG_HANDLE hKernelCCBMemInfo;
IMG_HANDLE hKernelCCBCtlMemInfo;
IMG_HANDLE hKernelCCBEventKickerMemInfo;
IMG_HANDLE hKernelSGXHostCtlMemInfo;
IMG_HANDLE hKernelSGXTA3DCtlMemInfo;
#if defined(FIX_HW_BRN_31272) || defined(FIX_HW_BRN_31780) || defined(FIX_HW_BRN_33920)
IMG_HANDLE hKernelSGXPTLAWriteBackMemInfo;
#endif
IMG_HANDLE hKernelSGXMiscMemInfo;
#endif
IMG_UINT32 aui32HostKickAddr[SGXMKIF_CMD_MAX];
SGX_INIT_SCRIPTS sScripts;
IMG_UINT32 ui32ClientBuildOptions;
SGX_MISCINFO_STRUCT_SIZES sSGXStructSizes;
#if defined(SGX_SUPPORT_HWPROFILING)
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID hKernelHWProfilingMemInfo;
#else
IMG_HANDLE hKernelHWProfilingMemInfo;
#endif
#endif
#if defined(SUPPORT_SGX_HWPERF)
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID hKernelHWPerfCBMemInfo;
#else
IMG_HANDLE hKernelHWPerfCBMemInfo;
#endif
#endif
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID hKernelTASigBufferMemInfo;
IMG_SID hKernel3DSigBufferMemInfo;
#else
IMG_HANDLE hKernelTASigBufferMemInfo;
IMG_HANDLE hKernel3DSigBufferMemInfo;
#endif
#if defined(FIX_HW_BRN_29702)
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID hKernelCFIMemInfo;
#else
IMG_HANDLE hKernelCFIMemInfo;
#endif
#endif
#if defined(FIX_HW_BRN_29823)
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID hKernelDummyTermStreamMemInfo;
#else
IMG_HANDLE hKernelDummyTermStreamMemInfo;
#endif
#endif
#if defined(FIX_HW_BRN_31542) || defined(FIX_HW_BRN_36513)
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID hKernelClearClipWAVDMStreamMemInfo;
IMG_SID hKernelClearClipWAIndexStreamMemInfo;
IMG_SID hKernelClearClipWAPDSMemInfo;
IMG_SID hKernelClearClipWAUSEMemInfo;
IMG_SID hKernelClearClipWAParamMemInfo;
IMG_SID hKernelClearClipWAPMPTMemInfo;
IMG_SID hKernelClearClipWATPCMemInfo;
IMG_SID hKernelClearClipWAPSGRgnHdrMemInfo;
#else
IMG_HANDLE hKernelClearClipWAVDMStreamMemInfo;
IMG_HANDLE hKernelClearClipWAIndexStreamMemInfo;
IMG_HANDLE hKernelClearClipWAPDSMemInfo;
IMG_HANDLE hKernelClearClipWAUSEMemInfo;
IMG_HANDLE hKernelClearClipWAParamMemInfo;
IMG_HANDLE hKernelClearClipWAPMPTMemInfo;
IMG_HANDLE hKernelClearClipWATPCMemInfo;
IMG_HANDLE hKernelClearClipWAPSGRgnHdrMemInfo;
#endif
#endif
#if defined(SGX_FEATURE_VDM_CONTEXT_SWITCH) && defined(FIX_HW_BRN_31559)
IMG_HANDLE hKernelVDMSnapShotBufferMemInfo;
IMG_HANDLE hKernelVDMCtrlStreamBufferMemInfo;
#endif
#if defined(SGX_FEATURE_VDM_CONTEXT_SWITCH) && \
defined(FIX_HW_BRN_33657) && defined(SUPPORT_SECURE_33657_FIX)
IMG_HANDLE hKernelVDMStateUpdateBufferMemInfo;
#endif
#if defined(PVRSRV_USSE_EDM_STATUS_DEBUG)
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID hKernelEDMStatusBufferMemInfo;
#else
IMG_HANDLE hKernelEDMStatusBufferMemInfo;
#endif
#endif
IMG_UINT32 ui32EDMTaskReg0;
IMG_UINT32 ui32EDMTaskReg1;
IMG_UINT32 ui32ClkGateCtl;
IMG_UINT32 ui32ClkGateCtl2;
IMG_UINT32 ui32ClkGateStatusReg;
IMG_UINT32 ui32ClkGateStatusMask;
#if defined(SGX_FEATURE_MP)
IMG_UINT32 ui32MasterClkGateStatusReg;
IMG_UINT32 ui32MasterClkGateStatusMask;
IMG_UINT32 ui32MasterClkGateStatus2Reg;
IMG_UINT32 ui32MasterClkGateStatus2Mask;
#endif
IMG_UINT32 ui32CacheControl;
IMG_UINT32 asInitDevData[SGX_MAX_DEV_DATA];
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID asInitMemHandles[SGX_MAX_INIT_MEM_HANDLES];
#else
IMG_HANDLE asInitMemHandles[SGX_MAX_INIT_MEM_HANDLES];
#endif
} SGX_BRIDGE_INIT_INFO;
typedef struct _SGX_DEVICE_SYNC_LIST_
{
PSGXMKIF_HWDEVICE_SYNC_LIST psHWDeviceSyncList;
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID hKernelHWSyncListMemInfo;
#else
IMG_HANDLE hKernelHWSyncListMemInfo;
#endif
PVRSRV_CLIENT_MEM_INFO *psHWDeviceSyncListClientMemInfo;
PVRSRV_CLIENT_MEM_INFO *psAccessResourceClientMemInfo;
volatile IMG_UINT32 *pui32Lock;
struct _SGX_DEVICE_SYNC_LIST_ *psNext;
IMG_UINT32 ui32NumSyncObjects;
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID ahSyncHandles[1];
#else
IMG_HANDLE ahSyncHandles[1];
#endif
} SGX_DEVICE_SYNC_LIST, *PSGX_DEVICE_SYNC_LIST;
typedef struct _SGX_INTERNEL_STATUS_UPDATE_
{
CTL_STATUS sCtlStatus;
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID hKernelMemInfo;
#else
IMG_HANDLE hKernelMemInfo;
#endif
} SGX_INTERNEL_STATUS_UPDATE;
typedef struct _SGX_CCB_KICK_
{
SGXMKIF_COMMAND sCommand;
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID hCCBKernelMemInfo;
#else
IMG_HANDLE hCCBKernelMemInfo;
#endif
IMG_UINT32 ui32NumDstSyncObjects;
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID hKernelHWSyncListMemInfo;
#else
IMG_HANDLE hKernelHWSyncListMemInfo;
#endif
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID *pahDstSyncHandles;
#else
IMG_HANDLE *pahDstSyncHandles;
#endif
IMG_UINT32 ui32NumTAStatusVals;
IMG_UINT32 ui32Num3DStatusVals;
#if defined(SUPPORT_SGX_NEW_STATUS_VALS)
SGX_INTERNEL_STATUS_UPDATE asTAStatusUpdate[SGX_MAX_TA_STATUS_VALS];
SGX_INTERNEL_STATUS_UPDATE as3DStatusUpdate[SGX_MAX_3D_STATUS_VALS];
#else
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID ahTAStatusSyncInfo[SGX_MAX_TA_STATUS_VALS];
IMG_SID ah3DStatusSyncInfo[SGX_MAX_3D_STATUS_VALS];
#else
IMG_HANDLE ahTAStatusSyncInfo[SGX_MAX_TA_STATUS_VALS];
IMG_HANDLE ah3DStatusSyncInfo[SGX_MAX_3D_STATUS_VALS];
#endif
#endif
IMG_BOOL bFirstKickOrResume;
#if (defined(NO_HARDWARE) || defined(PDUMP))
IMG_BOOL bTerminateOrAbort;
#endif
IMG_BOOL bLastInScene;
IMG_UINT32 ui32CCBOffset;
#if defined(SUPPORT_SGX_GENERALISED_SYNCOBJECTS)
IMG_UINT32 ui32NumTASrcSyncs;
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID ahTASrcKernelSyncInfo[SGX_MAX_TA_SRC_SYNCS];
#else
IMG_HANDLE ahTASrcKernelSyncInfo[SGX_MAX_TA_SRC_SYNCS];
#endif
IMG_UINT32 ui32NumTADstSyncs;
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID ahTADstKernelSyncInfo[SGX_MAX_TA_DST_SYNCS];
#else
IMG_HANDLE ahTADstKernelSyncInfo[SGX_MAX_TA_DST_SYNCS];
#endif
IMG_UINT32 ui32Num3DSrcSyncs;
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID ah3DSrcKernelSyncInfo[SGX_MAX_3D_SRC_SYNCS];
#else
IMG_HANDLE ah3DSrcKernelSyncInfo[SGX_MAX_3D_SRC_SYNCS];
#endif
#else
IMG_UINT32 ui32NumSrcSyncs;
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID ahSrcKernelSyncInfo[SGX_MAX_SRC_SYNCS_TA];
#else
IMG_HANDLE ahSrcKernelSyncInfo[SGX_MAX_SRC_SYNCS_TA];
#endif
#endif
IMG_BOOL bTADependency;
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID hTA3DSyncInfo;
IMG_SID hTASyncInfo;
IMG_SID h3DSyncInfo;
#else
IMG_HANDLE hTA3DSyncInfo;
IMG_HANDLE hTASyncInfo;
IMG_HANDLE h3DSyncInfo;
#endif
#if defined(PDUMP)
IMG_UINT32 ui32CCBDumpWOff;
#endif
#if defined(NO_HARDWARE)
IMG_UINT32 ui32WriteOpsPendingVal;
#endif
IMG_HANDLE hDevMemContext;
} SGX_CCB_KICK;
#define SGX_KERNEL_USE_CODE_BASE_INDEX 15
typedef struct _SGX_CLIENT_INFO_
{
IMG_UINT32 ui32ProcessID;
IMG_VOID *pvProcess;
PVRSRV_MISC_INFO sMiscInfo;
IMG_UINT32 asDevData[SGX_MAX_DEV_DATA];
} SGX_CLIENT_INFO;
typedef struct _SGX_INTERNAL_DEVINFO_
{
IMG_UINT32 ui32Flags;
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID hHostCtlKernelMemInfoHandle;
#else
IMG_HANDLE hHostCtlKernelMemInfoHandle;
#endif
IMG_BOOL bForcePTOff;
} SGX_INTERNAL_DEVINFO;
typedef struct _SGX_INTERNAL_DEVINFO_KM_
{
IMG_UINT32 ui32Flags;
IMG_HANDLE hHostCtlKernelMemInfoHandle;
IMG_BOOL bForcePTOff;
} SGX_INTERNAL_DEVINFO_KM;
#if defined(TRANSFER_QUEUE)
typedef struct _PVRSRV_TRANSFER_SGX_KICK_
{
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID hCCBMemInfo;
#else
IMG_HANDLE hCCBMemInfo;
#endif
IMG_UINT32 ui32SharedCmdCCBOffset;
IMG_DEV_VIRTADDR sHWTransferContextDevVAddr;
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID hTASyncInfo;
IMG_SID h3DSyncInfo;
#else
IMG_HANDLE hTASyncInfo;
IMG_HANDLE h3DSyncInfo;
#endif
IMG_UINT32 ui32NumSrcSync;
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID ahSrcSyncInfo[SGX_MAX_TRANSFER_SYNC_OPS];
#else
IMG_HANDLE ahSrcSyncInfo[SGX_MAX_TRANSFER_SYNC_OPS];
#endif
IMG_UINT32 ui32NumDstSync;
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID ahDstSyncInfo[SGX_MAX_TRANSFER_SYNC_OPS];
#else
IMG_HANDLE ahDstSyncInfo[SGX_MAX_TRANSFER_SYNC_OPS];
#endif
IMG_UINT32 ui32Flags;
IMG_UINT32 ui32PDumpFlags;
#if defined(PDUMP)
IMG_UINT32 ui32CCBDumpWOff;
#endif
IMG_HANDLE hDevMemContext;
} PVRSRV_TRANSFER_SGX_KICK, *PPVRSRV_TRANSFER_SGX_KICK;
#if defined(SGX_FEATURE_2D_HARDWARE)
typedef struct _PVRSRV_2D_SGX_KICK_
{
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID hCCBMemInfo;
#else
IMG_HANDLE hCCBMemInfo;
#endif
IMG_UINT32 ui32SharedCmdCCBOffset;
IMG_DEV_VIRTADDR sHW2DContextDevVAddr;
IMG_UINT32 ui32NumSrcSync;
#if defined (SUPPORT_SID_INTERFACE)
IMG_SID ahSrcSyncInfo[SGX_MAX_2D_SRC_SYNC_OPS];
IMG_SID hDstSyncInfo;
IMG_SID hTASyncInfo;
IMG_SID h3DSyncInfo;
#else
IMG_HANDLE ahSrcSyncInfo[SGX_MAX_2D_SRC_SYNC_OPS];
IMG_HANDLE hDstSyncInfo;
IMG_HANDLE hTASyncInfo;
IMG_HANDLE h3DSyncInfo;
#endif
IMG_UINT32 ui32PDumpFlags;
#if defined(PDUMP)
IMG_UINT32 ui32CCBDumpWOff;
#endif
IMG_HANDLE hDevMemContext;
} PVRSRV_2D_SGX_KICK, *PPVRSRV_2D_SGX_KICK;
#endif
#endif
#endif
|