1 /**********************************************************************
3 * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful but, except
10 * as otherwise stated in writing, without any warranty; without even the
11 * implied warranty of merchantability or fitness for a particular purpose.
12 * See the GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 * The full GNU General Public License is included in this distribution in
19 * the file called "COPYING".
21 * Contact Information:
22 * Imagination Technologies Ltd. <gpl-support@imgtec.com>
23 * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
25 ******************************************************************************/
27 #if !defined(__SERVICESINT_H__)
28 #define __SERVICESINT_H__
34 #define HWREC_DEFAULT_TIMEOUT 500
36 #define DRIVERNAME_MAXLENGTH 100
38 struct PVRSRV_KERNEL_MEM_INFO {
41 struct IMG_DEV_VIRTADDR sDevVAddr;
44 struct PVRSRV_MEMBLK sMemBlk;
46 void *pvSysBackupBuffer;
50 struct PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo;
53 struct PVRSRV_KERNEL_SYNC_INFO {
54 struct PVRSRV_SYNC_DATA *psSyncData;
55 struct IMG_DEV_VIRTADDR sWriteOpsCompleteDevVAddr;
56 struct IMG_DEV_VIRTADDR sReadOpsCompleteDevVAddr;
57 struct PVRSRV_KERNEL_MEM_INFO *psSyncDataMemInfoKM;
60 * This stores the physical address of the buffer that
61 * this syncobject manages (if provided)
63 struct IMG_SYS_PHYADDR phys_addr;
68 struct PVRSRV_DEVICE_SYNC_OBJECT {
70 u32 ui32ReadOpsPendingVal;
71 struct IMG_DEV_VIRTADDR sReadOpsCompleteDevVAddr;
72 u32 ui32WriteOpsPendingVal;
73 struct IMG_DEV_VIRTADDR sWriteOpsCompleteDevVAddr;
76 struct PVRSRV_SYNC_OBJECT {
77 struct PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfoKM;
78 u32 ui32WriteOpsPending;
79 u32 ui32ReadOpsPending;
82 struct PVRSRV_COMMAND {
88 struct PVRSRV_SYNC_OBJECT *psDstSync;
89 struct PVRSRV_SYNC_OBJECT *psSrcSync;
95 struct PVRSRV_QUEUE_INFO {
98 volatile u32 ui32ReadOffset;
99 volatile u32 ui32WriteOffset;
100 u32 *pui32KickerAddrKM;
101 u32 *pui32KickerAddrUM;
108 struct PVRSRV_QUEUE_INFO *psNextKM;
111 struct PVRSRV_DEVICECLASS_BUFFER {
112 enum PVRSRV_ERROR (*pfnGetBufferAddr)(void *, void *,
113 struct IMG_SYS_PHYADDR **, u32 *,
114 void __iomem **, void **, IMG_BOOL *);
115 void *hDevMemContext;
118 struct PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo;
121 struct PVRSRV_CLIENT_DEVICECLASS_INFO {
126 static inline u32 PVRSRVGetWriteOpsPending(
127 struct PVRSRV_KERNEL_SYNC_INFO *psSyncInfo, IMG_BOOL bIsReadOp)
129 u32 ui32WriteOpsPending;
132 ui32WriteOpsPending =
133 psSyncInfo->psSyncData->ui32WriteOpsPending;
135 ui32WriteOpsPending =
136 psSyncInfo->psSyncData->ui32WriteOpsPending++;
138 return ui32WriteOpsPending;
141 static inline u32 PVRSRVGetReadOpsPending(
142 struct PVRSRV_KERNEL_SYNC_INFO *psSyncInfo, IMG_BOOL bIsReadOp)
144 u32 ui32ReadOpsPending;
148 psSyncInfo->psSyncData->ui32ReadOpsPending++;
150 ui32ReadOpsPending = psSyncInfo->psSyncData->ui32ReadOpsPending;
152 return ui32ReadOpsPending;
155 enum PVRSRV_ERROR PVRSRVQueueCommand(void *hQueueInfo,
156 struct PVRSRV_COMMAND *psCommand);
158 enum PVRSRV_ERROR PVRSRVGetMMUContextPDDevPAddr(
159 const struct PVRSRV_CONNECTION *psConnection,
160 void *hDevMemContext,
161 struct IMG_DEV_PHYADDR *sPDDevPAddr);
163 enum PVRSRV_ERROR PVRSRVAllocSharedSysMem(
164 const struct PVRSRV_CONNECTION *psConnection,
165 u32 ui32Flags, u32 ui32Size,
166 struct PVRSRV_CLIENT_MEM_INFO **ppsClientMemInfo);
168 enum PVRSRV_ERROR PVRSRVFreeSharedSysMem(
169 const struct PVRSRV_CONNECTION *psConnection,
170 struct PVRSRV_CLIENT_MEM_INFO *psClientMemInfo);
172 enum PVRSRV_ERROR PVRSRVUnrefSharedSysMem(
173 const struct PVRSRV_CONNECTION *psConnection,
174 struct PVRSRV_CLIENT_MEM_INFO *psClientMemInfo);
176 enum PVRSRV_ERROR PVRSRVMapMemInfoMem(
177 const struct PVRSRV_CONNECTION *psConnection,
178 void *hKernelMemInfo,
179 struct PVRSRV_CLIENT_MEM_INFO **ppsClientMemInfo);