1 /*************************************************************************/ /*!
3 @Title Common System APIs and structures
4 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description This header provides common system-specific declarations and macros
6 that are supported by all systems
7 @License Dual MIT/GPLv2
9 The contents of this file are subject to the MIT license as set out below.
11 Permission is hereby granted, free of charge, to any person obtaining a copy
12 of this software and associated documentation files (the "Software"), to deal
13 in the Software without restriction, including without limitation the rights
14 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 copies of the Software, and to permit persons to whom the Software is
16 furnished to do so, subject to the following conditions:
18 The above copyright notice and this permission notice shall be included in
19 all copies or substantial portions of the Software.
21 Alternatively, the contents of this file may be used under the terms of
22 the GNU General Public License Version 2 ("GPL") in which case the provisions
23 of GPL are applicable instead of those above.
25 If you wish to allow use of your version of this file only under the terms of
26 GPL, and not to allow others to use your version of this file under the terms
27 of the MIT license, indicate your decision by deleting the provisions above
28 and replace them with the notice and other provisions required by GPL as set
29 out in the file called "GPL-COPYING" included in this distribution. If you do
30 not delete the provisions above, a recipient may use your version of this file
31 under the terms of either the MIT license or GPL.
33 This License is also included in this distribution in the file called
36 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
37 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
38 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
39 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
40 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
41 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
42 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
43 */ /**************************************************************************/
50 #if defined(NO_HARDWARE) && defined(__linux__) && defined(__KERNEL__)
54 #if defined (__cplusplus)
59 PVRSRV_ERROR SysCreateConfigData(PVRSRV_SYSTEM_CONFIG **ppsSysConfig, void *hDevice);
60 IMG_VOID SysDestroyConfigData(PVRSRV_SYSTEM_CONFIG *psSysConfig);
61 PVRSRV_ERROR SysAcquireSystemData(IMG_HANDLE hSysData);
62 PVRSRV_ERROR SysReleaseSystemData(IMG_HANDLE hSysData);
63 PVRSRV_ERROR SysDebugInfo(PVRSRV_SYSTEM_CONFIG *psSysConfig, DUMPDEBUG_PRINTF_FUNC *pfnDumpDebugPrintf);
65 #if defined(SUPPORT_GPUVIRT_VALIDATION)
67 IMG_VOID SysSetOSidRegisters(IMG_UINT32 aui32OSidMin[GPUVIRT_VALIDATION_NUM_OS][GPUVIRT_VALIDATION_NUM_REGIONS], IMG_UINT32 aui32OSidMax[GPUVIRT_VALIDATION_NUM_OS][GPUVIRT_VALIDATION_NUM_REGIONS]);
68 IMG_VOID SysPrintAndResetFaultStatusRegister(void);
71 #if defined(SUPPORT_SYSTEM_INTERRUPT_HANDLING)
72 PVRSRV_ERROR SysInstallDeviceLISR(IMG_UINT32 ui32IRQ,
76 IMG_HANDLE *phLISRData);
78 PVRSRV_ERROR SysUninstallDeviceLISR(IMG_HANDLE hLISRData);
80 #if defined(SUPPORT_DRM)
81 IMG_BOOL SystemISRHandler(IMG_VOID *pvData);
83 #endif /* defined(SUPPORT_SYSTEM_INTERRUPT_HANDLING) */
87 * SysReadHWReg and SysWriteHWReg differ from OSReadHWReg and OSWriteHWReg
88 * in that they are always intended for use with real hardware, even on
89 * NO_HARDWARE systems.
91 #if !(defined(NO_HARDWARE) && defined(__linux__) && defined(__KERNEL__))
92 #define SysReadHWReg(p, o) OSReadHWReg(p, o)
93 #define SysWriteHWReg(p, o, v) OSWriteHWReg(p, o, v)
94 #else /* !(defined(NO_HARDWARE) && defined(__linux__)) */
96 ******************************************************************************
98 @Function SysReadHWReg
102 register read function
104 @input pvLinRegBaseAddr : lin addr of register block base
108 @Return register value
110 ******************************************************************************/
111 static inline IMG_UINT32 SysReadHWReg(IMG_PVOID pvLinRegBaseAddr, IMG_UINT32 ui32Offset)
113 return (IMG_UINT32) readl(pvLinRegBaseAddr + ui32Offset);
117 ******************************************************************************
119 @Function SysWriteHWReg
123 register write function
125 @input pvLinRegBaseAddr : lin addr of register block base
133 ******************************************************************************/
134 static inline IMG_VOID SysWriteHWReg(IMG_PVOID pvLinRegBaseAddr, IMG_UINT32 ui32Offset, IMG_UINT32 ui32Value)
136 writel(ui32Value, pvLinRegBaseAddr + ui32Offset);
138 #endif /* !(defined(NO_HARDWARE) && defined(__linux__)) */
141 ******************************************************************************
143 @Function SysCheckMemAllocSize
145 @Description Function to apply memory budgeting policies
151 @input ui32NumPhysChunks
155 ******************************************************************************/
156 FORCE_INLINE PVRSRV_ERROR SysCheckMemAllocSize(struct _PVRSRV_DEVICE_NODE_ *psDevNode,
157 IMG_UINT64 ui64MemSize)
159 PVR_UNREFERENCED_PARAMETER(psDevNode);
160 PVR_UNREFERENCED_PARAMETER(ui64MemSize);
165 #if defined(__cplusplus)
171 /*****************************************************************************
172 End of file (syscommon.h)
173 *****************************************************************************/