RK3368 GPU: Rogue N Init.
[firefly-linux-kernel-4.4.55.git] / drivers / staging / imgtec / rogue / generated / pdumpmm_bridge / client_pdumpmm_direct_bridge.c
1 /*************************************************************************/ /*!
2 @Title          Direct client bridge for pdumpmm
3 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
4 @License        Dual MIT/GPLv2
5
6 The contents of this file are subject to the MIT license as set out below.
7
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
14
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
17
18 Alternatively, the contents of this file may be used under the terms of
19 the GNU General Public License Version 2 ("GPL") in which case the provisions
20 of GPL are applicable instead of those above.
21
22 If you wish to allow use of your version of this file only under the terms of
23 GPL, and not to allow others to use your version of this file under the terms
24 of the MIT license, indicate your decision by deleting the provisions above
25 and replace them with the notice and other provisions required by GPL as set
26 out in the file called "GPL-COPYING" included in this distribution. If you do
27 not delete the provisions above, a recipient may use your version of this file
28 under the terms of either the MIT license or GPL.
29
30 This License is also included in this distribution in the file called
31 "MIT-COPYING".
32
33 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
34 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
35 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
36 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
37 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
38 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
39 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
40 */ /**************************************************************************/
41
42 #include "client_pdumpmm_bridge.h"
43 #include "img_defs.h"
44 #include "pvr_debug.h"
45
46 /* Module specific includes */
47 #include "pdump.h"
48 #include "pdumpdefs.h"
49 #include "pvrsrv_memallocflags.h"
50 #include "devicemem_typedefs.h"
51
52 #include "devicemem_server.h"
53 #include "pmr.h"
54 #include "physmem.h"
55
56
57 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgePMRPDumpLoadMem(IMG_HANDLE hBridge,
58                                                              IMG_HANDLE hPMR,
59                                                              IMG_DEVMEM_OFFSET_T uiOffset,
60                                                              IMG_DEVMEM_SIZE_T uiSize,
61                                                              IMG_UINT32 ui32PDumpFlags,
62                                                              IMG_BOOL bbZero)
63 {
64         PVRSRV_ERROR eError;
65         PMR * psPMRInt;
66         PVR_UNREFERENCED_PARAMETER(hBridge);
67
68         psPMRInt = (PMR *) hPMR;
69
70         eError =
71                 PMRPDumpLoadMem(
72                                         psPMRInt,
73                                         uiOffset,
74                                         uiSize,
75                                         ui32PDumpFlags,
76                                         bbZero);
77
78         return eError;
79 }
80
81 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgePMRPDumpLoadMemValue32(IMG_HANDLE hBridge,
82                                                                     IMG_HANDLE hPMR,
83                                                                     IMG_DEVMEM_OFFSET_T uiOffset,
84                                                                     IMG_UINT32 ui32Value,
85                                                                     IMG_UINT32 ui32PDumpFlags)
86 {
87         PVRSRV_ERROR eError;
88         PMR * psPMRInt;
89         PVR_UNREFERENCED_PARAMETER(hBridge);
90
91         psPMRInt = (PMR *) hPMR;
92
93         eError =
94                 PMRPDumpLoadMemValue32(
95                                         psPMRInt,
96                                         uiOffset,
97                                         ui32Value,
98                                         ui32PDumpFlags);
99
100         return eError;
101 }
102
103 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgePMRPDumpLoadMemValue64(IMG_HANDLE hBridge,
104                                                                     IMG_HANDLE hPMR,
105                                                                     IMG_DEVMEM_OFFSET_T uiOffset,
106                                                                     IMG_UINT64 ui64Value,
107                                                                     IMG_UINT32 ui32PDumpFlags)
108 {
109         PVRSRV_ERROR eError;
110         PMR * psPMRInt;
111         PVR_UNREFERENCED_PARAMETER(hBridge);
112
113         psPMRInt = (PMR *) hPMR;
114
115         eError =
116                 PMRPDumpLoadMemValue64(
117                                         psPMRInt,
118                                         uiOffset,
119                                         ui64Value,
120                                         ui32PDumpFlags);
121
122         return eError;
123 }
124
125 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgePMRPDumpSaveToFile(IMG_HANDLE hBridge,
126                                                                 IMG_HANDLE hPMR,
127                                                                 IMG_DEVMEM_OFFSET_T uiOffset,
128                                                                 IMG_DEVMEM_SIZE_T uiSize,
129                                                                 IMG_UINT32 ui32ArraySize,
130                                                                 const IMG_CHAR *puiFileName,
131                                                                 IMG_UINT32 ui32uiFileOffset)
132 {
133         PVRSRV_ERROR eError;
134         PMR * psPMRInt;
135         PVR_UNREFERENCED_PARAMETER(hBridge);
136
137         psPMRInt = (PMR *) hPMR;
138
139         eError =
140                 PMRPDumpSaveToFile(
141                                         psPMRInt,
142                                         uiOffset,
143                                         uiSize,
144                                         ui32ArraySize,
145                                         puiFileName,
146                                         ui32uiFileOffset);
147
148         return eError;
149 }
150
151 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgePMRPDumpSymbolicAddr(IMG_HANDLE hBridge,
152                                                                   IMG_HANDLE hPMR,
153                                                                   IMG_DEVMEM_OFFSET_T uiOffset,
154                                                                   IMG_UINT32 ui32MemspaceNameLen,
155                                                                   IMG_CHAR *puiMemspaceName,
156                                                                   IMG_UINT32 ui32SymbolicAddrLen,
157                                                                   IMG_CHAR *puiSymbolicAddr,
158                                                                   IMG_DEVMEM_OFFSET_T *puiNewOffset,
159                                                                   IMG_DEVMEM_OFFSET_T *puiNextSymName)
160 {
161         PVRSRV_ERROR eError;
162         PMR * psPMRInt;
163         PVR_UNREFERENCED_PARAMETER(hBridge);
164
165         psPMRInt = (PMR *) hPMR;
166
167         eError =
168                 PMR_PDumpSymbolicAddr(
169                                         psPMRInt,
170                                         uiOffset,
171                                         ui32MemspaceNameLen,
172                                         puiMemspaceName,
173                                         ui32SymbolicAddrLen,
174                                         puiSymbolicAddr,
175                                         puiNewOffset,
176                                         puiNextSymName);
177
178         return eError;
179 }
180
181 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgePMRPDumpPol32(IMG_HANDLE hBridge,
182                                                            IMG_HANDLE hPMR,
183                                                            IMG_DEVMEM_OFFSET_T uiOffset,
184                                                            IMG_UINT32 ui32Value,
185                                                            IMG_UINT32 ui32Mask,
186                                                            PDUMP_POLL_OPERATOR eOperator,
187                                                            IMG_UINT32 ui32PDumpFlags)
188 {
189         PVRSRV_ERROR eError;
190         PMR * psPMRInt;
191         PVR_UNREFERENCED_PARAMETER(hBridge);
192
193         psPMRInt = (PMR *) hPMR;
194
195         eError =
196                 PMRPDumpPol32(
197                                         psPMRInt,
198                                         uiOffset,
199                                         ui32Value,
200                                         ui32Mask,
201                                         eOperator,
202                                         ui32PDumpFlags);
203
204         return eError;
205 }
206
207 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgePMRPDumpCBP(IMG_HANDLE hBridge,
208                                                          IMG_HANDLE hPMR,
209                                                          IMG_DEVMEM_OFFSET_T uiReadOffset,
210                                                          IMG_DEVMEM_OFFSET_T uiWriteOffset,
211                                                          IMG_DEVMEM_SIZE_T uiPacketSize,
212                                                          IMG_DEVMEM_SIZE_T uiBufferSize)
213 {
214         PVRSRV_ERROR eError;
215         PMR * psPMRInt;
216         PVR_UNREFERENCED_PARAMETER(hBridge);
217
218         psPMRInt = (PMR *) hPMR;
219
220         eError =
221                 PMRPDumpCBP(
222                                         psPMRInt,
223                                         uiReadOffset,
224                                         uiWriteOffset,
225                                         uiPacketSize,
226                                         uiBufferSize);
227
228         return eError;
229 }
230
231 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgeDevmemIntPDumpSaveToFileVirtual(IMG_HANDLE hBridge,
232                                                                              IMG_HANDLE hDevmemServerContext,
233                                                                              IMG_DEV_VIRTADDR sAddress,
234                                                                              IMG_DEVMEM_SIZE_T uiSize,
235                                                                              IMG_UINT32 ui32ArraySize,
236                                                                              const IMG_CHAR *puiFileName,
237                                                                              IMG_UINT32 ui32FileOffset,
238                                                                              IMG_UINT32 ui32PDumpFlags)
239 {
240         PVRSRV_ERROR eError;
241         DEVMEMINT_CTX * psDevmemServerContextInt;
242         PVR_UNREFERENCED_PARAMETER(hBridge);
243
244         psDevmemServerContextInt = (DEVMEMINT_CTX *) hDevmemServerContext;
245
246         eError =
247                 DevmemIntPDumpSaveToFileVirtual(
248                                         psDevmemServerContextInt,
249                                         sAddress,
250                                         uiSize,
251                                         ui32ArraySize,
252                                         puiFileName,
253                                         ui32FileOffset,
254                                         ui32PDumpFlags);
255
256         return eError;
257 }
258