1 /* -*- mode: c; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 /* vi: set ts=8 sw=8 sts=8: */
3 /*************************************************************************/ /*!
4 @File services_kernel_client.h
5 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
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 */ /**************************************************************************/
44 /* This file contains a partial redefinition of the PowerVR Services 5
45 * interface for use by components which are checkpatch clean. This
46 * header is included by the unrefined, non-checkpatch clean headers
47 * to ensure that prototype/typedef/macro changes break the build.
50 #ifndef __SERVICES_KERNEL_CLIENT__
51 #define __SERVICES_KERNEL_CLIENT__
53 #include "pvrsrv_error.h"
55 #include <linux/types.h>
57 #ifndef __pvrsrv_defined_struct_enum__
59 /* rgx_fwif_shared.h */
61 struct _RGXFWIF_DEV_VIRTADDR_ {
67 struct PVRSRV_CLIENT_SYNC_PRIM {
68 volatile __u32 *pui32LinAddr;
71 struct PVRSRV_CLIENT_SYNC_PRIM_OP {
73 struct pvrsrv_sync_prim *psSync;
75 __u32 ui32UpdateValue;
78 #else /* __pvrsrv_defined_struct_enum__ */
80 struct _RGXFWIF_DEV_VIRTADDR_;
82 struct PVRSRV_CLIENT_SYNC_PRIM;
83 struct PVRSRV_CLIENT_SYNC_PRIM_OP;
85 #endif /* __pvrsrv_defined_struct_enum__ */
88 struct _PVRSRV_DEVICE_NODE_;
90 struct SYNC_PRIM_CONTEXT;
94 typedef void (*PFN_CMDCOMP_NOTIFY)(void *hCmdCompHandle);
95 enum PVRSRV_ERROR PVRSRVRegisterCmdCompleteNotify(void **phNotify,
96 PFN_CMDCOMP_NOTIFY pfnCmdCompleteNotify, void *hPrivData);
97 enum PVRSRV_ERROR PVRSRVUnregisterCmdCompleteNotify(void *hNotify);
98 void PVRSRVCheckStatus(void *hCmdCompCallerHandle);
100 #define DEBUG_REQUEST_DC 0
101 #define DEBUG_REQUEST_SERVERSYNC 1
102 #define DEBUG_REQUEST_SYS 2
103 #define DEBUG_REQUEST_ANDROIDSYNC 3
104 #define DEBUG_REQUEST_LINUXFENCE 4
105 #define DEBUG_REQUEST_SYNCCHECKPOINT 5
106 #define DEBUG_REQUEST_HTB 6
107 #define DEBUG_REQUEST_APPHINT 7
109 #define DEBUG_REQUEST_VERBOSITY_LOW 0
110 #define DEBUG_REQUEST_VERBOSITY_MEDIUM 1
111 #define DEBUG_REQUEST_VERBOSITY_HIGH 2
112 #define DEBUG_REQUEST_VERBOSITY_MAX DEBUG_REQUEST_VERBOSITY_HIGH
114 typedef void (DUMPDEBUG_PRINTF_FUNC)(void *pvDumpDebugFile,
115 const char *fmt, ...) __printf(2, 3);
117 typedef void (*PFN_DBGREQ_NOTIFY) (void *hDebugRequestHandle,
119 DUMPDEBUG_PRINTF_FUNC *pfnDumpDebugPrintf,
120 void *pvDumpDebugFile);
121 enum PVRSRV_ERROR PVRSRVRegisterDbgRequestNotify(void **phNotify,
122 struct _PVRSRV_DEVICE_NODE_ *psDevNode,
123 PFN_DBGREQ_NOTIFY pfnDbgRequestNotify,
124 __u32 ui32RequesterID,
125 void *hDbgRequestHandle);
126 enum PVRSRV_ERROR PVRSRVUnregisterDbgRequestNotify(void *hNotify);
128 /* physmem_dmabuf.h */
130 struct dma_buf *PhysmemGetDmaBuf(struct _PMR_ *psPMR);
134 enum PVRSRV_ERROR PVRSRVAcquireGlobalEventObjectKM(void **phGlobalEventObject);
135 enum PVRSRV_ERROR PVRSRVReleaseGlobalEventObjectKM(void *hGlobalEventObject);
139 enum PVRSRV_ERROR SyncPrimContextCreate(
140 struct _PVRSRV_DEVICE_NODE_ *psDevConnection,
141 struct SYNC_PRIM_CONTEXT **phSyncPrimContext);
142 void SyncPrimContextDestroy(struct SYNC_PRIM_CONTEXT *hSyncPrimContext);
144 enum PVRSRV_ERROR SyncPrimAlloc(struct SYNC_PRIM_CONTEXT *hSyncPrimContext,
145 struct PVRSRV_CLIENT_SYNC_PRIM **ppsSync, const char *pszClassName);
146 enum PVRSRV_ERROR SyncPrimFree(struct PVRSRV_CLIENT_SYNC_PRIM *psSync);
147 enum PVRSRV_ERROR SyncPrimGetFirmwareAddr(
148 struct PVRSRV_CLIENT_SYNC_PRIM *psSync,
150 enum PVRSRV_ERROR SyncPrimSet(struct PVRSRV_CLIENT_SYNC_PRIM *psSync,
156 enum PVRSRV_ERROR __printf(1, 2) PDumpComment(char *fmt, ...);
158 static inline enum PVRSRV_ERROR __printf(1, 2) PDumpComment(char *fmt, ...)
166 void OSAcquireBridgeLock(void);
167 void OSReleaseBridgeLock(void);
168 enum PVRSRV_ERROR OSEventObjectWait(void *hOSEventKM);
169 enum PVRSRV_ERROR OSEventObjectOpen(void *hEventObject, void **phOSEventKM);
170 enum PVRSRV_ERROR OSEventObjectClose(void *hOSEventKM);
174 enum PVRSRV_ERROR PVRSRVDeviceCreate(void *pvOSDevice,
175 struct _PVRSRV_DEVICE_NODE_ **ppsDeviceNode);
176 enum PVRSRV_ERROR PVRSRVDeviceDestroy(
177 struct _PVRSRV_DEVICE_NODE_ *psDeviceNode);
178 const char *PVRSRVGetErrorStringKM(enum PVRSRV_ERROR eError);
180 #endif /* __SERVICES_KERNEL_CLIENT__ */