bb8776a8ec7be4cb71e8178c9dcc0df618179713
[android-sdk/device-ti-proprietary-open.git] / jacinto6 / sgx_src / eurasia_km / include4 / sgxapi_km.h
1 /*************************************************************************/ /*!
2 @Title          SGX KM API Header
3 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
4 @Description    Exported SGX API details
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 */ /**************************************************************************/
43 #ifndef __SGXAPI_KM_H__
44 #define __SGXAPI_KM_H__
46 #if defined (__cplusplus)
47 extern "C" {
48 #endif
50 #include "sgxdefs.h"
52 #if (defined(__linux__) || defined(__QNXNTO__)) && !defined(USE_CODE)
53         #if defined(__KERNEL__)
54                 #include <asm/unistd.h>
55         #else
56                 #include <unistd.h>
57         #endif
58 #endif
60 /******************************************************************************
61  Some defines...
62 ******************************************************************************/
64 /* SGX Heap IDs, note: not all heaps are available to clients */
65 #define SGX_UNDEFINED_HEAP_ID                                   (~0LU)
66 #define SGX_GENERAL_HEAP_ID                                             0
67 #define SGX_TADATA_HEAP_ID                                              1
68 #define SGX_KERNEL_CODE_HEAP_ID                                 2
69 #define SGX_KERNEL_DATA_HEAP_ID                                 3
70 #define SGX_PIXELSHADER_HEAP_ID                                 4
71 #define SGX_VERTEXSHADER_HEAP_ID                                5
72 #define SGX_PDSPIXEL_CODEDATA_HEAP_ID                   6
73 #define SGX_PDSVERTEX_CODEDATA_HEAP_ID                  7
74 #define SGX_SYNCINFO_HEAP_ID                                    8
75 #define SGX_SHARED_3DPARAMETERS_HEAP_ID                         9
76 #define SGX_PERCONTEXT_3DPARAMETERS_HEAP_ID                     10
77 #if defined(SUPPORT_SGX_GENERAL_MAPPING_HEAP)
78 #define SGX_GENERAL_MAPPING_HEAP_ID                             11
79 #endif
80 #if defined(SGX_FEATURE_2D_HARDWARE)
81 #define SGX_2D_HEAP_ID                                                  12
82 #endif
83 #if defined(SUPPORT_MEMORY_TILING)
84 #define SGX_VPB_TILED_HEAP_ID                   14
85 #endif
86 #if defined(SUPPORT_ION)
87 #define SGX_ION_HEAP_ID                                                 15
88 #endif
90 #define SGX_MAX_HEAP_ID                                                 16
92 /*
93  * Keep SGX_3DPARAMETERS_HEAP_ID as TQ full custom
94  * shaders need it to select which heap to write
95  * their ISP controll stream to.
96  */
97 #if (defined(SUPPORT_PERCONTEXT_PB) || defined(SUPPORT_HYBRID_PB))
98 #define SGX_3DPARAMETERS_HEAP_ID                        SGX_PERCONTEXT_3DPARAMETERS_HEAP_ID     
99 #else
100 #define SGX_3DPARAMETERS_HEAP_ID                        SGX_SHARED_3DPARAMETERS_HEAP_ID
101 #endif
102 /* Define for number of bytes between consecutive code base registers */
103 #if defined(SGX543) || defined(SGX544) || defined(SGX554)
104 #define SGX_USE_CODE_SEGMENT_RANGE_BITS         23
105 #else
106 #define SGX_USE_CODE_SEGMENT_RANGE_BITS         19
107 #endif
109 #define SGX_MAX_TA_STATUS_VALS  32
110 #define SGX_MAX_3D_STATUS_VALS  4
112 #if defined(SUPPORT_SGX_GENERALISED_SYNCOBJECTS)
113 /* sync info structure array size */
114 #define SGX_MAX_TA_DST_SYNCS                    1
115 #define SGX_MAX_TA_SRC_SYNCS                    1
116 #define SGX_MAX_3D_SRC_SYNCS                    4
117 /* note: there is implicitly 1 3D Dst Sync */
118 #else
119 /* sync info structure array size */
120 #define SGX_MAX_SRC_SYNCS_TA                            32
121 #define SGX_MAX_DST_SYNCS_TA                            1
122 /* note: there is implicitly 1 3D Dst Sync */
123 #define SGX_MAX_SRC_SYNCS_TQ                            8
124 #define SGX_MAX_DST_SYNCS_TQ                            1
125 #endif
128 #if defined(SGX_FEATURE_EXTENDED_PERF_COUNTERS)
129 #define PVRSRV_SGX_HWPERF_NUM_COUNTERS  8
130 #define PVRSRV_SGX_HWPERF_NUM_MISC_COUNTERS 11
131 #else
132 #define PVRSRV_SGX_HWPERF_NUM_COUNTERS  9
133 #define PVRSRV_SGX_HWPERF_NUM_MISC_COUNTERS 8
134 #endif /* SGX543 */
136 #define PVRSRV_SGX_HWPERF_INVALID                                       0x1
138 #define PVRSRV_SGX_HWPERF_TRANSFER                                      0x2
139 #define PVRSRV_SGX_HWPERF_TA                                            0x3
140 #define PVRSRV_SGX_HWPERF_3D                                            0x4
141 #define PVRSRV_SGX_HWPERF_2D                                            0x5
142 #define PVRSRV_SGX_HWPERF_POWER                                         0x6
143 #define PVRSRV_SGX_HWPERF_PERIODIC                                      0x7
144 #define PVRSRV_SGX_HWPERF_3DSPM                                         0x8
146 #define PVRSRV_SGX_HWPERF_MK_EVENT                                      0x101
147 #define PVRSRV_SGX_HWPERF_MK_TA                                         0x102
148 #define PVRSRV_SGX_HWPERF_MK_3D                                         0x103
149 #define PVRSRV_SGX_HWPERF_MK_2D                                         0x104
150 #define PVRSRV_SGX_HWPERF_MK_TRANSFER_DUMMY                             0x105
151 #define PVRSRV_SGX_HWPERF_MK_TA_DUMMY                                   0x106
152 #define PVRSRV_SGX_HWPERF_MK_3D_DUMMY                                   0x107
153 #define PVRSRV_SGX_HWPERF_MK_2D_DUMMY                                   0x108
154 #define PVRSRV_SGX_HWPERF_MK_TA_LOCKUP                                  0x109
155 #define PVRSRV_SGX_HWPERF_MK_3D_LOCKUP                                  0x10A
156 #define PVRSRV_SGX_HWPERF_MK_2D_LOCKUP                                  0x10B
158 #define PVRSRV_SGX_HWPERF_TYPE_STARTEND_BIT                     28
159 #define PVRSRV_SGX_HWPERF_TYPE_OP_MASK                          ((1UL << PVRSRV_SGX_HWPERF_TYPE_STARTEND_BIT) - 1)
160 #define PVRSRV_SGX_HWPERF_TYPE_OP_START                         (0UL << PVRSRV_SGX_HWPERF_TYPE_STARTEND_BIT)
161 #define PVRSRV_SGX_HWPERF_TYPE_OP_END                           (1Ul << PVRSRV_SGX_HWPERF_TYPE_STARTEND_BIT)
163 #define PVRSRV_SGX_HWPERF_TYPE_TRANSFER_START           (PVRSRV_SGX_HWPERF_TRANSFER | PVRSRV_SGX_HWPERF_TYPE_OP_START)
164 #define PVRSRV_SGX_HWPERF_TYPE_TRANSFER_END                     (PVRSRV_SGX_HWPERF_TRANSFER | PVRSRV_SGX_HWPERF_TYPE_OP_END)
165 #define PVRSRV_SGX_HWPERF_TYPE_TA_START                         (PVRSRV_SGX_HWPERF_TA | PVRSRV_SGX_HWPERF_TYPE_OP_START)
166 #define PVRSRV_SGX_HWPERF_TYPE_TA_END                           (PVRSRV_SGX_HWPERF_TA | PVRSRV_SGX_HWPERF_TYPE_OP_END)
167 #define PVRSRV_SGX_HWPERF_TYPE_3D_START                         (PVRSRV_SGX_HWPERF_3D | PVRSRV_SGX_HWPERF_TYPE_OP_START)
168 #define PVRSRV_SGX_HWPERF_TYPE_3D_END                           (PVRSRV_SGX_HWPERF_3D | PVRSRV_SGX_HWPERF_TYPE_OP_END)
169 #define PVRSRV_SGX_HWPERF_TYPE_2D_START                         (PVRSRV_SGX_HWPERF_2D | PVRSRV_SGX_HWPERF_TYPE_OP_START)
170 #define PVRSRV_SGX_HWPERF_TYPE_2D_END                           (PVRSRV_SGX_HWPERF_2D | PVRSRV_SGX_HWPERF_TYPE_OP_END)
171 #define PVRSRV_SGX_HWPERF_TYPE_POWER_START                      (PVRSRV_SGX_HWPERF_POWER | PVRSRV_SGX_HWPERF_TYPE_OP_START)
172 #define PVRSRV_SGX_HWPERF_TYPE_POWER_END                        (PVRSRV_SGX_HWPERF_POWER | PVRSRV_SGX_HWPERF_TYPE_OP_END)
173 #define PVRSRV_SGX_HWPERF_TYPE_PERIODIC                         (PVRSRV_SGX_HWPERF_PERIODIC)
174 #define PVRSRV_SGX_HWPERF_TYPE_3DSPM_START                      (PVRSRV_SGX_HWPERF_3DSPM | PVRSRV_SGX_HWPERF_TYPE_OP_START)
175 #define PVRSRV_SGX_HWPERF_TYPE_3DSPM_END                        (PVRSRV_SGX_HWPERF_3DSPM | PVRSRV_SGX_HWPERF_TYPE_OP_END)
176 #define PVRSRV_SGX_HWPERF_TYPE_MK_TRANSFER_DUMMY_START          (PVRSRV_SGX_HWPERF_MK_TRANSFER_DUMMY | PVRSRV_SGX_HWPERF_TYPE_OP_START)
177 #define PVRSRV_SGX_HWPERF_TYPE_MK_TRANSFER_DUMMY_END            (PVRSRV_SGX_HWPERF_MK_TRANSFER_DUMMY | PVRSRV_SGX_HWPERF_TYPE_OP_END)
178 #define PVRSRV_SGX_HWPERF_TYPE_MK_TA_DUMMY_START                (PVRSRV_SGX_HWPERF_MK_TA_DUMMY | PVRSRV_SGX_HWPERF_TYPE_OP_START)
179 #define PVRSRV_SGX_HWPERF_TYPE_MK_TA_DUMMY_END                  (PVRSRV_SGX_HWPERF_MK_TA_DUMMY | PVRSRV_SGX_HWPERF_TYPE_OP_END)
180 #define PVRSRV_SGX_HWPERF_TYPE_MK_3D_DUMMY_START                (PVRSRV_SGX_HWPERF_MK_3D_DUMMY | PVRSRV_SGX_HWPERF_TYPE_OP_START)
181 #define PVRSRV_SGX_HWPERF_TYPE_MK_3D_DUMMY_END                  (PVRSRV_SGX_HWPERF_MK_3D_DUMMY | PVRSRV_SGX_HWPERF_TYPE_OP_END)
182 #define PVRSRV_SGX_HWPERF_TYPE_MK_2D_DUMMY_START                (PVRSRV_SGX_HWPERF_MK_2D_DUMMY | PVRSRV_SGX_HWPERF_TYPE_OP_START)
183 #define PVRSRV_SGX_HWPERF_TYPE_MK_2D_DUMMY_END                  (PVRSRV_SGX_HWPERF_MK_2D_DUMMY | PVRSRV_SGX_HWPERF_TYPE_OP_END)
184 #define PVRSRV_SGX_HWPERF_TYPE_MK_TA_LOCKUP                     (PVRSRV_SGX_HWPERF_MK_TA_LOCKUP)
185 #define PVRSRV_SGX_HWPERF_TYPE_MK_3D_LOCKUP                     (PVRSRV_SGX_HWPERF_MK_3D_LOCKUP)
186 #define PVRSRV_SGX_HWPERF_TYPE_MK_2D_LOCKUP                     (PVRSRV_SGX_HWPERF_MK_2D_LOCKUP)
188 #define PVRSRV_SGX_HWPERF_TYPE_MK_EVENT_START           (PVRSRV_SGX_HWPERF_MK_EVENT | PVRSRV_SGX_HWPERF_TYPE_OP_START)
189 #define PVRSRV_SGX_HWPERF_TYPE_MK_EVENT_END                     (PVRSRV_SGX_HWPERF_MK_EVENT | PVRSRV_SGX_HWPERF_TYPE_OP_END)
190 #define PVRSRV_SGX_HWPERF_TYPE_MK_TA_START                      (PVRSRV_SGX_HWPERF_MK_TA | PVRSRV_SGX_HWPERF_TYPE_OP_START)
191 #define PVRSRV_SGX_HWPERF_TYPE_MK_TA_END                        (PVRSRV_SGX_HWPERF_MK_TA | PVRSRV_SGX_HWPERF_TYPE_OP_END)
192 #define PVRSRV_SGX_HWPERF_TYPE_MK_3D_START                      (PVRSRV_SGX_HWPERF_MK_3D | PVRSRV_SGX_HWPERF_TYPE_OP_START)
193 #define PVRSRV_SGX_HWPERF_TYPE_MK_3D_END                        (PVRSRV_SGX_HWPERF_MK_3D | PVRSRV_SGX_HWPERF_TYPE_OP_END)
194 #define PVRSRV_SGX_HWPERF_TYPE_MK_2D_START                      (PVRSRV_SGX_HWPERF_MK_2D | PVRSRV_SGX_HWPERF_TYPE_OP_START)
195 #define PVRSRV_SGX_HWPERF_TYPE_MK_2D_END                        (PVRSRV_SGX_HWPERF_MK_2D | PVRSRV_SGX_HWPERF_TYPE_OP_END)
197 #define PVRSRV_SGX_HWPERF_STATUS_OFF                            (0x0)
198 #define PVRSRV_SGX_HWPERF_STATUS_RESET_COUNTERS         (1UL << 0)
199 #define PVRSRV_SGX_HWPERF_STATUS_GRAPHICS_ON            (1UL << 1)
200 #define PVRSRV_SGX_HWPERF_STATUS_PERIODIC_ON            (1UL << 2)
201 #define PVRSRV_SGX_HWPERF_STATUS_MK_EXECUTION_ON        (1UL << 3)
204 /*!
205  *****************************************************************************
206  * One entry in the HWPerf Circular Buffer. 
207  *****************************************************************************/
208 typedef struct _PVRSRV_SGX_HWPERF_CB_ENTRY_
210         IMG_UINT32      ui32FrameNo;
211         IMG_UINT32      ui32PID;
212         IMG_UINT32      ui32RTData;
213         IMG_UINT32      ui32Type;
214         IMG_UINT32      ui32Ordinal;
215         IMG_UINT32      ui32Info;
216         IMG_UINT32      ui32Clocksx16;
217         /* NOTE: There should always be at least as many 3D cores as TA cores. */       
218         IMG_UINT32      ui32Counters[SGX_FEATURE_MP_CORE_COUNT_3D][PVRSRV_SGX_HWPERF_NUM_COUNTERS];
219         IMG_UINT32      ui32MiscCounters[SGX_FEATURE_MP_CORE_COUNT_3D][PVRSRV_SGX_HWPERF_NUM_MISC_COUNTERS];
220 } PVRSRV_SGX_HWPERF_CB_ENTRY;
223 /*
224         Status values control structure
225 */
226 typedef struct _CTL_STATUS_
228         IMG_DEV_VIRTADDR        sStatusDevAddr;
229         IMG_UINT32                      ui32StatusValue;
230 } CTL_STATUS;
233 /*!
234         List of possible requests/commands to SGXGetMiscInfo()
235 */
236 typedef enum _SGX_MISC_INFO_REQUEST_
238         SGX_MISC_INFO_REQUEST_CLOCKSPEED = 0,
239         SGX_MISC_INFO_REQUEST_SGXREV,
240         SGX_MISC_INFO_REQUEST_DRIVER_SGXREV,
241 #if defined(SUPPORT_SGX_EDM_MEMORY_DEBUG)
242         SGX_MISC_INFO_REQUEST_MEMREAD,
243         SGX_MISC_INFO_REQUEST_MEMCOPY,
244 #endif /* SUPPORT_SGX_EDM_MEMORY_DEBUG */
245         SGX_MISC_INFO_REQUEST_SET_HWPERF_STATUS,
246 #if defined(SGX_FEATURE_DATA_BREAKPOINTS)
247         SGX_MISC_INFO_REQUEST_SET_BREAKPOINT,
248         SGX_MISC_INFO_REQUEST_POLL_BREAKPOINT,
249         SGX_MISC_INFO_REQUEST_RESUME_BREAKPOINT,
250 #endif /* SGX_FEATURE_DATA_BREAKPOINTS */
251         SGX_MISC_INFO_DUMP_DEBUG_INFO,
252         SGX_MISC_INFO_DUMP_DEBUG_INFO_FORCE_REGS,
253         SGX_MISC_INFO_PANIC,
254         SGX_MISC_INFO_REQUEST_SPM,
255         SGX_MISC_INFO_REQUEST_ACTIVEPOWER,
256         SGX_MISC_INFO_REQUEST_LOCKUPS,
257         SGX_MISC_INFO_REQUEST_FORCE_I16                                 =  0x7fff
258 } SGX_MISC_INFO_REQUEST;
261 /******************************************************************************
262  * Struct for passing SGX core rev/features from ukernel to driver.
263  * This is accessed from the kernel part of the driver and microkernel; it is
264  * only accessed in user space during buffer allocation in srvinit.
265  ******************************************************************************/
266 typedef struct _PVRSRV_SGX_MISCINFO_FEATURES
268         IMG_UINT32                      ui32CoreRev;    /*!< SGX Core revision from HW register */
269         IMG_UINT32                      ui32CoreID;             /*!< SGX Core ID from HW register */
270         IMG_UINT32                      ui32DDKVersion; /*!< software DDK version */
271         IMG_UINT32                      ui32DDKBuild;   /*!< software DDK build no. */
272         IMG_UINT32                      ui32CoreIdSW;   /*!< software core version (ID), e.g. SGX535, SGX540 */
273         IMG_UINT32                      ui32CoreRevSW;  /*!< software core revision */
274         IMG_UINT32                      ui32BuildOptions;       /*!< build options bit-field */
275 #if defined(SUPPORT_SGX_EDM_MEMORY_DEBUG)
276         IMG_UINT32                      ui32DeviceMemValue;             /*!< device mem value read from ukernel */
277 #endif
278 #if defined(PVRSRV_USSE_EDM_STATUS_DEBUG)
279         IMG_DEV_VIRTADDR        sDevVAEDMStatusBuffer;  /*!< DevVAddr of the EDM status buffer */
280         IMG_PVOID                       pvEDMStatusBuffer;              /*!< CPUVAddr of the EDM status buffer */
281 #endif
282 } PVRSRV_SGX_MISCINFO_FEATURES;
285 /******************************************************************************
286  * Struct for getting lock-up stats from the kernel driver
287  ******************************************************************************/
288 typedef struct _PVRSRV_SGX_MISCINFO_LOCKUPS
290         IMG_UINT32                      ui32HostDetectedLockups; /*!< Host timer detected lockups */
291         IMG_UINT32                      ui32uKernelDetectedLockups; /*!< Microkernel detected lockups */
292 } PVRSRV_SGX_MISCINFO_LOCKUPS;
295 /******************************************************************************
296  * Struct for getting lock-up stats from the kernel driver
297  ******************************************************************************/
298 typedef struct _PVRSRV_SGX_MISCINFO_ACTIVEPOWER
300         IMG_UINT32                      ui32NumActivePowerEvents; /*!< active power events */
301 } PVRSRV_SGX_MISCINFO_ACTIVEPOWER;
304 /******************************************************************************
305  * Struct for getting SPM stats fro the kernel driver
306  ******************************************************************************/
307 typedef struct _PVRSRV_SGX_MISCINFO_SPM
309         IMG_HANDLE                      hRTDataSet;                             /*!< render target data set handle returned from SGXAddRenderTarget */
310         IMG_UINT32                      ui32NumOutOfMemSignals; /*!< Number of Out of Mem Signals */
311         IMG_UINT32                      ui32NumSPMRenders;      /*!< Number of SPM renders */
312 } PVRSRV_SGX_MISCINFO_SPM;
315 #if defined(SGX_FEATURE_DATA_BREAKPOINTS)
316 /*!
317  ******************************************************************************
318  * Structure for SGX break points control
319  *****************************************************************************/
320 typedef struct _SGX_BREAKPOINT_INFO
322         /* set/clear BP boolean */
323         IMG_BOOL                                        bBPEnable;
324         /* Index of BP to set */
325         IMG_UINT32                                      ui32BPIndex;
326         /* On which DataMaster(s) should the breakpoint fire? */
327         IMG_UINT32                  ui32DataMasterMask;
328         /* DevVAddr of BP to set */
329         IMG_DEV_VIRTADDR                        sBPDevVAddr, sBPDevVAddrEnd;
330         /* Whether or not the desired breakpoint will be trapped */
331         IMG_BOOL                    bTrapped;
332         /* Will the requested breakpoint fire for reads? */
333         IMG_BOOL                    bRead;
334         /* Will the requested breakpoint fire for writes? */
335         IMG_BOOL                    bWrite;
336         /* Has a breakpoint been trapped? */
337         IMG_BOOL                    bTrappedBP;
338         /* Extra information recorded about a trapped breakpoint */
339         IMG_UINT32                  ui32CoreNum;
340         IMG_DEV_VIRTADDR            sTrappedBPDevVAddr;
341         IMG_UINT32                  ui32TrappedBPBurstLength;
342         IMG_BOOL                    bTrappedBPRead;
343         IMG_UINT32                  ui32TrappedBPDataMaster;
344         IMG_UINT32                  ui32TrappedBPTag;
345 } SGX_BREAKPOINT_INFO;
346 #endif /* SGX_FEATURE_DATA_BREAKPOINTS */
349 /*!
350  ******************************************************************************
351  * Structure for setting the hardware performance status
352  *****************************************************************************/
353 typedef struct _PVRSRV_SGX_MISCINFO_SET_HWPERF_STATUS
355         /* See PVRSRV_SGX_HWPERF_STATUS_* */
356         IMG_UINT32      ui32NewHWPerfStatus;
357         
358         #if defined(SGX_FEATURE_EXTENDED_PERF_COUNTERS)
359         /* Specifies the HW's active group selectors */
360         IMG_UINT32      aui32PerfGroup[PVRSRV_SGX_HWPERF_NUM_COUNTERS];
361         /* Specifies the HW's active bit selectors */
362         IMG_UINT32      aui32PerfBit[PVRSRV_SGX_HWPERF_NUM_COUNTERS];
363         /* Specifies the HW's counter bit selectors */
364         IMG_UINT32      ui32PerfCounterBitSelect;
365         /* Specifies the HW's sum_mux selectors */
366         IMG_UINT32      ui32PerfSumMux;
367         #else
368         /* Specifies the HW's active group */
369         IMG_UINT32      ui32PerfGroup;
370         #endif /* SGX_FEATURE_EXTENDED_PERF_COUNTERS */
371 } PVRSRV_SGX_MISCINFO_SET_HWPERF_STATUS;
374 /*!
375  ******************************************************************************
376  * Structure for misc SGX commands in services
377  *****************************************************************************/
378 typedef struct _SGX_MISC_INFO_
380         SGX_MISC_INFO_REQUEST   eRequest;       /*!< Command request to SGXGetMiscInfo() */
381         IMG_UINT32                              ui32Padding;
382 #if defined(SUPPORT_SGX_EDM_MEMORY_DEBUG)
383         IMG_DEV_VIRTADDR                        sDevVAddrSrc;           /*!< dev virtual addr for mem read */
384         IMG_DEV_VIRTADDR                        sDevVAddrDest;          /*!< dev virtual addr for mem write */
385         IMG_HANDLE                                      hDevMemContext;         /*!< device memory context for mem debug */
386 #endif
387         union
388         {
389                 IMG_UINT32      reserved;       /*!< Unused: ensures valid code in the case everything else is compiled out */
390                 PVRSRV_SGX_MISCINFO_FEATURES                                            sSGXFeatures;
391                 IMG_UINT32                                                                                      ui32SGXClockSpeed;
392                 PVRSRV_SGX_MISCINFO_ACTIVEPOWER                                         sActivePower;
393                 PVRSRV_SGX_MISCINFO_LOCKUPS                                                     sLockups;
394                 PVRSRV_SGX_MISCINFO_SPM                                                         sSPM;
395 #if defined(SGX_FEATURE_DATA_BREAKPOINTS)
396                 SGX_BREAKPOINT_INFO                                                                     sSGXBreakpointInfo;
397 #endif
398                 PVRSRV_SGX_MISCINFO_SET_HWPERF_STATUS                           sSetHWPerfStatus;
399         } uData;
400 } SGX_MISC_INFO;
402 #if defined(SGX_FEATURE_2D_HARDWARE)
403 /*
404  * The largest number of source sync objects that can be associated with a blit
405  * command.  Allows for src, pattern, and mask
406  */
407 #define PVRSRV_MAX_BLT_SRC_SYNCS                3
408 #endif
411 #define SGX_KICKTA_DUMPBITMAP_MAX_NAME_LENGTH           256
413 /*
414         Structure for dumping bitmaps
415 */
416 typedef struct _SGX_KICKTA_DUMPBITMAP_
418         IMG_DEV_VIRTADDR        sDevBaseAddr;
419         IMG_UINT32                      ui32Flags;
420         IMG_UINT32                      ui32Width;
421         IMG_UINT32                      ui32Height;
422         IMG_UINT32                      ui32Stride;
423         IMG_UINT32                      ui32PDUMPFormat;
424         IMG_UINT32                      ui32BytesPP;
425         IMG_CHAR                        pszName[SGX_KICKTA_DUMPBITMAP_MAX_NAME_LENGTH];
426 } SGX_KICKTA_DUMPBITMAP, *PSGX_KICKTA_DUMPBITMAP;
428 #define PVRSRV_SGX_PDUMP_CONTEXT_MAX_BITMAP_ARRAY_SIZE  (16)
430 /*!
431  ******************************************************************************
432  * Data required only when dumping parameters
433  *****************************************************************************/
434 typedef struct _PVRSRV_SGX_PDUMP_CONTEXT_
436         /* cache control word for micro kernel cache flush/invalidates */
437         IMG_UINT32                                              ui32CacheControl;
439 } PVRSRV_SGX_PDUMP_CONTEXT;
442 #if !defined (SUPPORT_SID_INTERFACE)
443 typedef struct _SGX_KICKTA_DUMP_ROFF_
445         IMG_HANDLE                      hKernelMemInfo;                                         /*< Buffer handle */
446         IMG_UINT32                      uiAllocIndex;                                           /*< Alloc index for LDDM */
447         IMG_UINT32                      ui32Offset;                                                     /*< Byte offset to value to dump */
448         IMG_UINT32                      ui32Value;                                                      /*< Actual value to dump */
449         IMG_PCHAR                       pszName;                                                        /*< Name of buffer */
450 } SGX_KICKTA_DUMP_ROFF, *PSGX_KICKTA_DUMP_ROFF;
451 #endif
453 #if defined (SUPPORT_SID_INTERFACE)
454 typedef struct _SGX_KICKTA_DUMP_BUFFER_KM_
455 #else
456 typedef struct _SGX_KICKTA_DUMP_BUFFER_
457 #endif
459         IMG_UINT32                      ui32SpaceUsed;
460         IMG_UINT32                      ui32Start;                                                      /*< Byte offset of start to dump */
461         IMG_UINT32                      ui32End;                                                        /*< Byte offset of end of dump (non-inclusive) */
462         IMG_UINT32                      ui32BufferSize;                                         /*< Size of buffer */
463         IMG_UINT32                      ui32BackEndLength;                                      /*< Size of back end portion, if End < Start */
464         IMG_UINT32                      uiAllocIndex;
465         IMG_HANDLE                      hKernelMemInfo;                                         /*< MemInfo handle for the circular buffer */
466         IMG_PVOID                       pvLinAddr;
467 #if defined(SUPPORT_SGX_NEW_STATUS_VALS)
468         IMG_HANDLE                      hCtrlKernelMemInfo;                                     /*< MemInfo handle for the control structure of the
469                                                                                                                                 circular buffer */
470         IMG_DEV_VIRTADDR        sCtrlDevVAddr;                                          /*< Device virtual address of the memory in the 
471                                                                                                                                 control structure to be checked */
472 #endif
473         IMG_PCHAR                       pszName;                                                        /*< Name of buffer */
475 #if defined (__QNXNTO__)
476         IMG_UINT32          ui32NameLength;                     /*< Number of characters in buffer name */
477 #endif
478 #if defined (SUPPORT_SID_INTERFACE)
479 } SGX_KICKTA_DUMP_BUFFER_KM, *PSGX_KICKTA_DUMP_BUFFER_KM;
480 #else
481 } SGX_KICKTA_DUMP_BUFFER, *PSGX_KICKTA_DUMP_BUFFER;
482 #endif
484 #if !defined (SUPPORT_SID_INTERFACE)
485 #ifdef PDUMP
486 /*
487         PDUMP version of above kick structure
488 */
489 typedef struct _SGX_KICKTA_PDUMP_
491         // Bitmaps to dump
492         PSGX_KICKTA_DUMPBITMAP          psPDumpBitmapArray;
493         IMG_UINT32                                              ui32PDumpBitmapSize;
495         // Misc buffers to dump (e.g. TA, PDS etc..)
496         PSGX_KICKTA_DUMP_BUFFER psBufferArray;
497         IMG_UINT32                                              ui32BufferArraySize;
499         // Roffs to dump
500         PSGX_KICKTA_DUMP_ROFF           psROffArray;
501         IMG_UINT32                                              ui32ROffArraySize;
502 } SGX_KICKTA_PDUMP, *PSGX_KICKTA_PDUMP;
503 #endif  /* PDUMP */
504 #endif /* #if !defined (SUPPORT_SID_INTERFACE) */
506 #if defined(TRANSFER_QUEUE)
507 #if defined(SGX_FEATURE_2D_HARDWARE)
508 /* Maximum size of ctrl stream for 2d blit command (in 32 bit words) */
509 #define SGX_MAX_2D_BLIT_CMD_SIZE                26
510 #define SGX_MAX_2D_SRC_SYNC_OPS                 3
511 #endif
512 #define SGX_MAX_TRANSFER_STATUS_VALS    2
513 #define SGX_MAX_TRANSFER_SYNC_OPS       5
514 #endif
516 #if defined (__cplusplus)
518 #endif
520 #endif /* __SGXAPI_KM_H__ */
522 /******************************************************************************
523  End of file (sgxapi_km.h)
524 ******************************************************************************/