RK3368 GPU: Rogue N Init.
[firefly-linux-kernel-4.4.55.git] / drivers / staging / imgtec / rogue / rgxsrvinit_script.h
1 /*************************************************************************/ /*!
2 @File
3 @Title          Header for Services script routines used at initialisation time
4 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description    Defines the connections between the various parts of the
6                 initialisation server.
7 @License        Dual MIT/GPLv2
8
9 The contents of this file are subject to the MIT license as set out below.
10
11 Permission is hereby granted, free of charge, to any person obtaining a copy
12 of this software and associated documentation files (the "Software"), to deal
13 in the Software without restriction, including without limitation the rights
14 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 copies of the Software, and to permit persons to whom the Software is
16 furnished to do so, subject to the following conditions:
17
18 The above copyright notice and this permission notice shall be included in
19 all copies or substantial portions of the Software.
20
21 Alternatively, the contents of this file may be used under the terms of
22 the GNU General Public License Version 2 ("GPL") in which case the provisions
23 of GPL are applicable instead of those above.
24
25 If you wish to allow use of your version of this file only under the terms of
26 GPL, and not to allow others to use your version of this file under the terms
27 of the MIT license, indicate your decision by deleting the provisions above
28 and replace them with the notice and other provisions required by GPL as set
29 out in the file called "GPL-COPYING" included in this distribution. If you do
30 not delete the provisions above, a recipient may use your version of this file
31 under the terms of either the MIT license or GPL.
32
33 This License is also included in this distribution in the file called
34 "MIT-COPYING".
35
36 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
37 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
38 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
39 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
40 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
41 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
42 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
43 */ /**************************************************************************/
44 #ifndef __RGXSRVINIT_SCRIPT_H__
45 #define __RGXSRVINIT_SCRIPT_H__
46
47 #if defined (__cplusplus)
48 extern "C" {
49 #endif
50
51 #include "img_defs.h"
52 #include "rgxscript.h"
53 #include "rgx_firmware_processor.h"
54 #include "rgxdefs_km.h"
55
56
57 typedef struct _RGX_SCRIPT_BUILD
58 {
59         IMG_UINT32 ui32MaxLen;
60         IMG_UINT32 ui32CurrComm;
61         IMG_BOOL bOutOfSpace;
62         RGX_INIT_COMMAND *psCommands;
63 } RGX_SCRIPT_BUILD;
64
65
66 /*!
67 *******************************************************************************
68
69  @Function      ScriptWriteRGXReg
70
71  @Description   Sets up a script entry for register write
72
73  @Input         psScript
74  @Input         ui32Offset
75  @Input         ui32Value
76
77  @Return        IMG_BOOL
78
79 ******************************************************************************/
80 IMG_INTERNAL
81 IMG_BOOL ScriptWriteRGXReg(RGX_SCRIPT_BUILD *psScript,
82                            IMG_UINT32 ui32Offset,
83                            IMG_UINT32 ui32Value);
84
85 /*!
86 *******************************************************************************
87
88  @Function      ScriptPoll64RGXReg
89
90  @Description   Sets up a script entry for register poll
91
92  @Input         psScript
93  @Input         ui32Offset
94  @Input         ui32Value
95  @Input         ui32PollMask
96
97  @Return        IMG_BOOL
98
99 ******************************************************************************/
100 IMG_INTERNAL
101 IMG_BOOL ScriptPoll64RGXReg(RGX_SCRIPT_BUILD *psScript,
102                             IMG_UINT32 ui32Offset,
103                             IMG_UINT64 ui64Value,
104                             IMG_UINT64 ui64PollMask);
105
106 /*!
107 *******************************************************************************
108
109  @Function      ScriptPollRGXReg
110
111  @Description   Sets up a script entry for register poll
112
113  @Input         psScript
114  @Input         ui32Offset
115  @Input         ui32Value
116  @Input         ui32PollMask
117
118  @Return        IMG_BOOL
119
120 ******************************************************************************/
121 IMG_INTERNAL
122 IMG_BOOL ScriptPollRGXReg(RGX_SCRIPT_BUILD *psScript,
123                           IMG_UINT32 ui32Offset,
124                           IMG_UINT32 ui32Value,
125                           IMG_UINT32 ui32PollMask);
126
127 /*!
128 *******************************************************************************
129
130  @Function      ScriptDBGReadRGXReg
131
132  @Description   Sets up a script entry for register setup
133
134  @Input         psScript
135  @Input         eOp
136  @Input         ui32Offset
137  @Input         ui32Value
138
139  @Return        IMG_BOOL
140
141 ******************************************************************************/
142 IMG_INTERNAL
143 IMG_BOOL ScriptDBGReadRGXReg(RGX_SCRIPT_BUILD *psScript,
144                              RGX_INIT_OPERATION eOp,
145                              IMG_UINT32 ui32Offset,
146                              IMG_CHAR *pszName);
147
148 /*!
149 *******************************************************************************
150
151  @Function      ScriptDBGCalc
152
153  @Description   Sets up a script for calculation
154
155  @Input         psScript
156  @Input         eOp
157  @Input         ui32Offset1
158  @Input         ui32Offset2
159  @Input         ui32Offset3
160
161  @Return        IMG_BOOL
162
163 ******************************************************************************/
164 IMG_INTERNAL
165 IMG_BOOL ScriptDBGCalc(RGX_SCRIPT_BUILD *psScript,
166                        RGX_INIT_OPERATION eOp,
167                        IMG_UINT32 ui32Offset1,
168                        IMG_UINT32 ui32Offset2,
169                        IMG_UINT32 ui32Offset3,
170                        IMG_CHAR *pszName);
171
172
173 #if defined(RGX_FEATURE_META) || defined(SUPPORT_KERNEL_SRVINIT)
174 /*!
175 *******************************************************************************
176
177  @Function      ScriptWriteRGXReg
178
179  @Description   Sets up a script entry for register setup
180
181  @Input         psScript
182  @Input         ui32Offset
183  @Input         ui32Value
184
185  @Return        IMG_BOOL
186
187 ******************************************************************************/
188 IMG_INTERNAL
189 IMG_BOOL ScriptWriteRGXRegPDUMPOnly(RGX_SCRIPT_BUILD *psScript,
190                                     IMG_UINT32 ui32Offset,
191                                     IMG_UINT32 ui32Value);
192
193 /*!
194 *******************************************************************************
195
196  @Function      ScriptDBGReadMetaRegThroughSP
197
198  @Description   Add script entries for reading a reg through Meta slave port
199
200  @Input         psScript
201  @Input         ui32RegAddr
202  @Input         pszName
203
204  @Return        IMG_BOOL
205
206 ******************************************************************************/
207 IMG_INTERNAL
208 IMG_BOOL ScriptDBGReadMetaRegThroughSP(RGX_SCRIPT_BUILD *psScript,
209                                        IMG_UINT32 ui32RegAddr,
210                                        IMG_CHAR *pszName);
211
212 /*!
213 *******************************************************************************
214
215  @Function      ScriptDBGReadMetaRegThroughSP
216
217  @Description   Add script entries for polling a reg through Meta slave port
218
219  @Input         psScript
220  @Input         ui32RegAddr
221  @Input         pszName
222
223  @Return        IMG_BOOL
224
225 ******************************************************************************/
226 IMG_INTERNAL
227 IMG_BOOL ScriptMetaRegCondPollRGXReg(RGX_SCRIPT_BUILD *psScript,
228                                      IMG_UINT32 ui32MetaRegAddr,
229                                      IMG_UINT32 ui32MetaRegValue,
230                                      IMG_UINT32 ui32MetaRegMask,
231                                      IMG_UINT32 ui32RegAddr,
232                                      IMG_UINT32 ui32RegValue,
233                                      IMG_UINT32 ui32RegMask);
234
235 /*!
236 *******************************************************************************
237
238  @Function      ScriptWriteMetaRegThroughSP
239
240  @Description   Add script entries for writing a reg through Meta slave port
241
242  @Input         psScript
243  @Input         ui32RegAddr
244  @Input         pszName
245
246  @Return        IMG_BOOL
247
248 ******************************************************************************/
249 IMG_INTERNAL
250 IMG_BOOL ScriptWriteMetaRegThroughSP(RGX_SCRIPT_BUILD *psScript,
251                                      IMG_UINT32 ui32RegAddr,
252                                      IMG_UINT32 ui32RegValue);
253
254 /*!
255 *******************************************************************************
256
257  @Function      ScriptPollMetaRegThroughSP
258
259  @Description   Polls a Core Garten register through the slave port
260
261  @Input         psScript
262
263  @Return        void
264
265 ******************************************************************************/
266 IMG_INTERNAL
267 IMG_BOOL ScriptPollMetaRegThroughSP(RGX_SCRIPT_BUILD *psScript,
268                                     IMG_UINT32 ui32Offset,
269                                     IMG_UINT32 ui32PollValue,
270                                     IMG_UINT32 ui32PollMask);
271
272 /*!
273 *******************************************************************************
274
275  @Function      ScriptDBGReadMetaRegThroughSP
276
277  @Description   Adds script entries reading a reg through Meta slave port
278
279  @Input         psScript
280  @Input         ui32RegAddr
281  @Input         pszName
282
283  @Return        IMG_BOOL
284
285 ******************************************************************************/
286 IMG_INTERNAL
287 IMG_BOOL ScriptDBGReadMetaCoreReg(RGX_SCRIPT_BUILD *psScript,
288                                   IMG_UINT32 ui32RegAddr,
289                                   IMG_CHAR *pszName);
290 #endif /* RGX_FEATURE_META */
291
292
293 /*!
294 *******************************************************************************
295
296  @Function      ScriptDBGString
297
298  @Description   Adds a debug print to the script
299
300  @Input         psScript
301  @Input         pszName
302
303  @Return        IMG_BOOL
304
305 ******************************************************************************/
306
307 IMG_INTERNAL
308 IMG_BOOL ScriptDBGString(RGX_SCRIPT_BUILD *psScript,
309                          const IMG_CHAR *aszString);
310
311
312 /*!
313 *******************************************************************************
314
315  @Function      ScriptHalt
316
317  @Description   Add a cmd to finish the script
318
319  @Input         psScript
320
321  @Return        IMG_BOOL True if it runs out of cmds when building the script
322
323 ******************************************************************************/
324 IMG_INTERNAL
325 IMG_BOOL ScriptHalt(RGX_SCRIPT_BUILD *psScript);
326
327
328 #if defined (__cplusplus)
329 }
330 #endif
331
332 #endif /* __RGXSRVINIT_SCRIPT_H__ */
333