1 /*************************************************************************/ /*!
3 @Title System Configuration
4 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description System Configuration functions
6 @License Dual MIT/GPLv2
8 The contents of this file are subject to the MIT license as set out below.
10 Permission is hereby granted, free of charge, to any person obtaining a copy
11 of this software and associated documentation files (the "Software"), to deal
12 in the Software without restriction, including without limitation the rights
13 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 copies of the Software, and to permit persons to whom the Software is
15 furnished to do so, subject to the following conditions:
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
20 Alternatively, the contents of this file may be used under the terms of
21 the GNU General Public License Version 2 ("GPL") in which case the provisions
22 of GPL are applicable instead of those above.
24 If you wish to allow use of your version of this file only under the terms of
25 GPL, and not to allow others to use your version of this file under the terms
26 of the MIT license, indicate your decision by deleting the provisions above
27 and replace them with the notice and other provisions required by GPL as set
28 out in the file called "GPL-COPYING" included in this distribution. If you do
29 not delete the provisions above, a recipient may use your version of this file
30 under the terms of either the MIT license or GPL.
32 This License is also included in this distribution in the file called
35 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
36 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
37 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
38 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
39 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
40 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
41 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42 */ /**************************************************************************/
44 #include "pvrsrv_device.h"
45 #include "syscommon.h"
46 #include "sysconfig.h"
48 #if defined(SUPPORT_ION)
49 #include "ion_support.h"
53 static RGX_TIMING_INFORMATION gsRGXTimingInfo;
54 static RGX_DATA gsRGXData;
55 static PVRSRV_DEVICE_CONFIG gsDevices[1];
56 static PVRSRV_SYSTEM_CONFIG gsSysConfig;
58 static PHYS_HEAP_FUNCTIONS gsPhysHeapFuncs;
59 #if defined(TDMETACODE)
60 static PHYS_HEAP_CONFIG gsPhysHeapConfig[3];
62 static PHYS_HEAP_CONFIG gsPhysHeapConfig[1];
66 CPU to Device physcial address translation
69 IMG_VOID UMAPhysHeapCpuPAddrToDevPAddr(IMG_HANDLE hPrivData,
70 IMG_UINT32 ui32NumOfAddr,
71 IMG_DEV_PHYADDR *psDevPAddr,
72 IMG_CPU_PHYADDR *psCpuPAddr)
74 PVR_UNREFERENCED_PARAMETER(hPrivData);
76 /* Optimise common case */
77 psDevPAddr[0].uiAddr = psCpuPAddr[0].uiAddr;
78 if (ui32NumOfAddr > 1)
81 for (ui32Idx = 1; ui32Idx < ui32NumOfAddr; ++ui32Idx)
83 psDevPAddr[ui32Idx].uiAddr = psCpuPAddr[ui32Idx].uiAddr;
89 Device to CPU physcial address translation
92 IMG_VOID UMAPhysHeapDevPAddrToCpuPAddr(IMG_HANDLE hPrivData,
93 IMG_UINT32 ui32NumOfAddr,
94 IMG_CPU_PHYADDR *psCpuPAddr,
95 IMG_DEV_PHYADDR *psDevPAddr)
97 PVR_UNREFERENCED_PARAMETER(hPrivData);
99 /* Optimise common case */
100 psCpuPAddr[0].uiAddr = psDevPAddr[0].uiAddr;
101 if (ui32NumOfAddr > 1)
104 for (ui32Idx = 1; ui32Idx < ui32NumOfAddr; ++ui32Idx)
106 psCpuPAddr[ui32Idx].uiAddr = psDevPAddr[ui32Idx].uiAddr;
114 PVRSRV_ERROR SysCreateConfigData(PVRSRV_SYSTEM_CONFIG **ppsSysConfig, void *hDevice)
116 PVR_UNREFERENCED_PARAMETER(hDevice);
121 * Setup information about physical memory heap(s) we have
123 gsPhysHeapFuncs.pfnCpuPAddrToDevPAddr = UMAPhysHeapCpuPAddrToDevPAddr;
124 gsPhysHeapFuncs.pfnDevPAddrToCpuPAddr = UMAPhysHeapDevPAddrToCpuPAddr;
126 gsPhysHeapConfig[0].ui32PhysHeapID = 0;
127 gsPhysHeapConfig[0].pszPDumpMemspaceName = "SYSMEM";
128 gsPhysHeapConfig[0].eType = PHYS_HEAP_TYPE_UMA;
129 gsPhysHeapConfig[0].psMemFuncs = &gsPhysHeapFuncs;
130 gsPhysHeapConfig[0].hPrivData = IMG_NULL;
132 #if defined(TDMETACODE)
133 gsPhysHeapConfig[1].ui32PhysHeapID = 1;
134 gsPhysHeapConfig[1].pszPDumpMemspaceName = "TDMETACODEMEM";
135 gsPhysHeapConfig[1].eType = PHYS_HEAP_TYPE_UMA;
136 gsPhysHeapConfig[1].psMemFuncs = &gsPhysHeapFuncs;
137 gsPhysHeapConfig[1].hPrivData = IMG_NULL;
139 gsPhysHeapConfig[2].ui32PhysHeapID = 2;
140 gsPhysHeapConfig[2].pszPDumpMemspaceName = "TDSECUREBUFMEM";
141 gsPhysHeapConfig[2].eType = PHYS_HEAP_TYPE_UMA;
142 gsPhysHeapConfig[2].psMemFuncs = &gsPhysHeapFuncs;
143 gsPhysHeapConfig[2].hPrivData = IMG_NULL;
146 gsSysConfig.pasPhysHeaps = &(gsPhysHeapConfig[0]);
147 gsSysConfig.ui32PhysHeapCount = IMG_ARR_NUM_ELEMS(gsPhysHeapConfig);
149 gsSysConfig.pui32BIFTilingHeapConfigs = gauiBIFTilingHeapXStrides;
150 gsSysConfig.ui32BIFTilingHeapCount = IMG_ARR_NUM_ELEMS(gauiBIFTilingHeapXStrides);
153 * Setup RGX specific timing data
155 gsRGXTimingInfo.ui32CoreClockSpeed = RGX_RK_CORE_CLOCK_SPEED;
156 gsRGXTimingInfo.bEnableActivePM = IMG_TRUE;
157 gsRGXTimingInfo.bEnableRDPowIsland = IMG_FALSE;
158 gsRGXTimingInfo.ui32ActivePMLatencyms = SYS_RGX_ACTIVE_POWER_LATENCY_MS;
161 *Setup RGX specific data
163 gsRGXData.psRGXTimingInfo = &gsRGXTimingInfo;
164 #if defined(TDMETACODE)
165 gsRGXData.bHasTDMetaCodePhysHeap = IMG_TRUE;
166 gsRGXData.uiTDMetaCodePhysHeapID = 1;
168 gsRGXData.bHasTDSecureBufPhysHeap = IMG_TRUE;
169 gsRGXData.uiTDSecureBufPhysHeapID = 2;
175 gsDevices[0].eDeviceType = PVRSRV_DEVICE_TYPE_RGX;
176 gsDevices[0].pszName = "RGX";
178 /* Device setup information */
179 gsDevices[0].sRegsCpuPBase.uiAddr = RK_GPU_PBASE;
180 gsDevices[0].ui32RegsSize = RK_GPU_SIZE;
181 gsDevices[0].ui32IRQ = RK_IRQ_GPU;
182 gsDevices[0].bIRQIsShared = IMG_FALSE;
184 /* Device's physical heap IDs */
185 gsDevices[0].aui32PhysHeapID[PVRSRV_DEVICE_PHYS_HEAP_GPU_LOCAL] = 0;
186 gsDevices[0].aui32PhysHeapID[PVRSRV_DEVICE_PHYS_HEAP_CPU_LOCAL] = 0;
188 /* No power management on RK system */
189 gsDevices[0].pfnPrePowerState = RkPrePowerState;
190 gsDevices[0].pfnPostPowerState = RkPostPowerState;
192 /* No clock frequency either */
193 gsDevices[0].pfnClockFreqGet = IMG_NULL;
195 /* No interrupt handled either */
196 gsDevices[0].pfnInterruptHandled = IMG_NULL;
198 gsDevices[0].pfnCheckMemAllocSize = SysCheckMemAllocSize;
200 gsDevices[0].hDevData = &gsRGXData;
203 * Setup system config
205 gsSysConfig.pszSystemName = RGX_RK_SYSTEM_NAME;
206 gsSysConfig.uiDeviceCount = sizeof(gsDevices)/sizeof(gsDevices[0]);
207 gsSysConfig.pasDevices = &gsDevices[0];
209 /* No power management on no HW system */
210 gsSysConfig.pfnSysPrePowerState = IMG_NULL;
211 gsSysConfig.pfnSysPostPowerState = IMG_NULL;
213 /* no cache snooping */
214 gsSysConfig.eCacheSnoopingMode = PVRSRV_SYSTEM_SNOOP_NONE;
216 /* Setup other system specific stuff */
217 #if defined(SUPPORT_ION)
221 *ppsSysConfig = &gsSysConfig;
229 IMG_VOID SysDestroyConfigData(PVRSRV_SYSTEM_CONFIG *psSysConfig)
231 PVR_UNREFERENCED_PARAMETER(psSysConfig);
236 #if defined(SUPPORT_ION)
241 PVRSRV_ERROR SysAcquireSystemData(IMG_HANDLE hSysData)
243 PVR_UNREFERENCED_PARAMETER(hSysData);
245 return PVRSRV_ERROR_NOT_SUPPORTED;
248 PVRSRV_ERROR SysReleaseSystemData(IMG_HANDLE hSysData)
250 PVR_UNREFERENCED_PARAMETER(hSysData);
252 return PVRSRV_ERROR_NOT_SUPPORTED;
255 PVRSRV_ERROR SysDebugInfo(PVRSRV_SYSTEM_CONFIG *psSysConfig, DUMPDEBUG_PRINTF_FUNC *pfnDumpDebugPrintf)
257 PVR_UNREFERENCED_PARAMETER(psSysConfig);
258 PVR_UNREFERENCED_PARAMETER(pfnDumpDebugPrintf);
262 /******************************************************************************
263 End of file (sysconfig.c)
264 ******************************************************************************/