1 /**************************************************************************/ /*!
3 @Title pdump functions to assist with physmem allocations
4 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description Implements basic low level control of MMU.
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 #ifndef SRVSRV_PDUMP_PHYSMEM_H
45 #define SRVSRV_PDUMP_PHYSMEM_H
47 #include "img_types.h"
48 #include "pvrsrv_error.h"
52 typedef struct _PDUMP_PHYSMEM_INFO_T_ PDUMP_PHYSMEM_INFO_T;
56 PDumpPMRMalloc(const IMG_CHAR *pszDevSpace,
57 const IMG_CHAR *pszSymbolicAddress,
59 /* alignment is alignment of start of buffer _and_
60 minimum contiguity - i.e. smallest allowable
62 IMG_DEVMEM_ALIGN_T uiAlign,
63 IMG_BOOL bForcePersistent,
64 IMG_HANDLE *phHandlePtr);
67 PDumpPMRMallocPMR(const PMR *psPMR,
68 IMG_DEVMEM_SIZE_T uiSize,
69 IMG_DEVMEM_ALIGN_T uiBlockSize,
70 IMG_BOOL bForcePersistent,
71 IMG_HANDLE *phPDumpAllocInfoPtr);
74 PVRSRV_ERROR PDumpPMRFree(IMG_HANDLE hPDumpAllocationInfoHandle);
77 #ifdef INLINE_IS_PRAGMA
78 #pragma inline(PVRSRVSyncPrimPDumpPolKM)
80 static INLINE PVRSRV_ERROR
81 PDumpPMRMalloc(const IMG_CHAR *pszDevSpace,
82 const IMG_CHAR *pszSymbolicAddress,
84 IMG_DEVMEM_ALIGN_T uiAlign,
85 IMG_BOOL bForcePersistent,
86 IMG_HANDLE *phHandlePtr)
88 PVR_UNREFERENCED_PARAMETER(pszDevSpace);
89 PVR_UNREFERENCED_PARAMETER(pszSymbolicAddress);
90 PVR_UNREFERENCED_PARAMETER(ui64Size);
91 PVR_UNREFERENCED_PARAMETER(uiAlign);
92 PVR_UNREFERENCED_PARAMETER(bForcePersistent);
93 PVR_UNREFERENCED_PARAMETER(phHandlePtr);
94 PVR_UNREFERENCED_PARAMETER(bForcePersistent);
98 static INLINE IMG_VOID
99 PDumpPMRMallocPMR(const PMR *psPMR,
100 IMG_DEVMEM_SIZE_T uiSize,
101 IMG_DEVMEM_ALIGN_T uiBlockSize,
102 IMG_BOOL bForcePersistent,
103 IMG_HANDLE *phPDumpAllocInfoPtr)
105 PVR_UNREFERENCED_PARAMETER(psPMR);
106 PVR_UNREFERENCED_PARAMETER(uiSize);
107 PVR_UNREFERENCED_PARAMETER(uiBlockSize);
108 PVR_UNREFERENCED_PARAMETER(bForcePersistent);
109 PVR_UNREFERENCED_PARAMETER(phPDumpAllocInfoPtr);
112 #ifdef INLINE_IS_PRAGMA
113 #pragma inline(PVRSRVSyncPrimPDumpPolKM)
115 static INLINE PVRSRV_ERROR
116 PDumpPMRFree(IMG_HANDLE hPDumpAllocationInfoHandle)
118 PVR_UNREFERENCED_PARAMETER(hPDumpAllocationInfoHandle);
123 #define PMR_DEFAULT_PREFIX "PMR"
124 #define PMR_SYMBOLICADDR_FMTSPEC "%s%llu"
127 #define PDUMP_PHYSMEM_MALLOC_OSPAGES(pszPDumpMemDevName, ui32SerialNum, ui32Size, ui32Align, phHandlePtr) \
128 PDumpPMRMalloc(pszPDumpMemDevName, PMR_OSALLOCPAGES_PREFIX, ui32SerialNum, ui32Size, ui32Align, phHandlePtr)
129 #define PDUMP_PHYSMEM_FREE_OSPAGES(hHandle) \
130 PDumpPMRFree(hHandle)
132 #define PDUMP_PHYSMEM_MALLOC_OSPAGES(pszPDumpMemDevName, ui32SerialNum, ui32Size, ui32Align, phHandlePtr) \
133 ((IMG_VOID)(*phHandlePtr=IMG_NULL))
134 #define PDUMP_PHYSMEM_FREE_OSPAGES(hHandle) \
136 #endif // defined(PDUMP)
139 PDumpPMRWRW32(const IMG_CHAR *pszDevSpace,
140 const IMG_CHAR *pszSymbolicName,
141 IMG_DEVMEM_OFFSET_T uiOffset,
142 IMG_UINT32 ui32Value,
143 PDUMP_FLAGS_T uiPDumpFlags);
146 PDumpPMRWRW64(const IMG_CHAR *pszDevSpace,
147 const IMG_CHAR *pszSymbolicName,
148 IMG_DEVMEM_OFFSET_T uiOffset,
149 IMG_UINT64 ui64Value,
150 PDUMP_FLAGS_T uiPDumpFlags);
153 PDumpPMRLDB(const IMG_CHAR *pszDevSpace,
154 const IMG_CHAR *pszSymbolicName,
155 IMG_DEVMEM_OFFSET_T uiOffset,
156 IMG_DEVMEM_SIZE_T uiSize,
157 const IMG_CHAR *pszFilename,
158 IMG_UINT32 uiFileOffset,
159 PDUMP_FLAGS_T uiPDumpFlags);
162 PDumpPMRSAB(const IMG_CHAR *pszDevSpace,
163 const IMG_CHAR *pszSymbolicName,
164 IMG_DEVMEM_OFFSET_T uiOffset,
165 IMG_DEVMEM_SIZE_T uiSize,
166 const IMG_CHAR *pszFileName,
167 IMG_UINT32 uiFileOffset);
172 emits a POL to the PDUMP.
175 PDumpPMRPOL(const IMG_CHAR *pszMempaceName,
176 const IMG_CHAR *pszSymbolicName,
177 IMG_DEVMEM_OFFSET_T uiOffset,
178 IMG_UINT32 ui32Value,
180 PDUMP_POLL_OPERATOR eOperator,
183 PDUMP_FLAGS_T uiPDumpFlags);
186 PDumpPMRCBP(const IMG_CHAR *pszMemspaceName,
187 const IMG_CHAR *pszSymbolicName,
188 IMG_DEVMEM_OFFSET_T uiReadOffset,
189 IMG_DEVMEM_OFFSET_T uiWriteOffset,
190 IMG_DEVMEM_SIZE_T uiPacketSize,
191 IMG_DEVMEM_SIZE_T uiBufferSize);
196 * writes a binary blob to the pdump param stream containing the
197 * current contents of the memory, and returns the filename and offset
198 * of where that blob is located (for use in a subsequent LDB, for
201 * Caller to provide buffer to receive filename, and declare the size
205 PDumpWriteBuffer(IMG_UINT8 *pcBuffer,
206 IMG_SIZE_T uiNumBytes,
207 PDUMP_FLAGS_T uiPDumpFlags,
208 IMG_CHAR *pszFilenameOut,
209 IMG_SIZE_T uiFilenameBufSz,
210 PDUMP_FILEOFFSET_T *puiOffsetOut);
212 #endif /* #ifndef SRVSRV_PDUMP_PHYSMEM_H */