1 /**************************************************************************/ /*!
3 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
4 @License Dual MIT/GPLv2
6 The contents of this file are subject to the MIT license as set out below.
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
18 Alternatively, the contents of this file may be used under the terms of
19 the GNU General Public License Version 2 ("GPL") in which case the provisions
20 of GPL are applicable instead of those above.
22 If you wish to allow use of your version of this file only under the terms of
23 GPL, and not to allow others to use your version of this file under the terms
24 of the MIT license, indicate your decision by deleting the provisions above
25 and replace them with the notice and other provisions required by GPL as set
26 out in the file called "GPL-COPYING" included in this distribution. If you do
27 not delete the provisions above, a recipient may use your version of this file
28 under the terms of either the MIT license or GPL.
30 This License is also included in this distribution in the file called
33 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
34 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
35 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
36 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
37 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
38 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
39 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
40 */ /***************************************************************************/
42 #ifndef __PVRSRV_DEVICE_H__
43 #define __PVRSRV_DEVICE_H__
45 #include "servicesext.h"
46 #include "pvrsrv_device_types.h"
47 #include "img_types.h"
50 #include "rgx_fwif_km.h"
55 typedef struct _PVRSRV_DEVICE_CONFIG_ PVRSRV_DEVICE_CONFIG;
57 /*! The CPU physical base of the LMA physical heap is used as the base for
58 * device memory physical heap allocations */
59 #define PVRSRV_DEVICE_CONFIG_LMA_USE_CPU_ADDR (1<<0)
62 * The maximum number of physical heaps associated
67 PVRSRV_DEVICE_PHYS_HEAP_GPU_LOCAL = 0,
68 PVRSRV_DEVICE_PHYS_HEAP_CPU_LOCAL = 1,
69 PVRSRV_DEVICE_PHYS_HEAP_LAST
70 }PVRSRV_DEVICE_PHYS_HEAP;
74 PVRSRV_DEVICE_IRQ_ACTIVE_SYSDEFAULT = 0,
75 PVRSRV_DEVICE_IRQ_ACTIVE_LOW,
76 PVRSRV_DEVICE_IRQ_ACTIVE_HIGH
77 }PVRSRV_DEVICE_IRQ_ACTIVE_LEVEL;
79 typedef IMG_VOID (*PFN_MISR)(IMG_VOID *pvData);
81 typedef IMG_BOOL (*PFN_LISR)(IMG_VOID *pvData);
83 typedef IMG_UINT32 (*PFN_SYS_DEV_CLK_FREQ_GET)(IMG_HANDLE hSysData);
85 typedef PVRSRV_ERROR (*PFN_SYS_DEV_PRE_POWER)(PVRSRV_DEV_POWER_STATE eNewPowerState,
86 PVRSRV_DEV_POWER_STATE eCurrentPowerState,
90 typedef PVRSRV_ERROR (*PFN_SYS_DEV_POST_POWER)(PVRSRV_DEV_POWER_STATE eNewPowerState,
91 PVRSRV_DEV_POWER_STATE eCurrentPowerState,
94 typedef IMG_VOID (*PFN_SYS_DEV_INTERRUPT_HANDLED)(PVRSRV_DEVICE_CONFIG *psDevConfig);
96 typedef PVRSRV_ERROR (*PFN_SYS_DEV_CHECK_MEM_ALLOC_SIZE)(struct _PVRSRV_DEVICE_NODE_ *psDevNode,
97 IMG_UINT64 ui64MemSize);
99 struct _PVRSRV_DEVICE_CONFIG_
101 /*! Configuration flags */
104 /*! Name of the device (used when registering the IRQ) */
107 /*! Type of device this is */
108 PVRSRV_DEVICE_TYPE eDeviceType;
110 /*! Register bank address */
111 IMG_CPU_PHYADDR sRegsCpuPBase;
112 /*! Register bank size */
113 IMG_UINT32 ui32RegsSize;
114 /*! Device interrupt number */
117 /*! The device interrupt is shared */
118 IMG_BOOL bIRQIsShared;
121 PVRSRV_DEVICE_IRQ_ACTIVE_LEVEL eIRQActiveLevel;
123 /*! Device specific data handle */
126 /*! System specific data. This gets passed into system callback functions */
129 /*! ID of the Physical memory heap to use
130 *! The first entry (aui32PhysHeapID[PVRSRV_DEVICE_PHYS_HEAP_GPU_LOCAL]) will be used for allocations
131 *! where the PVRSRV_MEMALLOCFLAG_CPU_LOCAL flag is not set. Normally this will be the PhysHeapID
132 *! of an LMA heap (but the configuration could specify a UMA heap here, if desired)
133 *! The second entry (aui32PhysHeapID[PVRSRV_DEVICE_PHYS_HEAP_CPU_LOCAL]) will be used for allocations
134 *! where the PVRSRV_MEMALLOCFLAG_CPU_LOCAL flag is set. Normally this will be the PhysHeapID
135 *! of a UMA heap (but the configuration could specify an LMA heap here, if desired)
136 *! In the event of there being only one Physical Heap, the configuration should specify the
137 *! same heap details in both entries */
138 IMG_UINT32 aui32PhysHeapID[PVRSRV_DEVICE_PHYS_HEAP_LAST];
140 /*! Callback to inform the device we about to change power state */
141 PFN_SYS_DEV_PRE_POWER pfnPrePowerState;
143 /*! Callback to inform the device we have finished the power state change */
144 PFN_SYS_DEV_POST_POWER pfnPostPowerState;
146 /*! Callback to obtain the clock frequency from the device */
147 PFN_SYS_DEV_CLK_FREQ_GET pfnClockFreqGet;
149 /*! Callback to inform the device that an interrupt has been handled */
150 PFN_SYS_DEV_INTERRUPT_HANDLED pfnInterruptHandled;
152 /*! Callback to handle memory budgeting */
153 PFN_SYS_DEV_CHECK_MEM_ALLOC_SIZE pfnCheckMemAllocSize;
155 /*! Current breakpoint data master */
157 /*! A Breakpoint has been set */
160 #if defined(PVR_DVFS)
165 typedef PVRSRV_ERROR (*PFN_SYSTEM_PRE_POWER_STATE)(PVRSRV_SYS_POWER_STATE eNewPowerState);
166 typedef PVRSRV_ERROR (*PFN_SYSTEM_POST_POWER_STATE)(PVRSRV_SYS_POWER_STATE eNewPowerState);
168 typedef enum _PVRSRV_SYSTEM_SNOOP_MODE_ {
169 PVRSRV_SYSTEM_SNOOP_NONE = 0,
170 PVRSRV_SYSTEM_SNOOP_CPU_ONLY,
171 PVRSRV_SYSTEM_SNOOP_DEVICE_ONLY,
172 PVRSRV_SYSTEM_SNOOP_CROSS,
173 } PVRSRV_SYSTEM_SNOOP_MODE;
175 typedef struct _PVRSRV_SYSTEM_CONFIG_
177 IMG_UINT32 uiSysFlags;
178 IMG_CHAR *pszSystemName;
179 IMG_UINT32 uiDeviceCount;
180 PVRSRV_DEVICE_CONFIG *pasDevices;
181 PFN_SYSTEM_PRE_POWER_STATE pfnSysPrePowerState;
182 PFN_SYSTEM_POST_POWER_STATE pfnSysPostPowerState;
183 PVRSRV_SYSTEM_SNOOP_MODE eCacheSnoopingMode;
185 PHYS_HEAP_CONFIG *pasPhysHeaps;
186 IMG_UINT32 ui32PhysHeapCount;
188 IMG_UINT32 *pui32BIFTilingHeapConfigs;
189 IMG_UINT32 ui32BIFTilingHeapCount;
190 } PVRSRV_SYSTEM_CONFIG;
193 #endif /* __PVRSRV_DEVICE_H__*/