RK3368 GPU: Rogue N Init.
[firefly-linux-kernel-4.4.55.git] / drivers / staging / imgtec / rogue / rgxutils.h
1 /*************************************************************************/ /*!
2 @File
3 @Title          Device specific utility routines declarations
4 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description    Inline functions/structures specific to RGX
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 #include "device.h"
45 #include "rgxdevice.h"
46 #include "rgxdebug.h"
47 #include "pvr_notifier.h"
48 #include "pvrsrv.h"
49
50 /*!
51 ******************************************************************************
52
53  @Function      RGXQueryAPMState
54
55  @Description   Query the state of the APM configuration
56
57  @Input         psDeviceNode : The device node
58
59  @Input         pvPrivateData: Unused (required for AppHint callback)
60
61  @Output        pui32State   : The APM configuration state
62
63  @Return        PVRSRV_ERROR
64
65 ******************************************************************************/
66 PVRSRV_ERROR RGXQueryAPMState(const PVRSRV_DEVICE_NODE *psDeviceNode,
67         const void *pvPrivateData,
68         IMG_UINT32 *pui32State);
69
70 /*!
71 ******************************************************************************
72
73  @Function      RGXSetAPMState
74
75  @Description   Set the APM configuration state. Currently only 'OFF' is
76                 supported
77
78  @Input         psDeviceNode : The device node
79
80  @Input         pvPrivateData: Unused (required for AppHint callback)
81
82  @Input         ui32State    : The requested APM configuration state
83
84  @Return        PVRSRV_ERROR
85
86 ******************************************************************************/
87 PVRSRV_ERROR RGXSetAPMState(const PVRSRV_DEVICE_NODE *psDeviceNode,
88         const void *pvPrivateData,
89         IMG_UINT32 ui32State);
90
91 /*!
92 ******************************************************************************
93
94  @Function      RGXQueryPdumpPanicEnable
95
96  @Description   Get the PDump Panic Enable configuration state.
97
98  @Input         psDeviceNode : The device node
99
100  @Input         pvPrivateData: Unused (required for AppHint callback)
101
102  @Input         pbEnabled    : IMG_TRUE if PDump Panic is enabled
103
104  @Return        PVRSRV_ERROR
105
106 ******************************************************************************/
107 PVRSRV_ERROR RGXQueryPdumpPanicEnable(const PVRSRV_DEVICE_NODE *psDeviceNode,
108         const void *pvPrivateData,
109         IMG_BOOL *pbEnabled);
110
111 /*!
112 ******************************************************************************
113
114  @Function      RGXSetPdumpPanicEnable
115
116  @Description   Set the PDump Panic Enable flag
117
118  @Input         psDeviceNode : The device node
119
120  @Input         pvPrivateData: Unused (required for AppHint callback)
121
122  @Input         bEnable      : The requested configuration state
123
124  @Return        PVRSRV_ERROR
125
126 ******************************************************************************/
127 PVRSRV_ERROR RGXSetPdumpPanicEnable(const PVRSRV_DEVICE_NODE *psDeviceNode,
128         const void *pvPrivateData,
129         IMG_BOOL bEnable);
130
131 /*!
132 ******************************************************************************
133
134  @Function      RGXGetDeviceFlags
135
136  @Description   Get the device flags for a given device
137
138  @Input         psDevInfo        : The device descriptor query
139
140  @Output        pui32DeviceFlags : The current state of the device flags
141
142  @Return        PVRSRV_ERROR
143
144 ******************************************************************************/
145 PVRSRV_ERROR RGXGetDeviceFlags(PVRSRV_RGXDEV_INFO *psDevInfo,
146                                 IMG_UINT32 *pui32DeviceFlags);
147
148 /*!
149 ******************************************************************************
150
151  @Function      RGXSetDeviceFlags
152
153  @Description   Set the device flags for a given device
154
155  @Input         psDevInfo : The device descriptor to modify
156
157  @Input         ui32Config : The device flags to modify
158
159  @Input         bSetNotClear : Set or clear the specified flags
160
161  @Return        PVRSRV_ERROR
162
163 ******************************************************************************/
164 PVRSRV_ERROR RGXSetDeviceFlags(PVRSRV_RGXDEV_INFO *psDevInfo,
165                                 IMG_UINT32 ui32Config,
166                                 IMG_BOOL bSetNotClear);
167
168 /*!
169 ******************************************************************************
170
171  @Function      RGXRunScript
172
173  @Description Execute the commands in the script
174
175  @Input 
176
177  @Return   PVRSRV_ERROR
178
179 ******************************************************************************/
180 PVRSRV_ERROR RGXRunScript(PVRSRV_RGXDEV_INFO *psDevInfo,
181                                 RGX_INIT_COMMAND *psScript,
182                                 IMG_UINT32 ui32NumCommands,
183                                 IMG_UINT32 ui32PdumpFlags,
184                                 DUMPDEBUG_PRINTF_FUNC *pfnDumpDebugPrintf,
185                                 void *pvDumpDebugFile);
186
187 /*!
188 ******************************************************************************
189
190  @Function    RGXStringifyKickTypeDM
191
192  @Description Gives the kick type DM name stringified
193
194  @Input       Kick type DM
195
196  @Return      Array containing the kick type DM name
197
198 ******************************************************************************/
199 const char* RGXStringifyKickTypeDM(RGX_KICK_TYPE_DM eKickTypeDM);
200                                                                              
201 #define RGX_STRINGIFY_KICK_TYPE_DM_IF_SET(bitmask, eKickTypeDM) bitmask & eKickTypeDM ? RGXStringifyKickTypeDM(eKickTypeDM) : ""
202 /******************************************************************************
203  End of file (rgxutils.h)
204 ******************************************************************************/