1 /*************************************************************************/ /*!
3 @Title Server bridge for rgxinit
4 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description Implements the server side of the bridge for rgxinit
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>
52 #include "common_rgxinit_bridge.h"
55 #include "pvr_debug.h"
56 #include "connection_server.h"
57 #include "pvr_bridge.h"
58 #include "rgx_bridge.h"
62 #if defined (SUPPORT_AUTH)
66 #include <linux/slab.h>
69 static PVRSRV_ERROR ReleaseFWCodeAllocServerExportCookie(IMG_VOID *pvData)
71 PVR_UNREFERENCED_PARAMETER(pvData);
75 static PVRSRV_ERROR ReleaseFWDataAllocServerExportCookie(IMG_VOID *pvData)
77 PVR_UNREFERENCED_PARAMETER(pvData);
81 static PVRSRV_ERROR ReleaseFWCorememAllocServerExportCookie(IMG_VOID *pvData)
83 PVR_UNREFERENCED_PARAMETER(pvData);
87 static PVRSRV_ERROR ReleaseHWPerfDataAllocServerExportCookie(IMG_VOID *pvData)
89 PVR_UNREFERENCED_PARAMETER(pvData);
95 /* ***************************************************************************
96 * Server-side bridge entry points
100 PVRSRVBridgeRGXInitAllocFWImgMem(IMG_UINT32 ui32DispatchTableEntry,
101 PVRSRV_BRIDGE_IN_RGXINITALLOCFWIMGMEM *psRGXInitAllocFWImgMemIN,
102 PVRSRV_BRIDGE_OUT_RGXINITALLOCFWIMGMEM *psRGXInitAllocFWImgMemOUT,
103 CONNECTION_DATA *psConnection)
105 IMG_HANDLE hDevNodeInt = IMG_NULL;
106 DEVMEM_EXPORTCOOKIE * psFWCodeAllocServerExportCookieInt = IMG_NULL;
107 DEVMEM_EXPORTCOOKIE * psFWDataAllocServerExportCookieInt = IMG_NULL;
108 DEVMEM_EXPORTCOOKIE * psFWCorememAllocServerExportCookieInt = IMG_NULL;
117 /* Look up the address from the handle */
118 psRGXInitAllocFWImgMemOUT->eError =
119 PVRSRVLookupHandle(psConnection->psHandleBase,
120 (IMG_VOID **) &hDevNodeInt,
121 psRGXInitAllocFWImgMemIN->hDevNode,
122 PVRSRV_HANDLE_TYPE_DEV_NODE);
123 if(psRGXInitAllocFWImgMemOUT->eError != PVRSRV_OK)
125 goto RGXInitAllocFWImgMem_exit;
130 psRGXInitAllocFWImgMemOUT->eError =
131 PVRSRVRGXInitAllocFWImgMemKM(
133 psRGXInitAllocFWImgMemIN->uiFWCodeLen,
134 psRGXInitAllocFWImgMemIN->uiFWDataLen,
135 psRGXInitAllocFWImgMemIN->uiFWCoremem,
136 &psFWCodeAllocServerExportCookieInt,
137 &psRGXInitAllocFWImgMemOUT->sFWCodeDevVAddrBase,
138 &psFWDataAllocServerExportCookieInt,
139 &psRGXInitAllocFWImgMemOUT->sFWDataDevVAddrBase,
140 &psFWCorememAllocServerExportCookieInt,
141 &psRGXInitAllocFWImgMemOUT->sFWCorememDevVAddrBase,
142 &psRGXInitAllocFWImgMemOUT->sFWCorememMetaVAddrBase);
143 /* Exit early if bridged call fails */
144 if(psRGXInitAllocFWImgMemOUT->eError != PVRSRV_OK)
146 goto RGXInitAllocFWImgMem_exit;
150 psRGXInitAllocFWImgMemOUT->eError = PVRSRVAllocHandle(psConnection->psHandleBase,
151 &psRGXInitAllocFWImgMemOUT->hFWCodeAllocServerExportCookie,
152 (IMG_VOID *) psFWCodeAllocServerExportCookieInt,
153 PVRSRV_HANDLE_TYPE_SERVER_EXPORTCOOKIE,
154 PVRSRV_HANDLE_ALLOC_FLAG_NONE
155 ,(PFN_HANDLE_RELEASE)&ReleaseFWCodeAllocServerExportCookie);
156 if (psRGXInitAllocFWImgMemOUT->eError != PVRSRV_OK)
158 goto RGXInitAllocFWImgMem_exit;
162 psRGXInitAllocFWImgMemOUT->eError = PVRSRVAllocHandle(psConnection->psHandleBase,
163 &psRGXInitAllocFWImgMemOUT->hFWDataAllocServerExportCookie,
164 (IMG_VOID *) psFWDataAllocServerExportCookieInt,
165 PVRSRV_HANDLE_TYPE_SERVER_EXPORTCOOKIE,
166 PVRSRV_HANDLE_ALLOC_FLAG_NONE
167 ,(PFN_HANDLE_RELEASE)&ReleaseFWDataAllocServerExportCookie);
168 if (psRGXInitAllocFWImgMemOUT->eError != PVRSRV_OK)
170 goto RGXInitAllocFWImgMem_exit;
174 psRGXInitAllocFWImgMemOUT->eError = PVRSRVAllocHandle(psConnection->psHandleBase,
175 &psRGXInitAllocFWImgMemOUT->hFWCorememAllocServerExportCookie,
176 (IMG_VOID *) psFWCorememAllocServerExportCookieInt,
177 PVRSRV_HANDLE_TYPE_SERVER_EXPORTCOOKIE,
178 PVRSRV_HANDLE_ALLOC_FLAG_NONE
179 ,(PFN_HANDLE_RELEASE)&ReleaseFWCorememAllocServerExportCookie);
180 if (psRGXInitAllocFWImgMemOUT->eError != PVRSRV_OK)
182 goto RGXInitAllocFWImgMem_exit;
188 RGXInitAllocFWImgMem_exit:
189 if (psRGXInitAllocFWImgMemOUT->eError != PVRSRV_OK)
198 PVRSRVBridgeRGXInitFirmware(IMG_UINT32 ui32DispatchTableEntry,
199 PVRSRV_BRIDGE_IN_RGXINITFIRMWARE *psRGXInitFirmwareIN,
200 PVRSRV_BRIDGE_OUT_RGXINITFIRMWARE *psRGXInitFirmwareOUT,
201 CONNECTION_DATA *psConnection)
203 IMG_HANDLE hDevNodeInt = IMG_NULL;
204 IMG_UINT32 *ui32RGXFWAlignChecksInt = IMG_NULL;
205 DEVMEM_EXPORTCOOKIE * psHWPerfDataAllocServerExportCookieInt = IMG_NULL;
210 if (psRGXInitFirmwareIN->ui32RGXFWAlignChecksSize != 0)
212 ui32RGXFWAlignChecksInt = OSAllocMem(psRGXInitFirmwareIN->ui32RGXFWAlignChecksSize * sizeof(IMG_UINT32));
213 if (!ui32RGXFWAlignChecksInt)
215 psRGXInitFirmwareOUT->eError = PVRSRV_ERROR_OUT_OF_MEMORY;
217 goto RGXInitFirmware_exit;
221 /* Copy the data over */
222 if ( !OSAccessOK(PVR_VERIFY_READ, (IMG_VOID*) psRGXInitFirmwareIN->pui32RGXFWAlignChecks, psRGXInitFirmwareIN->ui32RGXFWAlignChecksSize * sizeof(IMG_UINT32))
223 || (OSCopyFromUser(NULL, ui32RGXFWAlignChecksInt, psRGXInitFirmwareIN->pui32RGXFWAlignChecks,
224 psRGXInitFirmwareIN->ui32RGXFWAlignChecksSize * sizeof(IMG_UINT32)) != PVRSRV_OK) )
226 psRGXInitFirmwareOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
228 goto RGXInitFirmware_exit;
234 /* Look up the address from the handle */
235 psRGXInitFirmwareOUT->eError =
236 PVRSRVLookupHandle(psConnection->psHandleBase,
237 (IMG_VOID **) &hDevNodeInt,
238 psRGXInitFirmwareIN->hDevNode,
239 PVRSRV_HANDLE_TYPE_DEV_NODE);
240 if(psRGXInitFirmwareOUT->eError != PVRSRV_OK)
242 goto RGXInitFirmware_exit;
247 psRGXInitFirmwareOUT->eError =
248 PVRSRVRGXInitFirmwareKM(
250 &psRGXInitFirmwareOUT->spsRGXFwInit,
251 psRGXInitFirmwareIN->bEnableSignatureChecks,
252 psRGXInitFirmwareIN->ui32SignatureChecksBufSize,
253 psRGXInitFirmwareIN->ui32HWPerfFWBufSizeKB,
254 psRGXInitFirmwareIN->ui64HWPerfFilter,
255 psRGXInitFirmwareIN->ui32RGXFWAlignChecksSize,
256 ui32RGXFWAlignChecksInt,
257 psRGXInitFirmwareIN->ui32ConfigFlags,
258 psRGXInitFirmwareIN->ui32LogType,
259 psRGXInitFirmwareIN->ui32FilterFlags,
260 psRGXInitFirmwareIN->ui32JonesDisableMask,
261 psRGXInitFirmwareIN->ui32ui32HWRDebugDumpLimit,
262 &psRGXInitFirmwareIN->sClientBVNC,
263 psRGXInitFirmwareIN->ui32HWPerfCountersDataSize,
264 &psHWPerfDataAllocServerExportCookieInt,
265 psRGXInitFirmwareIN->eRGXRDPowerIslandConf);
266 /* Exit early if bridged call fails */
267 if(psRGXInitFirmwareOUT->eError != PVRSRV_OK)
269 goto RGXInitFirmware_exit;
273 psRGXInitFirmwareOUT->eError = PVRSRVAllocHandle(psConnection->psHandleBase,
274 &psRGXInitFirmwareOUT->hHWPerfDataAllocServerExportCookie,
275 (IMG_VOID *) psHWPerfDataAllocServerExportCookieInt,
276 PVRSRV_HANDLE_TYPE_SERVER_EXPORTCOOKIE,
277 PVRSRV_HANDLE_ALLOC_FLAG_NONE
278 ,(PFN_HANDLE_RELEASE)&ReleaseHWPerfDataAllocServerExportCookie);
279 if (psRGXInitFirmwareOUT->eError != PVRSRV_OK)
281 goto RGXInitFirmware_exit;
287 RGXInitFirmware_exit:
288 if (psRGXInitFirmwareOUT->eError != PVRSRV_OK)
292 if (ui32RGXFWAlignChecksInt)
293 OSFreeMem(ui32RGXFWAlignChecksInt);
299 PVRSRVBridgeRGXInitLoadFWImage(IMG_UINT32 ui32DispatchTableEntry,
300 PVRSRV_BRIDGE_IN_RGXINITLOADFWIMAGE *psRGXInitLoadFWImageIN,
301 PVRSRV_BRIDGE_OUT_RGXINITLOADFWIMAGE *psRGXInitLoadFWImageOUT,
302 CONNECTION_DATA *psConnection)
304 PMR * psImgDestImportInt = IMG_NULL;
305 PMR * psImgSrcImportInt = IMG_NULL;
306 PMR * psSigImportInt = IMG_NULL;
315 /* Look up the address from the handle */
316 psRGXInitLoadFWImageOUT->eError =
317 PVRSRVLookupHandle(psConnection->psHandleBase,
318 (IMG_VOID **) &psImgDestImportInt,
319 psRGXInitLoadFWImageIN->hImgDestImport,
320 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR);
321 if(psRGXInitLoadFWImageOUT->eError != PVRSRV_OK)
323 goto RGXInitLoadFWImage_exit;
329 /* Look up the address from the handle */
330 psRGXInitLoadFWImageOUT->eError =
331 PVRSRVLookupHandle(psConnection->psHandleBase,
332 (IMG_VOID **) &psImgSrcImportInt,
333 psRGXInitLoadFWImageIN->hImgSrcImport,
334 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR);
335 if(psRGXInitLoadFWImageOUT->eError != PVRSRV_OK)
337 goto RGXInitLoadFWImage_exit;
343 /* Look up the address from the handle */
344 psRGXInitLoadFWImageOUT->eError =
345 PVRSRVLookupHandle(psConnection->psHandleBase,
346 (IMG_VOID **) &psSigImportInt,
347 psRGXInitLoadFWImageIN->hSigImport,
348 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR);
349 if(psRGXInitLoadFWImageOUT->eError != PVRSRV_OK)
351 goto RGXInitLoadFWImage_exit;
356 psRGXInitLoadFWImageOUT->eError =
357 PVRSRVRGXInitLoadFWImageKM(
360 psRGXInitLoadFWImageIN->ui64ImgLen,
362 psRGXInitLoadFWImageIN->ui64SigLen);
367 RGXInitLoadFWImage_exit:
373 PVRSRVBridgeRGXInitDevPart2(IMG_UINT32 ui32DispatchTableEntry,
374 PVRSRV_BRIDGE_IN_RGXINITDEVPART2 *psRGXInitDevPart2IN,
375 PVRSRV_BRIDGE_OUT_RGXINITDEVPART2 *psRGXInitDevPart2OUT,
376 CONNECTION_DATA *psConnection)
378 IMG_HANDLE hDevNodeInt = IMG_NULL;
379 RGX_INIT_COMMAND *psInitScriptInt = IMG_NULL;
380 RGX_INIT_COMMAND *psDbgScriptInt = IMG_NULL;
381 RGX_INIT_COMMAND *psDbgBusScriptInt = IMG_NULL;
382 RGX_INIT_COMMAND *psDeinitScriptInt = IMG_NULL;
383 DEVMEM_EXPORTCOOKIE * psFWCodeAllocServerExportCookieInt = IMG_NULL;
384 DEVMEM_EXPORTCOOKIE * psFWDataAllocServerExportCookieInt = IMG_NULL;
385 DEVMEM_EXPORTCOOKIE * psFWCorememAllocServerExportCookieInt = IMG_NULL;
386 DEVMEM_EXPORTCOOKIE * psHWPerfDataAllocServerExportCookieInt = IMG_NULL;
393 psInitScriptInt = OSAllocMem(RGX_MAX_INIT_COMMANDS * sizeof(RGX_INIT_COMMAND));
394 if (!psInitScriptInt)
396 psRGXInitDevPart2OUT->eError = PVRSRV_ERROR_OUT_OF_MEMORY;
398 goto RGXInitDevPart2_exit;
402 /* Copy the data over */
403 if ( !OSAccessOK(PVR_VERIFY_READ, (IMG_VOID*) psRGXInitDevPart2IN->psInitScript, RGX_MAX_INIT_COMMANDS * sizeof(RGX_INIT_COMMAND))
404 || (OSCopyFromUser(NULL, psInitScriptInt, psRGXInitDevPart2IN->psInitScript,
405 RGX_MAX_INIT_COMMANDS * sizeof(RGX_INIT_COMMAND)) != PVRSRV_OK) )
407 psRGXInitDevPart2OUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
409 goto RGXInitDevPart2_exit;
413 psDbgScriptInt = OSAllocMem(RGX_MAX_DEBUG_COMMANDS * sizeof(RGX_INIT_COMMAND));
416 psRGXInitDevPart2OUT->eError = PVRSRV_ERROR_OUT_OF_MEMORY;
418 goto RGXInitDevPart2_exit;
422 /* Copy the data over */
423 if ( !OSAccessOK(PVR_VERIFY_READ, (IMG_VOID*) psRGXInitDevPart2IN->psDbgScript, RGX_MAX_DEBUG_COMMANDS * sizeof(RGX_INIT_COMMAND))
424 || (OSCopyFromUser(NULL, psDbgScriptInt, psRGXInitDevPart2IN->psDbgScript,
425 RGX_MAX_DEBUG_COMMANDS * sizeof(RGX_INIT_COMMAND)) != PVRSRV_OK) )
427 psRGXInitDevPart2OUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
429 goto RGXInitDevPart2_exit;
433 psDbgBusScriptInt = OSAllocMem(RGX_MAX_DBGBUS_COMMANDS * sizeof(RGX_INIT_COMMAND));
434 if (!psDbgBusScriptInt)
436 psRGXInitDevPart2OUT->eError = PVRSRV_ERROR_OUT_OF_MEMORY;
438 goto RGXInitDevPart2_exit;
442 /* Copy the data over */
443 if ( !OSAccessOK(PVR_VERIFY_READ, (IMG_VOID*) psRGXInitDevPart2IN->psDbgBusScript, RGX_MAX_DBGBUS_COMMANDS * sizeof(RGX_INIT_COMMAND))
444 || (OSCopyFromUser(NULL, psDbgBusScriptInt, psRGXInitDevPart2IN->psDbgBusScript,
445 RGX_MAX_DBGBUS_COMMANDS * sizeof(RGX_INIT_COMMAND)) != PVRSRV_OK) )
447 psRGXInitDevPart2OUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
449 goto RGXInitDevPart2_exit;
453 psDeinitScriptInt = OSAllocMem(RGX_MAX_DEINIT_COMMANDS * sizeof(RGX_INIT_COMMAND));
454 if (!psDeinitScriptInt)
456 psRGXInitDevPart2OUT->eError = PVRSRV_ERROR_OUT_OF_MEMORY;
458 goto RGXInitDevPart2_exit;
462 /* Copy the data over */
463 if ( !OSAccessOK(PVR_VERIFY_READ, (IMG_VOID*) psRGXInitDevPart2IN->psDeinitScript, RGX_MAX_DEINIT_COMMANDS * sizeof(RGX_INIT_COMMAND))
464 || (OSCopyFromUser(NULL, psDeinitScriptInt, psRGXInitDevPart2IN->psDeinitScript,
465 RGX_MAX_DEINIT_COMMANDS * sizeof(RGX_INIT_COMMAND)) != PVRSRV_OK) )
467 psRGXInitDevPart2OUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
469 goto RGXInitDevPart2_exit;
475 /* Look up the address from the handle */
476 psRGXInitDevPart2OUT->eError =
477 PVRSRVLookupHandle(psConnection->psHandleBase,
478 (IMG_VOID **) &hDevNodeInt,
479 psRGXInitDevPart2IN->hDevNode,
480 PVRSRV_HANDLE_TYPE_DEV_NODE);
481 if(psRGXInitDevPart2OUT->eError != PVRSRV_OK)
483 goto RGXInitDevPart2_exit;
489 /* Look up the address from the handle */
490 psRGXInitDevPart2OUT->eError =
491 PVRSRVLookupHandle(psConnection->psHandleBase,
492 (IMG_VOID **) &psFWCodeAllocServerExportCookieInt,
493 psRGXInitDevPart2IN->hFWCodeAllocServerExportCookie,
494 PVRSRV_HANDLE_TYPE_SERVER_EXPORTCOOKIE);
495 if(psRGXInitDevPart2OUT->eError != PVRSRV_OK)
497 goto RGXInitDevPart2_exit;
503 /* Look up the address from the handle */
504 psRGXInitDevPart2OUT->eError =
505 PVRSRVLookupHandle(psConnection->psHandleBase,
506 (IMG_VOID **) &psFWDataAllocServerExportCookieInt,
507 psRGXInitDevPart2IN->hFWDataAllocServerExportCookie,
508 PVRSRV_HANDLE_TYPE_SERVER_EXPORTCOOKIE);
509 if(psRGXInitDevPart2OUT->eError != PVRSRV_OK)
511 goto RGXInitDevPart2_exit;
517 /* Look up the address from the handle */
518 psRGXInitDevPart2OUT->eError =
519 PVRSRVLookupHandle(psConnection->psHandleBase,
520 (IMG_VOID **) &psFWCorememAllocServerExportCookieInt,
521 psRGXInitDevPart2IN->hFWCorememAllocServerExportCookie,
522 PVRSRV_HANDLE_TYPE_SERVER_EXPORTCOOKIE);
523 if(psRGXInitDevPart2OUT->eError != PVRSRV_OK)
525 goto RGXInitDevPart2_exit;
531 /* Look up the address from the handle */
532 psRGXInitDevPart2OUT->eError =
533 PVRSRVLookupHandle(psConnection->psHandleBase,
534 (IMG_VOID **) &psHWPerfDataAllocServerExportCookieInt,
535 psRGXInitDevPart2IN->hHWPerfDataAllocServerExportCookie,
536 PVRSRV_HANDLE_TYPE_SERVER_EXPORTCOOKIE);
537 if(psRGXInitDevPart2OUT->eError != PVRSRV_OK)
539 goto RGXInitDevPart2_exit;
544 psRGXInitDevPart2OUT->eError =
545 PVRSRVRGXInitDevPart2KM(
551 psRGXInitDevPart2IN->ui32ui32KernelCatBaseIdReg,
552 psRGXInitDevPart2IN->ui32KernelCatBaseId,
553 psRGXInitDevPart2IN->ui32KernelCatBaseReg,
554 psRGXInitDevPart2IN->ui32KernelCatBaseWordSize,
555 psRGXInitDevPart2IN->ui32KernelCatBaseAlignShift,
556 psRGXInitDevPart2IN->ui32KernelCatBaseShift,
557 psRGXInitDevPart2IN->ui64KernelCatBaseMask,
558 psRGXInitDevPart2IN->ui32DeviceFlags,
559 psRGXInitDevPart2IN->ui32RGXActivePMConf,
560 psFWCodeAllocServerExportCookieInt,
561 psFWDataAllocServerExportCookieInt,
562 psFWCorememAllocServerExportCookieInt,
563 psHWPerfDataAllocServerExportCookieInt);
566 psRGXInitDevPart2OUT->eError =
567 PVRSRVReleaseHandle(psConnection->psHandleBase,
568 (IMG_HANDLE) psRGXInitDevPart2IN->hFWCodeAllocServerExportCookie,
569 PVRSRV_HANDLE_TYPE_SERVER_EXPORTCOOKIE);
570 if ((psRGXInitDevPart2OUT->eError != PVRSRV_OK) && (psRGXInitDevPart2OUT->eError != PVRSRV_ERROR_RETRY))
573 goto RGXInitDevPart2_exit;
576 psRGXInitDevPart2OUT->eError =
577 PVRSRVReleaseHandle(psConnection->psHandleBase,
578 (IMG_HANDLE) psRGXInitDevPart2IN->hFWDataAllocServerExportCookie,
579 PVRSRV_HANDLE_TYPE_SERVER_EXPORTCOOKIE);
580 if ((psRGXInitDevPart2OUT->eError != PVRSRV_OK) && (psRGXInitDevPart2OUT->eError != PVRSRV_ERROR_RETRY))
583 goto RGXInitDevPart2_exit;
586 psRGXInitDevPart2OUT->eError =
587 PVRSRVReleaseHandle(psConnection->psHandleBase,
588 (IMG_HANDLE) psRGXInitDevPart2IN->hFWCorememAllocServerExportCookie,
589 PVRSRV_HANDLE_TYPE_SERVER_EXPORTCOOKIE);
590 if ((psRGXInitDevPart2OUT->eError != PVRSRV_OK) && (psRGXInitDevPart2OUT->eError != PVRSRV_ERROR_RETRY))
593 goto RGXInitDevPart2_exit;
596 psRGXInitDevPart2OUT->eError =
597 PVRSRVReleaseHandle(psConnection->psHandleBase,
598 (IMG_HANDLE) psRGXInitDevPart2IN->hHWPerfDataAllocServerExportCookie,
599 PVRSRV_HANDLE_TYPE_SERVER_EXPORTCOOKIE);
600 if ((psRGXInitDevPart2OUT->eError != PVRSRV_OK) && (psRGXInitDevPart2OUT->eError != PVRSRV_ERROR_RETRY))
603 goto RGXInitDevPart2_exit;
608 RGXInitDevPart2_exit:
610 OSFreeMem(psInitScriptInt);
612 OSFreeMem(psDbgScriptInt);
613 if (psDbgBusScriptInt)
614 OSFreeMem(psDbgBusScriptInt);
615 if (psDeinitScriptInt)
616 OSFreeMem(psDeinitScriptInt);
622 PVRSRVBridgeGPUVIRTPopulateLMASubArenas(IMG_UINT32 ui32DispatchTableEntry,
623 PVRSRV_BRIDGE_IN_GPUVIRTPOPULATELMASUBARENAS *psGPUVIRTPopulateLMASubArenasIN,
624 PVRSRV_BRIDGE_OUT_GPUVIRTPOPULATELMASUBARENAS *psGPUVIRTPopulateLMASubArenasOUT,
625 CONNECTION_DATA *psConnection)
627 IMG_HANDLE hDevNodeInt = IMG_NULL;
628 IMG_UINT32 *ui32ElementsInt = IMG_NULL;
633 if (psGPUVIRTPopulateLMASubArenasIN->ui32NumElements != 0)
635 ui32ElementsInt = OSAllocMem(psGPUVIRTPopulateLMASubArenasIN->ui32NumElements * sizeof(IMG_UINT32));
636 if (!ui32ElementsInt)
638 psGPUVIRTPopulateLMASubArenasOUT->eError = PVRSRV_ERROR_OUT_OF_MEMORY;
640 goto GPUVIRTPopulateLMASubArenas_exit;
644 /* Copy the data over */
645 if ( !OSAccessOK(PVR_VERIFY_READ, (IMG_VOID*) psGPUVIRTPopulateLMASubArenasIN->pui32Elements, psGPUVIRTPopulateLMASubArenasIN->ui32NumElements * sizeof(IMG_UINT32))
646 || (OSCopyFromUser(NULL, ui32ElementsInt, psGPUVIRTPopulateLMASubArenasIN->pui32Elements,
647 psGPUVIRTPopulateLMASubArenasIN->ui32NumElements * sizeof(IMG_UINT32)) != PVRSRV_OK) )
649 psGPUVIRTPopulateLMASubArenasOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
651 goto GPUVIRTPopulateLMASubArenas_exit;
657 /* Look up the address from the handle */
658 psGPUVIRTPopulateLMASubArenasOUT->eError =
659 PVRSRVLookupHandle(psConnection->psHandleBase,
660 (IMG_VOID **) &hDevNodeInt,
661 psGPUVIRTPopulateLMASubArenasIN->hDevNode,
662 PVRSRV_HANDLE_TYPE_DEV_NODE);
663 if(psGPUVIRTPopulateLMASubArenasOUT->eError != PVRSRV_OK)
665 goto GPUVIRTPopulateLMASubArenas_exit;
670 psGPUVIRTPopulateLMASubArenasOUT->eError =
671 PVRSRVGPUVIRTPopulateLMASubArenasKM(
673 psGPUVIRTPopulateLMASubArenasIN->ui32NumElements,
679 GPUVIRTPopulateLMASubArenas_exit:
681 OSFreeMem(ui32ElementsInt);
688 /* ***************************************************************************
689 * Server bridge dispatch related glue
693 PVRSRV_ERROR InitRGXINITBridge(IMG_VOID);
694 PVRSRV_ERROR DeinitRGXINITBridge(IMG_VOID);
697 * Register all RGXINIT functions with services
699 PVRSRV_ERROR InitRGXINITBridge(IMG_VOID)
702 SetDispatchTableEntry(PVRSRV_BRIDGE_RGXINIT, PVRSRV_BRIDGE_RGXINIT_RGXINITALLOCFWIMGMEM, PVRSRVBridgeRGXInitAllocFWImgMem,
706 SetDispatchTableEntry(PVRSRV_BRIDGE_RGXINIT, PVRSRV_BRIDGE_RGXINIT_RGXINITFIRMWARE, PVRSRVBridgeRGXInitFirmware,
710 SetDispatchTableEntry(PVRSRV_BRIDGE_RGXINIT, PVRSRV_BRIDGE_RGXINIT_RGXINITLOADFWIMAGE, PVRSRVBridgeRGXInitLoadFWImage,
714 SetDispatchTableEntry(PVRSRV_BRIDGE_RGXINIT, PVRSRV_BRIDGE_RGXINIT_RGXINITDEVPART2, PVRSRVBridgeRGXInitDevPart2,
718 SetDispatchTableEntry(PVRSRV_BRIDGE_RGXINIT, PVRSRV_BRIDGE_RGXINIT_GPUVIRTPOPULATELMASUBARENAS, PVRSRVBridgeGPUVIRTPopulateLMASubArenas,
727 * Unregister all rgxinit functions with services
729 PVRSRV_ERROR DeinitRGXINITBridge(IMG_VOID)