1 /**********************************************************************
3 * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful but, except
10 * as otherwise stated in writing, without any warranty; without even the
11 * implied warranty of merchantability or fitness for a particular purpose.
12 * See the GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 * The full GNU General Public License is included in this distribution in
19 * the file called "COPYING".
21 * Contact Information:
22 * Imagination Technologies Ltd. <gpl-support@imgtec.com>
23 * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
25 ******************************************************************************/
27 #if !defined(__SGXINFO_H__)
30 #include "sgxscript.h"
32 #include "servicesint.h"
35 #include "sgxapi_km.h"
37 #define SGX_MP_CORE_SELECT(x, i) (x)
39 #define SGX_MAX_DEV_DATA 24
40 #define SGX_MAX_INIT_MEM_HANDLES 16
42 #define SGX_BIF_DIR_LIST_INDEX_EDM 0
44 struct SGX_BRIDGE_INFO_FOR_SRVINIT {
45 struct IMG_DEV_PHYADDR sPDDevPAddr;
46 struct PVRSRV_HEAP_INFO asHeapInfo[PVRSRV_MAX_CLIENT_HEAPS];
49 struct SGX_BRIDGE_INIT_INFO {
50 void *hKernelCCBMemInfo;
51 void *hKernelCCBCtlMemInfo;
52 void *hKernelCCBEventKickerMemInfo;
53 void *hKernelSGXHostCtlMemInfo;
54 void *hKernelSGXTA3DCtlMemInfo;
55 void *hKernelSGXMiscMemInfo;
56 u32 ui32HostKickAddress;
57 u32 ui32GetMiscInfoAddress;
58 void *hKernelHWPerfCBMemInfo;
59 #if defined(PVRSRV_USSE_EDM_STATUS_DEBUG)
60 void *hKernelEDMStatusBufferMemInfo;
66 u32 ui32ClkGateStatusReg;
67 u32 ui32ClkGateStatusMask;
71 u32 asInitDevData[SGX_MAX_DEV_DATA];
72 void *asInitMemHandles[SGX_MAX_INIT_MEM_HANDLES];
74 struct SGX_INIT_SCRIPTS sScripts;
78 struct SGXMKIF_COMMAND {
79 u32 ui32ServiceAddress;
83 struct PVRSRV_SGX_KERNEL_CCB {
84 struct SGXMKIF_COMMAND asCommands[256];
87 struct PVRSRV_SGX_CCB_CTL {
92 #define SGX_AUXCCBFLAGS_SHARED 0x00000001
94 enum SGXMKIF_COMMAND_TYPE {
95 SGXMKIF_COMMAND_EDM_KICK = 0,
96 SGXMKIF_COMMAND_VIDEO_KICK = 1,
97 SGXMKIF_COMMAND_REQUEST_SGXMISCINFO = 2,
99 SGXMKIF_COMMAND_FORCE_I32 = -1,
103 #define PVRSRV_CCBFLAGS_RASTERCMD 0x1
104 #define PVRSRV_CCBFLAGS_TRANSFERCMD 0x2
105 #define PVRSRV_CCBFLAGS_PROCESS_QUEUESCMD 0x3
106 #define PVRSRV_CCBFLAGS_POWERCMD 0x5
108 #define PVRSRV_POWERCMD_POWEROFF 0x1
109 #define PVRSRV_POWERCMD_IDLE 0x2
111 #define SGX_BIF_INVALIDATE_PTCACHE 0x1
112 #define SGX_BIF_INVALIDATE_PDCACHE 0x2
114 struct SGXMKIF_HWDEVICE_SYNC_LIST {
115 struct IMG_DEV_VIRTADDR sAccessDevAddr;
116 u32 ui32NumSyncObjects;
118 struct PVRSRV_DEVICE_SYNC_OBJECT asSyncData[1];
121 struct SGX_DEVICE_SYNC_LIST {
122 struct SGXMKIF_HWDEVICE_SYNC_LIST *psHWDeviceSyncList;
124 void *hKernelHWSyncListMemInfo;
125 struct PVRSRV_CLIENT_MEM_INFO *psHWDeviceSyncListClientMemInfo;
126 struct PVRSRV_CLIENT_MEM_INFO *psAccessResourceClientMemInfo;
128 volatile u32 *pui32Lock;
130 struct SGX_DEVICE_SYNC_LIST *psNext;
132 u32 ui32NumSyncObjects;
133 void *ahSyncHandles[1];
136 struct SGX_INTERNEL_STATUS_UPDATE {
137 struct CTL_STATUS sCtlStatus;
138 void *hKernelMemInfo;
139 /* pdump specific - required? */
140 u32 ui32LastStatusUpdateDumpVal;
143 struct SGX_CCB_KICK {
144 enum SGXMKIF_COMMAND_TYPE eCommand;
145 struct SGXMKIF_COMMAND sCommand;
146 void *hCCBKernelMemInfo;
148 u32 ui32NumDstSyncObjects;
149 void *hKernelHWSyncListMemInfo;
150 void *sDstSyncHandle;
152 u32 ui32NumTAStatusVals;
153 u32 ui32Num3DStatusVals;
155 void *ahTAStatusSyncInfo[SGX_MAX_TA_STATUS_VALS];
156 void *ah3DStatusSyncInfo[SGX_MAX_3D_STATUS_VALS];
158 IMG_BOOL bFirstKickOrResume;
159 #if (defined(NO_HARDWARE) || defined(PDUMP))
160 IMG_BOOL bTerminateOrAbort;
162 IMG_BOOL bKickRender;
167 void *ahSrcKernelSyncInfo[SGX_MAX_SRC_SYNCS];
169 IMG_BOOL bTADependency;
177 #if defined(NO_HARDWARE)
178 u32 ui32WriteOpsPendingVal;
182 #define SGX_KERNEL_USE_CODE_BASE_INDEX 15
184 struct SGXMKIF_HOST_CTL {
187 u32 ui32uKernelDetectedLockups;
188 u32 ui32HostDetectedLockups;
189 u32 ui32HWRecoverySampleRate;
190 u32 ui32ActivePowManSampleRate;
191 u32 ui32InterruptFlags;
192 u32 ui32InterruptClearFlags;
195 struct IMG_DEV_VIRTADDR sResManCleanupData;
197 u32 ui32NumActivePowerEvents;
201 #if defined(PVRSRV_USSE_EDM_STATUS_DEBUG)
202 /* !< See SGXMK_STATUS_BUFFER */
203 struct IMG_DEV_VIRTADDR sEDMStatusBuffer;
206 /*< to count time wraps in the Timer task */
210 struct SGX_CLIENT_INFO {
213 struct PVRSRV_MISC_INFO sMiscInfo;
215 u32 asDevData[SGX_MAX_DEV_DATA];
219 struct SGX_INTERNAL_DEVINFO {
221 void *hHostCtlKernelMemInfoHandle;
222 IMG_BOOL bForcePTOff;
225 #define SGXTQ_MAX_STATUS (SGX_MAX_TRANSFER_STATUS_VALS + 2)
227 #define SGXMKIF_TQFLAGS_NOSYNCUPDATE 0x00000001
228 #define SGXMKIF_TQFLAGS_KEEPPENDING 0x00000002
229 #define SGXMKIF_TQFLAGS_TATQ_SYNC 0x00000004
230 #define SGXMKIF_TQFLAGS_3DTQ_SYNC 0x00000008
231 struct SGXMKIF_CMDTA_SHARED {
232 u32 ui32NumTAStatusVals;
233 u32 ui32Num3DStatusVals;
235 u32 ui32TATQSyncWriteOpsPendingVal;
236 struct IMG_DEV_VIRTADDR sTATQSyncWriteOpsCompleteDevVAddr;
237 u32 ui32TATQSyncReadOpsPendingVal;
238 struct IMG_DEV_VIRTADDR sTATQSyncReadOpsCompleteDevVAddr;
240 u32 ui323DTQSyncWriteOpsPendingVal;
241 struct IMG_DEV_VIRTADDR s3DTQSyncWriteOpsCompleteDevVAddr;
242 u32 ui323DTQSyncReadOpsPendingVal;
243 struct IMG_DEV_VIRTADDR s3DTQSyncReadOpsCompleteDevVAddr;
246 struct PVRSRV_DEVICE_SYNC_OBJECT asSrcSyncs[SGX_MAX_SRC_SYNCS];
248 struct CTL_STATUS sCtlTAStatusInfo[SGX_MAX_TA_STATUS_VALS];
250 * Note that the actual size of sCtl3DStatusInfo changes based
251 * on the IOCTL ABI version used.
253 struct CTL_STATUS sCtl3DStatusInfo[SGX_MAX_3D_STATUS_VALS];
255 struct PVRSRV_DEVICE_SYNC_OBJECT sTA3DDependency;
259 struct SGXMKIF_TRANSFERCMD_SHARED {
261 u32 ui32SrcReadOpPendingVal;
262 struct IMG_DEV_VIRTADDR sSrcReadOpsCompleteDevAddr;
264 u32 ui32SrcWriteOpPendingVal;
265 struct IMG_DEV_VIRTADDR sSrcWriteOpsCompleteDevAddr;
267 u32 ui32DstReadOpPendingVal;
268 struct IMG_DEV_VIRTADDR sDstReadOpsCompleteDevAddr;
270 u32 ui32DstWriteOpPendingVal;
271 struct IMG_DEV_VIRTADDR sDstWriteOpsCompleteDevAddr;
273 u32 ui32TASyncWriteOpsPendingVal;
274 struct IMG_DEV_VIRTADDR sTASyncWriteOpsCompleteDevVAddr;
275 u32 ui32TASyncReadOpsPendingVal;
276 struct IMG_DEV_VIRTADDR sTASyncReadOpsCompleteDevVAddr;
278 u32 ui323DSyncWriteOpsPendingVal;
279 struct IMG_DEV_VIRTADDR s3DSyncWriteOpsCompleteDevVAddr;
280 u32 ui323DSyncReadOpsPendingVal;
281 struct IMG_DEV_VIRTADDR s3DSyncReadOpsCompleteDevVAddr;
283 u32 ui32NumStatusVals;
284 struct CTL_STATUS sCtlStatusInfo[SGXTQ_MAX_STATUS];
287 struct PVRSRV_TRANSFER_SGX_KICK {
289 u32 ui32SharedCmdCCBOffset;
291 struct IMG_DEV_VIRTADDR sHWTransferContextDevVAddr;
297 void *ahSrcSyncInfo[SGX_MAX_TRANSFER_SYNC_OPS];
300 void *ahDstSyncInfo[SGX_MAX_TRANSFER_SYNC_OPS];
310 #define PVRSRV_SGX_DIFF_NUM_COUNTERS 9
312 struct PVRSRV_SGXDEV_DIFF_INFO {
313 u32 aui32Counters[PVRSRV_SGX_DIFF_NUM_COUNTERS];
318 #define SGXMKIF_HWPERF_CB_SIZE 0x100
320 struct SGXMKIF_HWPERF_CB_ENTRY {
326 u32 ui32Counters[PVRSRV_SGX_HWPERF_NUM_COUNTERS];
329 struct SGXMKIF_HWPERF_CB {
332 u32 ui32OrdinalGRAPHICS;
333 u32 ui32OrdinalMK_EXECUTION;
334 struct SGXMKIF_HWPERF_CB_ENTRY psHWPerfCBData[SGXMKIF_HWPERF_CB_SIZE];
337 struct PVRSRV_SGX_MISCINFO_INFO {
338 u32 ui32MiscInfoFlags;
339 struct PVRSRV_SGX_MISCINFO_FEATURES sSGXFeatures;