1 /*************************************************************************/ /*!
3 @Title Server bridge for mm
4 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description Implements the server side of the bridge for mm
6 @License Dual MIT/GPLv2
8 The contents of this file are subject to the MIT license as set out below.
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:
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
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.
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.
32 This License is also included in this distribution in the file called
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 */ /**************************************************************************/
45 #include <asm/uaccess.h>
49 #include "devicemem_server.h"
51 #include "devicemem_heapcfg.h"
55 #include "common_mm_bridge.h"
58 #include "pvr_debug.h"
59 #include "connection_server.h"
60 #include "pvr_bridge.h"
61 #include "rgx_bridge.h"
65 #if defined (SUPPORT_AUTH)
69 #include <linux/slab.h>
72 static PVRSRV_ERROR ReleasePMRExport(IMG_VOID *pvData)
74 PVR_UNREFERENCED_PARAMETER(pvData);
78 static PVRSRV_ERROR ReleasePMRExportOut(IMG_VOID *pvData)
80 PVR_UNREFERENCED_PARAMETER(pvData);
86 /* ***************************************************************************
87 * Server-side bridge entry points
91 PVRSRVBridgePMRExportPMR(IMG_UINT32 ui32DispatchTableEntry,
92 PVRSRV_BRIDGE_IN_PMREXPORTPMR *psPMRExportPMRIN,
93 PVRSRV_BRIDGE_OUT_PMREXPORTPMR *psPMRExportPMROUT,
94 CONNECTION_DATA *psConnection)
96 PMR * psPMRInt = IMG_NULL;
97 PMR_EXPORT * psPMRExportInt = IMG_NULL;
98 IMG_HANDLE hPMRExportInt = IMG_NULL;
108 /* Look up the address from the handle */
109 psPMRExportPMROUT->eError =
110 PVRSRVLookupHandle(psConnection->psHandleBase,
111 (IMG_VOID **) &psPMRInt,
112 psPMRExportPMRIN->hPMR,
113 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR);
114 if(psPMRExportPMROUT->eError != PVRSRV_OK)
117 goto PMRExportPMR_exit;
122 psPMRExportPMROUT->eError =
126 &psPMRExportPMROUT->ui64Size,
127 &psPMRExportPMROUT->ui32Log2Contig,
128 &psPMRExportPMROUT->ui64Password);
129 /* Exit early if bridged call fails */
130 if(psPMRExportPMROUT->eError != PVRSRV_OK)
133 goto PMRExportPMR_exit;
139 * For cases where we need a cross process handle we actually allocate two.
141 * The first one is a connection specific handle and it gets given the real
142 * release function. This handle does *NOT* get returned to the caller. It's
143 * purpose is to release any leaked resources when we either have a bad or
144 * abnormally terminated client. If we didn't do this then the resource
145 * wouldn't be freed until driver unload. If the resource is freed normally,
146 * this handle can be looked up via the cross process handle and then
147 * released accordingly.
149 * The second one is a cross process handle and it gets given a noop release
150 * function. This handle does get returned to the caller.
152 psPMRExportPMROUT->eError = PVRSRVAllocHandle(psConnection->psHandleBase,
154 (IMG_VOID *) psPMRExportInt,
155 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR_EXPORT,
156 PVRSRV_HANDLE_ALLOC_FLAG_SHARED
157 ,(PFN_HANDLE_RELEASE)&PMRUnexportPMR);
158 if (psPMRExportPMROUT->eError != PVRSRV_OK)
160 goto PMRExportPMR_exit;
163 psPMRExportPMROUT->eError = PVRSRVAllocHandle(KERNEL_HANDLE_BASE,
164 &psPMRExportPMROUT->hPMRExport,
165 (IMG_VOID *) psPMRExportInt,
166 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR_EXPORT,
167 PVRSRV_HANDLE_ALLOC_FLAG_MULTI,
168 (PFN_HANDLE_RELEASE)&ReleasePMRExport);
169 if (psPMRExportPMROUT->eError != PVRSRV_OK)
171 goto PMRExportPMR_exit;
177 if (psPMRExportPMROUT->eError != PVRSRV_OK)
179 if (psPMRExportPMROUT->hPMRExport)
181 PVRSRV_ERROR eError = PVRSRVReleaseHandle(KERNEL_HANDLE_BASE,
182 (IMG_HANDLE) psPMRExportPMROUT->hPMRExport,
183 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR_EXPORT);
185 /* Releasing the handle should free/destroy/release the resource. This should never fail... */
186 PVR_ASSERT((eError == PVRSRV_OK) || (eError == PVRSRV_ERROR_RETRY));
192 PVRSRV_ERROR eError = PVRSRVReleaseHandle(psConnection->psHandleBase,
194 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR_EXPORT);
196 /* Releasing the handle should free/destroy/release the resource. This should never fail... */
197 PVR_ASSERT((eError == PVRSRV_OK) || (eError == PVRSRV_ERROR_RETRY));
199 /* Avoid freeing/destroying/releasing the resource a second time below */
200 psPMRExportInt = IMG_NULL;
205 PMRUnexportPMR(psPMRExportInt);
214 PVRSRVBridgePMRUnexportPMR(IMG_UINT32 ui32DispatchTableEntry,
215 PVRSRV_BRIDGE_IN_PMRUNEXPORTPMR *psPMRUnexportPMRIN,
216 PVRSRV_BRIDGE_OUT_PMRUNEXPORTPMR *psPMRUnexportPMROUT,
217 CONNECTION_DATA *psConnection)
219 PMR_EXPORT * psPMRExportInt = IMG_NULL;
220 IMG_HANDLE hPMRExportInt = IMG_NULL;
222 PVR_UNREFERENCED_PARAMETER(psConnection);
231 psPMRUnexportPMROUT->eError =
232 PVRSRVLookupHandle(KERNEL_HANDLE_BASE,
233 (IMG_VOID **) &psPMRExportInt,
234 (IMG_HANDLE) psPMRUnexportPMRIN->hPMRExport,
235 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR_EXPORT);
236 PVR_ASSERT(psPMRUnexportPMROUT->eError == PVRSRV_OK);
239 * Find the connection specific handle that represents the same data
240 * as the cross process handle as releasing it will actually call the
241 * data's real release function (see the function where the cross
242 * process handle is allocated for more details).
244 psPMRUnexportPMROUT->eError =
245 PVRSRVFindHandle(psConnection->psHandleBase,
248 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR_EXPORT);
249 PVR_ASSERT(psPMRUnexportPMROUT->eError == PVRSRV_OK);
251 psPMRUnexportPMROUT->eError =
252 PVRSRVReleaseHandle(psConnection->psHandleBase,
254 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR_EXPORT);
255 PVR_ASSERT((psPMRUnexportPMROUT->eError == PVRSRV_OK) || (psPMRUnexportPMROUT->eError == PVRSRV_ERROR_RETRY));
257 psPMRUnexportPMROUT->eError =
258 PVRSRVReleaseHandle(KERNEL_HANDLE_BASE,
259 (IMG_HANDLE) psPMRUnexportPMRIN->hPMRExport,
260 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR_EXPORT);
261 if ((psPMRUnexportPMROUT->eError != PVRSRV_OK) && (psPMRUnexportPMROUT->eError != PVRSRV_ERROR_RETRY))
265 goto PMRUnexportPMR_exit;
277 PVRSRVBridgePMRGetUID(IMG_UINT32 ui32DispatchTableEntry,
278 PVRSRV_BRIDGE_IN_PMRGETUID *psPMRGetUIDIN,
279 PVRSRV_BRIDGE_OUT_PMRGETUID *psPMRGetUIDOUT,
280 CONNECTION_DATA *psConnection)
282 PMR * psPMRInt = IMG_NULL;
292 /* Look up the address from the handle */
293 psPMRGetUIDOUT->eError =
294 PVRSRVLookupHandle(psConnection->psHandleBase,
295 (IMG_VOID **) &psPMRInt,
297 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR);
298 if(psPMRGetUIDOUT->eError != PVRSRV_OK)
306 psPMRGetUIDOUT->eError =
309 &psPMRGetUIDOUT->ui64UID);
321 PVRSRVBridgePMRMakeServerExportClientExport(IMG_UINT32 ui32DispatchTableEntry,
322 PVRSRV_BRIDGE_IN_PMRMAKESERVEREXPORTCLIENTEXPORT *psPMRMakeServerExportClientExportIN,
323 PVRSRV_BRIDGE_OUT_PMRMAKESERVEREXPORTCLIENTEXPORT *psPMRMakeServerExportClientExportOUT,
324 CONNECTION_DATA *psConnection)
326 DEVMEM_EXPORTCOOKIE * psPMRServerExportInt = IMG_NULL;
327 PMR_EXPORT * psPMRExportOutInt = IMG_NULL;
328 IMG_HANDLE hPMRExportOutInt = IMG_NULL;
337 /* Look up the address from the handle */
338 psPMRMakeServerExportClientExportOUT->eError =
339 PVRSRVLookupHandle(psConnection->psHandleBase,
340 (IMG_VOID **) &psPMRServerExportInt,
341 psPMRMakeServerExportClientExportIN->hPMRServerExport,
342 PVRSRV_HANDLE_TYPE_SERVER_EXPORTCOOKIE);
343 if(psPMRMakeServerExportClientExportOUT->eError != PVRSRV_OK)
345 goto PMRMakeServerExportClientExport_exit;
350 psPMRMakeServerExportClientExportOUT->eError =
351 PMRMakeServerExportClientExport(
352 psPMRServerExportInt,
354 &psPMRMakeServerExportClientExportOUT->ui64Size,
355 &psPMRMakeServerExportClientExportOUT->ui32Log2Contig,
356 &psPMRMakeServerExportClientExportOUT->ui64Password);
357 /* Exit early if bridged call fails */
358 if(psPMRMakeServerExportClientExportOUT->eError != PVRSRV_OK)
360 goto PMRMakeServerExportClientExport_exit;
365 * For cases where we need a cross process handle we actually allocate two.
367 * The first one is a connection specific handle and it gets given the real
368 * release function. This handle does *NOT* get returned to the caller. It's
369 * purpose is to release any leaked resources when we either have a bad or
370 * abnormally terminated client. If we didn't do this then the resource
371 * wouldn't be freed until driver unload. If the resource is freed normally,
372 * this handle can be looked up via the cross process handle and then
373 * released accordingly.
375 * The second one is a cross process handle and it gets given a noop release
376 * function. This handle does get returned to the caller.
378 psPMRMakeServerExportClientExportOUT->eError = PVRSRVAllocHandle(psConnection->psHandleBase,
380 (IMG_VOID *) psPMRExportOutInt,
381 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR_EXPORT,
382 PVRSRV_HANDLE_ALLOC_FLAG_SHARED
383 ,(PFN_HANDLE_RELEASE)&PMRUnmakeServerExportClientExport);
384 if (psPMRMakeServerExportClientExportOUT->eError != PVRSRV_OK)
386 goto PMRMakeServerExportClientExport_exit;
389 psPMRMakeServerExportClientExportOUT->eError = PVRSRVAllocHandle(KERNEL_HANDLE_BASE,
390 &psPMRMakeServerExportClientExportOUT->hPMRExportOut,
391 (IMG_VOID *) psPMRExportOutInt,
392 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR_EXPORT,
393 PVRSRV_HANDLE_ALLOC_FLAG_MULTI,
394 (PFN_HANDLE_RELEASE)&ReleasePMRExportOut);
395 if (psPMRMakeServerExportClientExportOUT->eError != PVRSRV_OK)
397 goto PMRMakeServerExportClientExport_exit;
402 PMRMakeServerExportClientExport_exit:
403 if (psPMRMakeServerExportClientExportOUT->eError != PVRSRV_OK)
405 if (psPMRMakeServerExportClientExportOUT->hPMRExportOut)
407 PVRSRV_ERROR eError = PVRSRVReleaseHandle(KERNEL_HANDLE_BASE,
408 (IMG_HANDLE) psPMRMakeServerExportClientExportOUT->hPMRExportOut,
409 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR_EXPORT);
411 /* Releasing the handle should free/destroy/release the resource. This should never fail... */
412 PVR_ASSERT((eError == PVRSRV_OK) || (eError == PVRSRV_ERROR_RETRY));
416 if (hPMRExportOutInt)
418 PVRSRV_ERROR eError = PVRSRVReleaseHandle(psConnection->psHandleBase,
420 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR_EXPORT);
422 /* Releasing the handle should free/destroy/release the resource. This should never fail... */
423 PVR_ASSERT((eError == PVRSRV_OK) || (eError == PVRSRV_ERROR_RETRY));
425 /* Avoid freeing/destroying/releasing the resource a second time below */
426 psPMRExportOutInt = IMG_NULL;
429 if (psPMRExportOutInt)
431 PMRUnmakeServerExportClientExport(psPMRExportOutInt);
440 PVRSRVBridgePMRUnmakeServerExportClientExport(IMG_UINT32 ui32DispatchTableEntry,
441 PVRSRV_BRIDGE_IN_PMRUNMAKESERVEREXPORTCLIENTEXPORT *psPMRUnmakeServerExportClientExportIN,
442 PVRSRV_BRIDGE_OUT_PMRUNMAKESERVEREXPORTCLIENTEXPORT *psPMRUnmakeServerExportClientExportOUT,
443 CONNECTION_DATA *psConnection)
445 PMR_EXPORT * psPMRExportInt = IMG_NULL;
446 IMG_HANDLE hPMRExportInt = IMG_NULL;
448 PVR_UNREFERENCED_PARAMETER(psConnection);
456 psPMRUnmakeServerExportClientExportOUT->eError =
457 PVRSRVLookupHandle(KERNEL_HANDLE_BASE,
458 (IMG_VOID **) &psPMRExportInt,
459 (IMG_HANDLE) psPMRUnmakeServerExportClientExportIN->hPMRExport,
460 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR_EXPORT);
461 PVR_ASSERT(psPMRUnmakeServerExportClientExportOUT->eError == PVRSRV_OK);
464 * Find the connection specific handle that represents the same data
465 * as the cross process handle as releasing it will actually call the
466 * data's real release function (see the function where the cross
467 * process handle is allocated for more details).
469 psPMRUnmakeServerExportClientExportOUT->eError =
470 PVRSRVFindHandle(psConnection->psHandleBase,
473 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR_EXPORT);
474 PVR_ASSERT(psPMRUnmakeServerExportClientExportOUT->eError == PVRSRV_OK);
476 psPMRUnmakeServerExportClientExportOUT->eError =
477 PVRSRVReleaseHandle(psConnection->psHandleBase,
479 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR_EXPORT);
480 PVR_ASSERT((psPMRUnmakeServerExportClientExportOUT->eError == PVRSRV_OK) || (psPMRUnmakeServerExportClientExportOUT->eError == PVRSRV_ERROR_RETRY));
482 psPMRUnmakeServerExportClientExportOUT->eError =
483 PVRSRVReleaseHandle(KERNEL_HANDLE_BASE,
484 (IMG_HANDLE) psPMRUnmakeServerExportClientExportIN->hPMRExport,
485 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR_EXPORT);
486 if ((psPMRUnmakeServerExportClientExportOUT->eError != PVRSRV_OK) && (psPMRUnmakeServerExportClientExportOUT->eError != PVRSRV_ERROR_RETRY))
489 goto PMRUnmakeServerExportClientExport_exit;
494 PMRUnmakeServerExportClientExport_exit:
500 PVRSRVBridgePMRImportPMR(IMG_UINT32 ui32DispatchTableEntry,
501 PVRSRV_BRIDGE_IN_PMRIMPORTPMR *psPMRImportPMRIN,
502 PVRSRV_BRIDGE_OUT_PMRIMPORTPMR *psPMRImportPMROUT,
503 CONNECTION_DATA *psConnection)
505 PMR_EXPORT * psPMRExportInt = IMG_NULL;
506 PMR * psPMRInt = IMG_NULL;
511 #if defined (SUPPORT_AUTH)
512 psPMRImportPMROUT->eError = OSCheckAuthentication(psConnection, 1);
513 if (psPMRImportPMROUT->eError != PVRSRV_OK)
515 goto PMRImportPMR_exit;
523 /* Look up the address from the handle */
524 psPMRImportPMROUT->eError =
525 PVRSRVLookupHandle(KERNEL_HANDLE_BASE,
526 (IMG_VOID **) &psPMRExportInt,
527 psPMRImportPMRIN->hPMRExport,
528 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR_EXPORT);
529 if(psPMRImportPMROUT->eError != PVRSRV_OK)
532 goto PMRImportPMR_exit;
537 psPMRImportPMROUT->eError =
540 psPMRImportPMRIN->ui64uiPassword,
541 psPMRImportPMRIN->ui64uiSize,
542 psPMRImportPMRIN->ui32uiLog2Contig,
544 /* Exit early if bridged call fails */
545 if(psPMRImportPMROUT->eError != PVRSRV_OK)
548 goto PMRImportPMR_exit;
553 psPMRImportPMROUT->eError = PVRSRVAllocHandle(psConnection->psHandleBase,
554 &psPMRImportPMROUT->hPMR,
555 (IMG_VOID *) psPMRInt,
556 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR,
557 PVRSRV_HANDLE_ALLOC_FLAG_MULTI
558 ,(PFN_HANDLE_RELEASE)&PMRUnrefPMR);
559 if (psPMRImportPMROUT->eError != PVRSRV_OK)
561 goto PMRImportPMR_exit;
568 if (psPMRImportPMROUT->eError != PVRSRV_OK)
572 PMRUnrefPMR(psPMRInt);
581 PVRSRVBridgeDevmemIntCtxCreate(IMG_UINT32 ui32DispatchTableEntry,
582 PVRSRV_BRIDGE_IN_DEVMEMINTCTXCREATE *psDevmemIntCtxCreateIN,
583 PVRSRV_BRIDGE_OUT_DEVMEMINTCTXCREATE *psDevmemIntCtxCreateOUT,
584 CONNECTION_DATA *psConnection)
586 IMG_HANDLE hDeviceNodeInt = IMG_NULL;
587 DEVMEMINT_CTX * psDevMemServerContextInt = IMG_NULL;
588 IMG_HANDLE hPrivDataInt = IMG_NULL;
592 psDevmemIntCtxCreateOUT->hDevMemServerContext = IMG_NULL;
598 /* Look up the address from the handle */
599 psDevmemIntCtxCreateOUT->eError =
600 PVRSRVLookupHandle(psConnection->psHandleBase,
601 (IMG_VOID **) &hDeviceNodeInt,
602 psDevmemIntCtxCreateIN->hDeviceNode,
603 PVRSRV_HANDLE_TYPE_DEV_NODE);
604 if(psDevmemIntCtxCreateOUT->eError != PVRSRV_OK)
606 goto DevmemIntCtxCreate_exit;
611 psDevmemIntCtxCreateOUT->eError =
614 &psDevMemServerContextInt,
616 /* Exit early if bridged call fails */
617 if(psDevmemIntCtxCreateOUT->eError != PVRSRV_OK)
619 goto DevmemIntCtxCreate_exit;
623 psDevmemIntCtxCreateOUT->eError = PVRSRVAllocHandle(psConnection->psHandleBase,
624 &psDevmemIntCtxCreateOUT->hDevMemServerContext,
625 (IMG_VOID *) psDevMemServerContextInt,
626 PVRSRV_HANDLE_TYPE_DEVMEMINT_CTX,
627 PVRSRV_HANDLE_ALLOC_FLAG_MULTI
628 ,(PFN_HANDLE_RELEASE)&DevmemIntCtxDestroy);
629 if (psDevmemIntCtxCreateOUT->eError != PVRSRV_OK)
631 goto DevmemIntCtxCreate_exit;
635 psDevmemIntCtxCreateOUT->eError = PVRSRVAllocSubHandle(psConnection->psHandleBase,
636 &psDevmemIntCtxCreateOUT->hPrivData,
637 (IMG_VOID *) hPrivDataInt,
638 PVRSRV_HANDLE_TYPE_DEV_PRIV_DATA,
639 PVRSRV_HANDLE_ALLOC_FLAG_MULTI
640 ,psDevmemIntCtxCreateOUT->hDevMemServerContext);
641 if (psDevmemIntCtxCreateOUT->eError != PVRSRV_OK)
643 goto DevmemIntCtxCreate_exit;
649 DevmemIntCtxCreate_exit:
650 if (psDevmemIntCtxCreateOUT->eError != PVRSRV_OK)
652 if (psDevmemIntCtxCreateOUT->hDevMemServerContext)
654 PVRSRV_ERROR eError = PVRSRVReleaseHandle(psConnection->psHandleBase,
655 (IMG_HANDLE) psDevmemIntCtxCreateOUT->hDevMemServerContext,
656 PVRSRV_HANDLE_TYPE_DEVMEMINT_CTX);
658 /* Releasing the handle should free/destroy/release the resource. This should never fail... */
659 PVR_ASSERT((eError == PVRSRV_OK) || (eError == PVRSRV_ERROR_RETRY));
661 /* Avoid freeing/destroying/releasing the resource a second time below */
662 psDevMemServerContextInt = IMG_NULL;
666 if (psDevMemServerContextInt)
668 DevmemIntCtxDestroy(psDevMemServerContextInt);
677 PVRSRVBridgeDevmemIntCtxDestroy(IMG_UINT32 ui32DispatchTableEntry,
678 PVRSRV_BRIDGE_IN_DEVMEMINTCTXDESTROY *psDevmemIntCtxDestroyIN,
679 PVRSRV_BRIDGE_OUT_DEVMEMINTCTXDESTROY *psDevmemIntCtxDestroyOUT,
680 CONNECTION_DATA *psConnection)
691 psDevmemIntCtxDestroyOUT->eError =
692 PVRSRVReleaseHandle(psConnection->psHandleBase,
693 (IMG_HANDLE) psDevmemIntCtxDestroyIN->hDevmemServerContext,
694 PVRSRV_HANDLE_TYPE_DEVMEMINT_CTX);
695 if ((psDevmemIntCtxDestroyOUT->eError != PVRSRV_OK) && (psDevmemIntCtxDestroyOUT->eError != PVRSRV_ERROR_RETRY))
698 goto DevmemIntCtxDestroy_exit;
703 DevmemIntCtxDestroy_exit:
709 PVRSRVBridgeDevmemIntHeapCreate(IMG_UINT32 ui32DispatchTableEntry,
710 PVRSRV_BRIDGE_IN_DEVMEMINTHEAPCREATE *psDevmemIntHeapCreateIN,
711 PVRSRV_BRIDGE_OUT_DEVMEMINTHEAPCREATE *psDevmemIntHeapCreateOUT,
712 CONNECTION_DATA *psConnection)
714 DEVMEMINT_CTX * psDevmemCtxInt = IMG_NULL;
715 DEVMEMINT_HEAP * psDevmemHeapPtrInt = IMG_NULL;
724 /* Look up the address from the handle */
725 psDevmemIntHeapCreateOUT->eError =
726 PVRSRVLookupHandle(psConnection->psHandleBase,
727 (IMG_VOID **) &psDevmemCtxInt,
728 psDevmemIntHeapCreateIN->hDevmemCtx,
729 PVRSRV_HANDLE_TYPE_DEVMEMINT_CTX);
730 if(psDevmemIntHeapCreateOUT->eError != PVRSRV_OK)
732 goto DevmemIntHeapCreate_exit;
737 psDevmemIntHeapCreateOUT->eError =
740 psDevmemIntHeapCreateIN->sHeapBaseAddr,
741 psDevmemIntHeapCreateIN->uiHeapLength,
742 psDevmemIntHeapCreateIN->ui32Log2DataPageSize,
743 &psDevmemHeapPtrInt);
744 /* Exit early if bridged call fails */
745 if(psDevmemIntHeapCreateOUT->eError != PVRSRV_OK)
747 goto DevmemIntHeapCreate_exit;
751 psDevmemIntHeapCreateOUT->eError = PVRSRVAllocHandle(psConnection->psHandleBase,
752 &psDevmemIntHeapCreateOUT->hDevmemHeapPtr,
753 (IMG_VOID *) psDevmemHeapPtrInt,
754 PVRSRV_HANDLE_TYPE_DEVMEMINT_HEAP,
755 PVRSRV_HANDLE_ALLOC_FLAG_MULTI
756 ,(PFN_HANDLE_RELEASE)&DevmemIntHeapDestroy);
757 if (psDevmemIntHeapCreateOUT->eError != PVRSRV_OK)
759 goto DevmemIntHeapCreate_exit;
765 DevmemIntHeapCreate_exit:
766 if (psDevmemIntHeapCreateOUT->eError != PVRSRV_OK)
768 if (psDevmemHeapPtrInt)
770 DevmemIntHeapDestroy(psDevmemHeapPtrInt);
779 PVRSRVBridgeDevmemIntHeapDestroy(IMG_UINT32 ui32DispatchTableEntry,
780 PVRSRV_BRIDGE_IN_DEVMEMINTHEAPDESTROY *psDevmemIntHeapDestroyIN,
781 PVRSRV_BRIDGE_OUT_DEVMEMINTHEAPDESTROY *psDevmemIntHeapDestroyOUT,
782 CONNECTION_DATA *psConnection)
793 psDevmemIntHeapDestroyOUT->eError =
794 PVRSRVReleaseHandle(psConnection->psHandleBase,
795 (IMG_HANDLE) psDevmemIntHeapDestroyIN->hDevmemHeap,
796 PVRSRV_HANDLE_TYPE_DEVMEMINT_HEAP);
797 if ((psDevmemIntHeapDestroyOUT->eError != PVRSRV_OK) && (psDevmemIntHeapDestroyOUT->eError != PVRSRV_ERROR_RETRY))
800 goto DevmemIntHeapDestroy_exit;
805 DevmemIntHeapDestroy_exit:
811 PVRSRVBridgeDevmemIntMapPMR(IMG_UINT32 ui32DispatchTableEntry,
812 PVRSRV_BRIDGE_IN_DEVMEMINTMAPPMR *psDevmemIntMapPMRIN,
813 PVRSRV_BRIDGE_OUT_DEVMEMINTMAPPMR *psDevmemIntMapPMROUT,
814 CONNECTION_DATA *psConnection)
816 DEVMEMINT_HEAP * psDevmemServerHeapInt = IMG_NULL;
817 DEVMEMINT_RESERVATION * psReservationInt = IMG_NULL;
818 PMR * psPMRInt = IMG_NULL;
819 DEVMEMINT_MAPPING * psMappingInt = IMG_NULL;
829 /* Look up the address from the handle */
830 psDevmemIntMapPMROUT->eError =
831 PVRSRVLookupHandle(psConnection->psHandleBase,
832 (IMG_VOID **) &psDevmemServerHeapInt,
833 psDevmemIntMapPMRIN->hDevmemServerHeap,
834 PVRSRV_HANDLE_TYPE_DEVMEMINT_HEAP);
835 if(psDevmemIntMapPMROUT->eError != PVRSRV_OK)
838 goto DevmemIntMapPMR_exit;
844 /* Look up the address from the handle */
845 psDevmemIntMapPMROUT->eError =
846 PVRSRVLookupHandle(psConnection->psHandleBase,
847 (IMG_VOID **) &psReservationInt,
848 psDevmemIntMapPMRIN->hReservation,
849 PVRSRV_HANDLE_TYPE_DEVMEMINT_RESERVATION);
850 if(psDevmemIntMapPMROUT->eError != PVRSRV_OK)
853 goto DevmemIntMapPMR_exit;
859 /* Look up the address from the handle */
860 psDevmemIntMapPMROUT->eError =
861 PVRSRVLookupHandle(psConnection->psHandleBase,
862 (IMG_VOID **) &psPMRInt,
863 psDevmemIntMapPMRIN->hPMR,
864 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR);
865 if(psDevmemIntMapPMROUT->eError != PVRSRV_OK)
868 goto DevmemIntMapPMR_exit;
873 psDevmemIntMapPMROUT->eError =
875 psDevmemServerHeapInt,
878 psDevmemIntMapPMRIN->uiMapFlags,
880 /* Exit early if bridged call fails */
881 if(psDevmemIntMapPMROUT->eError != PVRSRV_OK)
884 goto DevmemIntMapPMR_exit;
889 psDevmemIntMapPMROUT->eError = PVRSRVAllocHandle(psConnection->psHandleBase,
890 &psDevmemIntMapPMROUT->hMapping,
891 (IMG_VOID *) psMappingInt,
892 PVRSRV_HANDLE_TYPE_DEVMEMINT_MAPPING,
893 PVRSRV_HANDLE_ALLOC_FLAG_MULTI
894 ,(PFN_HANDLE_RELEASE)&DevmemIntUnmapPMR);
895 if (psDevmemIntMapPMROUT->eError != PVRSRV_OK)
897 goto DevmemIntMapPMR_exit;
903 DevmemIntMapPMR_exit:
904 if (psDevmemIntMapPMROUT->eError != PVRSRV_OK)
908 DevmemIntUnmapPMR(psMappingInt);
917 PVRSRVBridgeDevmemIntUnmapPMR(IMG_UINT32 ui32DispatchTableEntry,
918 PVRSRV_BRIDGE_IN_DEVMEMINTUNMAPPMR *psDevmemIntUnmapPMRIN,
919 PVRSRV_BRIDGE_OUT_DEVMEMINTUNMAPPMR *psDevmemIntUnmapPMROUT,
920 CONNECTION_DATA *psConnection)
932 psDevmemIntUnmapPMROUT->eError =
933 PVRSRVReleaseHandle(psConnection->psHandleBase,
934 (IMG_HANDLE) psDevmemIntUnmapPMRIN->hMapping,
935 PVRSRV_HANDLE_TYPE_DEVMEMINT_MAPPING);
936 if ((psDevmemIntUnmapPMROUT->eError != PVRSRV_OK) && (psDevmemIntUnmapPMROUT->eError != PVRSRV_ERROR_RETRY))
940 goto DevmemIntUnmapPMR_exit;
946 DevmemIntUnmapPMR_exit:
952 PVRSRVBridgeDevmemIntReserveRange(IMG_UINT32 ui32DispatchTableEntry,
953 PVRSRV_BRIDGE_IN_DEVMEMINTRESERVERANGE *psDevmemIntReserveRangeIN,
954 PVRSRV_BRIDGE_OUT_DEVMEMINTRESERVERANGE *psDevmemIntReserveRangeOUT,
955 CONNECTION_DATA *psConnection)
957 DEVMEMINT_HEAP * psDevmemServerHeapInt = IMG_NULL;
958 DEVMEMINT_RESERVATION * psReservationInt = IMG_NULL;
967 /* Look up the address from the handle */
968 psDevmemIntReserveRangeOUT->eError =
969 PVRSRVLookupHandle(psConnection->psHandleBase,
970 (IMG_VOID **) &psDevmemServerHeapInt,
971 psDevmemIntReserveRangeIN->hDevmemServerHeap,
972 PVRSRV_HANDLE_TYPE_DEVMEMINT_HEAP);
973 if(psDevmemIntReserveRangeOUT->eError != PVRSRV_OK)
975 goto DevmemIntReserveRange_exit;
980 psDevmemIntReserveRangeOUT->eError =
981 DevmemIntReserveRange(
982 psDevmemServerHeapInt,
983 psDevmemIntReserveRangeIN->sAddress,
984 psDevmemIntReserveRangeIN->uiLength,
986 /* Exit early if bridged call fails */
987 if(psDevmemIntReserveRangeOUT->eError != PVRSRV_OK)
989 goto DevmemIntReserveRange_exit;
993 psDevmemIntReserveRangeOUT->eError = PVRSRVAllocHandle(psConnection->psHandleBase,
994 &psDevmemIntReserveRangeOUT->hReservation,
995 (IMG_VOID *) psReservationInt,
996 PVRSRV_HANDLE_TYPE_DEVMEMINT_RESERVATION,
997 PVRSRV_HANDLE_ALLOC_FLAG_MULTI
998 ,(PFN_HANDLE_RELEASE)&DevmemIntUnreserveRange);
999 if (psDevmemIntReserveRangeOUT->eError != PVRSRV_OK)
1001 goto DevmemIntReserveRange_exit;
1007 DevmemIntReserveRange_exit:
1008 if (psDevmemIntReserveRangeOUT->eError != PVRSRV_OK)
1010 if (psReservationInt)
1012 DevmemIntUnreserveRange(psReservationInt);
1021 PVRSRVBridgeDevmemIntUnreserveRange(IMG_UINT32 ui32DispatchTableEntry,
1022 PVRSRV_BRIDGE_IN_DEVMEMINTUNRESERVERANGE *psDevmemIntUnreserveRangeIN,
1023 PVRSRV_BRIDGE_OUT_DEVMEMINTUNRESERVERANGE *psDevmemIntUnreserveRangeOUT,
1024 CONNECTION_DATA *psConnection)
1035 psDevmemIntUnreserveRangeOUT->eError =
1036 PVRSRVReleaseHandle(psConnection->psHandleBase,
1037 (IMG_HANDLE) psDevmemIntUnreserveRangeIN->hReservation,
1038 PVRSRV_HANDLE_TYPE_DEVMEMINT_RESERVATION);
1039 if ((psDevmemIntUnreserveRangeOUT->eError != PVRSRV_OK) && (psDevmemIntUnreserveRangeOUT->eError != PVRSRV_ERROR_RETRY))
1042 goto DevmemIntUnreserveRange_exit;
1047 DevmemIntUnreserveRange_exit:
1053 PVRSRVBridgePhysmemNewRamBackedPMR(IMG_UINT32 ui32DispatchTableEntry,
1054 PVRSRV_BRIDGE_IN_PHYSMEMNEWRAMBACKEDPMR *psPhysmemNewRamBackedPMRIN,
1055 PVRSRV_BRIDGE_OUT_PHYSMEMNEWRAMBACKEDPMR *psPhysmemNewRamBackedPMROUT,
1056 CONNECTION_DATA *psConnection)
1058 IMG_HANDLE hDeviceNodeInt = IMG_NULL;
1059 IMG_BOOL *bMappingTableInt = IMG_NULL;
1060 PMR * psPMRPtrInt = IMG_NULL;
1065 if (psPhysmemNewRamBackedPMRIN->ui32NumVirtChunks != 0)
1067 bMappingTableInt = OSAllocMem(psPhysmemNewRamBackedPMRIN->ui32NumVirtChunks * sizeof(IMG_BOOL));
1068 if (!bMappingTableInt)
1070 psPhysmemNewRamBackedPMROUT->eError = PVRSRV_ERROR_OUT_OF_MEMORY;
1072 goto PhysmemNewRamBackedPMR_exit;
1076 /* Copy the data over */
1077 if ( !OSAccessOK(PVR_VERIFY_READ, (IMG_VOID*) psPhysmemNewRamBackedPMRIN->pbMappingTable, psPhysmemNewRamBackedPMRIN->ui32NumVirtChunks * sizeof(IMG_BOOL))
1078 || (OSCopyFromUser(NULL, bMappingTableInt, psPhysmemNewRamBackedPMRIN->pbMappingTable,
1079 psPhysmemNewRamBackedPMRIN->ui32NumVirtChunks * sizeof(IMG_BOOL)) != PVRSRV_OK) )
1081 psPhysmemNewRamBackedPMROUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
1083 goto PhysmemNewRamBackedPMR_exit;
1090 /* Look up the address from the handle */
1091 psPhysmemNewRamBackedPMROUT->eError =
1092 PVRSRVLookupHandle(psConnection->psHandleBase,
1093 (IMG_VOID **) &hDeviceNodeInt,
1094 psPhysmemNewRamBackedPMRIN->hDeviceNode,
1095 PVRSRV_HANDLE_TYPE_DEV_NODE);
1096 if(psPhysmemNewRamBackedPMROUT->eError != PVRSRV_OK)
1099 goto PhysmemNewRamBackedPMR_exit;
1104 psPhysmemNewRamBackedPMROUT->eError =
1105 PhysmemNewRamBackedPMR(
1107 psPhysmemNewRamBackedPMRIN->uiSize,
1108 psPhysmemNewRamBackedPMRIN->uiChunkSize,
1109 psPhysmemNewRamBackedPMRIN->ui32NumPhysChunks,
1110 psPhysmemNewRamBackedPMRIN->ui32NumVirtChunks,
1112 psPhysmemNewRamBackedPMRIN->ui32Log2PageSize,
1113 psPhysmemNewRamBackedPMRIN->uiFlags,
1115 /* Exit early if bridged call fails */
1116 if(psPhysmemNewRamBackedPMROUT->eError != PVRSRV_OK)
1119 goto PhysmemNewRamBackedPMR_exit;
1124 psPhysmemNewRamBackedPMROUT->eError = PVRSRVAllocHandle(psConnection->psHandleBase,
1125 &psPhysmemNewRamBackedPMROUT->hPMRPtr,
1126 (IMG_VOID *) psPMRPtrInt,
1127 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR,
1128 PVRSRV_HANDLE_ALLOC_FLAG_MULTI
1129 ,(PFN_HANDLE_RELEASE)&PMRUnrefPMR);
1130 if (psPhysmemNewRamBackedPMROUT->eError != PVRSRV_OK)
1132 goto PhysmemNewRamBackedPMR_exit;
1138 PhysmemNewRamBackedPMR_exit:
1139 if (psPhysmemNewRamBackedPMROUT->eError != PVRSRV_OK)
1143 PMRUnrefPMR(psPMRPtrInt);
1147 if (bMappingTableInt)
1148 OSFreeMem(bMappingTableInt);
1154 PVRSRVBridgePMRLocalImportPMR(IMG_UINT32 ui32DispatchTableEntry,
1155 PVRSRV_BRIDGE_IN_PMRLOCALIMPORTPMR *psPMRLocalImportPMRIN,
1156 PVRSRV_BRIDGE_OUT_PMRLOCALIMPORTPMR *psPMRLocalImportPMROUT,
1157 CONNECTION_DATA *psConnection)
1159 PMR * psExtHandleInt = IMG_NULL;
1160 PMR * psPMRInt = IMG_NULL;
1170 /* Look up the address from the handle */
1171 psPMRLocalImportPMROUT->eError =
1172 PVRSRVLookupHandle(psConnection->psHandleBase,
1173 (IMG_VOID **) &psExtHandleInt,
1174 psPMRLocalImportPMRIN->hExtHandle,
1175 PVRSRV_HANDLE_TYPE_DEVMEM_MEM_IMPORT);
1176 if(psPMRLocalImportPMROUT->eError != PVRSRV_OK)
1179 goto PMRLocalImportPMR_exit;
1184 psPMRLocalImportPMROUT->eError =
1188 &psPMRLocalImportPMROUT->uiSize,
1189 &psPMRLocalImportPMROUT->sAlign);
1190 /* Exit early if bridged call fails */
1191 if(psPMRLocalImportPMROUT->eError != PVRSRV_OK)
1194 goto PMRLocalImportPMR_exit;
1199 psPMRLocalImportPMROUT->eError = PVRSRVAllocHandle(psConnection->psHandleBase,
1200 &psPMRLocalImportPMROUT->hPMR,
1201 (IMG_VOID *) psPMRInt,
1202 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR,
1203 PVRSRV_HANDLE_ALLOC_FLAG_MULTI
1204 ,(PFN_HANDLE_RELEASE)&PMRUnrefPMR);
1205 if (psPMRLocalImportPMROUT->eError != PVRSRV_OK)
1207 goto PMRLocalImportPMR_exit;
1213 PMRLocalImportPMR_exit:
1214 if (psPMRLocalImportPMROUT->eError != PVRSRV_OK)
1218 PMRUnrefPMR(psPMRInt);
1227 PVRSRVBridgePMRUnrefPMR(IMG_UINT32 ui32DispatchTableEntry,
1228 PVRSRV_BRIDGE_IN_PMRUNREFPMR *psPMRUnrefPMRIN,
1229 PVRSRV_BRIDGE_OUT_PMRUNREFPMR *psPMRUnrefPMROUT,
1230 CONNECTION_DATA *psConnection)
1242 psPMRUnrefPMROUT->eError =
1243 PVRSRVReleaseHandle(psConnection->psHandleBase,
1244 (IMG_HANDLE) psPMRUnrefPMRIN->hPMR,
1245 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR);
1246 if ((psPMRUnrefPMROUT->eError != PVRSRV_OK) && (psPMRUnrefPMROUT->eError != PVRSRV_ERROR_RETRY))
1250 goto PMRUnrefPMR_exit;
1262 PVRSRVBridgeDevmemSLCFlushInvalRequest(IMG_UINT32 ui32DispatchTableEntry,
1263 PVRSRV_BRIDGE_IN_DEVMEMSLCFLUSHINVALREQUEST *psDevmemSLCFlushInvalRequestIN,
1264 PVRSRV_BRIDGE_OUT_DEVMEMSLCFLUSHINVALREQUEST *psDevmemSLCFlushInvalRequestOUT,
1265 CONNECTION_DATA *psConnection)
1267 IMG_HANDLE hDeviceNodeInt = IMG_NULL;
1268 PMR * psPmrInt = IMG_NULL;
1277 /* Look up the address from the handle */
1278 psDevmemSLCFlushInvalRequestOUT->eError =
1279 PVRSRVLookupHandle(psConnection->psHandleBase,
1280 (IMG_VOID **) &hDeviceNodeInt,
1281 psDevmemSLCFlushInvalRequestIN->hDeviceNode,
1282 PVRSRV_HANDLE_TYPE_DEV_NODE);
1283 if(psDevmemSLCFlushInvalRequestOUT->eError != PVRSRV_OK)
1285 goto DevmemSLCFlushInvalRequest_exit;
1291 /* Look up the address from the handle */
1292 psDevmemSLCFlushInvalRequestOUT->eError =
1293 PVRSRVLookupHandle(psConnection->psHandleBase,
1294 (IMG_VOID **) &psPmrInt,
1295 psDevmemSLCFlushInvalRequestIN->hPmr,
1296 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR);
1297 if(psDevmemSLCFlushInvalRequestOUT->eError != PVRSRV_OK)
1299 goto DevmemSLCFlushInvalRequest_exit;
1304 psDevmemSLCFlushInvalRequestOUT->eError =
1305 DevmemSLCFlushInvalRequest(
1312 DevmemSLCFlushInvalRequest_exit:
1318 PVRSRVBridgeDevmemIsVDevAddrValid(IMG_UINT32 ui32DispatchTableEntry,
1319 PVRSRV_BRIDGE_IN_DEVMEMISVDEVADDRVALID *psDevmemIsVDevAddrValidIN,
1320 PVRSRV_BRIDGE_OUT_DEVMEMISVDEVADDRVALID *psDevmemIsVDevAddrValidOUT,
1321 CONNECTION_DATA *psConnection)
1323 DEVMEMINT_CTX * psDevmemCtxInt = IMG_NULL;
1332 /* Look up the address from the handle */
1333 psDevmemIsVDevAddrValidOUT->eError =
1334 PVRSRVLookupHandle(psConnection->psHandleBase,
1335 (IMG_VOID **) &psDevmemCtxInt,
1336 psDevmemIsVDevAddrValidIN->hDevmemCtx,
1337 PVRSRV_HANDLE_TYPE_DEVMEMINT_CTX);
1338 if(psDevmemIsVDevAddrValidOUT->eError != PVRSRV_OK)
1340 goto DevmemIsVDevAddrValid_exit;
1345 psDevmemIsVDevAddrValidOUT->eError =
1346 DevmemIntIsVDevAddrValid(
1348 psDevmemIsVDevAddrValidIN->sAddress);
1353 DevmemIsVDevAddrValid_exit:
1359 PVRSRVBridgeHeapCfgHeapConfigCount(IMG_UINT32 ui32DispatchTableEntry,
1360 PVRSRV_BRIDGE_IN_HEAPCFGHEAPCONFIGCOUNT *psHeapCfgHeapConfigCountIN,
1361 PVRSRV_BRIDGE_OUT_HEAPCFGHEAPCONFIGCOUNT *psHeapCfgHeapConfigCountOUT,
1362 CONNECTION_DATA *psConnection)
1364 IMG_HANDLE hDeviceNodeInt = IMG_NULL;
1373 /* Look up the address from the handle */
1374 psHeapCfgHeapConfigCountOUT->eError =
1375 PVRSRVLookupHandle(psConnection->psHandleBase,
1376 (IMG_VOID **) &hDeviceNodeInt,
1377 psHeapCfgHeapConfigCountIN->hDeviceNode,
1378 PVRSRV_HANDLE_TYPE_DEV_NODE);
1379 if(psHeapCfgHeapConfigCountOUT->eError != PVRSRV_OK)
1381 goto HeapCfgHeapConfigCount_exit;
1386 psHeapCfgHeapConfigCountOUT->eError =
1387 HeapCfgHeapConfigCount(
1389 &psHeapCfgHeapConfigCountOUT->ui32NumHeapConfigs);
1394 HeapCfgHeapConfigCount_exit:
1400 PVRSRVBridgeHeapCfgHeapCount(IMG_UINT32 ui32DispatchTableEntry,
1401 PVRSRV_BRIDGE_IN_HEAPCFGHEAPCOUNT *psHeapCfgHeapCountIN,
1402 PVRSRV_BRIDGE_OUT_HEAPCFGHEAPCOUNT *psHeapCfgHeapCountOUT,
1403 CONNECTION_DATA *psConnection)
1405 IMG_HANDLE hDeviceNodeInt = IMG_NULL;
1414 /* Look up the address from the handle */
1415 psHeapCfgHeapCountOUT->eError =
1416 PVRSRVLookupHandle(psConnection->psHandleBase,
1417 (IMG_VOID **) &hDeviceNodeInt,
1418 psHeapCfgHeapCountIN->hDeviceNode,
1419 PVRSRV_HANDLE_TYPE_DEV_NODE);
1420 if(psHeapCfgHeapCountOUT->eError != PVRSRV_OK)
1422 goto HeapCfgHeapCount_exit;
1427 psHeapCfgHeapCountOUT->eError =
1430 psHeapCfgHeapCountIN->ui32HeapConfigIndex,
1431 &psHeapCfgHeapCountOUT->ui32NumHeaps);
1436 HeapCfgHeapCount_exit:
1442 PVRSRVBridgeHeapCfgHeapConfigName(IMG_UINT32 ui32DispatchTableEntry,
1443 PVRSRV_BRIDGE_IN_HEAPCFGHEAPCONFIGNAME *psHeapCfgHeapConfigNameIN,
1444 PVRSRV_BRIDGE_OUT_HEAPCFGHEAPCONFIGNAME *psHeapCfgHeapConfigNameOUT,
1445 CONNECTION_DATA *psConnection)
1447 IMG_HANDLE hDeviceNodeInt = IMG_NULL;
1448 IMG_CHAR *puiHeapConfigNameInt = IMG_NULL;
1451 psHeapCfgHeapConfigNameOUT->puiHeapConfigName = psHeapCfgHeapConfigNameIN->puiHeapConfigName;
1454 if (psHeapCfgHeapConfigNameIN->ui32HeapConfigNameBufSz != 0)
1456 puiHeapConfigNameInt = OSAllocMem(psHeapCfgHeapConfigNameIN->ui32HeapConfigNameBufSz * sizeof(IMG_CHAR));
1457 if (!puiHeapConfigNameInt)
1459 psHeapCfgHeapConfigNameOUT->eError = PVRSRV_ERROR_OUT_OF_MEMORY;
1461 goto HeapCfgHeapConfigName_exit;
1469 /* Look up the address from the handle */
1470 psHeapCfgHeapConfigNameOUT->eError =
1471 PVRSRVLookupHandle(psConnection->psHandleBase,
1472 (IMG_VOID **) &hDeviceNodeInt,
1473 psHeapCfgHeapConfigNameIN->hDeviceNode,
1474 PVRSRV_HANDLE_TYPE_DEV_NODE);
1475 if(psHeapCfgHeapConfigNameOUT->eError != PVRSRV_OK)
1477 goto HeapCfgHeapConfigName_exit;
1482 psHeapCfgHeapConfigNameOUT->eError =
1483 HeapCfgHeapConfigName(
1485 psHeapCfgHeapConfigNameIN->ui32HeapConfigIndex,
1486 psHeapCfgHeapConfigNameIN->ui32HeapConfigNameBufSz,
1487 puiHeapConfigNameInt);
1491 if ( !OSAccessOK(PVR_VERIFY_WRITE, (IMG_VOID*) psHeapCfgHeapConfigNameOUT->puiHeapConfigName, (psHeapCfgHeapConfigNameIN->ui32HeapConfigNameBufSz * sizeof(IMG_CHAR)))
1492 || (OSCopyToUser(NULL, psHeapCfgHeapConfigNameOUT->puiHeapConfigName, puiHeapConfigNameInt,
1493 (psHeapCfgHeapConfigNameIN->ui32HeapConfigNameBufSz * sizeof(IMG_CHAR))) != PVRSRV_OK) )
1495 psHeapCfgHeapConfigNameOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
1497 goto HeapCfgHeapConfigName_exit;
1501 HeapCfgHeapConfigName_exit:
1502 if (puiHeapConfigNameInt)
1503 OSFreeMem(puiHeapConfigNameInt);
1509 PVRSRVBridgeHeapCfgHeapDetails(IMG_UINT32 ui32DispatchTableEntry,
1510 PVRSRV_BRIDGE_IN_HEAPCFGHEAPDETAILS *psHeapCfgHeapDetailsIN,
1511 PVRSRV_BRIDGE_OUT_HEAPCFGHEAPDETAILS *psHeapCfgHeapDetailsOUT,
1512 CONNECTION_DATA *psConnection)
1514 IMG_HANDLE hDeviceNodeInt = IMG_NULL;
1515 IMG_CHAR *puiHeapNameOutInt = IMG_NULL;
1518 psHeapCfgHeapDetailsOUT->puiHeapNameOut = psHeapCfgHeapDetailsIN->puiHeapNameOut;
1521 if (psHeapCfgHeapDetailsIN->ui32HeapNameBufSz != 0)
1523 puiHeapNameOutInt = OSAllocMem(psHeapCfgHeapDetailsIN->ui32HeapNameBufSz * sizeof(IMG_CHAR));
1524 if (!puiHeapNameOutInt)
1526 psHeapCfgHeapDetailsOUT->eError = PVRSRV_ERROR_OUT_OF_MEMORY;
1528 goto HeapCfgHeapDetails_exit;
1536 /* Look up the address from the handle */
1537 psHeapCfgHeapDetailsOUT->eError =
1538 PVRSRVLookupHandle(psConnection->psHandleBase,
1539 (IMG_VOID **) &hDeviceNodeInt,
1540 psHeapCfgHeapDetailsIN->hDeviceNode,
1541 PVRSRV_HANDLE_TYPE_DEV_NODE);
1542 if(psHeapCfgHeapDetailsOUT->eError != PVRSRV_OK)
1544 goto HeapCfgHeapDetails_exit;
1549 psHeapCfgHeapDetailsOUT->eError =
1552 psHeapCfgHeapDetailsIN->ui32HeapConfigIndex,
1553 psHeapCfgHeapDetailsIN->ui32HeapIndex,
1554 psHeapCfgHeapDetailsIN->ui32HeapNameBufSz,
1556 &psHeapCfgHeapDetailsOUT->sDevVAddrBase,
1557 &psHeapCfgHeapDetailsOUT->uiHeapLength,
1558 &psHeapCfgHeapDetailsOUT->ui32Log2DataPageSizeOut,
1559 &psHeapCfgHeapDetailsOUT->ui32Log2ImportAlignmentOut);
1563 if ( !OSAccessOK(PVR_VERIFY_WRITE, (IMG_VOID*) psHeapCfgHeapDetailsOUT->puiHeapNameOut, (psHeapCfgHeapDetailsIN->ui32HeapNameBufSz * sizeof(IMG_CHAR)))
1564 || (OSCopyToUser(NULL, psHeapCfgHeapDetailsOUT->puiHeapNameOut, puiHeapNameOutInt,
1565 (psHeapCfgHeapDetailsIN->ui32HeapNameBufSz * sizeof(IMG_CHAR))) != PVRSRV_OK) )
1567 psHeapCfgHeapDetailsOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
1569 goto HeapCfgHeapDetails_exit;
1573 HeapCfgHeapDetails_exit:
1574 if (puiHeapNameOutInt)
1575 OSFreeMem(puiHeapNameOutInt);
1582 /* ***************************************************************************
1583 * Server bridge dispatch related glue
1587 PVRSRV_ERROR InitMMBridge(IMG_VOID);
1588 PVRSRV_ERROR DeinitMMBridge(IMG_VOID);
1591 * Register all MM functions with services
1593 PVRSRV_ERROR InitMMBridge(IMG_VOID)
1596 SetDispatchTableEntry(PVRSRV_BRIDGE_MM, PVRSRV_BRIDGE_MM_PMREXPORTPMR, PVRSRVBridgePMRExportPMR,
1600 SetDispatchTableEntry(PVRSRV_BRIDGE_MM, PVRSRV_BRIDGE_MM_PMRUNEXPORTPMR, PVRSRVBridgePMRUnexportPMR,
1604 SetDispatchTableEntry(PVRSRV_BRIDGE_MM, PVRSRV_BRIDGE_MM_PMRGETUID, PVRSRVBridgePMRGetUID,
1608 SetDispatchTableEntry(PVRSRV_BRIDGE_MM, PVRSRV_BRIDGE_MM_PMRMAKESERVEREXPORTCLIENTEXPORT, PVRSRVBridgePMRMakeServerExportClientExport,
1612 SetDispatchTableEntry(PVRSRV_BRIDGE_MM, PVRSRV_BRIDGE_MM_PMRUNMAKESERVEREXPORTCLIENTEXPORT, PVRSRVBridgePMRUnmakeServerExportClientExport,
1616 SetDispatchTableEntry(PVRSRV_BRIDGE_MM, PVRSRV_BRIDGE_MM_PMRIMPORTPMR, PVRSRVBridgePMRImportPMR,
1620 SetDispatchTableEntry(PVRSRV_BRIDGE_MM, PVRSRV_BRIDGE_MM_DEVMEMINTCTXCREATE, PVRSRVBridgeDevmemIntCtxCreate,
1624 SetDispatchTableEntry(PVRSRV_BRIDGE_MM, PVRSRV_BRIDGE_MM_DEVMEMINTCTXDESTROY, PVRSRVBridgeDevmemIntCtxDestroy,
1628 SetDispatchTableEntry(PVRSRV_BRIDGE_MM, PVRSRV_BRIDGE_MM_DEVMEMINTHEAPCREATE, PVRSRVBridgeDevmemIntHeapCreate,
1632 SetDispatchTableEntry(PVRSRV_BRIDGE_MM, PVRSRV_BRIDGE_MM_DEVMEMINTHEAPDESTROY, PVRSRVBridgeDevmemIntHeapDestroy,
1636 SetDispatchTableEntry(PVRSRV_BRIDGE_MM, PVRSRV_BRIDGE_MM_DEVMEMINTMAPPMR, PVRSRVBridgeDevmemIntMapPMR,
1640 SetDispatchTableEntry(PVRSRV_BRIDGE_MM, PVRSRV_BRIDGE_MM_DEVMEMINTUNMAPPMR, PVRSRVBridgeDevmemIntUnmapPMR,
1644 SetDispatchTableEntry(PVRSRV_BRIDGE_MM, PVRSRV_BRIDGE_MM_DEVMEMINTRESERVERANGE, PVRSRVBridgeDevmemIntReserveRange,
1648 SetDispatchTableEntry(PVRSRV_BRIDGE_MM, PVRSRV_BRIDGE_MM_DEVMEMINTUNRESERVERANGE, PVRSRVBridgeDevmemIntUnreserveRange,
1652 SetDispatchTableEntry(PVRSRV_BRIDGE_MM, PVRSRV_BRIDGE_MM_PHYSMEMNEWRAMBACKEDPMR, PVRSRVBridgePhysmemNewRamBackedPMR,
1656 SetDispatchTableEntry(PVRSRV_BRIDGE_MM, PVRSRV_BRIDGE_MM_PMRLOCALIMPORTPMR, PVRSRVBridgePMRLocalImportPMR,
1660 SetDispatchTableEntry(PVRSRV_BRIDGE_MM, PVRSRV_BRIDGE_MM_PMRUNREFPMR, PVRSRVBridgePMRUnrefPMR,
1664 SetDispatchTableEntry(PVRSRV_BRIDGE_MM, PVRSRV_BRIDGE_MM_DEVMEMSLCFLUSHINVALREQUEST, PVRSRVBridgeDevmemSLCFlushInvalRequest,
1668 SetDispatchTableEntry(PVRSRV_BRIDGE_MM, PVRSRV_BRIDGE_MM_DEVMEMISVDEVADDRVALID, PVRSRVBridgeDevmemIsVDevAddrValid,
1672 SetDispatchTableEntry(PVRSRV_BRIDGE_MM, PVRSRV_BRIDGE_MM_HEAPCFGHEAPCONFIGCOUNT, PVRSRVBridgeHeapCfgHeapConfigCount,
1676 SetDispatchTableEntry(PVRSRV_BRIDGE_MM, PVRSRV_BRIDGE_MM_HEAPCFGHEAPCOUNT, PVRSRVBridgeHeapCfgHeapCount,
1680 SetDispatchTableEntry(PVRSRV_BRIDGE_MM, PVRSRV_BRIDGE_MM_HEAPCFGHEAPCONFIGNAME, PVRSRVBridgeHeapCfgHeapConfigName,
1684 SetDispatchTableEntry(PVRSRV_BRIDGE_MM, PVRSRV_BRIDGE_MM_HEAPCFGHEAPDETAILS, PVRSRVBridgeHeapCfgHeapDetails,
1693 * Unregister all mm functions with services
1695 PVRSRV_ERROR DeinitMMBridge(IMG_VOID)