1 /*************************************************************************/ /*!
3 @Title Server bridge for srvcore
4 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description Implements the server side of the bridge for srvcore
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>
53 #include "common_srvcore_bridge.h"
56 #include "pvr_debug.h"
57 #include "connection_server.h"
58 #include "pvr_bridge.h"
59 #include "rgx_bridge.h"
63 #if defined (SUPPORT_AUTH)
67 #include <linux/slab.h>
69 /* ***************************************************************************
70 * Bridge proxy functions
74 ReleaseGlobalEventObjectResManProxy(IMG_HANDLE hResmanItem)
78 eError = ResManFreeResByPtr(hResmanItem);
80 /* Freeing a resource should never fail... */
81 PVR_ASSERT((eError == PVRSRV_OK) || (eError == PVRSRV_ERROR_RETRY));
87 EventObjectCloseResManProxy(IMG_HANDLE hResmanItem)
91 eError = ResManFreeResByPtr(hResmanItem);
93 /* Freeing a resource should never fail... */
94 PVR_ASSERT((eError == PVRSRV_OK) || (eError == PVRSRV_ERROR_RETRY));
101 /* ***************************************************************************
102 * Server-side bridge entry points
106 PVRSRVBridgeConnect(IMG_UINT32 ui32BridgeID,
107 PVRSRV_BRIDGE_IN_CONNECT *psConnectIN,
108 PVRSRV_BRIDGE_OUT_CONNECT *psConnectOUT,
109 CONNECTION_DATA *psConnection)
112 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_CONNECT);
114 PVR_UNREFERENCED_PARAMETER(psConnection);
119 psConnectOUT->eError =
120 PVRSRVConnectKM(psConnection,
121 psConnectIN->ui32Flags,
122 psConnectIN->ui32ClientBuildOptions,
123 psConnectIN->ui32ClientDDKVersion,
124 psConnectIN->ui32ClientDDKBuild,
125 &psConnectOUT->ui8KernelArch,
126 &psConnectOUT->ui32Log2PageSize);
135 PVRSRVBridgeDisconnect(IMG_UINT32 ui32BridgeID,
136 PVRSRV_BRIDGE_IN_DISCONNECT *psDisconnectIN,
137 PVRSRV_BRIDGE_OUT_DISCONNECT *psDisconnectOUT,
138 CONNECTION_DATA *psConnection)
141 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_DISCONNECT);
143 PVR_UNREFERENCED_PARAMETER(psConnection);
144 PVR_UNREFERENCED_PARAMETER(psDisconnectIN);
149 psDisconnectOUT->eError =
160 PVRSRVBridgeEnumerateDevices(IMG_UINT32 ui32BridgeID,
161 PVRSRV_BRIDGE_IN_ENUMERATEDEVICES *psEnumerateDevicesIN,
162 PVRSRV_BRIDGE_OUT_ENUMERATEDEVICES *psEnumerateDevicesOUT,
163 CONNECTION_DATA *psConnection)
165 PVRSRV_DEVICE_TYPE *peDeviceTypeInt = IMG_NULL;
166 PVRSRV_DEVICE_CLASS *peDeviceClassInt = IMG_NULL;
167 IMG_UINT32 *pui32DeviceIndexInt = IMG_NULL;
169 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_ENUMERATEDEVICES);
171 PVR_UNREFERENCED_PARAMETER(psConnection);
172 PVR_UNREFERENCED_PARAMETER(psEnumerateDevicesIN);
174 psEnumerateDevicesOUT->peDeviceType = psEnumerateDevicesIN->peDeviceType;
175 psEnumerateDevicesOUT->peDeviceClass = psEnumerateDevicesIN->peDeviceClass;
176 psEnumerateDevicesOUT->pui32DeviceIndex = psEnumerateDevicesIN->pui32DeviceIndex;
181 peDeviceTypeInt = OSAllocMem(PVRSRV_MAX_DEVICES * sizeof(PVRSRV_DEVICE_TYPE));
182 if (!peDeviceTypeInt)
184 psEnumerateDevicesOUT->eError = PVRSRV_ERROR_OUT_OF_MEMORY;
186 goto EnumerateDevices_exit;
192 peDeviceClassInt = OSAllocMem(PVRSRV_MAX_DEVICES * sizeof(PVRSRV_DEVICE_CLASS));
193 if (!peDeviceClassInt)
195 psEnumerateDevicesOUT->eError = PVRSRV_ERROR_OUT_OF_MEMORY;
197 goto EnumerateDevices_exit;
203 pui32DeviceIndexInt = OSAllocMem(PVRSRV_MAX_DEVICES * sizeof(IMG_UINT32));
204 if (!pui32DeviceIndexInt)
206 psEnumerateDevicesOUT->eError = PVRSRV_ERROR_OUT_OF_MEMORY;
208 goto EnumerateDevices_exit;
213 psEnumerateDevicesOUT->eError =
214 PVRSRVEnumerateDevicesKM(
215 &psEnumerateDevicesOUT->ui32NumDevices,
218 pui32DeviceIndexInt);
221 if ( !OSAccessOK(PVR_VERIFY_WRITE, (IMG_VOID*) psEnumerateDevicesOUT->peDeviceType, (PVRSRV_MAX_DEVICES * sizeof(PVRSRV_DEVICE_TYPE)))
222 || (OSCopyToUser(NULL, psEnumerateDevicesOUT->peDeviceType, peDeviceTypeInt,
223 (PVRSRV_MAX_DEVICES * sizeof(PVRSRV_DEVICE_TYPE))) != PVRSRV_OK) )
225 psEnumerateDevicesOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
227 goto EnumerateDevices_exit;
230 if ( !OSAccessOK(PVR_VERIFY_WRITE, (IMG_VOID*) psEnumerateDevicesOUT->peDeviceClass, (PVRSRV_MAX_DEVICES * sizeof(PVRSRV_DEVICE_CLASS)))
231 || (OSCopyToUser(NULL, psEnumerateDevicesOUT->peDeviceClass, peDeviceClassInt,
232 (PVRSRV_MAX_DEVICES * sizeof(PVRSRV_DEVICE_CLASS))) != PVRSRV_OK) )
234 psEnumerateDevicesOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
236 goto EnumerateDevices_exit;
239 if ( !OSAccessOK(PVR_VERIFY_WRITE, (IMG_VOID*) psEnumerateDevicesOUT->pui32DeviceIndex, (PVRSRV_MAX_DEVICES * sizeof(IMG_UINT32)))
240 || (OSCopyToUser(NULL, psEnumerateDevicesOUT->pui32DeviceIndex, pui32DeviceIndexInt,
241 (PVRSRV_MAX_DEVICES * sizeof(IMG_UINT32))) != PVRSRV_OK) )
243 psEnumerateDevicesOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
245 goto EnumerateDevices_exit;
249 EnumerateDevices_exit:
251 OSFreeMem(peDeviceTypeInt);
252 if (peDeviceClassInt)
253 OSFreeMem(peDeviceClassInt);
254 if (pui32DeviceIndexInt)
255 OSFreeMem(pui32DeviceIndexInt);
261 PVRSRVBridgeAcquireDeviceData(IMG_UINT32 ui32BridgeID,
262 PVRSRV_BRIDGE_IN_ACQUIREDEVICEDATA *psAcquireDeviceDataIN,
263 PVRSRV_BRIDGE_OUT_ACQUIREDEVICEDATA *psAcquireDeviceDataOUT,
264 CONNECTION_DATA *psConnection)
266 IMG_HANDLE hDevCookieInt = IMG_NULL;
268 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_ACQUIREDEVICEDATA);
274 psAcquireDeviceDataOUT->eError =
275 PVRSRVAcquireDeviceDataKM(
276 psAcquireDeviceDataIN->ui32DevIndex,
277 psAcquireDeviceDataIN->eDeviceType,
279 /* Exit early if bridged call fails */
280 if(psAcquireDeviceDataOUT->eError != PVRSRV_OK)
282 goto AcquireDeviceData_exit;
285 psAcquireDeviceDataOUT->eError = PVRSRVAllocHandle(psConnection->psHandleBase,
286 &psAcquireDeviceDataOUT->hDevCookie,
287 (IMG_HANDLE) hDevCookieInt,
288 PVRSRV_HANDLE_TYPE_DEV_NODE,
289 PVRSRV_HANDLE_ALLOC_FLAG_SHARED
291 if (psAcquireDeviceDataOUT->eError != PVRSRV_OK)
293 goto AcquireDeviceData_exit;
297 AcquireDeviceData_exit:
298 if (psAcquireDeviceDataOUT->eError != PVRSRV_OK)
307 PVRSRVBridgeReleaseDeviceData(IMG_UINT32 ui32BridgeID,
308 PVRSRV_BRIDGE_IN_RELEASEDEVICEDATA *psReleaseDeviceDataIN,
309 PVRSRV_BRIDGE_OUT_RELEASEDEVICEDATA *psReleaseDeviceDataOUT,
310 CONNECTION_DATA *psConnection)
312 IMG_HANDLE hDevCookieInt = IMG_NULL;
314 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_RELEASEDEVICEDATA);
321 /* Look up the address from the handle */
322 psReleaseDeviceDataOUT->eError =
323 PVRSRVLookupHandle(psConnection->psHandleBase,
324 (IMG_HANDLE *) &hDevCookieInt,
325 psReleaseDeviceDataIN->hDevCookie,
326 PVRSRV_HANDLE_TYPE_DEV_NODE);
327 if(psReleaseDeviceDataOUT->eError != PVRSRV_OK)
329 goto ReleaseDeviceData_exit;
334 psReleaseDeviceDataOUT->eError =
335 PVRSRVReleaseDeviceDataKM(
337 /* Exit early if bridged call fails */
338 if(psReleaseDeviceDataOUT->eError != PVRSRV_OK)
340 goto ReleaseDeviceData_exit;
343 psReleaseDeviceDataOUT->eError =
344 PVRSRVReleaseHandle(psConnection->psHandleBase,
345 (IMG_HANDLE) psReleaseDeviceDataIN->hDevCookie,
346 PVRSRV_HANDLE_TYPE_DEV_NODE);
349 ReleaseDeviceData_exit:
355 PVRSRVBridgeInitSrvDisconnect(IMG_UINT32 ui32BridgeID,
356 PVRSRV_BRIDGE_IN_INITSRVDISCONNECT *psInitSrvDisconnectIN,
357 PVRSRV_BRIDGE_OUT_INITSRVDISCONNECT *psInitSrvDisconnectOUT,
358 CONNECTION_DATA *psConnection)
361 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_INITSRVDISCONNECT);
367 psInitSrvDisconnectOUT->eError =
368 PVRSRVInitSrvDisconnectKM(psConnection,
369 psInitSrvDisconnectIN->bInitSuccesful,
370 psInitSrvDisconnectIN->ui32ClientBuildOptions);
379 PVRSRVBridgeAcquireGlobalEventObject(IMG_UINT32 ui32BridgeID,
380 PVRSRV_BRIDGE_IN_ACQUIREGLOBALEVENTOBJECT *psAcquireGlobalEventObjectIN,
381 PVRSRV_BRIDGE_OUT_ACQUIREGLOBALEVENTOBJECT *psAcquireGlobalEventObjectOUT,
382 CONNECTION_DATA *psConnection)
384 IMG_HANDLE hGlobalEventObjectInt = IMG_NULL;
385 IMG_HANDLE hGlobalEventObjectInt2 = IMG_NULL;
387 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_ACQUIREGLOBALEVENTOBJECT);
389 PVR_UNREFERENCED_PARAMETER(psAcquireGlobalEventObjectIN);
394 psAcquireGlobalEventObjectOUT->eError =
395 AcquireGlobalEventObjectServer(
396 &hGlobalEventObjectInt);
397 /* Exit early if bridged call fails */
398 if(psAcquireGlobalEventObjectOUT->eError != PVRSRV_OK)
400 goto AcquireGlobalEventObject_exit;
403 /* Create a resman item and overwrite the handle with it */
404 hGlobalEventObjectInt2 = ResManRegisterRes(psConnection->hResManContext,
405 RESMAN_TYPE_SHARED_EVENT_OBJECT,
406 hGlobalEventObjectInt,
407 (RESMAN_FREE_FN)&ReleaseGlobalEventObjectServer);
408 if (hGlobalEventObjectInt2 == IMG_NULL)
410 psAcquireGlobalEventObjectOUT->eError = PVRSRV_ERROR_UNABLE_TO_REGISTER_RESOURCE;
411 goto AcquireGlobalEventObject_exit;
413 psAcquireGlobalEventObjectOUT->eError = PVRSRVAllocHandle(psConnection->psHandleBase,
414 &psAcquireGlobalEventObjectOUT->hGlobalEventObject,
415 (IMG_HANDLE) hGlobalEventObjectInt2,
416 PVRSRV_HANDLE_TYPE_SHARED_EVENT_OBJECT,
417 PVRSRV_HANDLE_ALLOC_FLAG_SHARED
419 if (psAcquireGlobalEventObjectOUT->eError != PVRSRV_OK)
421 goto AcquireGlobalEventObject_exit;
425 AcquireGlobalEventObject_exit:
426 if (psAcquireGlobalEventObjectOUT->eError != PVRSRV_OK)
428 /* If we have a valid resman item we should undo the bridge function by freeing the resman item */
429 if (hGlobalEventObjectInt2)
431 PVRSRV_ERROR eError = ResManFreeResByPtr(hGlobalEventObjectInt2);
433 /* Freeing a resource should never fail... */
434 PVR_ASSERT((eError == PVRSRV_OK) || (eError == PVRSRV_ERROR_RETRY));
436 else if (hGlobalEventObjectInt)
438 ReleaseGlobalEventObjectServer(hGlobalEventObjectInt);
447 PVRSRVBridgeReleaseGlobalEventObject(IMG_UINT32 ui32BridgeID,
448 PVRSRV_BRIDGE_IN_RELEASEGLOBALEVENTOBJECT *psReleaseGlobalEventObjectIN,
449 PVRSRV_BRIDGE_OUT_RELEASEGLOBALEVENTOBJECT *psReleaseGlobalEventObjectOUT,
450 CONNECTION_DATA *psConnection)
452 IMG_HANDLE hGlobalEventObjectInt2 = IMG_NULL;
454 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_RELEASEGLOBALEVENTOBJECT);
461 /* Look up the address from the handle */
462 psReleaseGlobalEventObjectOUT->eError =
463 PVRSRVLookupHandle(psConnection->psHandleBase,
464 (IMG_HANDLE *) &hGlobalEventObjectInt2,
465 psReleaseGlobalEventObjectIN->hGlobalEventObject,
466 PVRSRV_HANDLE_TYPE_SHARED_EVENT_OBJECT);
467 if(psReleaseGlobalEventObjectOUT->eError != PVRSRV_OK)
469 goto ReleaseGlobalEventObject_exit;
474 psReleaseGlobalEventObjectOUT->eError = ReleaseGlobalEventObjectResManProxy(hGlobalEventObjectInt2);
475 /* Exit early if bridged call fails */
476 if(psReleaseGlobalEventObjectOUT->eError != PVRSRV_OK)
478 goto ReleaseGlobalEventObject_exit;
481 psReleaseGlobalEventObjectOUT->eError =
482 PVRSRVReleaseHandle(psConnection->psHandleBase,
483 (IMG_HANDLE) psReleaseGlobalEventObjectIN->hGlobalEventObject,
484 PVRSRV_HANDLE_TYPE_SHARED_EVENT_OBJECT);
487 ReleaseGlobalEventObject_exit:
493 PVRSRVBridgeEventObjectOpen(IMG_UINT32 ui32BridgeID,
494 PVRSRV_BRIDGE_IN_EVENTOBJECTOPEN *psEventObjectOpenIN,
495 PVRSRV_BRIDGE_OUT_EVENTOBJECTOPEN *psEventObjectOpenOUT,
496 CONNECTION_DATA *psConnection)
498 IMG_HANDLE hEventObjectInt = IMG_NULL;
499 IMG_HANDLE hEventObjectInt2 = IMG_NULL;
500 IMG_HANDLE hOSEventInt = IMG_NULL;
501 IMG_HANDLE hOSEventInt2 = IMG_NULL;
503 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_EVENTOBJECTOPEN);
510 /* Look up the address from the handle */
511 psEventObjectOpenOUT->eError =
512 PVRSRVLookupHandle(psConnection->psHandleBase,
513 (IMG_HANDLE *) &hEventObjectInt2,
514 psEventObjectOpenIN->hEventObject,
515 PVRSRV_HANDLE_TYPE_SHARED_EVENT_OBJECT);
516 if(psEventObjectOpenOUT->eError != PVRSRV_OK)
518 goto EventObjectOpen_exit;
521 /* Look up the data from the resman address */
522 psEventObjectOpenOUT->eError = ResManFindPrivateDataByPtr(hEventObjectInt2, (IMG_VOID **) &hEventObjectInt);
524 if(psEventObjectOpenOUT->eError != PVRSRV_OK)
526 goto EventObjectOpen_exit;
530 psEventObjectOpenOUT->eError =
534 /* Exit early if bridged call fails */
535 if(psEventObjectOpenOUT->eError != PVRSRV_OK)
537 goto EventObjectOpen_exit;
540 /* Create a resman item and overwrite the handle with it */
541 hOSEventInt2 = ResManRegisterRes(psConnection->hResManContext,
542 RESMAN_TYPE_EVENT_OBJECT,
544 (RESMAN_FREE_FN)&OSEventObjectClose);
545 if (hOSEventInt2 == IMG_NULL)
547 psEventObjectOpenOUT->eError = PVRSRV_ERROR_UNABLE_TO_REGISTER_RESOURCE;
548 goto EventObjectOpen_exit;
550 psEventObjectOpenOUT->eError = PVRSRVAllocHandle(psConnection->psHandleBase,
551 &psEventObjectOpenOUT->hOSEvent,
552 (IMG_HANDLE) hOSEventInt2,
553 PVRSRV_HANDLE_TYPE_EVENT_OBJECT_CONNECT,
554 PVRSRV_HANDLE_ALLOC_FLAG_MULTI
556 if (psEventObjectOpenOUT->eError != PVRSRV_OK)
558 goto EventObjectOpen_exit;
562 EventObjectOpen_exit:
563 if (psEventObjectOpenOUT->eError != PVRSRV_OK)
565 /* If we have a valid resman item we should undo the bridge function by freeing the resman item */
568 PVRSRV_ERROR eError = ResManFreeResByPtr(hOSEventInt2);
570 /* Freeing a resource should never fail... */
571 PVR_ASSERT((eError == PVRSRV_OK) || (eError == PVRSRV_ERROR_RETRY));
573 else if (hOSEventInt)
575 OSEventObjectClose(hOSEventInt);
584 PVRSRVBridgeEventObjectWait(IMG_UINT32 ui32BridgeID,
585 PVRSRV_BRIDGE_IN_EVENTOBJECTWAIT *psEventObjectWaitIN,
586 PVRSRV_BRIDGE_OUT_EVENTOBJECTWAIT *psEventObjectWaitOUT,
587 CONNECTION_DATA *psConnection)
589 IMG_HANDLE hOSEventKMInt = IMG_NULL;
590 IMG_HANDLE hOSEventKMInt2 = IMG_NULL;
592 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_EVENTOBJECTWAIT);
599 /* Look up the address from the handle */
600 psEventObjectWaitOUT->eError =
601 PVRSRVLookupHandle(psConnection->psHandleBase,
602 (IMG_HANDLE *) &hOSEventKMInt2,
603 psEventObjectWaitIN->hOSEventKM,
604 PVRSRV_HANDLE_TYPE_EVENT_OBJECT_CONNECT);
605 if(psEventObjectWaitOUT->eError != PVRSRV_OK)
607 goto EventObjectWait_exit;
610 /* Look up the data from the resman address */
611 psEventObjectWaitOUT->eError = ResManFindPrivateDataByPtr(hOSEventKMInt2, (IMG_VOID **) &hOSEventKMInt);
613 if(psEventObjectWaitOUT->eError != PVRSRV_OK)
615 goto EventObjectWait_exit;
619 psEventObjectWaitOUT->eError =
625 EventObjectWait_exit:
631 PVRSRVBridgeEventObjectClose(IMG_UINT32 ui32BridgeID,
632 PVRSRV_BRIDGE_IN_EVENTOBJECTCLOSE *psEventObjectCloseIN,
633 PVRSRV_BRIDGE_OUT_EVENTOBJECTCLOSE *psEventObjectCloseOUT,
634 CONNECTION_DATA *psConnection)
636 IMG_HANDLE hOSEventKMInt2 = IMG_NULL;
638 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_EVENTOBJECTCLOSE);
645 /* Look up the address from the handle */
646 psEventObjectCloseOUT->eError =
647 PVRSRVLookupHandle(psConnection->psHandleBase,
648 (IMG_HANDLE *) &hOSEventKMInt2,
649 psEventObjectCloseIN->hOSEventKM,
650 PVRSRV_HANDLE_TYPE_EVENT_OBJECT_CONNECT);
651 if(psEventObjectCloseOUT->eError != PVRSRV_OK)
653 goto EventObjectClose_exit;
658 psEventObjectCloseOUT->eError = EventObjectCloseResManProxy(hOSEventKMInt2);
659 /* Exit early if bridged call fails */
660 if(psEventObjectCloseOUT->eError != PVRSRV_OK)
662 goto EventObjectClose_exit;
665 psEventObjectCloseOUT->eError =
666 PVRSRVReleaseHandle(psConnection->psHandleBase,
667 (IMG_HANDLE) psEventObjectCloseIN->hOSEventKM,
668 PVRSRV_HANDLE_TYPE_EVENT_OBJECT_CONNECT);
671 EventObjectClose_exit:
677 PVRSRVBridgeDumpDebugInfo(IMG_UINT32 ui32BridgeID,
678 PVRSRV_BRIDGE_IN_DUMPDEBUGINFO *psDumpDebugInfoIN,
679 PVRSRV_BRIDGE_OUT_DUMPDEBUGINFO *psDumpDebugInfoOUT,
680 CONNECTION_DATA *psConnection)
683 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_DUMPDEBUGINFO);
685 PVR_UNREFERENCED_PARAMETER(psConnection);
690 psDumpDebugInfoOUT->eError =
691 PVRSRVDumpDebugInfoKM(
692 psDumpDebugInfoIN->ui32ui32VerbLevel);
701 PVRSRVBridgeGetDevClockSpeed(IMG_UINT32 ui32BridgeID,
702 PVRSRV_BRIDGE_IN_GETDEVCLOCKSPEED *psGetDevClockSpeedIN,
703 PVRSRV_BRIDGE_OUT_GETDEVCLOCKSPEED *psGetDevClockSpeedOUT,
704 CONNECTION_DATA *psConnection)
706 IMG_HANDLE hDevNodeInt = IMG_NULL;
708 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_GETDEVCLOCKSPEED);
715 /* Look up the address from the handle */
716 psGetDevClockSpeedOUT->eError =
717 PVRSRVLookupHandle(psConnection->psHandleBase,
718 (IMG_HANDLE *) &hDevNodeInt,
719 psGetDevClockSpeedIN->hDevNode,
720 PVRSRV_HANDLE_TYPE_DEV_NODE);
721 if(psGetDevClockSpeedOUT->eError != PVRSRV_OK)
723 goto GetDevClockSpeed_exit;
728 psGetDevClockSpeedOUT->eError =
729 PVRSRVGetDevClockSpeedKM(
731 &psGetDevClockSpeedOUT->ui32ui32RGXClockSpeed);
735 GetDevClockSpeed_exit:
741 PVRSRVBridgeHWOpTimeout(IMG_UINT32 ui32BridgeID,
742 PVRSRV_BRIDGE_IN_HWOPTIMEOUT *psHWOpTimeoutIN,
743 PVRSRV_BRIDGE_OUT_HWOPTIMEOUT *psHWOpTimeoutOUT,
744 CONNECTION_DATA *psConnection)
747 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_HWOPTIMEOUT);
749 PVR_UNREFERENCED_PARAMETER(psConnection);
750 PVR_UNREFERENCED_PARAMETER(psHWOpTimeoutIN);
755 psHWOpTimeoutOUT->eError =
766 PVRSRVBridgeKickDevices(IMG_UINT32 ui32BridgeID,
767 PVRSRV_BRIDGE_IN_KICKDEVICES *psKickDevicesIN,
768 PVRSRV_BRIDGE_OUT_KICKDEVICES *psKickDevicesOUT,
769 CONNECTION_DATA *psConnection)
772 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_KICKDEVICES);
774 PVR_UNREFERENCED_PARAMETER(psConnection);
775 PVR_UNREFERENCED_PARAMETER(psKickDevicesIN);
780 psKickDevicesOUT->eError =
791 PVRSRVBridgeResetHWRLogs(IMG_UINT32 ui32BridgeID,
792 PVRSRV_BRIDGE_IN_RESETHWRLOGS *psResetHWRLogsIN,
793 PVRSRV_BRIDGE_OUT_RESETHWRLOGS *psResetHWRLogsOUT,
794 CONNECTION_DATA *psConnection)
796 IMG_HANDLE hDevNodeInt = IMG_NULL;
798 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_RESETHWRLOGS);
805 /* Look up the address from the handle */
806 psResetHWRLogsOUT->eError =
807 PVRSRVLookupHandle(psConnection->psHandleBase,
808 (IMG_HANDLE *) &hDevNodeInt,
809 psResetHWRLogsIN->hDevNode,
810 PVRSRV_HANDLE_TYPE_DEV_NODE);
811 if(psResetHWRLogsOUT->eError != PVRSRV_OK)
813 goto ResetHWRLogs_exit;
818 psResetHWRLogsOUT->eError =
819 PVRSRVResetHWRLogsKM(
830 PVRSRVBridgeSoftReset(IMG_UINT32 ui32BridgeID,
831 PVRSRV_BRIDGE_IN_SOFTRESET *psSoftResetIN,
832 PVRSRV_BRIDGE_OUT_SOFTRESET *psSoftResetOUT,
833 CONNECTION_DATA *psConnection)
835 IMG_HANDLE hDevNodeInt = IMG_NULL;
837 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_SOFTRESET);
844 /* Look up the address from the handle */
845 psSoftResetOUT->eError =
846 PVRSRVLookupHandle(psConnection->psHandleBase,
847 (IMG_HANDLE *) &hDevNodeInt,
848 psSoftResetIN->hDevNode,
849 PVRSRV_HANDLE_TYPE_DEV_NODE);
850 if(psSoftResetOUT->eError != PVRSRV_OK)
857 psSoftResetOUT->eError =
860 psSoftResetIN->ui64ResetValue);
871 /* ***************************************************************************
872 * Server bridge dispatch related glue
875 PVRSRV_ERROR RegisterSRVCOREFunctions(IMG_VOID);
876 IMG_VOID UnregisterSRVCOREFunctions(IMG_VOID);
879 * Register all SRVCORE functions with services
881 PVRSRV_ERROR RegisterSRVCOREFunctions(IMG_VOID)
883 SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_CONNECT, PVRSRVBridgeConnect);
884 SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_DISCONNECT, PVRSRVBridgeDisconnect);
885 SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_ENUMERATEDEVICES, PVRSRVBridgeEnumerateDevices);
886 SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_ACQUIREDEVICEDATA, PVRSRVBridgeAcquireDeviceData);
887 SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_RELEASEDEVICEDATA, PVRSRVBridgeReleaseDeviceData);
888 SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_INITSRVDISCONNECT, PVRSRVBridgeInitSrvDisconnect);
889 SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_ACQUIREGLOBALEVENTOBJECT, PVRSRVBridgeAcquireGlobalEventObject);
890 SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_RELEASEGLOBALEVENTOBJECT, PVRSRVBridgeReleaseGlobalEventObject);
891 SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_EVENTOBJECTOPEN, PVRSRVBridgeEventObjectOpen);
892 SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_EVENTOBJECTWAIT, PVRSRVBridgeEventObjectWait);
893 SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_EVENTOBJECTCLOSE, PVRSRVBridgeEventObjectClose);
894 SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_DUMPDEBUGINFO, PVRSRVBridgeDumpDebugInfo);
895 SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_GETDEVCLOCKSPEED, PVRSRVBridgeGetDevClockSpeed);
896 SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_HWOPTIMEOUT, PVRSRVBridgeHWOpTimeout);
897 SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_KICKDEVICES, PVRSRVBridgeKickDevices);
898 SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_RESETHWRLOGS, PVRSRVBridgeResetHWRLogs);
899 SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_SOFTRESET, PVRSRVBridgeSoftReset);
905 * Unregister all srvcore functions with services
907 IMG_VOID UnregisterSRVCOREFunctions(IMG_VOID)