1 /*************************************************************************/ /*!
3 @Title Host Trace Buffer server implementation.
4 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
6 @Description Host Trace Buffer provides a mechanism to log Host events to a
7 buffer in a similar way to the Firmware Trace mechanism.
8 Host Trace Buffer logs data using a Transport Layer buffer.
9 The Transport Layer and pvrtld tool provides the mechanism to
10 retrieve the trace data.
12 A Host Trace can be merged with a corresponding Firmware Trace.
13 This is achieved by inserting synchronisation data into both
14 traces and post processing to merge them.
16 The FW Trace will contain a "Sync Partition Marker". This is
17 updated every time the RGX is brought out of reset (RGX clock
18 timestamps reset at this point) and is repeated when the FW
19 Trace buffer wraps to ensure there is always at least 1
20 partition marker in the Firmware Trace buffer whenever it is
23 The Host Trace will contain corresponding "Sync Partition
24 Markers" - #HTBSyncPartitionMarker(). Each partition is then
25 subdivided into "Sync Scale" sections - #HTBSyncScale(). The
26 "Sync Scale" data allows the timestamps from the two traces to
27 be correlated. The "Sync Scale" data is updated as part of the
28 standard RGX time correlation code (rgxtimecorr.c) and is
29 updated periodically including on power and clock changes.
31 @License Dual MIT/GPLv2
33 The contents of this file are subject to the MIT license as set out below.
35 Permission is hereby granted, free of charge, to any person obtaining a copy
36 of this software and associated documentation files (the "Software"), to deal
37 in the Software without restriction, including without limitation the rights
38 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
39 copies of the Software, and to permit persons to whom the Software is
40 furnished to do so, subject to the following conditions:
42 The above copyright notice and this permission notice shall be included in
43 all copies or substantial portions of the Software.
45 Alternatively, the contents of this file may be used under the terms of
46 the GNU General Public License Version 2 ("GPL") in which case the provisions
47 of GPL are applicable instead of those above.
49 If you wish to allow use of your version of this file only under the terms of
50 GPL, and not to allow others to use your version of this file under the terms
51 of the MIT license, indicate your decision by deleting the provisions above
52 and replace them with the notice and other provisions required by GPL as set
53 out in the file called "GPL-COPYING" included in this distribution. If you do
54 not delete the provisions above, a recipient may use your version of this file
55 under the terms of either the MIT license or GPL.
57 This License is also included in this distribution in the file called
60 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
61 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
62 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
63 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
64 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
65 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
66 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
67 */ /**************************************************************************/
69 #ifndef __HTBSERVER_H__
70 #define __HTBSERVER_H__
72 #include "img_types.h"
73 #include "pvrsrv_error.h"
78 /************************************************************************/ /*!
79 @Function HTBIDeviceCreate
80 @Description Initialisation actions for HTB at device creation.
82 @Input psDeviceNode Reference to the device node in context
84 @Return eError Internal services call returned eError error
86 */ /**************************************************************************/
89 PVRSRV_DEVICE_NODE *psDeviceNode
93 /************************************************************************/ /*!
94 @Function HTBIDeviceDestroy
95 @Description De-initialisation actions for HTB at device destruction.
97 @Input psDeviceNode Reference to the device node in context
99 */ /**************************************************************************/
102 PVRSRV_DEVICE_NODE *psDeviceNode
106 /************************************************************************/ /*!
108 @Description Close the Host Trace Buffer and free all resources
110 @Return eError Internal services call returned eError error
112 */ /**************************************************************************/
117 /*************************************************************************/ /*!
118 @Function HTBConfigureKM
119 @Description Configure or update the configuration of the Host Trace Buffer
121 @Input ui32NameSize Size of the pszName string
123 @Input pszName Name to use for the underlying data buffer
125 @Input ui32BufferSize Size of the underlying data buffer
127 @Return eError Internal services call returned eError error
129 */ /**************************************************************************/
132 IMG_UINT32 ui32NameSize,
133 const IMG_CHAR * pszName,
134 const IMG_UINT32 ui32BufferSize
138 /*************************************************************************/ /*!
139 @Function HTBControlKM
140 @Description Update the configuration of the Host Trace Buffer
142 @Input ui32NumFlagGroups Number of group enable flags words
144 @Input aui32GroupEnable Flags words controlling groups to be logged
146 @Input ui32LogLevel Log level to record
148 @Input ui32EnablePID PID to enable logging for a specific process
150 @Input eLogMode Enable logging for all or specific processes,
152 @Input eOpMode Control the behaviour of the data buffer
154 @Return eError Internal services call returned eError error
156 */ /**************************************************************************/
159 const IMG_UINT32 ui32NumFlagGroups,
160 const IMG_UINT32 * aui32GroupEnable,
161 const IMG_UINT32 ui32LogLevel,
162 const IMG_UINT32 ui32EnablePID,
163 const HTB_LOGMODE_CTRL eLogMode,
164 const HTB_OPMODE_CTRL eOpMode
168 /*************************************************************************/ /*!
169 @Function HTBSyncPartitionMarker
170 @Description Write an HTB sync partition marker to the HTB log
172 @Input ui33Marker Marker value
174 */ /**************************************************************************/
176 HTBSyncPartitionMarker(
177 const IMG_UINT32 ui32Marker
181 /*************************************************************************/ /*!
182 @Function HTBSyncScale
183 @Description Write FW-Host synchronisation data to the HTB log when clocks
184 change or are re-calibrated
186 @Input bLogValues IMG_TRUE if value should be immediately written
189 @Input ui32OSTS OS Timestamp
191 @Input ui32CRTS Rogue timestamp
193 @Input ui32CalcClkSpd Calculated clock speed
195 */ /**************************************************************************/
198 const IMG_BOOL bLogValues,
199 const IMG_UINT64 ui64OSTS,
200 const IMG_UINT64 ui64CRTS,
201 const IMG_UINT32 ui32CalcClkSpd
205 /*************************************************************************/ /*!
207 @Description Record a Host Trace Buffer log event
209 @Input PID The PID of the process the event is associated
210 with. This is provided as an argument rather
211 than querying internally so that events associated
212 with a particular process, but performed by
213 another can be logged correctly.
215 @Input ui32TimeStamp The timestamp to be associated with this log event
217 @Input SF The log event ID
219 @Input ... Log parameters
221 @Return PVRSRV_OK Success.
223 */ /**************************************************************************/
227 IMG_UINT32 ui32TimeStamp,
229 IMG_UINT32 ui32NumArgs,
230 IMG_UINT32 * aui32Args
234 #endif /* __HTBSERVER_H__ */