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 void *hKernelEDMStatusBufferMemInfo;
64 u32 ui32ClkGateStatusReg;
65 u32 ui32ClkGateStatusMask;
69 u32 asInitDevData[SGX_MAX_DEV_DATA];
70 void *asInitMemHandles[SGX_MAX_INIT_MEM_HANDLES];
72 struct SGX_INIT_SCRIPTS sScripts;
77 struct SGXMKIF_COMMAND {
78 u32 ui32ServiceAddress;
82 struct PVRSRV_SGX_KERNEL_CCB {
83 struct SGXMKIF_COMMAND asCommands[256];
86 struct PVRSRV_SGX_CCB_CTL {
91 #define SGX_AUXCCBFLAGS_SHARED 0x00000001
93 enum SGXMKIF_COMMAND_TYPE {
94 SGXMKIF_COMMAND_EDM_KICK = 0,
95 SGXMKIF_COMMAND_VIDEO_KICK = 1,
96 SGXMKIF_COMMAND_REQUEST_SGXMISCINFO = 2,
98 SGXMKIF_COMMAND_FORCE_I32 = -1,
102 #define PVRSRV_CCBFLAGS_RASTERCMD 0x1
103 #define PVRSRV_CCBFLAGS_TRANSFERCMD 0x2
104 #define PVRSRV_CCBFLAGS_PROCESS_QUEUESCMD 0x3
105 #define PVRSRV_CCBFLAGS_POWERCMD 0x5
107 #define PVRSRV_POWERCMD_POWEROFF 0x1
108 #define PVRSRV_POWERCMD_IDLE 0x2
110 #define SGX_BIF_INVALIDATE_PTCACHE 0x1
111 #define SGX_BIF_INVALIDATE_PDCACHE 0x2
113 struct SGXMKIF_HWDEVICE_SYNC_LIST {
114 struct IMG_DEV_VIRTADDR sAccessDevAddr;
115 u32 ui32NumSyncObjects;
117 struct PVRSRV_DEVICE_SYNC_OBJECT asSyncData[1];
120 struct SGX_DEVICE_SYNC_LIST {
121 struct SGXMKIF_HWDEVICE_SYNC_LIST *psHWDeviceSyncList;
123 void *hKernelHWSyncListMemInfo;
124 struct PVRSRV_CLIENT_MEM_INFO *psHWDeviceSyncListClientMemInfo;
125 struct PVRSRV_CLIENT_MEM_INFO *psAccessResourceClientMemInfo;
127 volatile u32 *pui32Lock;
129 struct SGX_DEVICE_SYNC_LIST *psNext;
131 u32 ui32NumSyncObjects;
132 void *ahSyncHandles[1];
135 struct SGX_INTERNEL_STATUS_UPDATE {
136 struct CTL_STATUS sCtlStatus;
137 void *hKernelMemInfo;
138 /* pdump specific - required? */
139 u32 ui32LastStatusUpdateDumpVal;
142 struct SGX_CCB_KICK {
143 enum SGXMKIF_COMMAND_TYPE eCommand;
144 struct SGXMKIF_COMMAND sCommand;
145 void *hCCBKernelMemInfo;
147 u32 ui32NumDstSyncObjects;
148 void *hKernelHWSyncListMemInfo;
149 void *sDstSyncHandle;
151 u32 ui32NumTAStatusVals;
152 u32 ui32Num3DStatusVals;
154 void *ahTAStatusSyncInfo[SGX_MAX_TA_STATUS_VALS];
155 void *ah3DStatusSyncInfo[SGX_MAX_3D_STATUS_VALS];
157 IMG_BOOL bFirstKickOrResume;
158 #if (defined(NO_HARDWARE) || defined(PDUMP))
159 IMG_BOOL bTerminateOrAbort;
161 IMG_BOOL bKickRender;
166 void *ahSrcKernelSyncInfo[SGX_MAX_SRC_SYNCS];
168 IMG_BOOL bTADependency;
176 #if defined(NO_HARDWARE)
177 u32 ui32WriteOpsPendingVal;
181 #define SGX_KERNEL_USE_CODE_BASE_INDEX 15
183 struct SGXMKIF_HOST_CTL {
186 u32 ui32uKernelDetectedLockups;
187 u32 ui32HostDetectedLockups;
188 u32 ui32HWRecoverySampleRate;
189 u32 ui32ActivePowManSampleRate;
190 u32 ui32InterruptFlags;
191 u32 ui32InterruptClearFlags;
194 struct IMG_DEV_VIRTADDR sResManCleanupData;
196 u32 ui32NumActivePowerEvents;
200 /* !< See SGXMK_STATUS_BUFFER */
201 struct IMG_DEV_VIRTADDR sEDMStatusBuffer;
203 /*< to count time wraps in the Timer task */
206 u32 render_state_buf_ta_handle;
207 u32 render_state_buf_3d_handle;
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];
249 struct CTL_STATUS sCtl3DStatusInfo[SGX_MAX_3D_STATUS_VALS];
251 struct PVRSRV_DEVICE_SYNC_OBJECT sTA3DDependency;
255 struct SGXMKIF_TRANSFERCMD_SHARED {
257 u32 ui32SrcReadOpPendingVal;
258 struct IMG_DEV_VIRTADDR sSrcReadOpsCompleteDevAddr;
260 u32 ui32SrcWriteOpPendingVal;
261 struct IMG_DEV_VIRTADDR sSrcWriteOpsCompleteDevAddr;
263 u32 ui32DstReadOpPendingVal;
264 struct IMG_DEV_VIRTADDR sDstReadOpsCompleteDevAddr;
266 u32 ui32DstWriteOpPendingVal;
267 struct IMG_DEV_VIRTADDR sDstWriteOpsCompleteDevAddr;
269 u32 ui32TASyncWriteOpsPendingVal;
270 struct IMG_DEV_VIRTADDR sTASyncWriteOpsCompleteDevVAddr;
271 u32 ui32TASyncReadOpsPendingVal;
272 struct IMG_DEV_VIRTADDR sTASyncReadOpsCompleteDevVAddr;
274 u32 ui323DSyncWriteOpsPendingVal;
275 struct IMG_DEV_VIRTADDR s3DSyncWriteOpsCompleteDevVAddr;
276 u32 ui323DSyncReadOpsPendingVal;
277 struct IMG_DEV_VIRTADDR s3DSyncReadOpsCompleteDevVAddr;
279 u32 ui32NumStatusVals;
280 struct CTL_STATUS sCtlStatusInfo[SGXTQ_MAX_STATUS];
283 struct PVRSRV_TRANSFER_SGX_KICK {
285 u32 ui32SharedCmdCCBOffset;
287 struct IMG_DEV_VIRTADDR sHWTransferContextDevVAddr;
293 void *ahSrcSyncInfo[SGX_MAX_TRANSFER_SYNC_OPS];
296 void *ahDstSyncInfo[SGX_MAX_TRANSFER_SYNC_OPS];
306 #define PVRSRV_SGX_DIFF_NUM_COUNTERS 9
308 struct PVRSRV_SGXDEV_DIFF_INFO {
309 u32 aui32Counters[PVRSRV_SGX_DIFF_NUM_COUNTERS];
314 #define SGXMKIF_HWPERF_CB_SIZE 0x100
316 struct SGXMKIF_HWPERF_CB_ENTRY {
322 u32 ui32Counters[PVRSRV_SGX_HWPERF_NUM_COUNTERS];
325 struct SGXMKIF_HWPERF_CB {
328 u32 ui32OrdinalGRAPHICS;
329 u32 ui32OrdinalMK_EXECUTION;
330 struct SGXMKIF_HWPERF_CB_ENTRY psHWPerfCBData[SGXMKIF_HWPERF_CB_SIZE];
333 struct PVRSRV_SGX_MISCINFO_INFO {
334 u32 ui32MiscInfoFlags;
335 struct PVRSRV_SGX_MISCINFO_FEATURES sSGXFeatures;