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 ******************************************************************************/
38 #define PVRSRV_BACKINGSTORE_SYSMEM_CONTIG \
39 (1<<(PVRSRV_MEM_BACKINGSTORE_FIELD_SHIFT+0))
40 #define PVRSRV_BACKINGSTORE_SYSMEM_NONCONTIG \
41 (1<<(PVRSRV_MEM_BACKINGSTORE_FIELD_SHIFT+1))
42 #define PVRSRV_BACKINGSTORE_LOCALMEM_CONTIG \
43 (1<<(PVRSRV_MEM_BACKINGSTORE_FIELD_SHIFT+2))
44 #define PVRSRV_BACKINGSTORE_LOCALMEM_NONCONTIG \
45 (1<<(PVRSRV_MEM_BACKINGSTORE_FIELD_SHIFT+3))
47 #define DEVICE_MEMORY_HEAP_PERCONTEXT 0
48 #define DEVICE_MEMORY_HEAP_KERNEL 1
49 #define DEVICE_MEMORY_HEAP_SHARED 2
50 #define DEVICE_MEMORY_HEAP_SHARED_EXPORTED 3
52 #define PVRSRV_DEVICE_NODE_FLAGS_PORT80DISPLAY 1
53 #define PVRSRV_DEVICE_NODE_FLAGS_MMU_OPT_INV 2
55 struct DEVICE_MEMORY_HEAP_INFO {
59 struct IMG_DEV_VIRTADDR sDevVAddrBase;
64 struct RA_ARENA *psLocalDevMemArena;
70 struct DEVICE_MEMORY_INFO {
71 u32 ui32AddressSpaceSizeLog2;
75 u32 ui32MappingHeapID;
76 struct DEVICE_MEMORY_HEAP_INFO *psDeviceMemoryHeap;
77 struct BM_CONTEXT *pBMKernelContext;
78 struct BM_CONTEXT *pBMContext;
81 struct DEV_ARENA_DESCRIPTOR {
84 struct IMG_DEV_VIRTADDR BaseDevVAddr;
90 struct DEVICE_MEMORY_HEAP_INFO *psDeviceMemoryHeapInfo;
95 struct PVRSRV_DEVICE_NODE {
96 struct PVRSRV_DEVICE_IDENTIFIER sDevId;
99 enum PVRSRV_ERROR (*pfnInitDevice)(void *);
100 enum PVRSRV_ERROR (*pfnDeInitDevice)(void *);
102 enum PVRSRV_ERROR (*pfnInitDeviceCompatCheck)(
103 struct PVRSRV_DEVICE_NODE *);
105 enum PVRSRV_ERROR (*pfnMMUInitialise)(struct PVRSRV_DEVICE_NODE *,
106 struct MMU_CONTEXT **,
107 struct IMG_DEV_PHYADDR *);
108 void (*pfnMMUFinalise)(struct MMU_CONTEXT *);
109 void (*pfnMMUInsertHeap)(struct MMU_CONTEXT *, struct MMU_HEAP *);
110 struct MMU_HEAP *(*pfnMMUCreate)(struct MMU_CONTEXT *,
111 struct DEV_ARENA_DESCRIPTOR *, struct RA_ARENA **);
112 void (*pfnMMUDelete)(struct MMU_HEAP *);
113 IMG_BOOL (*pfnMMUAlloc)(struct MMU_HEAP *pMMU, size_t uSize, u32 uFlags,
114 u32 uDevVAddrAlignment,
115 struct IMG_DEV_VIRTADDR *pDevVAddr);
116 void (*pfnMMUFree)(struct MMU_HEAP *, struct IMG_DEV_VIRTADDR, u32);
117 void (*pfnMMUEnable)(struct MMU_HEAP *);
118 void (*pfnMMUDisable)(struct MMU_HEAP *);
119 void (*pfnMMUMapPages)(struct MMU_HEAP *pMMU,
120 struct IMG_DEV_VIRTADDR devVAddr,
121 struct IMG_SYS_PHYADDR SysPAddr,
122 size_t uSize, u32 ui32MemFlags, void *hUniqueTag);
123 void (*pfnMMUMapShadow)(struct MMU_HEAP *pMMU,
124 struct IMG_DEV_VIRTADDR MapBaseDevVAddr,
125 size_t uSize, void *CpuVAddr, void *hOSMemHandle,
126 struct IMG_DEV_VIRTADDR *pDevVAddr, u32 ui32MemFlags,
128 void (*pfnMMUUnmapPages)(struct MMU_HEAP *pMMU,
129 struct IMG_DEV_VIRTADDR dev_vaddr, u32 ui32PageCount,
132 void (*pfnMMUMapScatter)(struct MMU_HEAP *pMMU,
133 struct IMG_DEV_VIRTADDR DevVAddr,
134 struct IMG_SYS_PHYADDR *psSysAddr,
135 size_t uSize, u32 ui32MemFlags, void *hUniqueTag);
137 struct IMG_DEV_PHYADDR(*pfnMMUGetPhysPageAddr)(
138 struct MMU_HEAP *pMMUHeap,
139 struct IMG_DEV_VIRTADDR sDevVPageAddr);
140 struct IMG_DEV_PHYADDR(*pfnMMUGetPDDevPAddr)(
141 struct MMU_CONTEXT *pMMUContext);
143 IMG_BOOL (*pfnDeviceISR)(void *);
146 u32 ui32SOCInterruptBit;
148 void (*pfnDeviceMISR)(void *);
149 void (*pfnDeviceCommandComplete)(struct PVRSRV_DEVICE_NODE *
152 IMG_BOOL bReProcessDeviceCommandComplete;
153 struct DEVICE_MEMORY_INFO sDevMemoryInfo;
155 u32 ui32pvDeviceSize;
157 struct RESMAN_CONTEXT *hResManContext;
158 struct SYS_DATA *psSysData;
159 struct RA_ARENA *psLocalDevMemArena;
161 struct HASH_TABLE *sync_table;
162 struct PVRSRV_DEVICE_NODE *psNext;
165 enum PVRSRV_ERROR PVRSRVRegisterDevice(struct SYS_DATA *psSysData,
166 enum PVRSRV_ERROR (*pfnRegisterDevice)(struct PVRSRV_DEVICE_NODE *),
167 u32 ui32SOCInterruptBit, u32 *pui32DeviceIndex);
169 enum PVRSRV_ERROR PVRSRVInitialiseDevice(u32 ui32DevIndex);
170 enum PVRSRV_ERROR PVRSRVFinaliseSystem(IMG_BOOL bInitSuccesful);
172 enum PVRSRV_ERROR PVRSRVDevInitCompatCheck(struct PVRSRV_DEVICE_NODE
175 enum PVRSRV_ERROR PVRSRVDeinitialiseDevice(u32 ui32DevIndex);
178 enum PVRSRV_ERROR PollForValueKM(u32 __iomem *pui32LinMemAddr,
179 u32 ui32Value, u32 ui32Mask, u32 ui32Waitus, u32 ui32Tries);
181 enum PVRSRV_ERROR PVRSRVInit(struct SYS_DATA *psSysData);
182 void PVRSRVDeInit(struct SYS_DATA *psSysData);
183 IMG_BOOL PVRSRVDeviceLISR(struct PVRSRV_DEVICE_NODE *psDeviceNode);
184 IMG_BOOL PVRSRVSystemLISR(void *pvSysData);
185 void PVRSRVMISR(void *pvSysData);