RK3368 GPU: Rogue N Init.
[firefly-linux-kernel-4.4.55.git] / drivers / staging / imgtec / rogue / rgx_bridge.h
1 /*************************************************************************/ /*!
2 @File
3 @Title          RGX Bridge Functionality
4 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description    Header for the rgx 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 #if !defined(__RGX_BRIDGE_H__)
45 #define __RGX_BRIDGE_H__
46
47 #include "pvr_bridge.h"
48
49 #if defined (__cplusplus)
50 extern "C" {
51 #endif
52
53 #include "rgx_fwif.h"
54
55 #define RGXFWINITPARAMS_VERSION   1
56 #define RGXFWINITPARAMS_EXTENSION 128
57
58 /* Parameters for RGXFirmwareInit */
59 typedef struct __RGX_FW_INIT_IN_PARAMS__
60 {
61         IMG_UINT32               ui32Version;
62         IMG_BOOL                 bEnableSignatureChecks;
63         IMG_UINT32               ui32SignatureChecksBufSize;
64         IMG_UINT32               ui32HWPerfFWBufSizeKB;
65         IMG_UINT64               ui64HWPerfFilter;
66         IMG_UINT32               ui32ConfigFlags;
67         IMG_UINT32               ui32LogType;
68         IMG_UINT32               ui32FilterFlags;
69         IMG_UINT32               ui32JonesDisableMask;
70         IMG_UINT32               ui32HWRDebugDumpLimit;
71         RGXFWIF_COMPCHECKS_BVNC  sClientBVNC;
72         RGXFWIF_COMPCHECKS_BVNC  sFirmwareBVNC;
73         IMG_UINT32               ui32HWPerfCountersDataSize;
74         RGX_RD_POWER_ISLAND_CONF eRGXRDPowerIslandingConf;
75         FW_PERF_CONF             eFirmwarePerf;
76         /* Available for future extensions */
77         IMG_BYTE                 abUnused[RGXFWINITPARAMS_EXTENSION];
78 } RGX_FW_INIT_IN_PARAMS;
79
80 #if !defined(SUPPORT_KERNEL_SRVINIT)
81 #include "common_rgxinit_bridge.h"
82 #endif
83 #include "common_rgxta3d_bridge.h"
84 #include "common_rgxcmp_bridge.h"
85
86 #include "common_rgxtq2_bridge.h"
87 #include "common_rgxtq_bridge.h"
88 #if !defined(EXCLUDE_BREAKPOINT_BRIDGE)
89 #include "common_breakpoint_bridge.h"
90 #endif
91 #include "common_debugmisc_bridge.h"
92 #if defined(PDUMP)
93 #include "common_rgxpdump_bridge.h"
94 #endif
95 #include "common_rgxhwperf_bridge.h"
96 #include "common_rgxray_bridge.h"
97 #if !defined(EXCLUDE_REGCONFIG_BRIDGE)
98 #include "common_regconfig_bridge.h"
99 #endif
100 #include "common_timerquery_bridge.h"
101 #include "common_rgxkicksync_bridge.h"
102
103 #include "common_rgxsignals_bridge.h"
104
105
106 /*
107  * Bridge Cmd Ids
108  */
109
110 /* *REMEMBER* to update PVRSRV_BRIDGE_RGX_LAST if you add/remove a bridge
111  * group!
112  * Also you need to ensure all PVRSRV_BRIDGE_RGX_xxx_DISPATCH_FIRST
113  * offsets follow on from the previous bridge group's commands!
114  *
115  * If a bridge group is optional, ensure you *ALWAYS* define its index
116  * (e.g. PVRSRV_BRIDGE_RGXCMP is always 151, even is the feature is
117  * not defined). If an optional bridge group is not defined you must
118  * still define PVRSRV_BRIDGE_RGX_xxx_DISPATCH_FIRST for it with an
119  * assigned value of 0.
120  */
121
122 /* The RGX bridge groups start at 128 (PVRSRV_BRIDGE_RGX_FIRST) rather than follow-on from the other
123  * non-device bridge groups (meaning that they then won't be displaced if
124  * other non-device bridge groups are added)
125  */
126
127 #define PVRSRV_BRIDGE_RGX_FIRST                  128UL
128
129 /* 128: RGX TQ interface functions */
130 #define PVRSRV_BRIDGE_RGXTQ                      128UL
131 #define PVRSRV_BRIDGE_RGXTQ_DISPATCH_FIRST       (PVRSRV_BRIDGE_DISPATCH_LAST + 1)
132 #define PVRSRV_BRIDGE_RGXTQ_DISPATCH_LAST        (PVRSRV_BRIDGE_RGXTQ_DISPATCH_FIRST + PVRSRV_BRIDGE_RGXTQ_CMD_LAST)
133
134
135 /* 129: RGX Compute interface functions */
136 #define PVRSRV_BRIDGE_RGXCMP                     129UL
137 #       define PVRSRV_BRIDGE_RGXCMP_DISPATCH_FIRST   (PVRSRV_BRIDGE_RGXTQ_DISPATCH_LAST + 1)
138 #       define PVRSRV_BRIDGE_RGXCMP_DISPATCH_LAST    (PVRSRV_BRIDGE_RGXCMP_DISPATCH_FIRST + PVRSRV_BRIDGE_RGXCMP_CMD_LAST)
139
140
141 /* 130: RGX Initialisation interface functions */
142 #define PVRSRV_BRIDGE_RGXINIT                    130UL
143 #if !defined(SUPPORT_KERNEL_SRVINIT)
144 #       define PVRSRV_BRIDGE_RGXINIT_DISPATCH_FIRST  (PVRSRV_BRIDGE_RGXCMP_DISPATCH_LAST +1)
145 #       define PVRSRV_BRIDGE_RGXINIT_DISPATCH_LAST   (PVRSRV_BRIDGE_RGXINIT_DISPATCH_FIRST + PVRSRV_BRIDGE_RGXINIT_CMD_LAST)
146 #else
147 #       define PVRSRV_BRIDGE_RGXINIT_DISPATCH_FIRST  0
148 #       define PVRSRV_BRIDGE_RGXINIT_DISPATCH_LAST   (PVRSRV_BRIDGE_RGXCMP_DISPATCH_LAST)
149 #endif
150
151 /* 131: RGX TA/3D interface functions */
152 #define PVRSRV_BRIDGE_RGXTA3D                    131UL
153 #define PVRSRV_BRIDGE_RGXTA3D_DISPATCH_FIRST     (PVRSRV_BRIDGE_RGXINIT_DISPATCH_LAST +1)
154 #define PVRSRV_BRIDGE_RGXTA3D_DISPATCH_LAST      (PVRSRV_BRIDGE_RGXTA3D_DISPATCH_FIRST + PVRSRV_BRIDGE_RGXTA3D_CMD_LAST)
155
156 /* 132: RGX Breakpoint interface functions */
157 #define PVRSRV_BRIDGE_BREAKPOINT                 132UL
158 #if !defined(EXCLUDE_BREAKPOINT_BRIDGE)
159 #define PVRSRV_BRIDGE_BREAKPOINT_DISPATCH_FIRST  (PVRSRV_BRIDGE_RGXTA3D_DISPATCH_LAST + 1)
160 #define PVRSRV_BRIDGE_BREAKPOINT_DISPATCH_LAST   (PVRSRV_BRIDGE_BREAKPOINT_DISPATCH_FIRST + PVRSRV_BRIDGE_BREAKPOINT_CMD_LAST)
161 #else
162 #define PVRSRV_BRIDGE_BREAKPOINT_DISPATCH_FIRST  0
163 #define PVRSRV_BRIDGE_BREAKPOINT_DISPATCH_LAST   (PVRSRV_BRIDGE_RGXTA3D_DISPATCH_LAST)
164 #endif
165
166 /* 133: RGX Debug/Misc interface functions */
167 #define PVRSRV_BRIDGE_DEBUGMISC                  133UL
168 #define PVRSRV_BRIDGE_DEBUGMISC_DISPATCH_FIRST   (PVRSRV_BRIDGE_BREAKPOINT_DISPATCH_LAST + 1)
169 #define PVRSRV_BRIDGE_DEBUGMISC_DISPATCH_LAST    (PVRSRV_BRIDGE_DEBUGMISC_DISPATCH_FIRST + PVRSRV_BRIDGE_DEBUGMISC_CMD_LAST)
170
171 /* 134: RGX PDump interface functions */
172 #define PVRSRV_BRIDGE_RGXPDUMP                   134UL
173 #if defined(PDUMP)
174 #define PVRSRV_BRIDGE_RGXPDUMP_DISPATCH_FIRST    (PVRSRV_BRIDGE_DEBUGMISC_DISPATCH_LAST +1)
175 #define PVRSRV_BRIDGE_RGXPDUMP_DISPATCH_LAST     (PVRSRV_BRIDGE_RGXPDUMP_DISPATCH_FIRST + PVRSRV_BRIDGE_RGXPDUMP_CMD_LAST)
176 #else
177 #define PVRSRV_BRIDGE_RGXPDUMP_DISPATCH_FIRST    0
178 #define PVRSRV_BRIDGE_RGXPDUMP_DISPATCH_LAST     (PVRSRV_BRIDGE_DEBUGMISC_DISPATCH_LAST)
179 #endif
180
181 /* 135: RGX HWPerf interface functions */
182 #define PVRSRV_BRIDGE_RGXHWPERF                  135UL
183 #define PVRSRV_BRIDGE_RGXHWPERF_DISPATCH_FIRST   (PVRSRV_BRIDGE_RGXPDUMP_DISPATCH_LAST + 1)
184 #define PVRSRV_BRIDGE_RGXHWPERF_DISPATCH_LAST    (PVRSRV_BRIDGE_RGXHWPERF_DISPATCH_FIRST + PVRSRV_BRIDGE_RGXHWPERF_CMD_LAST)
185
186 /* 136: RGX Ray Tracing interface functions */
187 #define PVRSRV_BRIDGE_RGXRAY                     136UL
188 #define PVRSRV_BRIDGE_RGXRAY_DISPATCH_FIRST      (PVRSRV_BRIDGE_RGXHWPERF_DISPATCH_LAST + 1)
189 #define PVRSRV_BRIDGE_RGXRAY_DISPATCH_LAST       (PVRSRV_BRIDGE_RGXRAY_DISPATCH_FIRST + PVRSRV_BRIDGE_RGXRAY_CMD_LAST)
190
191 /* 137: RGX Register Configuration interface functions */
192 #define PVRSRV_BRIDGE_REGCONFIG                  137UL
193 #if !defined(EXCLUDE_REGCONFIG_BRIDGE)
194 #define PVRSRV_BRIDGE_REGCONFIG_DISPATCH_FIRST   (PVRSRV_BRIDGE_RGXRAY_DISPATCH_LAST + 1)
195 #define PVRSRV_BRIDGE_REGCONFIG_DISPATCH_LAST    (PVRSRV_BRIDGE_REGCONFIG_DISPATCH_FIRST + PVRSRV_BRIDGE_REGCONFIG_CMD_LAST)
196 #else
197 #define PVRSRV_BRIDGE_REGCONFIG_DISPATCH_FIRST   0
198 #define PVRSRV_BRIDGE_REGCONFIG_DISPATCH_LAST    (PVRSRV_BRIDGE_RGXRAY_DISPATCH_LAST)
199 #endif
200
201 /* 138: RGX Timer Query interface functions */
202 #define PVRSRV_BRIDGE_TIMERQUERY                 138UL
203 #define PVRSRV_BRIDGE_TIMERQUERY_DISPATCH_FIRST  (PVRSRV_BRIDGE_REGCONFIG_DISPATCH_LAST + 1)
204 #define PVRSRV_BRIDGE_TIMERQUERY_DISPATCH_LAST   (PVRSRV_BRIDGE_TIMERQUERY_DISPATCH_FIRST + PVRSRV_BRIDGE_TIMERQUERY_CMD_LAST)
205
206 /* 139: RGX kicksync interface */
207 #define PVRSRV_BRIDGE_RGXKICKSYNC                139UL
208 #define PVRSRV_BRIDGE_RGXKICKSYNC_DISPATCH_FIRST (PVRSRV_BRIDGE_TIMERQUERY_DISPATCH_LAST + 1)
209 #define PVRSRV_BRIDGE_RGXKICKSYNC_DISPATCH_LAST  (PVRSRV_BRIDGE_RGXKICKSYNC_DISPATCH_FIRST + PVRSRV_BRIDGE_RGXKICKSYNC_CMD_LAST)
210
211 /* 140: RGX signals interface */
212 #define PVRSRV_BRIDGE_RGXSIGNALS                140UL
213 #define PVRSRV_BRIDGE_RGXSIGNALS_DISPATCH_FIRST (PVRSRV_BRIDGE_RGXKICKSYNC_DISPATCH_LAST + 1)
214 #define PVRSRV_BRIDGE_RGXSIGNALS_DISPATCH_LAST  (PVRSRV_BRIDGE_RGXSIGNALS_DISPATCH_FIRST + PVRSRV_BRIDGE_RGXSIGNALS_CMD_LAST)
215
216
217 #define PVRSRV_BRIDGE_RGXTQ2                      141UL
218 #define PVRSRV_BRIDGE_RGXTQ2_DISPATCH_FIRST       (PVRSRV_BRIDGE_RGXSIGNALS_DISPATCH_LAST + 1)
219 #define PVRSRV_BRIDGE_RGXTQ2_DISPATCH_LAST        (PVRSRV_BRIDGE_RGXTQ2_DISPATCH_FIRST + PVRSRV_BRIDGE_RGXTQ2_CMD_LAST)
220
221 #define PVRSRV_BRIDGE_RGX_LAST                   (PVRSRV_BRIDGE_RGXTQ2)
222 #define PVRSRV_BRIDGE_RGX_DISPATCH_LAST          (PVRSRV_BRIDGE_RGXTQ2_DISPATCH_LAST)
223
224 /* bit mask representing the enabled RGX bridges */
225
226 static const IMG_UINT32 gui32RGXBridges =
227           (1U << (PVRSRV_BRIDGE_RGXTQ - PVRSRV_BRIDGE_RGX_FIRST))
228 #if defined(RGX_FEATURE_COMPUTE)
229         | (1U << (PVRSRV_BRIDGE_RGXCMP - PVRSRV_BRIDGE_RGX_FIRST))
230 #endif
231 #if !defined(SUPPORT_KERNEL_SRVINIT)
232         | (1U << (PVRSRV_BRIDGE_RGXINIT - PVRSRV_BRIDGE_RGX_FIRST))
233 #endif
234         | (1U << (PVRSRV_BRIDGE_RGXTA3D - PVRSRV_BRIDGE_RGX_FIRST))
235 #if defined(SUPPORT_BREAKPOINT)
236         | (1U << (PVRSRV_BRIDGE_BREAKPOINT - PVRSRV_BRIDGE_RGX_FIRST))
237 #endif
238 #if defined(SUPPORT_DEBUGMISC)
239         | (1U << (PVRSRV_BRIDGE_DEBUGMISC - PVRSRV_BRIDGE_RGX_FIRST))
240 #endif
241 #if defined(PDUMP)
242         | (1U << (PVRSRV_BRIDGE_RGXPDUMP - PVRSRV_BRIDGE_RGX_FIRST))
243 #endif
244         | (1U << (PVRSRV_BRIDGE_RGXHWPERF - PVRSRV_BRIDGE_RGX_FIRST))
245 #if defined(RGX_FEATURE_RAY_TRACING)
246         | (1U << (PVRSRV_BRIDGE_RGXRAY - PVRSRV_BRIDGE_RGX_FIRST))
247 #endif
248 #if defined(SUPPORT_REGCONFIG)
249         | (1U << (PVRSRV_BRIDGE_REGCONFIG - PVRSRV_BRIDGE_RGX_FIRST))
250 #endif
251 #if defined(SUPPORT_TIMERQUERY)
252         | (1U << (PVRSRV_BRIDGE_TIMERQUERY - PVRSRV_BRIDGE_RGX_FIRST))
253 #endif
254         | (1U << (PVRSRV_BRIDGE_RGXKICKSYNC - PVRSRV_BRIDGE_RGX_FIRST))
255 #if defined(RGX_FEATURE_SIGNAL_SNOOPING)
256         | (1U << (PVRSRV_BRIDGE_RGXSIGNALS - PVRSRV_BRIDGE_RGX_FIRST))
257 #endif
258         | (1U << (PVRSRV_BRIDGE_RGXTQ2 - PVRSRV_BRIDGE_RGX_FIRST));
259
260 /* bit field representing which RGX bridge groups may optionally not
261  * be present in the server
262  */
263
264 #define RGX_BRIDGES_OPTIONAL \
265         ( \
266                 0 /* no RGX bridges are currently optional */ \
267         )
268
269 #if defined (__cplusplus)
270 }
271 #endif
272
273 #endif /* __RGX_BRIDGE_H__ */