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
|
/**********************************************************************
*
* Copyright(c) 2008 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
*
******************************************************************************/
#ifndef __SGXINFOKM_H__
#define __SGXINFOKM_H__
#include "sgxdefs.h"
#include "device.h"
#include "power.h"
#include "sysconfig.h"
#include "sgxscript.h"
#include "sgxinfo.h"
#if defined (__cplusplus)
extern "C" {
#endif
#define SGX_HOSTPORT_PRESENT 0x00000001UL
#define SGX_PDUMPREG_NAME "SGXREG"
typedef struct _PVRSRV_STUB_PBDESC_ PVRSRV_STUB_PBDESC;
typedef struct _PVRSRV_SGX_CCB_INFO_ *PPVRSRV_SGX_CCB_INFO;
typedef struct _PVRSRV_SGXDEV_INFO_
{
PVRSRV_DEVICE_TYPE eDeviceType;
PVRSRV_DEVICE_CLASS eDeviceClass;
IMG_UINT8 ui8VersionMajor;
IMG_UINT8 ui8VersionMinor;
IMG_UINT32 ui32CoreConfig;
IMG_UINT32 ui32CoreFlags;
IMG_PVOID pvRegsBaseKM;
#if defined(SGX_FEATURE_HOST_PORT)
IMG_PVOID pvHostPortBaseKM;
IMG_UINT32 ui32HPSize;
IMG_SYS_PHYADDR sHPSysPAddr;
#endif
IMG_HANDLE hRegMapping;
IMG_SYS_PHYADDR sRegsPhysBase;
IMG_UINT32 ui32RegSize;
#if defined(SUPPORT_EXTERNAL_SYSTEM_CACHE)
IMG_UINT32 ui32ExtSysCacheRegsSize;
IMG_DEV_PHYADDR sExtSysCacheRegsDevPBase;
IMG_UINT32 *pui32ExtSystemCacheRegsPT;
IMG_HANDLE hExtSystemCacheRegsPTPageOSMemHandle;
IMG_SYS_PHYADDR sExtSystemCacheRegsPTSysPAddr;
#endif
IMG_UINT32 ui32CoreClockSpeed;
IMG_UINT32 ui32uKernelTimerClock;
PVRSRV_STUB_PBDESC *psStubPBDescListKM;
IMG_DEV_PHYADDR sKernelPDDevPAddr;
IMG_VOID *pvDeviceMemoryHeap;
PPVRSRV_KERNEL_MEM_INFO psKernelCCBMemInfo;
PVRSRV_SGX_KERNEL_CCB *psKernelCCB;
PPVRSRV_SGX_CCB_INFO psKernelCCBInfo;
PPVRSRV_KERNEL_MEM_INFO psKernelCCBCtlMemInfo;
PVRSRV_SGX_CCB_CTL *psKernelCCBCtl;
PPVRSRV_KERNEL_MEM_INFO psKernelCCBEventKickerMemInfo;
IMG_UINT32 *pui32KernelCCBEventKicker;
#if defined(PDUMP)
IMG_UINT32 ui32KernelCCBEventKickerDumpVal;
#endif
PVRSRV_KERNEL_MEM_INFO *psKernelSGXMiscMemInfo;
IMG_UINT32 aui32HostKickAddr[SGXMKIF_CMD_MAX];
#if defined(SGX_SUPPORT_HWPROFILING)
PPVRSRV_KERNEL_MEM_INFO psKernelHWProfilingMemInfo;
#endif
PPVRSRV_KERNEL_MEM_INFO psKernelHWPerfCBMemInfo;
PPVRSRV_KERNEL_MEM_INFO psKernelTASigBufferMemInfo;
PPVRSRV_KERNEL_MEM_INFO psKernel3DSigBufferMemInfo;
#if defined(FIX_HW_BRN_29702)
PPVRSRV_KERNEL_MEM_INFO psKernelCFIMemInfo;
#endif
#if defined(FIX_HW_BRN_29823)
PPVRSRV_KERNEL_MEM_INFO psKernelDummyTermStreamMemInfo;
#endif
#if defined(PVRSRV_USSE_EDM_STATUS_DEBUG)
PPVRSRV_KERNEL_MEM_INFO psKernelEDMStatusBufferMemInfo;
#endif
#if defined(SGX_FEATURE_OVERLAPPED_SPM)
PPVRSRV_KERNEL_MEM_INFO psKernelTmpRgnHeaderMemInfo;
#endif
#if defined(SGX_FEATURE_SPM_MODE_0)
PPVRSRV_KERNEL_MEM_INFO psKernelTmpDPMStateMemInfo;
#endif
IMG_UINT32 ui32ClientRefCount;
IMG_UINT32 ui32CacheControl;
IMG_UINT32 ui32ClientBuildOptions;
SGX_MISCINFO_STRUCT_SIZES sSGXStructSizes;
IMG_VOID *pvMMUContextList;
IMG_BOOL bForcePTOff;
IMG_UINT32 ui32EDMTaskReg0;
IMG_UINT32 ui32EDMTaskReg1;
IMG_UINT32 ui32ClkGateStatusReg;
IMG_UINT32 ui32ClkGateStatusMask;
#if defined(SGX_FEATURE_MP)
IMG_UINT32 ui32MasterClkGateStatusReg;
IMG_UINT32 ui32MasterClkGateStatusMask;
IMG_UINT32 ui32MasterClkGateStatus2Reg;
IMG_UINT32 ui32MasterClkGateStatus2Mask;
#endif
SGX_INIT_SCRIPTS sScripts;
IMG_HANDLE hBIFResetPDOSMemHandle;
IMG_DEV_PHYADDR sBIFResetPDDevPAddr;
IMG_DEV_PHYADDR sBIFResetPTDevPAddr;
IMG_DEV_PHYADDR sBIFResetPageDevPAddr;
IMG_UINT32 *pui32BIFResetPD;
IMG_UINT32 *pui32BIFResetPT;
#if defined(FIX_HW_BRN_22997) && defined(FIX_HW_BRN_23030) && defined(SGX_FEATURE_HOST_PORT)
IMG_HANDLE hBRN22997PTPageOSMemHandle;
IMG_HANDLE hBRN22997PDPageOSMemHandle;
IMG_DEV_PHYADDR sBRN22997PTDevPAddr;
IMG_DEV_PHYADDR sBRN22997PDDevPAddr;
IMG_UINT32 *pui32BRN22997PT;
IMG_UINT32 *pui32BRN22997PD;
IMG_SYS_PHYADDR sBRN22997SysPAddr;
#endif
#if defined(SUPPORT_HW_RECOVERY)
IMG_HANDLE hTimer;
IMG_UINT32 ui32TimeStamp;
#endif
IMG_UINT32 ui32NumResets;
PVRSRV_KERNEL_MEM_INFO *psKernelSGXHostCtlMemInfo;
SGXMKIF_HOST_CTL *psSGXHostCtl;
PVRSRV_KERNEL_MEM_INFO *psKernelSGXTA3DCtlMemInfo;
IMG_UINT32 ui32Flags;
IMG_UINT32 ui32MemTilingUsage;
#if defined(PDUMP)
PVRSRV_SGX_PDUMP_CONTEXT sPDContext;
#endif
#if defined(SUPPORT_SGX_MMU_DUMMY_PAGE)
IMG_VOID *pvDummyPTPageCpuVAddr;
IMG_DEV_PHYADDR sDummyPTDevPAddr;
IMG_HANDLE hDummyPTPageOSMemHandle;
IMG_VOID *pvDummyDataPageCpuVAddr;
IMG_DEV_PHYADDR sDummyDataDevPAddr;
IMG_HANDLE hDummyDataPageOSMemHandle;
#endif
#if defined(PDUMP)
PDUMP_MMU_ATTRIB sMMUAttrib;
#endif
IMG_UINT32 asSGXDevData[SGX_MAX_DEV_DATA];
} PVRSRV_SGXDEV_INFO;
typedef struct _SGX_TIMING_INFORMATION_
{
IMG_UINT32 ui32CoreClockSpeed;
IMG_UINT32 ui32HWRecoveryFreq;
IMG_BOOL bEnableActivePM;
IMG_UINT32 ui32ActivePowManLatencyms;
IMG_UINT32 ui32uKernelFreq;
} SGX_TIMING_INFORMATION;
typedef struct _SGX_DEVICE_MAP_
{
IMG_UINT32 ui32Flags;
IMG_SYS_PHYADDR sRegsSysPBase;
IMG_CPU_PHYADDR sRegsCpuPBase;
IMG_CPU_VIRTADDR pvRegsCpuVBase;
IMG_UINT32 ui32RegsSize;
#if defined(SGX_FEATURE_HOST_PORT)
IMG_SYS_PHYADDR sHPSysPBase;
IMG_CPU_PHYADDR sHPCpuPBase;
IMG_UINT32 ui32HPSize;
#endif
IMG_SYS_PHYADDR sLocalMemSysPBase;
IMG_DEV_PHYADDR sLocalMemDevPBase;
IMG_CPU_PHYADDR sLocalMemCpuPBase;
IMG_UINT32 ui32LocalMemSize;
#if defined(SUPPORT_EXTERNAL_SYSTEM_CACHE)
IMG_UINT32 ui32ExtSysCacheRegsSize;
IMG_DEV_PHYADDR sExtSysCacheRegsDevPBase;
#endif
IMG_UINT32 ui32IRQ;
#if !defined(SGX_DYNAMIC_TIMING_INFO)
SGX_TIMING_INFORMATION sTimingInfo;
#endif
#if defined(PDUMP)
IMG_CHAR *pszPDumpDevName;
#endif
} SGX_DEVICE_MAP;
struct _PVRSRV_STUB_PBDESC_
{
IMG_UINT32 ui32RefCount;
IMG_UINT32 ui32TotalPBSize;
PVRSRV_KERNEL_MEM_INFO *psSharedPBDescKernelMemInfo;
PVRSRV_KERNEL_MEM_INFO *psHWPBDescKernelMemInfo;
PVRSRV_KERNEL_MEM_INFO **ppsSubKernelMemInfos;
IMG_UINT32 ui32SubKernelMemInfosCount;
IMG_HANDLE hDevCookie;
PVRSRV_KERNEL_MEM_INFO *psBlockKernelMemInfo;
PVRSRV_KERNEL_MEM_INFO *psHWBlockKernelMemInfo;
PVRSRV_STUB_PBDESC *psNext;
PVRSRV_STUB_PBDESC **ppsThis;
};
typedef struct _PVRSRV_SGX_CCB_INFO_
{
PVRSRV_KERNEL_MEM_INFO *psCCBMemInfo;
PVRSRV_KERNEL_MEM_INFO *psCCBCtlMemInfo;
SGXMKIF_COMMAND *psCommands;
IMG_UINT32 *pui32WriteOffset;
volatile IMG_UINT32 *pui32ReadOffset;
#if defined(PDUMP)
IMG_UINT32 ui32CCBDumpWOff;
#endif
} PVRSRV_SGX_CCB_INFO;
PVRSRV_ERROR SGXRegisterDevice (PVRSRV_DEVICE_NODE *psDeviceNode);
IMG_VOID SGXOSTimer(IMG_VOID *pvData);
IMG_VOID SGXReset(PVRSRV_SGXDEV_INFO *psDevInfo,
IMG_BOOL bHardwareRecovery,
IMG_UINT32 ui32PDUMPFlags);
PVRSRV_ERROR SGXInitialise(PVRSRV_SGXDEV_INFO *psDevInfo,
IMG_BOOL bHardwareRecovery);
PVRSRV_ERROR SGXDeinitialise(IMG_HANDLE hDevCookie);
PVRSRV_ERROR SGXPrePowerState(IMG_HANDLE hDevHandle,
PVRSRV_DEV_POWER_STATE eNewPowerState,
PVRSRV_DEV_POWER_STATE eCurrentPowerState);
PVRSRV_ERROR SGXPostPowerState(IMG_HANDLE hDevHandle,
PVRSRV_DEV_POWER_STATE eNewPowerState,
PVRSRV_DEV_POWER_STATE eCurrentPowerState);
PVRSRV_ERROR SGXPreClockSpeedChange(IMG_HANDLE hDevHandle,
IMG_BOOL bIdleDevice,
PVRSRV_DEV_POWER_STATE eCurrentPowerState);
PVRSRV_ERROR SGXPostClockSpeedChange(IMG_HANDLE hDevHandle,
IMG_BOOL bIdleDevice,
PVRSRV_DEV_POWER_STATE eCurrentPowerState);
IMG_VOID SGXPanic(PVRSRV_SGXDEV_INFO *psDevInfo);
PVRSRV_ERROR SGXDevInitCompatCheck(PVRSRV_DEVICE_NODE *psDeviceNode);
#if defined(SGX_DYNAMIC_TIMING_INFO)
IMG_VOID SysGetSGXTimingInformation(SGX_TIMING_INFORMATION *psSGXTimingInfo);
#endif
#if defined(NO_HARDWARE)
static INLINE IMG_VOID NoHardwareGenerateEvent(PVRSRV_SGXDEV_INFO *psDevInfo,
IMG_UINT32 ui32StatusRegister,
IMG_UINT32 ui32StatusValue,
IMG_UINT32 ui32StatusMask)
{
IMG_UINT32 ui32RegVal;
ui32RegVal = OSReadHWReg(psDevInfo->pvRegsBaseKM, ui32StatusRegister);
ui32RegVal &= ~ui32StatusMask;
ui32RegVal |= (ui32StatusValue & ui32StatusMask);
OSWriteHWReg(psDevInfo->pvRegsBaseKM, ui32StatusRegister, ui32RegVal);
}
#endif
#if defined(__cplusplus)
}
#endif
#endif
|