RK3368 GPU version Rogue M 1.28
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / rogue_m / services / include / pvr_bridge.h
1 /*************************************************************************/ /*!
2 @File
3 @Title          PVR Bridge Functionality
4 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description    Header for the PVR Bridge code
6 @License        Dual MIT/GPLv2
7
8 The contents of this file are subject to the MIT license as set out below.
9
10 Permission is hereby granted, free of charge, to any person obtaining a copy
11 of this software and associated documentation files (the "Software"), to deal
12 in the Software without restriction, including without limitation the rights
13 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 copies of the Software, and to permit persons to whom the Software is
15 furnished to do so, subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 Alternatively, the contents of this file may be used under the terms of
21 the GNU General Public License Version 2 ("GPL") in which case the provisions
22 of GPL are applicable instead of those above.
23
24 If you wish to allow use of your version of this file only under the terms of
25 GPL, and not to allow others to use your version of this file under the terms
26 of the MIT license, indicate your decision by deleting the provisions above
27 and replace them with the notice and other provisions required by GPL as set
28 out in the file called "GPL-COPYING" included in this distribution. If you do
29 not delete the provisions above, a recipient may use your version of this file
30 under the terms of either the MIT license or GPL.
31
32 This License is also included in this distribution in the file called
33 "MIT-COPYING".
34
35 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
36 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
37 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
38 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
39 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
40 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
41 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42 */ /**************************************************************************/
43
44 #ifndef __PVR_BRIDGE_H__
45 #define __PVR_BRIDGE_H__
46
47 #if defined (__cplusplus)
48 extern "C" {
49 #endif
50
51 #include "pvrsrv_error.h"
52 #include "cache_defines.h"
53
54 #if defined(SUPPORT_DISPLAY_CLASS)
55 #include "common_dc_bridge.h"
56 #endif
57 #include "common_mm_bridge.h"
58 #if defined(SUPPORT_MMPLAT_BRIDGE)
59 #include "common_mmplat_bridge.h"
60 #endif
61 #include "common_cmm_bridge.h"
62 #include "common_pdumpmm_bridge.h"
63 #include "common_pdump_bridge.h"
64 #if defined(SUPPORT_ION)
65 #include "common_dmabuf_bridge.h"
66 #endif
67 #include "common_pdumpctrl_bridge.h"
68 #include "common_srvcore_bridge.h"
69 #include "common_sync_bridge.h"
70 #if defined(SUPPORT_INSECURE_EXPORT)
71 #include "common_syncexport_bridge.h"
72 #endif
73 #if defined(SUPPORT_SECURE_EXPORT)
74 #include "common_syncsexport_bridge.h"
75 #endif
76 #if (CACHEFLUSH_TYPE == CACHEFLUSH_GENERIC)
77 #include "common_cachegeneric_bridge.h"
78 #endif
79 #if defined(SUPPORT_SECURE_EXPORT)
80 #include "common_smm_bridge.h"
81 #endif
82 #include "common_pvrtl_bridge.h"
83 #if defined(PVR_RI_DEBUG)
84 #include "common_ri_bridge.h"
85 #endif
86
87 #if defined(SUPPORT_VALIDATION)
88 #include "common_validation_bridge.h"
89 #endif
90
91 #if defined(PVR_TESTING_UTILS)
92 #include "common_tutils_bridge.h"
93 #endif
94
95 #if defined(SUPPORT_PAGE_FAULT_DEBUG)
96 #include "common_devicememhistory_bridge.h"
97 #endif
98
99 /* 
100  * Bridge Cmd Ids
101  */
102
103
104 /* Note: The pattern
105  *   #define PVRSRV_BRIDGE_FEATURE (PVRSRV_BRIDGE_PREVFEATURE + 1)
106  *   #if defined(SUPPORT_FEATURE)
107  *   #define PVRSRV_BRIDGE_FEATURE_DISPATCH_FIRST       (PVRSRV_BRIDGE_PREVFEATURE_DISPATCH_LAST + 1)
108  *   #define PVRSRV_BRIDGE_FEATURE_DISPATCH_LAST        (PVRSRV_BRIDGE_FEATURE_DISPATCH_FIRST + PVRSRV_BRIDGE_FEATURE_CMD_LAST)
109  *   #else
110  *   #define PVRSRV_BRIDGE_FEATURE_DISPATCH_FIRST       0
111  *   #define PVRSRV_BRIDGE_FEATURE_DISPATCH_LAST        (PVRSRV_BRIDGE_PREVFEATURE_DISPATCH_LAST)
112  *   #endif
113  * is used in the macro definitions below to make PVRSRV_BRIDGE_FEATURE_*
114  * take up no space in the dispatch table if SUPPORT_FEATURE is disabled.
115  *
116  * Note however that a bridge always defines PVRSRV_BRIDGE_FEATURE, even where 
117  * the feature is not enabled (each bridge group retains its own ioctl number).
118  */
119
120 /*   0: CORE functions  */
121 #define PVRSRV_BRIDGE_SRVCORE                                   0UL
122 #define PVRSRV_BRIDGE_SRVCORE_DISPATCH_FIRST    0UL
123 #define PVRSRV_BRIDGE_SRVCORE_DISPATCH_LAST             (PVRSRV_BRIDGE_SRVCORE_DISPATCH_FIRST + PVRSRV_BRIDGE_SRVCORE_CMD_LAST)
124
125 /*   1: SYNC functions  */
126 #define PVRSRV_BRIDGE_SYNC                                      1UL
127 #define PVRSRV_BRIDGE_SYNC_DISPATCH_FIRST       (PVRSRV_BRIDGE_SRVCORE_DISPATCH_LAST + 1)
128 #define PVRSRV_BRIDGE_SYNC_DISPATCH_LAST        (PVRSRV_BRIDGE_SYNC_DISPATCH_FIRST + PVRSRV_BRIDGE_SYNC_CMD_LAST)
129
130 /*   2: SYNCEXPORT functions  */
131 #define PVRSRV_BRIDGE_SYNCEXPORT                        2UL
132 #if defined(SUPPORT_INSECURE_EXPORT)
133 #define PVRSRV_BRIDGE_SYNCEXPORT_DISPATCH_FIRST (PVRSRV_BRIDGE_SYNC_DISPATCH_LAST + 1)
134 #define PVRSRV_BRIDGE_SYNCEXPORT_DISPATCH_LAST  (PVRSRV_BRIDGE_SYNCEXPORT_DISPATCH_FIRST + PVRSRV_BRIDGE_SYNCEXPORT_CMD_LAST)
135 #else
136 #define PVRSRV_BRIDGE_SYNCEXPORT_DISPATCH_FIRST 0
137 #define PVRSRV_BRIDGE_SYNCEXPORT_DISPATCH_LAST  (PVRSRV_BRIDGE_SYNC_DISPATCH_LAST)
138 #endif
139
140 /*   3: SYNCSEXPORT functions  */
141 #define PVRSRV_BRIDGE_SYNCSEXPORT                   3UL
142 #if defined(SUPPORT_SECURE_EXPORT)
143 #define PVRSRV_BRIDGE_SYNCSEXPORT_DISPATCH_FIRST (PVRSRV_BRIDGE_SYNCEXPORT_DISPATCH_LAST + 1)
144 #define PVRSRV_BRIDGE_SYNCSEXPORT_DISPATCH_LAST  (PVRSRV_BRIDGE_SYNCSEXPORT_DISPATCH_FIRST + PVRSRV_BRIDGE_SYNCSEXPORT_CMD_LAST)
145 #else
146 #define PVRSRV_BRIDGE_SYNCSEXPORT_DISPATCH_FIRST 0
147 #define PVRSRV_BRIDGE_SYNCSEXPORT_DISPATCH_LAST  (PVRSRV_BRIDGE_SYNCEXPORT_DISPATCH_LAST)
148 #endif
149
150 /*   4: PDUMP CTRL layer functions*/
151 #define PVRSRV_BRIDGE_PDUMPCTRL                         4UL
152 #define PVRSRV_BRIDGE_PDUMPCTRL_DISPATCH_FIRST  (PVRSRV_BRIDGE_SYNCSEXPORT_DISPATCH_LAST + 1)
153 #define PVRSRV_BRIDGE_PDUMPCTRL_DISPATCH_LAST   (PVRSRV_BRIDGE_PDUMPCTRL_DISPATCH_FIRST + PVRSRV_BRIDGE_PDUMPCTRL_CMD_LAST)
154
155 /*   5: Memory Management functions */
156 #define PVRSRV_BRIDGE_MM                                5UL
157 #define PVRSRV_BRIDGE_MM_DISPATCH_FIRST         (PVRSRV_BRIDGE_PDUMPCTRL_DISPATCH_LAST + 1)
158 #define PVRSRV_BRIDGE_MM_DISPATCH_LAST          (PVRSRV_BRIDGE_MM_DISPATCH_FIRST + PVRSRV_BRIDGE_MM_CMD_LAST)
159
160 /*   6: Non-Linux Memory Management functions */
161 #define PVRSRV_BRIDGE_MMPLAT                    6UL
162 #if defined(SUPPORT_MMPLAT_BRIDGE)
163 #define PVRSRV_BRIDGE_MMPLAT_DISPATCH_FIRST     (PVRSRV_BRIDGE_MM_DISPATCH_LAST + 1)
164 #define PVRSRV_BRIDGE_MMPLAT_DISPATCH_LAST      (PVRSRV_BRIDGE_MMPLAT_DISPATCH_FIRST + PVRSRV_BRIDGE_MMPLAT_CMD_LAST)
165 #else
166 #define PVRSRV_BRIDGE_MMPLAT_DISPATCH_FIRST 0
167 #define PVRSRV_BRIDGE_MMPLAT_DISPATCH_LAST      (PVRSRV_BRIDGE_MM_DISPATCH_LAST)
168 #endif
169
170 /*   7: Context Memory Management functions */
171 #define PVRSRV_BRIDGE_CMM                               7UL
172 #define PVRSRV_BRIDGE_CMM_DISPATCH_FIRST        (PVRSRV_BRIDGE_MMPLAT_DISPATCH_LAST + 1)
173 #define PVRSRV_BRIDGE_CMM_DISPATCH_LAST         (PVRSRV_BRIDGE_CMM_DISPATCH_FIRST + PVRSRV_BRIDGE_CMM_CMD_LAST)
174
175 /*   8: PDUMP Memory Management functions */
176 #define PVRSRV_BRIDGE_PDUMPMM                           8UL
177 #define PVRSRV_BRIDGE_PDUMPMM_DISPATCH_FIRST (PVRSRV_BRIDGE_CMM_DISPATCH_LAST + 1)
178 #define PVRSRV_BRIDGE_PDUMPMM_DISPATCH_LAST      (PVRSRV_BRIDGE_PDUMPMM_DISPATCH_FIRST + PVRSRV_BRIDGE_PDUMPMM_CMD_LAST)
179
180 /*   9: PDUMP functions */
181 #define PVRSRV_BRIDGE_PDUMP                             9UL
182 #define PVRSRV_BRIDGE_PDUMP_DISPATCH_FIRST (PVRSRV_BRIDGE_PDUMPMM_DISPATCH_LAST + 1)
183 #define PVRSRV_BRIDGE_PDUMP_DISPATCH_LAST       (PVRSRV_BRIDGE_PDUMP_DISPATCH_FIRST + PVRSRV_BRIDGE_PDUMP_CMD_LAST)
184
185 /*  10: DMABUF functions */
186 #define PVRSRV_BRIDGE_DMABUF                                    10UL
187 #if defined(SUPPORT_ION)
188 #define PVRSRV_BRIDGE_DMABUF_DISPATCH_FIRST (PVRSRV_BRIDGE_PDUMP_DISPATCH_LAST + 1)
189 #define PVRSRV_BRIDGE_DMABUF_DISPATCH_LAST      (PVRSRV_BRIDGE_DMABUF_DISPATCH_FIRST + PVRSRV_BRIDGE_DMABUF_CMD_LAST)
190 #else
191 #define PVRSRV_BRIDGE_DMABUF_DISPATCH_FIRST 0
192 #define PVRSRV_BRIDGE_DMABUF_DISPATCH_LAST      (PVRSRV_BRIDGE_PDUMP_DISPATCH_LAST)
193 #endif
194
195 /*  11: Display Class functions */
196 #define PVRSRV_BRIDGE_DC                                                11UL
197 #if defined(SUPPORT_DISPLAY_CLASS)
198 #define PVRSRV_BRIDGE_DC_DISPATCH_FIRST     (PVRSRV_BRIDGE_DMABUF_DISPATCH_LAST + 1)
199 #define PVRSRV_BRIDGE_DC_DISPATCH_LAST          (PVRSRV_BRIDGE_DC_DISPATCH_FIRST + PVRSRV_BRIDGE_DC_CMD_LAST)
200 #else
201 #define PVRSRV_BRIDGE_DC_DISPATCH_FIRST     0
202 #define PVRSRV_BRIDGE_DC_DISPATCH_LAST          (PVRSRV_BRIDGE_DMABUF_DISPATCH_LAST)
203 #endif
204
205 /*  12: Generic cache interface functions*/
206 #define PVRSRV_BRIDGE_CACHEGENERIC                      12UL
207 #if (CACHEFLUSH_TYPE == CACHEFLUSH_GENERIC)
208 #define PVRSRV_BRIDGE_CACHEGENERIC_DISPATCH_FIRST (PVRSRV_BRIDGE_DC_DISPATCH_LAST + 1)
209 #define PVRSRV_BRIDGE_CACHEGENERIC_DISPATCH_LAST  (PVRSRV_BRIDGE_CACHEGENERIC_DISPATCH_FIRST + PVRSRV_BRIDGE_CACHEGENERIC_CMD_LAST)
210 #else
211 #define PVRSRV_BRIDGE_CACHEGENERIC_DISPATCH_FIRST 0
212 #define PVRSRV_BRIDGE_CACHEGENERIC_DISPATCH_LAST  (PVRSRV_BRIDGE_DC_DISPATCH_LAST)
213 #endif
214
215 /*  13: Secure Memory Management functions*/
216 #define PVRSRV_BRIDGE_SMM                                       13UL
217 #if defined(SUPPORT_SECURE_EXPORT)
218 #define PVRSRV_BRIDGE_SMM_DISPATCH_FIRST   (PVRSRV_BRIDGE_CACHEGENERIC_DISPATCH_LAST + 1)
219 #define PVRSRV_BRIDGE_SMM_DISPATCH_LAST         (PVRSRV_BRIDGE_SMM_DISPATCH_FIRST + PVRSRV_BRIDGE_SMM_CMD_LAST)
220 #else
221 #define PVRSRV_BRIDGE_SMM_DISPATCH_FIRST   0
222 #define PVRSRV_BRIDGE_SMM_DISPATCH_LAST         (PVRSRV_BRIDGE_CACHEGENERIC_DISPATCH_LAST)
223 #endif
224
225 /*  14: Transport Layer interface functions */
226 #define PVRSRV_BRIDGE_PVRTL                                     14UL
227 #define PVRSRV_BRIDGE_PVRTL_DISPATCH_FIRST  (PVRSRV_BRIDGE_SMM_DISPATCH_LAST + 1)
228 #define PVRSRV_BRIDGE_PVRTL_DISPATCH_LAST       (PVRSRV_BRIDGE_PVRTL_DISPATCH_FIRST + PVRSRV_BRIDGE_PVRTL_CMD_LAST)
229
230 /*  15: Resource Information (RI) interface functions */
231 #define PVRSRV_BRIDGE_RI                                                15UL
232 #if defined(PVR_RI_DEBUG)
233 #define PVRSRV_BRIDGE_RI_DISPATCH_FIRST     (PVRSRV_BRIDGE_PVRTL_DISPATCH_LAST + 1)
234 #define PVRSRV_BRIDGE_RI_DISPATCH_LAST          (PVRSRV_BRIDGE_RI_DISPATCH_FIRST + PVRSRV_BRIDGE_RI_CMD_LAST)
235 #else
236 #define PVRSRV_BRIDGE_RI_DISPATCH_FIRST     0
237 #define PVRSRV_BRIDGE_RI_DISPATCH_LAST          (PVRSRV_BRIDGE_PVRTL_DISPATCH_LAST)
238 #endif
239
240 /*  16: Validation interface functions */
241 #define PVRSRV_BRIDGE_VALIDATION                                16UL
242 #if defined(SUPPORT_VALIDATION)
243 #define PVRSRV_BRIDGE_VALIDATION_DISPATCH_FIRST (PVRSRV_BRIDGE_RI_DISPATCH_LAST + 1)
244 #define PVRSRV_BRIDGE_VALIDATION_DISPATCH_LAST  (PVRSRV_BRIDGE_VALIDATION_DISPATCH_FIRST + PVRSRV_BRIDGE_VALIDATION_CMD_LAST)
245 #else
246 #define PVRSRV_BRIDGE_VALIDATION_DISPATCH_FIRST 0 
247 #define PVRSRV_BRIDGE_VALIDATION_DISPATCH_LAST  (PVRSRV_BRIDGE_RI_DISPATCH_LAST)
248 #endif
249
250 /*  17: TUTILS interface functions */
251 #define PVRSRV_BRIDGE_TUTILS                                    17UL
252 #if defined(PVR_TESTING_UTILS)
253 #define PVRSRV_BRIDGE_TUTILS_DISPATCH_FIRST (PVRSRV_BRIDGE_VALIDATION_DISPATCH_LAST + 1)
254 #define PVRSRV_BRIDGE_TUTILS_DISPATCH_LAST  (PVRSRV_BRIDGE_TUTILS_DISPATCH_FIRST + PVRSRV_BRIDGE_TUTILS_CMD_LAST)
255 #else
256 #define PVRSRV_BRIDGE_TUTILS_DISPATCH_FIRST 0
257 #define PVRSRV_BRIDGE_TUTILS_DISPATCH_LAST  (PVRSRV_BRIDGE_VALIDATION_DISPATCH_LAST)
258 #endif
259
260 /*  18: DevMem history interface functions */
261 #define PVRSRV_BRIDGE_DEVICEMEMHISTORY          18UL
262 #if defined(SUPPORT_PAGE_FAULT_DEBUG)
263 #define PVRSRV_BRIDGE_DEVICEMEMHISTORY_DISPATCH_FIRST (PVRSRV_BRIDGE_TUTILS_DISPATCH_LAST + 1)
264 #define PVRSRV_BRIDGE_DEVICEMEMHISTORY_DISPATCH_LAST  (PVRSRV_BRIDGE_DEVICEMEMHISTORY_DISPATCH_FIRST + PVRSRV_BRIDGE_DEVICEMEMHISTORY_CMD_LAST)
265 #else
266 #define PVRSRV_BRIDGE_DEVICEMEMHISTORY_DISPATCH_FIRST 0
267 #define PVRSRV_BRIDGE_DEVICEMEMHISTORY_DISPATCH_LAST  (PVRSRV_BRIDGE_TUTILS_DISPATCH_LAST)
268 #endif
269
270 /* NB PVRSRV_BRIDGE_LAST below must be the last bridge group defined above (PVRSRV_BRIDGE_FEATURE) */
271 #define PVRSRV_BRIDGE_LAST                              (PVRSRV_BRIDGE_DEVICEMEMHISTORY)
272 /* NB PVRSRV_BRIDGE_DISPATCH LAST below must be the last dispatch entry defined above (PVRSRV_BRIDGE_FEATURE_DISPATCH_LAST) */
273 #define PVRSRV_BRIDGE_DISPATCH_LAST                     (PVRSRV_BRIDGE_DEVICEMEMHISTORY_DISPATCH_LAST)
274
275
276 /******************************************************************************
277  * Generic bridge structures 
278  *****************************************************************************/
279
280
281 /******************************************************************************
282  *      bridge packaging structure
283  *****************************************************************************/
284 typedef struct PVRSRV_BRIDGE_PACKAGE_TAG
285 {
286         IMG_UINT32                              ui32BridgeID;                   /*!< ioctl bridge group */
287         IMG_UINT32                              ui32FunctionID;         /*!< ioctl function index */
288         IMG_UINT32                              ui32Size;                               /*!< size of structure */
289         IMG_VOID                                *pvParamIn;                             /*!< input data buffer */ 
290         IMG_UINT32                              ui32InBufferSize;               /*!< size of input data buffer */
291         IMG_VOID                                *pvParamOut;                    /*!< output data buffer */
292         IMG_UINT32                              ui32OutBufferSize;              /*!< size of output data buffer */
293 }PVRSRV_BRIDGE_PACKAGE;
294
295
296 #if defined (__cplusplus)
297 }
298 #endif
299
300 #endif /* __PVR_BRIDGE_H__ */
301
302 /******************************************************************************
303  End of file (pvr_bridge.h)
304 ******************************************************************************/
305