summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'sgx_km/eurasia_km/services4/srvkm/bridged/bridged_support.c')
-rw-r--r--sgx_km/eurasia_km/services4/srvkm/bridged/bridged_support.c113
1 files changed, 113 insertions, 0 deletions
diff --git a/sgx_km/eurasia_km/services4/srvkm/bridged/bridged_support.c b/sgx_km/eurasia_km/services4/srvkm/bridged/bridged_support.c
new file mode 100644
index 0000000..2ccdc66
--- /dev/null
+++ b/sgx_km/eurasia_km/services4/srvkm/bridged/bridged_support.c
@@ -0,0 +1,113 @@
1/*************************************************************************/ /*!
2@Title PVR Bridge Support Functions
3@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
4@Description User/kernel mode bridge support. The functions in here
5 may be used beyond the bridge code proper (e.g. Linux
6 mmap interface).
7@License Dual MIT/GPLv2
8
9The contents of this file are subject to the MIT license as set out below.
10
11Permission is hereby granted, free of charge, to any person obtaining a copy
12of this software and associated documentation files (the "Software"), to deal
13in the Software without restriction, including without limitation the rights
14to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15copies of the Software, and to permit persons to whom the Software is
16furnished to do so, subject to the following conditions:
17
18The above copyright notice and this permission notice shall be included in
19all copies or substantial portions of the Software.
20
21Alternatively, the contents of this file may be used under the terms of
22the GNU General Public License Version 2 ("GPL") in which case the provisions
23of GPL are applicable instead of those above.
24
25If you wish to allow use of your version of this file only under the terms of
26GPL, and not to allow others to use your version of this file under the terms
27of the MIT license, indicate your decision by deleting the provisions above
28and replace them with the notice and other provisions required by GPL as set
29out in the file called "GPL-COPYING" included in this distribution. If you do
30not delete the provisions above, a recipient may use your version of this file
31under the terms of either the MIT license or GPL.
32
33This License is also included in this distribution in the file called
34"MIT-COPYING".
35
36EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
37PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
38BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
39PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
40COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
41IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
42CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
43*/ /**************************************************************************/
44
45#include "img_defs.h"
46#include "servicesint.h"
47#include "bridged_support.h"
48
49
50/*
51 * Derive the internal OS specific memory handle from a secure
52 * handle.
53 */
54PVRSRV_ERROR
55PVRSRVLookupOSMemHandle(PVRSRV_HANDLE_BASE *psHandleBase, IMG_HANDLE *phOSMemHandle, IMG_HANDLE hMHandle)
56{
57 IMG_HANDLE hMHandleInt;
58 PVRSRV_HANDLE_TYPE eHandleType;
59 PVRSRV_ERROR eError;
60
61 /*
62 * We don't know the type of the handle at this point, so we use
63 * PVRSRVLookupHandleAnyType to look it up.
64 */
65 eError = PVRSRVLookupHandleAnyType(psHandleBase, &hMHandleInt,
66 &eHandleType,
67 hMHandle);
68 if(eError != PVRSRV_OK)
69 {
70 return eError;
71 }
72
73 switch(eHandleType)
74 {
75#if defined(PVR_SECURE_HANDLES)
76 case PVRSRV_HANDLE_TYPE_MEM_INFO:
77 case PVRSRV_HANDLE_TYPE_MEM_INFO_REF:
78 case PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO:
79 {
80 PVRSRV_KERNEL_MEM_INFO *psMemInfo = (PVRSRV_KERNEL_MEM_INFO *)hMHandleInt;
81
82 *phOSMemHandle = psMemInfo->sMemBlk.hOSMemHandle;
83
84 break;
85 }
86 case PVRSRV_HANDLE_TYPE_SYNC_INFO:
87 {
88 PVRSRV_KERNEL_SYNC_INFO *psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)hMHandleInt;
89 PVRSRV_KERNEL_MEM_INFO *psMemInfo = psSyncInfo->psSyncDataMemInfoKM;
90
91 *phOSMemHandle = psMemInfo->sMemBlk.hOSMemHandle;
92
93 break;
94 }
95 case PVRSRV_HANDLE_TYPE_SOC_TIMER:
96 {
97 *phOSMemHandle = (IMG_VOID *)hMHandleInt;
98 break;
99 }
100#else
101 case PVRSRV_HANDLE_TYPE_NONE:
102 *phOSMemHandle = (IMG_VOID *)hMHandleInt;
103 break;
104#endif
105 default:
106 return PVRSRV_ERROR_BAD_MAPPING;
107 }
108
109 return PVRSRV_OK;
110}
111/******************************************************************************
112 End of file (bridged_support.c)
113******************************************************************************/