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 "img_types.h"
47 #include "pvrsrv_error.h"
48 #include "rgx_fwif_km.h"
49 #include "servicesext.h"
51 #if defined(PVR_DVFS) || defined(SUPPORT_PDVFS)
55 typedef struct _PVRSRV_DEVICE_CONFIG_ PVRSRV_DEVICE_CONFIG;
58 * All the heaps from which regular device memory allocations can be made in
59 * terms of their locality to the respective device.
63 PVRSRV_DEVICE_PHYS_HEAP_GPU_LOCAL = 0,
64 PVRSRV_DEVICE_PHYS_HEAP_CPU_LOCAL = 1,
65 PVRSRV_DEVICE_PHYS_HEAP_FW_LOCAL = 2,
66 PVRSRV_DEVICE_PHYS_HEAP_LAST
67 } PVRSRV_DEVICE_PHYS_HEAP;
71 PVRSRV_DEVICE_LOCAL_MEMORY_ARENA_MAPPABLE = 0,
72 PVRSRV_DEVICE_LOCAL_MEMORY_ARENA_NON_MAPPABLE = 1,
73 PVRSRV_DEVICE_LOCAL_MEMORY_ARENA_LAST
74 } PVRSRV_DEVICE_LOCAL_MEMORY_ARENA;
76 typedef enum _PVRSRV_DEVICE_SNOOP_MODE_
78 PVRSRV_DEVICE_SNOOP_NONE = 0,
79 PVRSRV_DEVICE_SNOOP_CPU_ONLY,
80 PVRSRV_DEVICE_SNOOP_DEVICE_ONLY,
81 PVRSRV_DEVICE_SNOOP_CROSS,
82 } PVRSRV_DEVICE_SNOOP_MODE;
85 (*PFN_SYS_DEV_CLK_FREQ_GET)(IMG_HANDLE hSysData);
88 (*PFN_SYS_DEV_PRE_POWER)(IMG_HANDLE hSysData,
89 PVRSRV_DEV_POWER_STATE eNewPowerState,
90 PVRSRV_DEV_POWER_STATE eCurrentPowerState,
94 (*PFN_SYS_DEV_POST_POWER)(IMG_HANDLE hSysData,
95 PVRSRV_DEV_POWER_STATE eNewPowerState,
96 PVRSRV_DEV_POWER_STATE eCurrentPowerState,
100 (*PFN_SYS_DEV_INTERRUPT_HANDLED)(PVRSRV_DEVICE_CONFIG *psDevConfig);
103 (*PFN_SYS_DEV_CHECK_MEM_ALLOC_SIZE)(IMG_HANDLE hSysData,
104 IMG_UINT64 ui64MemSize);
106 typedef void (*PFN_SYS_DEV_FEAT_DEP_INIT)(PVRSRV_DEVICE_CONFIG *, IMG_UINT64);
108 #if defined(SUPPORT_TRUSTED_DEVICE)
110 #define PVRSRV_DEVICE_FW_CODE_REGION (0)
111 #define PVRSRV_DEVICE_FW_COREMEM_CODE_REGION (1)
113 typedef struct _PVRSRV_TD_FW_PARAMS_
115 const void *pvFirmware;
116 IMG_UINT32 ui32FirmwareSize;
117 IMG_DEV_VIRTADDR sFWCodeDevVAddrBase;
118 IMG_DEV_VIRTADDR sFWDataDevVAddrBase;
119 RGXFWIF_DEV_VIRTADDR sFWCorememCodeFWAddr;
120 RGXFWIF_DEV_VIRTADDR sFWInitFWAddr;
121 } PVRSRV_TD_FW_PARAMS;
124 (*PFN_TD_SEND_FW_IMAGE)(IMG_HANDLE hSysData,
125 PVRSRV_TD_FW_PARAMS *psTDFWParams);
127 typedef struct _PVRSRV_TD_POWER_PARAMS_
129 IMG_DEV_PHYADDR sPCAddr; /* META only used param */
131 /* MIPS only used fields */
132 IMG_DEV_PHYADDR sGPURegAddr;
133 IMG_DEV_PHYADDR sBootRemapAddr;
134 IMG_DEV_PHYADDR sCodeRemapAddr;
135 IMG_DEV_PHYADDR sDataRemapAddr;
136 } PVRSRV_TD_POWER_PARAMS;
139 (*PFN_TD_SET_POWER_PARAMS)(IMG_HANDLE hSysData,
140 PVRSRV_TD_POWER_PARAMS *psTDPowerParams);
143 (*PFN_TD_RGXSTART)(IMG_HANDLE hSysData);
146 (*PFN_TD_RGXSTOP)(IMG_HANDLE hSysData);
148 typedef struct _PVRSRV_TD_SECBUF_PARAMS_
150 IMG_DEVMEM_SIZE_T uiSize;
151 IMG_DEVMEM_ALIGN_T uiAlign;
152 IMG_CPU_PHYADDR *psSecBufAddr;
153 IMG_UINT64 *pui64SecBufHandle;
154 } PVRSRV_TD_SECBUF_PARAMS;
157 (*PFN_TD_SECUREBUF_ALLOC)(IMG_HANDLE hSysData,
158 PVRSRV_TD_SECBUF_PARAMS *psTDSecBufParams);
161 (*PFN_TD_SECUREBUF_FREE)(IMG_HANDLE hSysData,
162 IMG_UINT64 ui64SecBufHandle);
163 #endif /* defined(SUPPORT_TRUSTED_DEVICE) */
165 struct _PVRSRV_DEVICE_CONFIG_
167 /*! OS device passed to SysDevInit (linux: 'struct device') */
171 *! Service representation of pvOSDevice. Should be set to NULL when the
172 *! config is created in SysDevInit. Set by Services once a device node has
173 *! been created for this config and unset before SysDevDeInit is called.
175 struct _PVRSRV_DEVICE_NODE_ *psDevNode;
177 /*! Name of the device */
180 /*! Version of the device (optional) */
181 IMG_CHAR *pszVersion;
183 /*! Register bank address */
184 IMG_CPU_PHYADDR sRegsCpuPBase;
185 /*! Register bank size */
186 IMG_UINT32 ui32RegsSize;
187 /*! Device interrupt number */
190 PVRSRV_DEVICE_SNOOP_MODE eCacheSnoopingMode;
192 /*! Device specific data handle */
195 /*! System specific data that gets passed into system callback functions. */
198 IMG_BOOL bHasNonMappableLocalMemory;
200 PHYS_HEAP_CONFIG *pasPhysHeaps;
201 IMG_UINT32 ui32PhysHeapCount;
204 *! ID of the Physical memory heap to use.
206 *! The first entry (aui32PhysHeapID[PVRSRV_DEVICE_PHYS_HEAP_GPU_LOCAL])
207 *! will be used for allocations where the PVRSRV_MEMALLOCFLAG_CPU_LOCAL
208 *! flag is not set. Normally this will be the PhysHeapID of an LMA heap
209 *! but the configuration could specify a UMA heap here (if desired).
211 *! The second entry (aui32PhysHeapID[PVRSRV_DEVICE_PHYS_HEAP_CPU_LOCAL])
212 *! will be used for allocations where the PVRSRV_MEMALLOCFLAG_CPU_LOCAL
213 *! flag is set. Normally this will be the PhysHeapID of a UMA heap but
214 *! the configuration could specify an LMA heap here (if desired).
216 *! The third entry (aui32PhysHeapID[PVRSRV_DEVICE_PHYS_HEAP_FW_LOCAL])
217 *! will be used for allocations where the PVRSRV_MEMALLOCFLAG_FW_LOCAL
220 *! In the event of there being only one Physical Heap, the configuration
221 *! should specify the same heap details in all entries.
223 IMG_UINT32 aui32PhysHeapID[PVRSRV_DEVICE_PHYS_HEAP_LAST];
225 RGXFWIF_BIFTILINGMODE eBIFTilingMode;
226 IMG_UINT32 *pui32BIFTilingHeapConfigs;
227 IMG_UINT32 ui32BIFTilingHeapCount;
230 *! Callbacks to change system device power state at the beginning and end
231 *! of a power state change (optional).
233 PFN_SYS_DEV_PRE_POWER pfnPrePowerState;
234 PFN_SYS_DEV_POST_POWER pfnPostPowerState;
236 /*! Callback to obtain the clock frequency from the device (optional). */
237 PFN_SYS_DEV_CLK_FREQ_GET pfnClockFreqGet;
240 *! Callback to handle memory budgeting. Can be used to reject allocations
241 *! over a certain size (optional).
243 PFN_SYS_DEV_CHECK_MEM_ALLOC_SIZE pfnCheckMemAllocSize;
245 #if defined(SUPPORT_TRUSTED_DEVICE)
247 *! Callback to send FW image and FW boot time parameters to the trusted
250 PFN_TD_SEND_FW_IMAGE pfnTDSendFWImage;
253 *! Callback to send parameters needed in a power transition to the trusted
256 PFN_TD_SET_POWER_PARAMS pfnTDSetPowerParams;
258 /*! Callbacks to ping the trusted device to securely run RGXStart/Stop() */
259 PFN_TD_RGXSTART pfnTDRGXStart;
260 PFN_TD_RGXSTOP pfnTDRGXStop;
262 /*! Callback to request allocation/freeing of secure buffers */
263 PFN_TD_SECUREBUF_ALLOC pfnTDSecureBufAlloc;
264 PFN_TD_SECUREBUF_FREE pfnTDSecureBufFree;
265 #endif /* defined(SUPPORT_TRUSTED_DEVICE) */
267 /*! Function that does device feature specific system layer initialisation */
268 PFN_SYS_DEV_FEAT_DEP_INIT pfnSysDevFeatureDepInit;
270 #if defined(PVR_DVFS) || defined(SUPPORT_PDVFS)
275 #endif /* __PVRSRV_DEVICE_H__*/