RK3368 GPU: Rogue N Init.
[firefly-linux-kernel-4.4.55.git] / drivers / staging / imgtec / rogue / generated / mm_bridge / client_mm_direct_bridge.c
1 /*************************************************************************/ /*!
2 @Title          Direct client bridge for mm
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_mm_bridge.h"
43 #include "img_defs.h"
44 #include "pvr_debug.h"
45
46 /* Module specific includes */
47 #include "pvrsrv_memallocflags.h"
48 #include "devicemem_typedefs.h"
49
50 #include "devicemem.h"
51 #include "devicemem_server.h"
52 #include "pmr.h"
53 #include "devicemem_heapcfg.h"
54 #include "physmem.h"
55
56
57 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgePMRExportPMR(IMG_HANDLE hBridge,
58                                                           IMG_HANDLE hPMR,
59                                                           IMG_HANDLE *phPMRExport,
60                                                           IMG_UINT64 *pui64Size,
61                                                           IMG_UINT32 *pui32Log2Contig,
62                                                           IMG_UINT64 *pui64Password)
63 {
64         PVRSRV_ERROR eError;
65         PMR * psPMRInt;
66         PMR_EXPORT * psPMRExportInt;
67         PVR_UNREFERENCED_PARAMETER(hBridge);
68
69         psPMRInt = (PMR *) hPMR;
70
71         eError =
72                 PMRExportPMR(
73                                         psPMRInt,
74                                         &psPMRExportInt,
75                                         pui64Size,
76                                         pui32Log2Contig,
77                                         pui64Password);
78
79         *phPMRExport = psPMRExportInt;
80         return eError;
81 }
82
83 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgePMRUnexportPMR(IMG_HANDLE hBridge,
84                                                             IMG_HANDLE hPMRExport)
85 {
86         PVRSRV_ERROR eError;
87         PMR_EXPORT * psPMRExportInt;
88         PVR_UNREFERENCED_PARAMETER(hBridge);
89
90         psPMRExportInt = (PMR_EXPORT *) hPMRExport;
91
92         eError =
93                 PMRUnexportPMR(
94                                         psPMRExportInt);
95
96         return eError;
97 }
98
99 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgePMRGetUID(IMG_HANDLE hBridge,
100                                                        IMG_HANDLE hPMR,
101                                                        IMG_UINT64 *pui64UID)
102 {
103         PVRSRV_ERROR eError;
104         PMR * psPMRInt;
105         PVR_UNREFERENCED_PARAMETER(hBridge);
106
107         psPMRInt = (PMR *) hPMR;
108
109         eError =
110                 PMRGetUID(
111                                         psPMRInt,
112                                         pui64UID);
113
114         return eError;
115 }
116
117 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgePMRMakeLocalImportHandle(IMG_HANDLE hBridge,
118                                                                       IMG_HANDLE hBuffer,
119                                                                       IMG_HANDLE *phExtMem)
120 {
121         PVRSRV_ERROR eError;
122         PMR * psBufferInt;
123         PMR * psExtMemInt;
124         PVR_UNREFERENCED_PARAMETER(hBridge);
125
126         psBufferInt = (PMR *) hBuffer;
127
128         eError =
129                 PMRMakeLocalImportHandle(
130                                         psBufferInt,
131                                         &psExtMemInt);
132
133         *phExtMem = psExtMemInt;
134         return eError;
135 }
136
137 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgePMRUnmakeLocalImportHandle(IMG_HANDLE hBridge,
138                                                                         IMG_HANDLE hExtMem)
139 {
140         PVRSRV_ERROR eError;
141         PMR * psExtMemInt;
142         PVR_UNREFERENCED_PARAMETER(hBridge);
143
144         psExtMemInt = (PMR *) hExtMem;
145
146         eError =
147                 PMRUnmakeLocalImportHandle(
148                                         psExtMemInt);
149
150         return eError;
151 }
152
153 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgePMRImportPMR(IMG_HANDLE hBridge,
154                                                           IMG_HANDLE hPMRExport,
155                                                           IMG_UINT64 ui64uiPassword,
156                                                           IMG_UINT64 ui64uiSize,
157                                                           IMG_UINT32 ui32uiLog2Contig,
158                                                           IMG_HANDLE *phPMR)
159 {
160         PVRSRV_ERROR eError;
161         PMR_EXPORT * psPMRExportInt;
162         PMR * psPMRInt;
163
164         psPMRExportInt = (PMR_EXPORT *) hPMRExport;
165
166         eError =
167                 PMRImportPMR(NULL, (PVRSRV_DEVICE_NODE *)((void*) hBridge)
168                 ,
169                                         psPMRExportInt,
170                                         ui64uiPassword,
171                                         ui64uiSize,
172                                         ui32uiLog2Contig,
173                                         &psPMRInt);
174
175         *phPMR = psPMRInt;
176         return eError;
177 }
178
179 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgePMRLocalImportPMR(IMG_HANDLE hBridge,
180                                                                IMG_HANDLE hExtHandle,
181                                                                IMG_HANDLE *phPMR,
182                                                                IMG_DEVMEM_SIZE_T *puiSize,
183                                                                IMG_DEVMEM_ALIGN_T *psAlign)
184 {
185         PVRSRV_ERROR eError;
186         PMR * psExtHandleInt;
187         PMR * psPMRInt;
188         PVR_UNREFERENCED_PARAMETER(hBridge);
189
190         psExtHandleInt = (PMR *) hExtHandle;
191
192         eError =
193                 PMRLocalImportPMR(
194                                         psExtHandleInt,
195                                         &psPMRInt,
196                                         puiSize,
197                                         psAlign);
198
199         *phPMR = psPMRInt;
200         return eError;
201 }
202
203 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgePMRUnrefPMR(IMG_HANDLE hBridge,
204                                                          IMG_HANDLE hPMR)
205 {
206         PVRSRV_ERROR eError;
207         PMR * psPMRInt;
208         PVR_UNREFERENCED_PARAMETER(hBridge);
209
210         psPMRInt = (PMR *) hPMR;
211
212         eError =
213                 PMRUnrefPMR(
214                                         psPMRInt);
215
216         return eError;
217 }
218
219 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgePMRUnrefUnlockPMR(IMG_HANDLE hBridge,
220                                                                IMG_HANDLE hPMR)
221 {
222         PVRSRV_ERROR eError;
223         PMR * psPMRInt;
224         PVR_UNREFERENCED_PARAMETER(hBridge);
225
226         psPMRInt = (PMR *) hPMR;
227
228         eError =
229                 PMRUnrefUnlockPMR(
230                                         psPMRInt);
231
232         return eError;
233 }
234
235 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgePhysmemNewRamBackedPMR(IMG_HANDLE hBridge,
236                                                                     IMG_DEVMEM_SIZE_T uiSize,
237                                                                     IMG_DEVMEM_SIZE_T uiChunkSize,
238                                                                     IMG_UINT32 ui32NumPhysChunks,
239                                                                     IMG_UINT32 ui32NumVirtChunks,
240                                                                     IMG_UINT32 *pui32MappingTable,
241                                                                     IMG_UINT32 ui32Log2PageSize,
242                                                                     PVRSRV_MEMALLOCFLAGS_T uiFlags,
243                                                                     IMG_UINT32 ui32AnnotationLength,
244                                                                     const IMG_CHAR *puiAnnotation,
245                                                                     IMG_HANDLE *phPMRPtr)
246 {
247         PVRSRV_ERROR eError;
248         PMR * psPMRPtrInt;
249
250
251         eError =
252                 PhysmemNewRamBackedPMR(NULL, (PVRSRV_DEVICE_NODE *)((void*) hBridge)
253                 ,
254                                         uiSize,
255                                         uiChunkSize,
256                                         ui32NumPhysChunks,
257                                         ui32NumVirtChunks,
258                                         pui32MappingTable,
259                                         ui32Log2PageSize,
260                                         uiFlags,
261                                         ui32AnnotationLength,
262                                         puiAnnotation,
263                                         &psPMRPtrInt);
264
265         *phPMRPtr = psPMRPtrInt;
266         return eError;
267 }
268
269 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgePhysmemNewRamBackedLockedPMR(IMG_HANDLE hBridge,
270                                                                           IMG_DEVMEM_SIZE_T uiSize,
271                                                                           IMG_DEVMEM_SIZE_T uiChunkSize,
272                                                                           IMG_UINT32 ui32NumPhysChunks,
273                                                                           IMG_UINT32 ui32NumVirtChunks,
274                                                                           IMG_UINT32 *pui32MappingTable,
275                                                                           IMG_UINT32 ui32Log2PageSize,
276                                                                           PVRSRV_MEMALLOCFLAGS_T uiFlags,
277                                                                           IMG_UINT32 ui32AnnotationLength,
278                                                                           const IMG_CHAR *puiAnnotation,
279                                                                           IMG_HANDLE *phPMRPtr)
280 {
281         PVRSRV_ERROR eError;
282         PMR * psPMRPtrInt;
283
284
285         eError =
286                 PhysmemNewRamBackedLockedPMR(NULL, (PVRSRV_DEVICE_NODE *)((void*) hBridge)
287                 ,
288                                         uiSize,
289                                         uiChunkSize,
290                                         ui32NumPhysChunks,
291                                         ui32NumVirtChunks,
292                                         pui32MappingTable,
293                                         ui32Log2PageSize,
294                                         uiFlags,
295                                         ui32AnnotationLength,
296                                         puiAnnotation,
297                                         &psPMRPtrInt);
298
299         *phPMRPtr = psPMRPtrInt;
300         return eError;
301 }
302
303 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgeDevmemIntPin(IMG_HANDLE hBridge,
304                                                           IMG_HANDLE hPMR)
305 {
306         PVRSRV_ERROR eError;
307         PMR * psPMRInt;
308         PVR_UNREFERENCED_PARAMETER(hBridge);
309
310         psPMRInt = (PMR *) hPMR;
311
312         eError =
313                 DevmemIntPin(
314                                         psPMRInt);
315
316         return eError;
317 }
318
319 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgeDevmemIntUnpin(IMG_HANDLE hBridge,
320                                                             IMG_HANDLE hPMR)
321 {
322         PVRSRV_ERROR eError;
323         PMR * psPMRInt;
324         PVR_UNREFERENCED_PARAMETER(hBridge);
325
326         psPMRInt = (PMR *) hPMR;
327
328         eError =
329                 DevmemIntUnpin(
330                                         psPMRInt);
331
332         return eError;
333 }
334
335 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgeDevmemIntPinValidate(IMG_HANDLE hBridge,
336                                                                   IMG_HANDLE hMapping,
337                                                                   IMG_HANDLE hPMR)
338 {
339         PVRSRV_ERROR eError;
340         DEVMEMINT_MAPPING * psMappingInt;
341         PMR * psPMRInt;
342         PVR_UNREFERENCED_PARAMETER(hBridge);
343
344         psMappingInt = (DEVMEMINT_MAPPING *) hMapping;
345         psPMRInt = (PMR *) hPMR;
346
347         eError =
348                 DevmemIntPinValidate(
349                                         psMappingInt,
350                                         psPMRInt);
351
352         return eError;
353 }
354
355 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgeDevmemIntUnpinInvalidate(IMG_HANDLE hBridge,
356                                                                       IMG_HANDLE hMapping,
357                                                                       IMG_HANDLE hPMR)
358 {
359         PVRSRV_ERROR eError;
360         DEVMEMINT_MAPPING * psMappingInt;
361         PMR * psPMRInt;
362         PVR_UNREFERENCED_PARAMETER(hBridge);
363
364         psMappingInt = (DEVMEMINT_MAPPING *) hMapping;
365         psPMRInt = (PMR *) hPMR;
366
367         eError =
368                 DevmemIntUnpinInvalidate(
369                                         psMappingInt,
370                                         psPMRInt);
371
372         return eError;
373 }
374
375 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgeDevmemIntCtxCreate(IMG_HANDLE hBridge,
376                                                                 IMG_BOOL bbKernelMemoryCtx,
377                                                                 IMG_HANDLE *phDevMemServerContext,
378                                                                 IMG_HANDLE *phPrivData,
379                                                                 IMG_UINT32 *pui32CPUCacheLineSize)
380 {
381         PVRSRV_ERROR eError;
382         DEVMEMINT_CTX * psDevMemServerContextInt;
383         IMG_HANDLE hPrivDataInt;
384
385
386         eError =
387                 DevmemIntCtxCreate(NULL, (PVRSRV_DEVICE_NODE *)((void*) hBridge)
388                 ,
389                                         bbKernelMemoryCtx,
390                                         &psDevMemServerContextInt,
391                                         &hPrivDataInt,
392                                         pui32CPUCacheLineSize);
393
394         *phDevMemServerContext = psDevMemServerContextInt;
395         *phPrivData = hPrivDataInt;
396         return eError;
397 }
398
399 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgeDevmemIntCtxDestroy(IMG_HANDLE hBridge,
400                                                                  IMG_HANDLE hDevmemServerContext)
401 {
402         PVRSRV_ERROR eError;
403         DEVMEMINT_CTX * psDevmemServerContextInt;
404         PVR_UNREFERENCED_PARAMETER(hBridge);
405
406         psDevmemServerContextInt = (DEVMEMINT_CTX *) hDevmemServerContext;
407
408         eError =
409                 DevmemIntCtxDestroy(
410                                         psDevmemServerContextInt);
411
412         return eError;
413 }
414
415 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgeDevmemIntHeapCreate(IMG_HANDLE hBridge,
416                                                                  IMG_HANDLE hDevmemCtx,
417                                                                  IMG_DEV_VIRTADDR sHeapBaseAddr,
418                                                                  IMG_DEVMEM_SIZE_T uiHeapLength,
419                                                                  IMG_UINT32 ui32Log2DataPageSize,
420                                                                  IMG_HANDLE *phDevmemHeapPtr)
421 {
422         PVRSRV_ERROR eError;
423         DEVMEMINT_CTX * psDevmemCtxInt;
424         DEVMEMINT_HEAP * psDevmemHeapPtrInt;
425         PVR_UNREFERENCED_PARAMETER(hBridge);
426
427         psDevmemCtxInt = (DEVMEMINT_CTX *) hDevmemCtx;
428
429         eError =
430                 DevmemIntHeapCreate(
431                                         psDevmemCtxInt,
432                                         sHeapBaseAddr,
433                                         uiHeapLength,
434                                         ui32Log2DataPageSize,
435                                         &psDevmemHeapPtrInt);
436
437         *phDevmemHeapPtr = psDevmemHeapPtrInt;
438         return eError;
439 }
440
441 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgeDevmemIntHeapDestroy(IMG_HANDLE hBridge,
442                                                                   IMG_HANDLE hDevmemHeap)
443 {
444         PVRSRV_ERROR eError;
445         DEVMEMINT_HEAP * psDevmemHeapInt;
446         PVR_UNREFERENCED_PARAMETER(hBridge);
447
448         psDevmemHeapInt = (DEVMEMINT_HEAP *) hDevmemHeap;
449
450         eError =
451                 DevmemIntHeapDestroy(
452                                         psDevmemHeapInt);
453
454         return eError;
455 }
456
457 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgeDevmemIntMapPMR(IMG_HANDLE hBridge,
458                                                              IMG_HANDLE hDevmemServerHeap,
459                                                              IMG_HANDLE hReservation,
460                                                              IMG_HANDLE hPMR,
461                                                              PVRSRV_MEMALLOCFLAGS_T uiMapFlags,
462                                                              IMG_HANDLE *phMapping)
463 {
464         PVRSRV_ERROR eError;
465         DEVMEMINT_HEAP * psDevmemServerHeapInt;
466         DEVMEMINT_RESERVATION * psReservationInt;
467         PMR * psPMRInt;
468         DEVMEMINT_MAPPING * psMappingInt;
469         PVR_UNREFERENCED_PARAMETER(hBridge);
470
471         psDevmemServerHeapInt = (DEVMEMINT_HEAP *) hDevmemServerHeap;
472         psReservationInt = (DEVMEMINT_RESERVATION *) hReservation;
473         psPMRInt = (PMR *) hPMR;
474
475         eError =
476                 DevmemIntMapPMR(
477                                         psDevmemServerHeapInt,
478                                         psReservationInt,
479                                         psPMRInt,
480                                         uiMapFlags,
481                                         &psMappingInt);
482
483         *phMapping = psMappingInt;
484         return eError;
485 }
486
487 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgeDevmemIntUnmapPMR(IMG_HANDLE hBridge,
488                                                                IMG_HANDLE hMapping)
489 {
490         PVRSRV_ERROR eError;
491         DEVMEMINT_MAPPING * psMappingInt;
492         PVR_UNREFERENCED_PARAMETER(hBridge);
493
494         psMappingInt = (DEVMEMINT_MAPPING *) hMapping;
495
496         eError =
497                 DevmemIntUnmapPMR(
498                                         psMappingInt);
499
500         return eError;
501 }
502
503 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgeDevmemIntReserveRange(IMG_HANDLE hBridge,
504                                                                    IMG_HANDLE hDevmemServerHeap,
505                                                                    IMG_DEV_VIRTADDR sAddress,
506                                                                    IMG_DEVMEM_SIZE_T uiLength,
507                                                                    IMG_HANDLE *phReservation)
508 {
509         PVRSRV_ERROR eError;
510         DEVMEMINT_HEAP * psDevmemServerHeapInt;
511         DEVMEMINT_RESERVATION * psReservationInt;
512         PVR_UNREFERENCED_PARAMETER(hBridge);
513
514         psDevmemServerHeapInt = (DEVMEMINT_HEAP *) hDevmemServerHeap;
515
516         eError =
517                 DevmemIntReserveRange(
518                                         psDevmemServerHeapInt,
519                                         sAddress,
520                                         uiLength,
521                                         &psReservationInt);
522
523         *phReservation = psReservationInt;
524         return eError;
525 }
526
527 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgeDevmemIntUnreserveRange(IMG_HANDLE hBridge,
528                                                                      IMG_HANDLE hReservation)
529 {
530         PVRSRV_ERROR eError;
531         DEVMEMINT_RESERVATION * psReservationInt;
532         PVR_UNREFERENCED_PARAMETER(hBridge);
533
534         psReservationInt = (DEVMEMINT_RESERVATION *) hReservation;
535
536         eError =
537                 DevmemIntUnreserveRange(
538                                         psReservationInt);
539
540         return eError;
541 }
542
543 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgeChangeSparseMem(IMG_HANDLE hBridge,
544                                                              IMG_HANDLE hSrvDevMemHeap,
545                                                              IMG_HANDLE hPMR,
546                                                              IMG_UINT32 ui32AllocPageCount,
547                                                              IMG_UINT32 *pui32AllocPageIndices,
548                                                              IMG_UINT32 ui32FreePageCount,
549                                                              IMG_UINT32 *pui32FreePageIndices,
550                                                              IMG_UINT32 ui32SparseFlags,
551                                                              PVRSRV_MEMALLOCFLAGS_T uiFlags,
552                                                              IMG_DEV_VIRTADDR sDevVAddr,
553                                                              IMG_UINT64 ui64CPUVAddr)
554 {
555         PVRSRV_ERROR eError;
556         DEVMEMINT_HEAP * psSrvDevMemHeapInt;
557         PMR * psPMRInt;
558         PVR_UNREFERENCED_PARAMETER(hBridge);
559
560         psSrvDevMemHeapInt = (DEVMEMINT_HEAP *) hSrvDevMemHeap;
561         psPMRInt = (PMR *) hPMR;
562
563         eError =
564                 DevmemIntChangeSparse(
565                                         psSrvDevMemHeapInt,
566                                         psPMRInt,
567                                         ui32AllocPageCount,
568                                         pui32AllocPageIndices,
569                                         ui32FreePageCount,
570                                         pui32FreePageIndices,
571                                         ui32SparseFlags,
572                                         uiFlags,
573                                         sDevVAddr,
574                                         ui64CPUVAddr);
575
576         return eError;
577 }
578
579 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgeDevmemIntMapPages(IMG_HANDLE hBridge,
580                                                                IMG_HANDLE hReservation,
581                                                                IMG_HANDLE hPMR,
582                                                                IMG_UINT32 ui32PageCount,
583                                                                IMG_UINT32 ui32PhysicalPgOffset,
584                                                                PVRSRV_MEMALLOCFLAGS_T uiFlags,
585                                                                IMG_DEV_VIRTADDR sDevVAddr)
586 {
587         PVRSRV_ERROR eError;
588         DEVMEMINT_RESERVATION * psReservationInt;
589         PMR * psPMRInt;
590         PVR_UNREFERENCED_PARAMETER(hBridge);
591
592         psReservationInt = (DEVMEMINT_RESERVATION *) hReservation;
593         psPMRInt = (PMR *) hPMR;
594
595         eError =
596                 DevmemIntMapPages(
597                                         psReservationInt,
598                                         psPMRInt,
599                                         ui32PageCount,
600                                         ui32PhysicalPgOffset,
601                                         uiFlags,
602                                         sDevVAddr);
603
604         return eError;
605 }
606
607 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgeDevmemIntUnmapPages(IMG_HANDLE hBridge,
608                                                                  IMG_HANDLE hReservation,
609                                                                  IMG_DEV_VIRTADDR sDevVAddr,
610                                                                  IMG_UINT32 ui32PageCount)
611 {
612         PVRSRV_ERROR eError;
613         DEVMEMINT_RESERVATION * psReservationInt;
614         PVR_UNREFERENCED_PARAMETER(hBridge);
615
616         psReservationInt = (DEVMEMINT_RESERVATION *) hReservation;
617
618         eError =
619                 DevmemIntUnmapPages(
620                                         psReservationInt,
621                                         sDevVAddr,
622                                         ui32PageCount);
623
624         return eError;
625 }
626
627 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgeDevmemIsVDevAddrValid(IMG_HANDLE hBridge,
628                                                                    IMG_HANDLE hDevmemCtx,
629                                                                    IMG_DEV_VIRTADDR sAddress)
630 {
631         PVRSRV_ERROR eError;
632         DEVMEMINT_CTX * psDevmemCtxInt;
633
634         psDevmemCtxInt = (DEVMEMINT_CTX *) hDevmemCtx;
635
636         eError =
637                 DevmemIntIsVDevAddrValid(NULL, (PVRSRV_DEVICE_NODE *)((void*) hBridge)
638                 ,
639                                         psDevmemCtxInt,
640                                         sAddress);
641
642         return eError;
643 }
644
645 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgeHeapCfgHeapConfigCount(IMG_HANDLE hBridge,
646                                                                     IMG_UINT32 *pui32NumHeapConfigs)
647 {
648         PVRSRV_ERROR eError;
649
650
651         eError =
652                 HeapCfgHeapConfigCount(NULL, (PVRSRV_DEVICE_NODE *)((void*) hBridge)
653                 ,
654                                         pui32NumHeapConfigs);
655
656         return eError;
657 }
658
659 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgeHeapCfgHeapCount(IMG_HANDLE hBridge,
660                                                               IMG_UINT32 ui32HeapConfigIndex,
661                                                               IMG_UINT32 *pui32NumHeaps)
662 {
663         PVRSRV_ERROR eError;
664
665
666         eError =
667                 HeapCfgHeapCount(NULL, (PVRSRV_DEVICE_NODE *)((void*) hBridge)
668                 ,
669                                         ui32HeapConfigIndex,
670                                         pui32NumHeaps);
671
672         return eError;
673 }
674
675 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgeHeapCfgHeapConfigName(IMG_HANDLE hBridge,
676                                                                    IMG_UINT32 ui32HeapConfigIndex,
677                                                                    IMG_UINT32 ui32HeapConfigNameBufSz,
678                                                                    IMG_CHAR *puiHeapConfigName)
679 {
680         PVRSRV_ERROR eError;
681
682
683         eError =
684                 HeapCfgHeapConfigName(NULL, (PVRSRV_DEVICE_NODE *)((void*) hBridge)
685                 ,
686                                         ui32HeapConfigIndex,
687                                         ui32HeapConfigNameBufSz,
688                                         puiHeapConfigName);
689
690         return eError;
691 }
692
693 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgeHeapCfgHeapDetails(IMG_HANDLE hBridge,
694                                                                 IMG_UINT32 ui32HeapConfigIndex,
695                                                                 IMG_UINT32 ui32HeapIndex,
696                                                                 IMG_UINT32 ui32HeapNameBufSz,
697                                                                 IMG_CHAR *puiHeapNameOut,
698                                                                 IMG_DEV_VIRTADDR *psDevVAddrBase,
699                                                                 IMG_DEVMEM_SIZE_T *puiHeapLength,
700                                                                 IMG_UINT32 *pui32Log2DataPageSizeOut,
701                                                                 IMG_UINT32 *pui32Log2ImportAlignmentOut)
702 {
703         PVRSRV_ERROR eError;
704
705
706         eError =
707                 HeapCfgHeapDetails(NULL, (PVRSRV_DEVICE_NODE *)((void*) hBridge)
708                 ,
709                                         ui32HeapConfigIndex,
710                                         ui32HeapIndex,
711                                         ui32HeapNameBufSz,
712                                         puiHeapNameOut,
713                                         psDevVAddrBase,
714                                         puiHeapLength,
715                                         pui32Log2DataPageSizeOut,
716                                         pui32Log2ImportAlignmentOut);
717
718         return eError;
719 }
720
721 IMG_INTERNAL PVRSRV_ERROR IMG_CALLCONV BridgeDevmemIntRegisterPFNotifyKM(IMG_HANDLE hBridge,
722                                                                          IMG_HANDLE hDevmemCtx,
723                                                                          IMG_UINT32 ui32PID,
724                                                                          IMG_BOOL bRegister)
725 {
726         PVRSRV_ERROR eError;
727         DEVMEMINT_CTX * psDevmemCtxInt;
728         PVR_UNREFERENCED_PARAMETER(hBridge);
729
730         psDevmemCtxInt = (DEVMEMINT_CTX *) hDevmemCtx;
731
732         eError =
733                 DevmemIntRegisterPFNotifyKM(
734                                         psDevmemCtxInt,
735                                         ui32PID,
736                                         bRegister);
737
738         return eError;
739 }
740