[android-sdk/device-ti-proprietary-open.git] / jacinto6 / sgx_src / eurasia_km / services4 / srvkm / include / pdump_km.h
1 /*************************************************************************/ /*!
2 @Title pdump functions
3 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
4 @Description Main APIs for pdump functions
5 @License Dual MIT/GPLv2
7 The contents of this file are subject to the MIT license as set out below.
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
19 Alternatively, the contents of this file may be used under the terms of
20 the GNU General Public License Version 2 ("GPL") in which case the provisions
21 of GPL are applicable instead of those above.
23 If you wish to allow use of your version of this file only under the terms of
24 GPL, and not to allow others to use your version of this file under the terms
25 of the MIT license, indicate your decision by deleting the provisions above
26 and replace them with the notice and other provisions required by GPL as set
27 out in the file called "GPL-COPYING" included in this distribution. If you do
28 not delete the provisions above, a recipient may use your version of this file
29 under the terms of either the MIT license or GPL.
31 This License is also included in this distribution in the file called
32 "MIT-COPYING".
34 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
35 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
36 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
37 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
38 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
39 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
40 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41 */ /**************************************************************************/
42 #ifndef _PDUMP_KM_H_
43 #define _PDUMP_KM_H_
46 /*
47 * Include the OS abstraction APIs
48 */
49 #include "pdump_osfunc.h"
51 #if defined(__cplusplus)
52 extern "C" {
53 #endif
55 /*
56 * Pull in pdump flags from services include
57 */
58 #include "pdump.h"
60 #define PDUMP_PD_UNIQUETAG (IMG_HANDLE)0
61 #define PDUMP_PT_UNIQUETAG (IMG_HANDLE)0
63 /*
64 * PDump streams (common to all OSes)
65 */
66 #define PDUMP_STREAM_PARAM2 0
67 #define PDUMP_STREAM_SCRIPT2 1
68 #define PDUMP_STREAM_DRIVERINFO 2
69 #define PDUMP_NUM_STREAMS 3
71 #if defined(PDUMP_DEBUG_OUTFILES)
72 /* counter increments each time debug write is called */
73 extern IMG_UINT32 g_ui32EveryLineCounter;
74 #endif
76 #ifndef PDUMP
77 #define MAKEUNIQUETAG(hMemInfo) (0)
78 #endif
80 #ifdef PDUMP
82 #define MAKEUNIQUETAG(hMemInfo) (((BM_BUF *)(((PVRSRV_KERNEL_MEM_INFO *)(hMemInfo))->sMemBlk.hBuffer))->pMapping)
84 IMG_IMPORT PVRSRV_ERROR PDumpMemPolKM(PVRSRV_KERNEL_MEM_INFO *psMemInfo,
85 IMG_UINT32 ui32Offset,
86 IMG_UINT32 ui32Value,
87 IMG_UINT32 ui32Mask,
88 PDUMP_POLL_OPERATOR eOperator,
89 IMG_UINT32 ui32Flags,
90 IMG_HANDLE hUniqueTag);
92 IMG_IMPORT PVRSRV_ERROR PDumpMemUM(PVRSRV_PER_PROCESS_DATA *psProcData,
93 IMG_PVOID pvAltLinAddr,
94 IMG_PVOID pvLinAddr,
95 PVRSRV_KERNEL_MEM_INFO *psMemInfo,
96 IMG_UINT32 ui32Offset,
97 IMG_UINT32 ui32Bytes,
98 IMG_UINT32 ui32Flags,
99 IMG_HANDLE hUniqueTag);
101 IMG_IMPORT PVRSRV_ERROR PDumpMemKM(IMG_PVOID pvAltLinAddr,
102 PVRSRV_KERNEL_MEM_INFO *psMemInfo,
103 IMG_UINT32 ui32Offset,
104 IMG_UINT32 ui32Bytes,
105 IMG_UINT32 ui32Flags,
106 IMG_HANDLE hUniqueTag);
107 PVRSRV_ERROR PDumpMemPagesKM(PVRSRV_DEVICE_IDENTIFIER *psDevID,
108 IMG_DEV_PHYADDR *pPages,
109 IMG_UINT32 ui32NumPages,
110 IMG_DEV_VIRTADDR sDevAddr,
111 IMG_UINT32 ui32Start,
112 IMG_UINT32 ui32Length,
113 IMG_UINT32 ui32Flags,
114 IMG_HANDLE hUniqueTag);
116 PVRSRV_ERROR PDumpMemPDEntriesKM(PDUMP_MMU_ATTRIB *psMMUAttrib,
117 IMG_HANDLE hOSMemHandle,
118 IMG_CPU_VIRTADDR pvLinAddr,
119 IMG_UINT32 ui32Bytes,
120 IMG_UINT32 ui32Flags,
121 IMG_BOOL bInitialisePages,
122 IMG_HANDLE hUniqueTag1,
123 IMG_HANDLE hUniqueTag2);
125 PVRSRV_ERROR PDumpMemPTEntriesKM(PDUMP_MMU_ATTRIB *psMMUAttrib,
126 IMG_HANDLE hOSMemHandle,
127 IMG_CPU_VIRTADDR pvLinAddr,
128 IMG_UINT32 ui32Bytes,
129 IMG_UINT32 ui32Flags,
130 IMG_BOOL bInitialisePages,
131 IMG_HANDLE hUniqueTag1,
132 IMG_HANDLE hUniqueTag2);
133 IMG_VOID PDumpInitCommon(IMG_VOID);
134 IMG_VOID PDumpDeInitCommon(IMG_VOID);
135 IMG_VOID PDumpInit(IMG_VOID);
136 IMG_VOID PDumpDeInit(IMG_VOID);
137 IMG_BOOL PDumpIsSuspended(IMG_VOID);
138 PVRSRV_ERROR PDumpStartInitPhaseKM(IMG_VOID);
139 PVRSRV_ERROR PDumpStopInitPhaseKM(IMG_VOID);
140 IMG_IMPORT PVRSRV_ERROR PDumpSetFrameKM(IMG_UINT32 ui32Frame);
141 IMG_IMPORT PVRSRV_ERROR PDumpCommentKM(IMG_CHAR *pszComment, IMG_UINT32 ui32Flags);
142 IMG_IMPORT PVRSRV_ERROR PDumpDriverInfoKM(IMG_CHAR *pszString, IMG_UINT32 ui32Flags);
144 PVRSRV_ERROR PDumpRegWithFlagsKM(IMG_CHAR *pszPDumpRegName,
145 IMG_UINT32 ui32RegAddr,
146 IMG_UINT32 ui32RegValue,
147 IMG_UINT32 ui32Flags);
148 PVRSRV_ERROR PDumpRegPolWithFlagsKM(IMG_CHAR *pszPDumpRegName,
149 IMG_UINT32 ui32RegAddr,
150 IMG_UINT32 ui32RegValue,
151 IMG_UINT32 ui32Mask,
152 IMG_UINT32 ui32Flags,
153 PDUMP_POLL_OPERATOR eOperator);
154 PVRSRV_ERROR PDumpRegPolKM(IMG_CHAR *pszPDumpRegName,
155 IMG_UINT32 ui32RegAddr,
156 IMG_UINT32 ui32RegValue,
157 IMG_UINT32 ui32Mask,
158 PDUMP_POLL_OPERATOR eOperator);
160 IMG_IMPORT PVRSRV_ERROR PDumpBitmapKM(PVRSRV_DEVICE_NODE *psDeviceNode,
161 IMG_CHAR *pszFileName,
162 IMG_UINT32 ui32FileOffset,
163 IMG_UINT32 ui32Width,
164 IMG_UINT32 ui32Height,
165 IMG_UINT32 ui32StrideInBytes,
166 IMG_DEV_VIRTADDR sDevBaseAddr,
167 IMG_HANDLE hDevMemContext,
168 IMG_UINT32 ui32Size,
169 PDUMP_PIXEL_FORMAT ePixelFormat,
170 PDUMP_MEM_FORMAT eMemFormat,
171 IMG_UINT32 ui32PDumpFlags);
172 IMG_IMPORT PVRSRV_ERROR PDumpReadRegKM(IMG_CHAR *pszPDumpRegName,
173 IMG_CHAR *pszFileName,
174 IMG_UINT32 ui32FileOffset,
175 IMG_UINT32 ui32Address,
176 IMG_UINT32 ui32Size,
177 IMG_UINT32 ui32PDumpFlags);
179 PVRSRV_ERROR PDumpRegKM(IMG_CHAR* pszPDumpRegName,
180 IMG_UINT32 dwReg,
181 IMG_UINT32 dwData);
183 PVRSRV_ERROR PDumpComment(IMG_CHAR* pszFormat, ...) IMG_FORMAT_PRINTF(1, 2);
184 PVRSRV_ERROR PDumpCommentWithFlags(IMG_UINT32 ui32Flags,
185 IMG_CHAR* pszFormat,
186 ...) IMG_FORMAT_PRINTF(2, 3);
188 PVRSRV_ERROR PDumpPDReg(PDUMP_MMU_ATTRIB *psMMUAttrib,
189 IMG_UINT32 ui32Reg,
190 IMG_UINT32 ui32dwData,
191 IMG_HANDLE hUniqueTag);
192 PVRSRV_ERROR PDumpPDRegWithFlags(PDUMP_MMU_ATTRIB *psMMUAttrib,
193 IMG_UINT32 ui32Reg,
194 IMG_UINT32 ui32Data,
195 IMG_UINT32 ui32Flags,
196 IMG_HANDLE hUniqueTag);
198 IMG_BOOL PDumpIsLastCaptureFrameKM(IMG_VOID);
199 IMG_IMPORT IMG_BOOL PDumpIsCaptureFrameKM(IMG_VOID);
201 IMG_VOID PDumpMallocPagesPhys(PVRSRV_DEVICE_IDENTIFIER *psDevID,
202 IMG_UINT32 ui32DevVAddr,
203 IMG_PUINT32 pui32PhysPages,
204 IMG_UINT32 ui32NumPages,
205 IMG_HANDLE hUniqueTag);
206 PVRSRV_ERROR PDumpSetMMUContext(PVRSRV_DEVICE_TYPE eDeviceType,
207 IMG_CHAR *pszMemSpace,
208 IMG_UINT32 *pui32MMUContextID,
209 IMG_UINT32 ui32MMUType,
210 IMG_HANDLE hUniqueTag1,
211 IMG_HANDLE hOSMemHandle,
212 IMG_VOID *pvPDCPUAddr);
213 PVRSRV_ERROR PDumpClearMMUContext(PVRSRV_DEVICE_TYPE eDeviceType,
214 IMG_CHAR *pszMemSpace,
215 IMG_UINT32 ui32MMUContextID,
216 IMG_UINT32 ui32MMUType);
218 PVRSRV_ERROR PDumpPDDevPAddrKM(PVRSRV_KERNEL_MEM_INFO *psMemInfo,
219 IMG_UINT32 ui32Offset,
220 IMG_DEV_PHYADDR sPDDevPAddr,
221 IMG_HANDLE hUniqueTag1,
222 IMG_HANDLE hUniqueTag2);
224 IMG_BOOL PDumpTestNextFrame(IMG_UINT32 ui32CurrentFrame);
226 PVRSRV_ERROR PDumpSaveMemKM (PVRSRV_DEVICE_IDENTIFIER *psDevId,
227 IMG_CHAR *pszFileName,
228 IMG_UINT32 ui32FileOffset,
229 IMG_DEV_VIRTADDR sDevBaseAddr,
230 IMG_UINT32 ui32Size,
231 IMG_UINT32 ui32DataMaster,
232 IMG_UINT32 ui32PDumpFlags);
234 PVRSRV_ERROR PDumpTASignatureRegisters(PVRSRV_DEVICE_IDENTIFIER *psDevId,
235 IMG_UINT32 ui32DumpFrameNum,
236 IMG_UINT32 ui32TAKickCount,
237 IMG_BOOL bLastFrame,
238 IMG_UINT32 *pui32Registers,
239 IMG_UINT32 ui32NumRegisters);
241 PVRSRV_ERROR PDump3DSignatureRegisters(PVRSRV_DEVICE_IDENTIFIER *psDevId,
242 IMG_UINT32 ui32DumpFrameNum,
243 IMG_BOOL bLastFrame,
244 IMG_UINT32 *pui32Registers,
245 IMG_UINT32 ui32NumRegisters);
247 PVRSRV_ERROR PDumpCounterRegisters(PVRSRV_DEVICE_IDENTIFIER *psDevId,
248 IMG_UINT32 ui32DumpFrameNum,
249 IMG_BOOL bLastFrame,
250 IMG_UINT32 *pui32Registers,
251 IMG_UINT32 ui32NumRegisters);
253 PVRSRV_ERROR PDumpRegRead(IMG_CHAR *pszPDumpRegName,
254 const IMG_UINT32 dwRegOffset,
255 IMG_UINT32 ui32Flags);
257 PVRSRV_ERROR PDumpCycleCountRegRead(PVRSRV_DEVICE_IDENTIFIER *psDevId,
258 const IMG_UINT32 dwRegOffset,
259 IMG_BOOL bLastFrame);
261 PVRSRV_ERROR PDumpIDLWithFlags(IMG_UINT32 ui32Clocks, IMG_UINT32 ui32Flags);
262 PVRSRV_ERROR PDumpIDL(IMG_UINT32 ui32Clocks);
264 PVRSRV_ERROR PDumpMallocPages(PVRSRV_DEVICE_IDENTIFIER *psDevID,
265 IMG_UINT32 ui32DevVAddr,
266 IMG_CPU_VIRTADDR pvLinAddr,
267 IMG_HANDLE hOSMemHandle,
268 IMG_UINT32 ui32NumBytes,
269 IMG_UINT32 ui32PageSize,
270 IMG_BOOL bShared,
271 IMG_HANDLE hUniqueTag);
272 PVRSRV_ERROR PDumpMallocPageTable(PVRSRV_DEVICE_IDENTIFIER *psDevId,
273 IMG_HANDLE hOSMemHandle,
274 IMG_UINT32 ui32Offset,
275 IMG_CPU_VIRTADDR pvLinAddr,
276 IMG_UINT32 ui32NumBytes,
277 IMG_UINT32 ui32Flags,
278 IMG_HANDLE hUniqueTag);
279 PVRSRV_ERROR PDumpFreePages(struct _BM_HEAP_ *psBMHeap,
280 IMG_DEV_VIRTADDR sDevVAddr,
281 IMG_UINT32 ui32NumBytes,
282 IMG_UINT32 ui32PageSize,
283 IMG_HANDLE hUniqueTag,
284 IMG_BOOL bInterleaved,
285 IMG_BOOL bSparse);
286 PVRSRV_ERROR PDumpFreePageTable(PVRSRV_DEVICE_IDENTIFIER *psDevID,
287 IMG_HANDLE hOSMemHandle,
288 IMG_CPU_VIRTADDR pvLinAddr,
289 IMG_UINT32 ui32NumBytes,
290 IMG_UINT32 ui32Flags,
291 IMG_HANDLE hUniqueTag);
293 IMG_IMPORT PVRSRV_ERROR PDumpHWPerfCBKM(PVRSRV_DEVICE_IDENTIFIER *psDevId,
294 IMG_CHAR *pszFileName,
295 IMG_UINT32 ui32FileOffset,
296 IMG_DEV_VIRTADDR sDevBaseAddr,
297 IMG_UINT32 ui32Size,
298 IMG_UINT32 ui32MMUContextID,
299 IMG_UINT32 ui32PDumpFlags);
301 PVRSRV_ERROR PDumpSignatureBuffer(PVRSRV_DEVICE_IDENTIFIER *psDevId,
302 IMG_CHAR *pszFileName,
303 IMG_CHAR *pszBufferType,
304 IMG_UINT32 ui32FileOffset,
305 IMG_DEV_VIRTADDR sDevBaseAddr,
306 IMG_UINT32 ui32Size,
307 IMG_UINT32 ui32MMUContextID,
308 IMG_UINT32 ui32PDumpFlags);
310 PVRSRV_ERROR PDumpCBP(PPVRSRV_KERNEL_MEM_INFO psROffMemInfo,
311 IMG_UINT32 ui32ROffOffset,
312 IMG_UINT32 ui32WPosVal,
313 IMG_UINT32 ui32PacketSize,
314 IMG_UINT32 ui32BufferSize,
315 IMG_UINT32 ui32Flags,
316 IMG_HANDLE hUniqueTag);
318 PVRSRV_ERROR PDumpRegBasedCBP(IMG_CHAR *pszPDumpRegName,
319 IMG_UINT32 ui32RegOffset,
320 IMG_UINT32 ui32WPosVal,
321 IMG_UINT32 ui32PacketSize,
322 IMG_UINT32 ui32BufferSize,
323 IMG_UINT32 ui32Flags);
325 IMG_VOID PDumpVGXMemToFile(IMG_CHAR *pszFileName,
326 IMG_UINT32 ui32FileOffset,
327 PVRSRV_KERNEL_MEM_INFO *psMemInfo,
328 IMG_UINT32 uiAddr,
329 IMG_UINT32 ui32Size,
330 IMG_UINT32 ui32PDumpFlags,
331 IMG_HANDLE hUniqueTag);
333 IMG_VOID PDumpSuspendKM(IMG_VOID);
334 IMG_VOID PDumpResumeKM(IMG_VOID);
336 /* New pdump common functions */
337 PVRSRV_ERROR PDumpStoreMemToFile(PDUMP_MMU_ATTRIB *psMMUAttrib,
338 IMG_CHAR *pszFileName,
339 IMG_UINT32 ui32FileOffset,
340 PVRSRV_KERNEL_MEM_INFO *psMemInfo,
341 IMG_UINT32 uiAddr,
342 IMG_UINT32 ui32Size,
343 IMG_UINT32 ui32PDumpFlags,
344 IMG_HANDLE hUniqueTag);
346 #define PDUMPMEMPOL PDumpMemPolKM
347 #define PDUMPMEM PDumpMemKM
348 #define PDUMPMEMPTENTRIES PDumpMemPTEntriesKM
349 #define PDUMPPDENTRIES PDumpMemPDEntriesKM
350 #define PDUMPMEMUM PDumpMemUM
351 #define PDUMPINIT PDumpInitCommon
352 #define PDUMPDEINIT PDumpDeInitCommon
353 #define PDUMPISLASTFRAME PDumpIsLastCaptureFrameKM
354 #define PDUMPTESTFRAME PDumpIsCaptureFrameKM
355 #define PDUMPTESTNEXTFRAME PDumpTestNextFrame
356 #define PDUMPREGWITHFLAGS PDumpRegWithFlagsKM
357 #define PDUMPREG PDumpRegKM
358 #define PDUMPCOMMENT PDumpComment
359 #define PDUMPCOMMENTWITHFLAGS PDumpCommentWithFlags
360 #define PDUMPREGPOL PDumpRegPolKM
361 #define PDUMPREGPOLWITHFLAGS PDumpRegPolWithFlagsKM
362 #define PDUMPMALLOCPAGES PDumpMallocPages
363 #define PDUMPMALLOCPAGETABLE PDumpMallocPageTable
364 #define PDUMPSETMMUCONTEXT PDumpSetMMUContext
365 #define PDUMPCLEARMMUCONTEXT PDumpClearMMUContext
366 #define PDUMPPDDEVPADDR PDumpPDDevPAddrKM
367 #define PDUMPFREEPAGES PDumpFreePages
368 #define PDUMPFREEPAGETABLE PDumpFreePageTable
369 #define PDUMPPDREG PDumpPDReg
370 #define PDUMPPDREGWITHFLAGS PDumpPDRegWithFlags
371 #define PDUMPCBP PDumpCBP
372 #define PDUMPREGBASEDCBP PDumpRegBasedCBP
373 #define PDUMPMALLOCPAGESPHYS PDumpMallocPagesPhys
374 #define PDUMPENDINITPHASE PDumpStopInitPhaseKM
375 #define PDUMPBITMAPKM PDumpBitmapKM
376 #define PDUMPDRIVERINFO PDumpDriverInfoKM
377 #define PDUMPIDLWITHFLAGS PDumpIDLWithFlags
378 #define PDUMPIDL PDumpIDL
379 #define PDUMPSUSPEND PDumpSuspendKM
380 #define PDUMPRESUME PDumpResumeKM
382 #else
383 #if defined LINUX || defined (__QNXNTO__) || defined GCC_IA32 || defined GCC_ARM
384 #define PDUMPMEMPOL(args...)
385 #define PDUMPMEM(args...)
386 #define PDUMPMEMPTENTRIES(args...)
387 #define PDUMPPDENTRIES(args...)
388 #define PDUMPMEMUM(args...)
389 #define PDUMPINIT(args...)
390 #define PDUMPDEINIT(args...)
391 #define PDUMPISLASTFRAME(args...)
392 #define PDUMPTESTFRAME(args...)
393 #define PDUMPTESTNEXTFRAME(args...)
394 #define PDUMPREGWITHFLAGS(args...)
395 #define PDUMPREG(args...)
396 #define PDUMPCOMMENT(args...)
397 #define PDUMPREGPOL(args...)
398 #define PDUMPREGPOLWITHFLAGS(args...)
399 #define PDUMPMALLOCPAGES(args...)
400 #define PDUMPMALLOCPAGETABLE(args...)
401 #define PDUMPSETMMUCONTEXT(args...)
402 #define PDUMPCLEARMMUCONTEXT(args...)
403 #define PDUMPPDDEVPADDR(args...)
404 #define PDUMPFREEPAGES(args...)
405 #define PDUMPFREEPAGETABLE(args...)
406 #define PDUMPPDREG(args...)
407 #define PDUMPPDREGWITHFLAGS(args...)
408 #define PDUMPSYNC(args...)
409 #define PDUMPCOPYTOMEM(args...)
410 #define PDUMPWRITE(args...)
411 #define PDUMPCBP(args...)
412 #define PDUMPREGBASEDCBP(args...)
413 #define PDUMPCOMMENTWITHFLAGS(args...)
414 #define PDUMPMALLOCPAGESPHYS(args...)
415 #define PDUMPENDINITPHASE(args...)
416 #define PDUMPMSVDXREG(args...)
417 #define PDUMPMSVDXREGWRITE(args...)
418 #define PDUMPMSVDXREGREAD(args...)
419 #define PDUMPMSVDXPOLEQ(args...)
420 #define PDUMPMSVDXPOL(args...)
421 #define PDUMPBITMAPKM(args...)
422 #define PDUMPDRIVERINFO(args...)
423 #define PDUMPIDLWITHFLAGS(args...)
424 #define PDUMPIDL(args...)
425 #define PDUMPSUSPEND(args...)
426 #define PDUMPRESUME(args...)
427 #define PDUMPMSVDXWRITEREF(args...)
428 #else
429 #error Compiler not specified
430 #endif
431 #endif
433 #if defined (__cplusplus)
434 }
435 #endif
437 #endif /* _PDUMP_KM_H_ */
439 /******************************************************************************
440 End of file (pdump_km.h)
441 ******************************************************************************/