1 /*************************************************************************/ /*!
2 @File devicemem_history_server.h
3 @Title Resource Information abstraction
4 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description Devicemem History 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 #ifndef DEVICEMEM_HISTORY_SERVER_H
45 #define DEVICEMEM_HISTORY_SERVER_H
48 #include "pvrsrv_error.h"
50 #include "devicemem_utils.h"
51 #include "connection_server.h"
53 PVRSRV_ERROR DevicememHistoryInitKM(void);
55 void DevicememHistoryDeInitKM(void);
57 PVRSRV_ERROR DevicememHistoryMapKM(PMR *psPMR,
58 IMG_UINT32 ui32Offset,
59 IMG_DEV_VIRTADDR sDevVAddr,
60 IMG_DEVMEM_SIZE_T uiSize,
61 const char szName[DEVMEM_ANNOTATION_MAX_LEN],
62 IMG_UINT32 ui32PageSize,
63 IMG_UINT32 ui32AllocationIndex,
64 IMG_UINT32 *pui32AllocationIndexOut);
66 PVRSRV_ERROR DevicememHistoryUnmapKM(PMR *psPMR,
67 IMG_UINT32 ui32Offset,
68 IMG_DEV_VIRTADDR sDevVAddr,
69 IMG_DEVMEM_SIZE_T uiSize,
70 const char szName[DEVMEM_ANNOTATION_MAX_LEN],
71 IMG_UINT32 ui32PageSize,
72 IMG_UINT32 ui32AllocationIndex,
73 IMG_UINT32 *pui32AllocationIndexOut);
75 PVRSRV_ERROR DevicememHistoryMapVRangeKM(CONNECTION_DATA *psConnection,
76 PVRSRV_DEVICE_NODE *psDeviceNode,
77 IMG_DEV_VIRTADDR sBaseDevVAddr,
78 IMG_UINT32 ui32StartPage,
79 IMG_UINT32 ui32NumPages,
80 IMG_DEVMEM_SIZE_T uiAllocSize,
81 const IMG_CHAR szName[DEVMEM_ANNOTATION_MAX_LEN],
82 IMG_UINT32 ui32Log2PageSize,
83 IMG_UINT32 ui32AllocationIndex,
84 IMG_UINT32 *ui32AllocationIndexOut);
86 PVRSRV_ERROR DevicememHistoryUnmapVRangeKM(CONNECTION_DATA *psConnection,
87 PVRSRV_DEVICE_NODE *psDeviceNode,
88 IMG_DEV_VIRTADDR sBaseDevVAddr,
89 IMG_UINT32 ui32StartPage,
90 IMG_UINT32 ui32NumPages,
91 IMG_DEVMEM_SIZE_T uiAllocSize,
92 const IMG_CHAR szName[DEVMEM_ANNOTATION_MAX_LEN],
93 IMG_UINT32 ui32Log2PageSize,
94 IMG_UINT32 ui32AllocationIndex,
95 IMG_UINT32 *ui32AllocationIndexOut);
97 PVRSRV_ERROR DevicememHistorySparseChangeKM(PMR *psPMR,
98 IMG_UINT32 ui32Offset,
99 IMG_DEV_VIRTADDR sDevVAddr,
100 IMG_DEVMEM_SIZE_T uiSize,
101 const char szName[DEVMEM_ANNOTATION_MAX_LEN],
102 IMG_UINT32 ui32PageSize,
103 IMG_UINT32 ui32AllocPageCount,
104 IMG_UINT32 *paui32AllocPageIndices,
105 IMG_UINT32 ui32FreePageCount,
106 IMG_UINT32 *pauiFreePageIndices,
107 IMG_UINT32 AllocationIndex,
108 IMG_UINT32 *pui32AllocationIndexOut);
110 /* used when the PID does not matter */
111 #define DEVICEMEM_HISTORY_PID_ANY 0xFFFFFFFE
113 typedef struct _DEVICEMEM_HISTORY_QUERY_IN_
116 IMG_DEV_VIRTADDR sDevVAddr;
117 } DEVICEMEM_HISTORY_QUERY_IN;
119 /* Store up to 4 results for a lookup. In the case of the faulting page being
120 * re-mapped between the page fault occurring on HW and the page fault analysis
121 * being done, the second result entry will show the allocation being unmapped.
122 * A further 2 entries are added to cater for multiple buffers in the same page.
124 #define DEVICEMEM_HISTORY_QUERY_OUT_MAX_RESULTS 4
126 typedef struct _DEVICEMEM_HISTORY_QUERY_OUT_RESULT_
128 IMG_CHAR szString[DEVMEM_ANNOTATION_MAX_LEN];
129 IMG_DEV_VIRTADDR sBaseDevVAddr;
130 IMG_DEVMEM_SIZE_T uiSize;
136 /* info for sparse map/unmap operations (i.e. bRange=IMG_TRUE) */
137 IMG_UINT32 ui32StartPage;
138 IMG_UINT32 ui32PageCount;
139 IMG_DEV_VIRTADDR sMapStartAddr;
140 IMG_DEV_VIRTADDR sMapEndAddr;
141 RGXMEM_PROCESS_INFO sProcessInfo;
142 } DEVICEMEM_HISTORY_QUERY_OUT_RESULT;
144 typedef struct _DEVICEMEM_HISTORY_QUERY_OUT_
146 IMG_UINT32 ui32NumResults;
147 /* result 0 is the newest */
148 DEVICEMEM_HISTORY_QUERY_OUT_RESULT sResults[DEVICEMEM_HISTORY_QUERY_OUT_MAX_RESULTS];
149 } DEVICEMEM_HISTORY_QUERY_OUT;
152 DevicememHistoryQuery(DEVICEMEM_HISTORY_QUERY_IN *psQueryIn,
153 DEVICEMEM_HISTORY_QUERY_OUT *psQueryOut,
154 IMG_UINT32 ui32PageSizeBytes,
155 IMG_BOOL bMatchAnyAllocInPage);