RK3368 GPU: Rogue N Init.
[firefly-linux-kernel-4.4.55.git] / drivers / staging / imgtec / services_kernel_client.h
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
7
8 The contents of this file are subject to the MIT license as set out below.
9
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:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
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.
23
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.
31
32 This License is also included in this distribution in the file called
33 "MIT-COPYING".
34
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 */ /**************************************************************************/
43
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.
48  */
49
50 #ifndef __SERVICES_KERNEL_CLIENT__
51 #define __SERVICES_KERNEL_CLIENT__
52
53 #include "pvrsrv_error.h"
54
55 #include <linux/types.h>
56
57 #ifndef __pvrsrv_defined_struct_enum__
58
59 /* rgx_fwif_shared.h */
60
61 struct _RGXFWIF_DEV_VIRTADDR_ {
62         __u32 ui32Addr;
63 };
64
65 /* sync_external.h */
66
67 struct PVRSRV_CLIENT_SYNC_PRIM {
68         volatile __u32 *pui32LinAddr;
69 };
70
71 struct PVRSRV_CLIENT_SYNC_PRIM_OP {
72         __u32 ui32Flags;
73         struct pvrsrv_sync_prim *psSync;
74         __u32 ui32FenceValue;
75         __u32 ui32UpdateValue;
76 };
77
78 #else /* __pvrsrv_defined_struct_enum__ */
79
80 struct _RGXFWIF_DEV_VIRTADDR_;
81
82 struct PVRSRV_CLIENT_SYNC_PRIM;
83 struct PVRSRV_CLIENT_SYNC_PRIM_OP;
84
85 #endif /* __pvrsrv_defined_struct_enum__ */
86
87 struct _PMR_;
88 struct _PVRSRV_DEVICE_NODE_;
89 struct dma_buf;
90 struct SYNC_PRIM_CONTEXT;
91
92 /* pvr_notifier.h */
93
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);
99
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
108
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
113
114 typedef void (DUMPDEBUG_PRINTF_FUNC)(void *pvDumpDebugFile,
115         const char *fmt, ...) __printf(2, 3);
116
117 typedef void (*PFN_DBGREQ_NOTIFY) (void *hDebugRequestHandle,
118         __u32 ui32VerbLevel,
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);
127
128 /* physmem_dmabuf.h */
129
130 struct dma_buf *PhysmemGetDmaBuf(struct _PMR_ *psPMR);
131
132 /* pvrsrv.h */
133
134 enum PVRSRV_ERROR PVRSRVAcquireGlobalEventObjectKM(void **phGlobalEventObject);
135 enum PVRSRV_ERROR PVRSRVReleaseGlobalEventObjectKM(void *hGlobalEventObject);
136
137 /* sync.h */
138
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);
143
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,
149         __u32 *sync_addr);
150 enum PVRSRV_ERROR SyncPrimSet(struct PVRSRV_CLIENT_SYNC_PRIM *psSync,
151         __u32 ui32Value);
152
153 /* pdump_km.h */
154
155 #ifdef PDUMP
156 enum PVRSRV_ERROR __printf(1, 2) PDumpComment(char *fmt, ...);
157 #else
158 static inline enum PVRSRV_ERROR __printf(1, 2) PDumpComment(char *fmt, ...)
159 {
160         return PVRSRV_OK;
161 }
162 #endif
163
164 /* osfunc.h */
165
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);
171
172 /* srvkm.h */
173
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);
179
180 #endif /* __SERVICES_KERNEL_CLIENT__ */