summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'omap5/sgx_src/eurasia_km/services4/system/include/syscommon.h')
-rw-r--r--omap5/sgx_src/eurasia_km/services4/system/include/syscommon.h397
1 files changed, 0 insertions, 397 deletions
diff --git a/omap5/sgx_src/eurasia_km/services4/system/include/syscommon.h b/omap5/sgx_src/eurasia_km/services4/system/include/syscommon.h
deleted file mode 100644
index 4fd3512..0000000
--- a/omap5/sgx_src/eurasia_km/services4/system/include/syscommon.h
+++ /dev/null
@@ -1,397 +0,0 @@
1/*************************************************************************/ /*!
2@Title Common System APIs and structures
3@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
4@Description This header provides common system-specific declarations and macros
5 that are supported by all system's
6@License Dual MIT/GPLv2
7
8The contents of this file are subject to the MIT license as set out below.
9
10Permission is hereby granted, free of charge, to any person obtaining a copy
11of this software and associated documentation files (the "Software"), to deal
12in the Software without restriction, including without limitation the rights
13to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14copies of the Software, and to permit persons to whom the Software is
15furnished to do so, subject to the following conditions:
16
17The above copyright notice and this permission notice shall be included in
18all copies or substantial portions of the Software.
19
20Alternatively, the contents of this file may be used under the terms of
21the GNU General Public License Version 2 ("GPL") in which case the provisions
22of GPL are applicable instead of those above.
23
24If you wish to allow use of your version of this file only under the terms of
25GPL, and not to allow others to use your version of this file under the terms
26of the MIT license, indicate your decision by deleting the provisions above
27and replace them with the notice and other provisions required by GPL as set
28out in the file called "GPL-COPYING" included in this distribution. If you do
29not delete the provisions above, a recipient may use your version of this file
30under the terms of either the MIT license or GPL.
31
32This License is also included in this distribution in the file called
33"MIT-COPYING".
34
35EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
36PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
37BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
38PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
39COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
40IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
41CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42*/ /**************************************************************************/
43
44#ifndef _SYSCOMMON_H
45#define _SYSCOMMON_H
46
47#include "sysconfig.h" /* System specific system defines */
48#include "sysinfo.h" /* globally accessible system info */
49#include "servicesint.h"
50#include "queue.h"
51#include "power.h"
52#include "resman.h"
53#include "ra.h"
54#include "device.h"
55#include "buffer_manager.h"
56#include "pvr_debug.h"
57#include "services.h"
58
59#if defined(NO_HARDWARE) && defined(__linux__) && defined(__KERNEL__)
60#include <asm/io.h>
61#endif
62
63#if defined (__cplusplus)
64extern "C" {
65#endif
66
67/*!
68 ****************************************************************************
69 device id management structure
70 ****************************************************************************/
71typedef struct _SYS_DEVICE_ID_TAG
72{
73 IMG_UINT32 uiID;
74 IMG_BOOL bInUse;
75
76} SYS_DEVICE_ID;
77
78
79/*
80 the max number of independent local backing stores services supports
81 (grow this number if ever required)
82*/
83#define SYS_MAX_LOCAL_DEVMEM_ARENAS 4
84
85typedef IMG_HANDLE (*PFN_HTIMER_CREATE) (IMG_VOID);
86typedef IMG_UINT32 (*PFN_HTIMER_GETUS) (IMG_HANDLE);
87typedef IMG_VOID (*PFN_HTIMER_DESTROY) (IMG_HANDLE);
88/*!
89 ****************************************************************************
90 Top level system data structure
91 ****************************************************************************/
92typedef struct _SYS_DATA_TAG_
93{
94 IMG_UINT32 ui32NumDevices; /*!< number of devices in system */
95 SYS_DEVICE_ID sDeviceID[SYS_DEVICE_COUNT];
96 PVRSRV_DEVICE_NODE *psDeviceNodeList; /*!< list of private device info structures */
97 PVRSRV_POWER_DEV *psPowerDeviceList; /*!< list of devices registered with the power manager */
98 PVRSRV_RESOURCE sPowerStateChangeResource; /*!< lock for power state transitions */
99 PVRSRV_SYS_POWER_STATE eCurrentPowerState; /*!< current Kernel services power state */
100 PVRSRV_SYS_POWER_STATE eFailedPowerState; /*!< Kernel services power state (Failed to transition to) */
101 IMG_UINT32 ui32CurrentOSPowerState; /*!< current OS specific power state */
102 PVRSRV_QUEUE_INFO *psQueueList; /*!< list of all command queues in the system */
103 PVRSRV_KERNEL_SYNC_INFO *psSharedSyncInfoList; /*!< list of cross process syncinfos */
104 IMG_PVOID pvEnvSpecificData; /*!< Environment specific data */
105 IMG_PVOID pvSysSpecificData; /*!< Unique to system, accessible at system layer only */
106 PVRSRV_RESOURCE sQProcessResource; /*!< Command Q processing access lock */
107 IMG_VOID *pvSOCRegsBase; /*!< SOC registers base linear address */
108 IMG_HANDLE hSOCTimerRegisterOSMemHandle; /*!< SOC Timer register (if present) */
109 IMG_UINT32 *pvSOCTimerRegisterKM; /*!< SOC Timer register (if present) */
110 IMG_VOID *pvSOCClockGateRegsBase; /*!< SOC Clock gating registers (if present) */
111 IMG_UINT32 ui32SOCClockGateRegsSize;
112
113 struct _DEVICE_COMMAND_DATA_ *apsDeviceCommandData[SYS_DEVICE_COUNT];
114 /*!< command complete data and callback function store for every command for every device */
115
116 RA_ARENA *apsLocalDevMemArena[SYS_MAX_LOCAL_DEVMEM_ARENAS]; /*!< RA Arenas for local device memory heap management */
117
118 IMG_CHAR *pszVersionString; /*!< Human readable string showing relevent system version info */
119#if defined (SUPPORT_SID_INTERFACE)
120 PVRSRV_EVENTOBJECT_KM *psGlobalEventObject; /*!< OS Global Event Object */
121#else
122 PVRSRV_EVENTOBJECT *psGlobalEventObject; /*!< OS Global Event Object */
123#endif
124
125 PVRSRV_MISC_INFO_CPUCACHEOP_TYPE ePendingCacheOpType; /*!< Deferred CPU cache op control */
126
127 PFN_HTIMER_CREATE pfnHighResTimerCreate;
128 PFN_HTIMER_GETUS pfnHighResTimerGetus;
129 PFN_HTIMER_DESTROY pfnHighResTimerDestroy;
130} SYS_DATA;
131
132
133/****************************************************************************
134 * common function prototypes
135 ****************************************************************************/
136
137#if defined (CUSTOM_DISPLAY_SEGMENT)
138PVRSRV_ERROR SysGetDisplaySegmentAddress (IMG_VOID *pvDevInfo, IMG_VOID *pvPhysicalAddress, IMG_UINT32 *pui32Length);
139#endif
140
141PVRSRV_ERROR SysInitialise(IMG_VOID);
142PVRSRV_ERROR SysFinalise(IMG_VOID);
143
144PVRSRV_ERROR SysDeinitialise(SYS_DATA *psSysData);
145PVRSRV_ERROR SysGetDeviceMemoryMap(PVRSRV_DEVICE_TYPE eDeviceType,
146 IMG_VOID **ppvDeviceMap);
147
148IMG_VOID SysRegisterExternalDevice(PVRSRV_DEVICE_NODE *psDeviceNode);
149IMG_VOID SysRemoveExternalDevice(PVRSRV_DEVICE_NODE *psDeviceNode);
150
151IMG_UINT32 SysGetInterruptSource(SYS_DATA *psSysData,
152 PVRSRV_DEVICE_NODE *psDeviceNode);
153
154IMG_VOID SysClearInterrupts(SYS_DATA* psSysData, IMG_UINT32 ui32ClearBits);
155
156PVRSRV_ERROR SysResetDevice(IMG_UINT32 ui32DeviceIndex);
157
158PVRSRV_ERROR SysSystemPrePowerState(PVRSRV_SYS_POWER_STATE eNewPowerState);
159PVRSRV_ERROR SysSystemPostPowerState(PVRSRV_SYS_POWER_STATE eNewPowerState);
160PVRSRV_ERROR SysDevicePrePowerState(IMG_UINT32 ui32DeviceIndex,
161 PVRSRV_DEV_POWER_STATE eNewPowerState,
162 PVRSRV_DEV_POWER_STATE eCurrentPowerState);
163PVRSRV_ERROR SysDevicePostPowerState(IMG_UINT32 ui32DeviceIndex,
164 PVRSRV_DEV_POWER_STATE eNewPowerState,
165 PVRSRV_DEV_POWER_STATE eCurrentPowerState);
166
167IMG_VOID SysSGXIdleEntered(IMG_VOID);
168IMG_VOID SysSGXCommandPending(IMG_BOOL bSGXIdle);
169
170#if defined(SYS_CUSTOM_POWERLOCK_WRAP)
171PVRSRV_ERROR SysPowerLockWrap(IMG_BOOL bTryLock);
172IMG_VOID SysPowerLockUnwrap(IMG_VOID);
173#endif
174
175IMG_VOID SysLockSystemSuspend(IMG_VOID);
176IMG_VOID SysUnlockSystemSuspend(IMG_VOID);
177
178PVRSRV_ERROR SysOEMFunction ( IMG_UINT32 ui32ID,
179 IMG_VOID *pvIn,
180 IMG_UINT32 ulInSize,
181 IMG_VOID *pvOut,
182 IMG_UINT32 ulOutSize);
183
184
185IMG_DEV_PHYADDR SysCpuPAddrToDevPAddr (PVRSRV_DEVICE_TYPE eDeviceType, IMG_CPU_PHYADDR cpu_paddr);
186IMG_DEV_PHYADDR SysSysPAddrToDevPAddr (PVRSRV_DEVICE_TYPE eDeviceType, IMG_SYS_PHYADDR SysPAddr);
187IMG_SYS_PHYADDR SysDevPAddrToSysPAddr (PVRSRV_DEVICE_TYPE eDeviceType, IMG_DEV_PHYADDR SysPAddr);
188IMG_CPU_PHYADDR SysSysPAddrToCpuPAddr (IMG_SYS_PHYADDR SysPAddr);
189IMG_SYS_PHYADDR SysCpuPAddrToSysPAddr (IMG_CPU_PHYADDR cpu_paddr);
190#if defined(PVR_LMA)
191IMG_BOOL SysVerifyCpuPAddrToDevPAddr (PVRSRV_DEVICE_TYPE eDeviceType, IMG_CPU_PHYADDR CpuPAddr);
192IMG_BOOL SysVerifySysPAddrToDevPAddr (PVRSRV_DEVICE_TYPE eDeviceType, IMG_SYS_PHYADDR SysPAddr);
193#endif
194
195extern SYS_DATA* gpsSysData;
196
197
198#if !defined(USE_CODE)
199
200/*!
201******************************************************************************
202
203 @Function SysAcquireData
204
205 @Description returns reference to to sysdata
206 creating one on first call
207
208 @Input ppsSysData - pointer to copy reference into
209
210 @Return ppsSysData updated
211
212******************************************************************************/
213#ifdef INLINE_IS_PRAGMA
214#pragma inline(SysAcquireData)
215#endif
216static INLINE IMG_VOID SysAcquireData(SYS_DATA **ppsSysData)
217{
218 /* Copy pointer back system information pointer */
219 *ppsSysData = gpsSysData;
220
221 /*
222 Verify we've not been called before being initialised. Instinctively
223 we should do this check first, but in the failing case we'll just write
224 null back and the compiler won't warn about an uninitialised varible.
225 */
226 PVR_ASSERT (gpsSysData != IMG_NULL);
227}
228
229
230/*!
231******************************************************************************
232
233 @Function SysAcquireDataNoCheck
234
235 @Description returns reference to to sysdata
236 creating one on first call
237
238 @Input none
239
240 @Return psSysData - pointer to copy reference into
241
242******************************************************************************/
243#ifdef INLINE_IS_PRAGMA
244#pragma inline(SysAcquireDataNoCheck)
245#endif
246static INLINE SYS_DATA * SysAcquireDataNoCheck(IMG_VOID)
247{
248 /* return pointer back system information pointer */
249 return gpsSysData;
250}
251
252
253/*!
254******************************************************************************
255
256 @Function SysInitialiseCommon
257
258 @Description Performs system initialisation common to all systems
259
260 @Input psSysData - pointer to system data
261
262 @Return PVRSRV_ERROR :
263
264******************************************************************************/
265#ifdef INLINE_IS_PRAGMA
266#pragma inline(SysInitialiseCommon)
267#endif
268static INLINE PVRSRV_ERROR SysInitialiseCommon(SYS_DATA *psSysData)
269{
270 PVRSRV_ERROR eError;
271
272 /* Initialise Services */
273 eError = PVRSRVInit(psSysData);
274
275 return eError;
276}
277
278/*!
279******************************************************************************
280
281 @Function SysDeinitialiseCommon
282
283 @Description Performs system deinitialisation common to all systems
284
285 @Input psSysData - pointer to system data
286
287 @Return PVRSRV_ERROR :
288
289******************************************************************************/
290#ifdef INLINE_IS_PRAGMA
291#pragma inline(SysDeinitialiseCommon)
292#endif
293static INLINE IMG_VOID SysDeinitialiseCommon(SYS_DATA *psSysData)
294{
295 /* De-initialise Services */
296 PVRSRVDeInit(psSysData);
297
298 OSDestroyResource(&psSysData->sPowerStateChangeResource);
299}
300#endif /* !defined(USE_CODE) */
301
302
303/*
304 * SysReadHWReg and SysWriteHWReg differ from OSReadHWReg and OSWriteHWReg
305 * in that they are always intended for use with real hardware, even on
306 * NO_HARDWARE systems.
307 */
308#if !(defined(NO_HARDWARE) && defined(__linux__) && defined(__KERNEL__))
309#define SysReadHWReg(p, o) OSReadHWReg(p, o)
310#define SysWriteHWReg(p, o, v) OSWriteHWReg(p, o, v)
311#else /* !(defined(NO_HARDWARE) && defined(__linux__)) */
312/*!
313******************************************************************************
314
315 @Function SysReadHWReg
316
317 @Description
318
319 register read function
320
321 @input pvLinRegBaseAddr : lin addr of register block base
322
323 @input ui32Offset :
324
325 @Return register value
326
327******************************************************************************/
328static inline IMG_UINT32 SysReadHWReg(IMG_PVOID pvLinRegBaseAddr, IMG_UINT32 ui32Offset)
329{
330 return (IMG_UINT32) readl(pvLinRegBaseAddr + ui32Offset);
331}
332
333/*!
334******************************************************************************
335
336 @Function SysWriteHWReg
337
338 @Description
339
340 register write function
341
342 @input pvLinRegBaseAddr : lin addr of register block base
343
344 @input ui32Offset :
345
346 @input ui32Value :
347
348 @Return none
349
350******************************************************************************/
351static inline IMG_VOID SysWriteHWReg(IMG_PVOID pvLinRegBaseAddr, IMG_UINT32 ui32Offset, IMG_UINT32 ui32Value)
352{
353 writel(ui32Value, pvLinRegBaseAddr + ui32Offset);
354}
355#endif /* !(defined(NO_HARDWARE) && defined(__linux__)) */
356
357#if defined(__cplusplus)
358}
359#endif
360
361#ifdef INLINE_IS_PRAGMA
362#pragma inline(SysHighResTimerCreate)
363#endif
364static INLINE IMG_HANDLE SysHighResTimerCreate(IMG_VOID)
365{
366 SYS_DATA *psSysData;
367
368 SysAcquireData(&psSysData);
369 return psSysData->pfnHighResTimerCreate();
370}
371
372#ifdef INLINE_IS_PRAGMA
373#pragma inline(SysHighResTimerGetus)
374#endif
375static INLINE IMG_UINT32 SysHighResTimerGetus(IMG_HANDLE hTimer)
376{
377 SYS_DATA *psSysData;
378
379 SysAcquireData(&psSysData);
380 return psSysData->pfnHighResTimerGetus(hTimer);
381}
382
383#ifdef INLINE_IS_PRAGMA
384#pragma inline(SysHighResTimerDestroy)
385#endif
386static INLINE IMG_VOID SysHighResTimerDestroy(IMG_HANDLE hTimer)
387{
388 SYS_DATA *psSysData;
389
390 SysAcquireData(&psSysData);
391 psSysData->pfnHighResTimerDestroy(hTimer);
392}
393#endif
394
395/*****************************************************************************
396 End of file (syscommon.h)
397*****************************************************************************/