diff options
Diffstat (limited to 'drivers/gpu/pvr/syscommon.h')
-rw-r--r-- | drivers/gpu/pvr/syscommon.h | 223 |
1 files changed, 223 insertions, 0 deletions
diff --git a/drivers/gpu/pvr/syscommon.h b/drivers/gpu/pvr/syscommon.h new file mode 100644 index 00000000000..5ae080ad4b2 --- /dev/null +++ b/drivers/gpu/pvr/syscommon.h | |||
@@ -0,0 +1,223 @@ | |||
1 | /********************************************************************** | ||
2 | * | ||
3 | * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved. | ||
4 | * | ||
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. | ||
8 | * | ||
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. | ||
13 | * | ||
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. | ||
17 | * | ||
18 | * The full GNU General Public License is included in this distribution in | ||
19 | * the file called "COPYING". | ||
20 | * | ||
21 | * Contact Information: | ||
22 | * Imagination Technologies Ltd. <gpl-support@imgtec.com> | ||
23 | * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK | ||
24 | * | ||
25 | ******************************************************************************/ | ||
26 | |||
27 | #ifndef _SYSCOMMON_H | ||
28 | #define _SYSCOMMON_H | ||
29 | |||
30 | #include "sysconfig.h" | ||
31 | #include "sysinfo.h" | ||
32 | #include "servicesint.h" | ||
33 | #include "queue.h" | ||
34 | #include "power.h" | ||
35 | #include "resman.h" | ||
36 | #include "ra.h" | ||
37 | #include "device.h" | ||
38 | #include "buffer_manager.h" | ||
39 | #include "pvr_debug.h" | ||
40 | #include "services.h" | ||
41 | |||
42 | #if defined(NO_HARDWARE) && defined(__linux__) && defined(__KERNEL__) | ||
43 | #include <asm/io.h> | ||
44 | #endif | ||
45 | |||
46 | #if defined (__cplusplus) | ||
47 | extern "C" { | ||
48 | #endif | ||
49 | |||
50 | typedef struct _SYS_DEVICE_ID_TAG | ||
51 | { | ||
52 | IMG_UINT32 uiID; | ||
53 | IMG_BOOL bInUse; | ||
54 | |||
55 | } SYS_DEVICE_ID; | ||
56 | |||
57 | |||
58 | #define SYS_MAX_LOCAL_DEVMEM_ARENAS 4 | ||
59 | |||
60 | typedef struct _SYS_DATA_TAG_ | ||
61 | { | ||
62 | IMG_UINT32 ui32NumDevices; | ||
63 | SYS_DEVICE_ID sDeviceID[SYS_DEVICE_COUNT]; | ||
64 | PVRSRV_DEVICE_NODE *psDeviceNodeList; | ||
65 | PVRSRV_POWER_DEV *psPowerDeviceList; | ||
66 | PVRSRV_RESOURCE sPowerStateChangeResource; | ||
67 | PVRSRV_SYS_POWER_STATE eCurrentPowerState; | ||
68 | PVRSRV_SYS_POWER_STATE eFailedPowerState; | ||
69 | IMG_UINT32 ui32CurrentOSPowerState; | ||
70 | PVRSRV_QUEUE_INFO *psQueueList; | ||
71 | PVRSRV_KERNEL_SYNC_INFO *psSharedSyncInfoList; | ||
72 | IMG_PVOID pvEnvSpecificData; | ||
73 | IMG_PVOID pvSysSpecificData; | ||
74 | PVRSRV_RESOURCE sQProcessResource; | ||
75 | IMG_VOID *pvSOCRegsBase; | ||
76 | IMG_HANDLE hSOCTimerRegisterOSMemHandle; | ||
77 | IMG_UINT32 *pvSOCTimerRegisterKM; | ||
78 | IMG_VOID *pvSOCClockGateRegsBase; | ||
79 | IMG_UINT32 ui32SOCClockGateRegsSize; | ||
80 | PFN_CMD_PROC *ppfnCmdProcList[SYS_DEVICE_COUNT]; | ||
81 | |||
82 | |||
83 | |||
84 | PCOMMAND_COMPLETE_DATA *ppsCmdCompleteData[SYS_DEVICE_COUNT]; | ||
85 | |||
86 | |||
87 | IMG_BOOL bReProcessQueues; | ||
88 | |||
89 | RA_ARENA *apsLocalDevMemArena[SYS_MAX_LOCAL_DEVMEM_ARENAS]; | ||
90 | |||
91 | IMG_CHAR *pszVersionString; | ||
92 | PVRSRV_EVENTOBJECT *psGlobalEventObject; | ||
93 | |||
94 | PVRSRV_MISC_INFO_CPUCACHEOP_TYPE ePendingCacheOpType; | ||
95 | } SYS_DATA; | ||
96 | |||
97 | |||
98 | |||
99 | PVRSRV_ERROR SysInitialise(IMG_VOID); | ||
100 | PVRSRV_ERROR SysFinalise(IMG_VOID); | ||
101 | |||
102 | PVRSRV_ERROR SysDeinitialise(SYS_DATA *psSysData); | ||
103 | PVRSRV_ERROR SysGetDeviceMemoryMap(PVRSRV_DEVICE_TYPE eDeviceType, | ||
104 | IMG_VOID **ppvDeviceMap); | ||
105 | |||
106 | IMG_VOID SysRegisterExternalDevice(PVRSRV_DEVICE_NODE *psDeviceNode); | ||
107 | IMG_VOID SysRemoveExternalDevice(PVRSRV_DEVICE_NODE *psDeviceNode); | ||
108 | |||
109 | IMG_UINT32 SysGetInterruptSource(SYS_DATA *psSysData, | ||
110 | PVRSRV_DEVICE_NODE *psDeviceNode); | ||
111 | |||
112 | IMG_VOID SysClearInterrupts(SYS_DATA* psSysData, IMG_UINT32 ui32ClearBits); | ||
113 | |||
114 | PVRSRV_ERROR SysResetDevice(IMG_UINT32 ui32DeviceIndex); | ||
115 | |||
116 | PVRSRV_ERROR SysSystemPrePowerState(PVRSRV_SYS_POWER_STATE eNewPowerState); | ||
117 | PVRSRV_ERROR SysSystemPostPowerState(PVRSRV_SYS_POWER_STATE eNewPowerState); | ||
118 | PVRSRV_ERROR SysDevicePrePowerState(IMG_UINT32 ui32DeviceIndex, | ||
119 | PVRSRV_DEV_POWER_STATE eNewPowerState, | ||
120 | PVRSRV_DEV_POWER_STATE eCurrentPowerState); | ||
121 | PVRSRV_ERROR SysDevicePostPowerState(IMG_UINT32 ui32DeviceIndex, | ||
122 | PVRSRV_DEV_POWER_STATE eNewPowerState, | ||
123 | PVRSRV_DEV_POWER_STATE eCurrentPowerState); | ||
124 | |||
125 | #if defined(SYS_CUSTOM_POWERLOCK_WRAP) | ||
126 | PVRSRV_ERROR SysPowerLockWrap(SYS_DATA *psSysData); | ||
127 | IMG_VOID SysPowerLockUnwrap(SYS_DATA *psSysData); | ||
128 | #endif | ||
129 | |||
130 | PVRSRV_ERROR SysOEMFunction ( IMG_UINT32 ui32ID, | ||
131 | IMG_VOID *pvIn, | ||
132 | IMG_UINT32 ulInSize, | ||
133 | IMG_VOID *pvOut, | ||
134 | IMG_UINT32 ulOutSize); | ||
135 | |||
136 | |||
137 | IMG_DEV_PHYADDR SysCpuPAddrToDevPAddr (PVRSRV_DEVICE_TYPE eDeviceType, IMG_CPU_PHYADDR cpu_paddr); | ||
138 | IMG_DEV_PHYADDR SysSysPAddrToDevPAddr (PVRSRV_DEVICE_TYPE eDeviceType, IMG_SYS_PHYADDR SysPAddr); | ||
139 | IMG_SYS_PHYADDR SysDevPAddrToSysPAddr (PVRSRV_DEVICE_TYPE eDeviceType, IMG_DEV_PHYADDR SysPAddr); | ||
140 | IMG_CPU_PHYADDR SysSysPAddrToCpuPAddr (IMG_SYS_PHYADDR SysPAddr); | ||
141 | IMG_SYS_PHYADDR SysCpuPAddrToSysPAddr (IMG_CPU_PHYADDR cpu_paddr); | ||
142 | #if defined(PVR_LMA) | ||
143 | IMG_BOOL SysVerifyCpuPAddrToDevPAddr (PVRSRV_DEVICE_TYPE eDeviceType, IMG_CPU_PHYADDR CpuPAddr); | ||
144 | IMG_BOOL SysVerifySysPAddrToDevPAddr (PVRSRV_DEVICE_TYPE eDeviceType, IMG_SYS_PHYADDR SysPAddr); | ||
145 | #endif | ||
146 | |||
147 | extern SYS_DATA* gpsSysData; | ||
148 | |||
149 | #if !defined(USE_CODE) | ||
150 | |||
151 | #ifdef INLINE_IS_PRAGMA | ||
152 | #pragma inline(SysAcquireData) | ||
153 | #endif | ||
154 | static INLINE IMG_VOID SysAcquireData(SYS_DATA **ppsSysData) | ||
155 | { | ||
156 | |||
157 | *ppsSysData = gpsSysData; | ||
158 | |||
159 | |||
160 | |||
161 | |||
162 | |||
163 | PVR_ASSERT (gpsSysData != IMG_NULL); | ||
164 | } | ||
165 | |||
166 | |||
167 | #ifdef INLINE_IS_PRAGMA | ||
168 | #pragma inline(SysAcquireDataNoCheck) | ||
169 | #endif | ||
170 | static INLINE SYS_DATA * SysAcquireDataNoCheck(IMG_VOID) | ||
171 | { | ||
172 | |||
173 | return gpsSysData; | ||
174 | } | ||
175 | |||
176 | |||
177 | #ifdef INLINE_IS_PRAGMA | ||
178 | #pragma inline(SysInitialiseCommon) | ||
179 | #endif | ||
180 | static INLINE PVRSRV_ERROR SysInitialiseCommon(SYS_DATA *psSysData) | ||
181 | { | ||
182 | PVRSRV_ERROR eError; | ||
183 | |||
184 | |||
185 | eError = PVRSRVInit(psSysData); | ||
186 | |||
187 | return eError; | ||
188 | } | ||
189 | |||
190 | #ifdef INLINE_IS_PRAGMA | ||
191 | #pragma inline(SysDeinitialiseCommon) | ||
192 | #endif | ||
193 | static INLINE IMG_VOID SysDeinitialiseCommon(SYS_DATA *psSysData) | ||
194 | { | ||
195 | |||
196 | PVRSRVDeInit(psSysData); | ||
197 | |||
198 | OSDestroyResource(&psSysData->sPowerStateChangeResource); | ||
199 | } | ||
200 | #endif | ||
201 | |||
202 | |||
203 | #if !(defined(NO_HARDWARE) && defined(__linux__) && defined(__KERNEL__)) | ||
204 | #define SysReadHWReg(p, o) OSReadHWReg(p, o) | ||
205 | #define SysWriteHWReg(p, o, v) OSWriteHWReg(p, o, v) | ||
206 | #else | ||
207 | static inline IMG_UINT32 SysReadHWReg(IMG_PVOID pvLinRegBaseAddr, IMG_UINT32 ui32Offset) | ||
208 | { | ||
209 | return (IMG_UINT32) readl(pvLinRegBaseAddr + ui32Offset); | ||
210 | } | ||
211 | |||
212 | static inline IMG_VOID SysWriteHWReg(IMG_PVOID pvLinRegBaseAddr, IMG_UINT32 ui32Offset, IMG_UINT32 ui32Value) | ||
213 | { | ||
214 | writel(ui32Value, pvLinRegBaseAddr + ui32Offset); | ||
215 | } | ||
216 | #endif | ||
217 | |||
218 | #if defined(__cplusplus) | ||
219 | } | ||
220 | #endif | ||
221 | |||
222 | #endif | ||
223 | |||