2 This file defines performance-related definitions, including the format of:
3 * performance GUID HOB.
4 * performance protocol interfaces.
5 * performance variables.
7 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
12 #ifndef __PERFORMANCE_DATA_H__
13 #define __PERFORMANCE_DATA_H__
15 #define PERFORMANCE_PROPERTY_REVISION 0x1
21 UINT64 TimerStartValue
;
23 } PERFORMANCE_PROPERTY
;
26 // PEI_PERFORMANCE_STRING_SIZE must be a multiple of 8.
28 #define PEI_PERFORMANCE_STRING_SIZE 8
29 #define PEI_PERFORMANCE_STRING_LENGTH (PEI_PERFORMANCE_STRING_SIZE - 1)
32 EFI_PHYSICAL_ADDRESS Handle
;
33 CHAR8 Token
[PEI_PERFORMANCE_STRING_SIZE
]; ///< Measured token string name.
34 CHAR8 Module
[PEI_PERFORMANCE_STRING_SIZE
]; ///< Module string name.
35 UINT64 StartTimeStamp
; ///< Start time point.
36 UINT64 EndTimeStamp
; ///< End time point.
37 } PEI_PERFORMANCE_LOG_ENTRY
;
40 // The header must be aligned at 8 bytes.
43 UINT32 NumberOfEntries
; ///< The number of all performance log entries.
45 } PEI_PERFORMANCE_LOG_HEADER
;
48 #define PERFORMANCE_PROTOCOL_GUID \
49 { 0x76b6bdfa, 0x2acd, 0x4462, { 0x9E, 0x3F, 0xcb, 0x58, 0xC9, 0x69, 0xd9, 0x37 } }
51 #define PERFORMANCE_EX_PROTOCOL_GUID \
52 { 0x1ea81bec, 0xf01a, 0x4d98, { 0xa2, 0x1, 0x4a, 0x61, 0xce, 0x2f, 0xc0, 0x22 } }
55 // Forward reference for pure ANSI compatibility
57 typedef struct _PERFORMANCE_PROTOCOL PERFORMANCE_PROTOCOL
;
58 typedef struct _PERFORMANCE_EX_PROTOCOL PERFORMANCE_EX_PROTOCOL
;
61 // DXE_PERFORMANCE_STRING_SIZE must be a multiple of 8.
63 #define DXE_PERFORMANCE_STRING_SIZE 32
64 #define DXE_PERFORMANCE_STRING_LENGTH (DXE_PERFORMANCE_STRING_SIZE - 1)
67 // The default guage entries number for DXE phase.
69 #define INIT_DXE_GAUGE_DATA_ENTRIES 800
72 EFI_PHYSICAL_ADDRESS Handle
;
73 CHAR8 Token
[DXE_PERFORMANCE_STRING_SIZE
]; ///< Measured token string name.
74 CHAR8 Module
[DXE_PERFORMANCE_STRING_SIZE
]; ///< Module string name.
75 UINT64 StartTimeStamp
; ///< Start time point.
76 UINT64 EndTimeStamp
; ///< End time point.
80 EFI_PHYSICAL_ADDRESS Handle
;
81 CHAR8 Token
[DXE_PERFORMANCE_STRING_SIZE
]; ///< Measured token string name.
82 CHAR8 Module
[DXE_PERFORMANCE_STRING_SIZE
]; ///< Module string name.
83 UINT64 StartTimeStamp
; ///< Start time point.
84 UINT64 EndTimeStamp
; ///< End time point.
85 UINT32 Identifier
; ///< Identifier.
86 } GAUGE_DATA_ENTRY_EX
;
89 // The header must be aligned at 8 bytes
92 UINT32 NumberOfEntries
; ///< The number of all performance gauge entries.
97 // SMM Performance Protocol definitions
100 #define SMM_PERFORMANCE_PROTOCOL_GUID \
101 { 0xf866226a, 0xeaa5, 0x4f5a, { 0xa9, 0xa, 0x6c, 0xfb, 0xa5, 0x7c, 0x58, 0x8e } }
103 #define SMM_PERFORMANCE_EX_PROTOCOL_GUID \
104 { 0x931fc048, 0xc71d, 0x4455, { 0x89, 0x30, 0x47, 0x6, 0x30, 0xe3, 0xe, 0xe5 } }
107 // SMM_PERFORMANCE_STRING_SIZE.
109 #define SMM_PERFORMANCE_STRING_SIZE 32
110 #define SMM_PERFORMANCE_STRING_LENGTH (SMM_PERFORMANCE_STRING_SIZE - 1)
113 // The default guage entries number for SMM phase.
115 #define INIT_SMM_GAUGE_DATA_ENTRIES 200
119 EFI_STATUS ReturnStatus
;
120 UINTN NumberOfEntries
;
122 GAUGE_DATA_ENTRY
*GaugeData
;
123 } SMM_PERF_COMMUNICATE
;
127 EFI_STATUS ReturnStatus
;
128 UINTN NumberOfEntries
;
130 GAUGE_DATA_ENTRY_EX
*GaugeDataEx
;
131 } SMM_PERF_COMMUNICATE_EX
;
133 #define SMM_PERF_FUNCTION_GET_GAUGE_ENTRY_NUMBER 1
134 #define SMM_PERF_FUNCTION_GET_GAUGE_DATA 2
137 Adds a record at the end of the performance measurement log
138 that records the start time of a performance measurement.
140 The added record contains the Handle, Token, and Module.
141 The end time of the new record is not recorded, so it is set to zero.
142 If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.
143 If TimeStamp is zero, the start time in the record is filled in with the value
144 read from the current time stamp.
146 @param Handle The pointer to environment specific context used
147 to identify the component being measured.
148 @param Token The pointer to a Null-terminated ASCII string
149 that identifies the component being measured.
150 @param Module The pointer to a Null-terminated ASCII string
151 that identifies the module being measured.
152 @param TimeStamp The 64-bit time stamp.
154 @retval EFI_SUCCESS The data was read correctly from the device.
155 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.
160 (EFIAPI
* PERFORMANCE_START_GAUGE
)(
161 IN CONST VOID
*Handle
, OPTIONAL
162 IN CONST CHAR8
*Token
, OPTIONAL
163 IN CONST CHAR8
*Module
, OPTIONAL
168 Searches the performance measurement log from the beginning of the log
169 for the first matching record that contains a zero end time and fills in a valid end time.
171 Searches the performance measurement log from the beginning of the log
172 for the first record that matches Handle, Token, and Module, and has an end time value of zero.
173 If the record can not be found then return EFI_NOT_FOUND.
174 If the record is found and TimeStamp is not zero,
175 then the end time in the record is filled in with the value specified by TimeStamp.
176 If the record is found and TimeStamp is zero, then the end time in the matching record
177 is filled in with the current time stamp value.
179 @param Handle The pointer to environment specific context used
180 to identify the component being measured.
181 @param Token The pointer to a Null-terminated ASCII string
182 that identifies the component being measured.
183 @param Module The pointer to a Null-terminated ASCII string
184 that identifies the module being measured.
185 @param TimeStamp The 64-bit time stamp.
187 @retval EFI_SUCCESS The end of the measurement was recorded.
188 @retval EFI_NOT_FOUND The specified measurement record could not be found.
193 (EFIAPI
* PERFORMANCE_END_GAUGE
)(
194 IN CONST VOID
*Handle
, OPTIONAL
195 IN CONST CHAR8
*Token
, OPTIONAL
196 IN CONST CHAR8
*Module
, OPTIONAL
201 Retrieves a previously logged performance measurement.
202 It can also retrieve the log created by StartGaugeEx and EndGaugeEx of PERFORMANCE_EX_PROTOCOL,
203 and then eliminate the Identifier.
205 Retrieves the performance log entry from the performance log specified by LogEntryKey.
206 If it stands for a valid entry, then EFI_SUCCESS is returned and
207 GaugeDataEntry stores the pointer to that entry.
209 @param LogEntryKey The key for the previous performance measurement log entry.
210 If 0, then the first performance measurement log entry is retrieved.
211 @param GaugeDataEntry Out parameter for the indirect pointer to the gauge data entry specified by LogEntryKey.
213 @retval EFI_SUCCESS The GuageDataEntry is successfully found based on LogEntryKey.
214 @retval EFI_NOT_FOUND There is no entry after the measurement referred to by LogEntryKey.
215 @retval EFI_INVALID_PARAMETER The LogEntryKey is not a valid entry, or GaugeDataEntry is NULL.
220 (EFIAPI
* PERFORMANCE_GET_GAUGE
)(
221 IN UINTN LogEntryKey
,
222 OUT GAUGE_DATA_ENTRY
**GaugeDataEntry
226 Adds a record at the end of the performance measurement log
227 that records the start time of a performance measurement.
229 The added record contains the Handle, Token, Module and Identifier.
230 The end time of the new record is not recorded, so it is set to zero.
231 If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.
232 If TimeStamp is zero, the start time in the record is filled in with the value
233 read from the current time stamp.
235 @param Handle The pointer to environment specific context used
236 to identify the component being measured.
237 @param Token The pointer to a Null-terminated ASCII string
238 that identifies the component being measured.
239 @param Module The pointer to a Null-terminated ASCII string
240 that identifies the module being measured.
241 @param TimeStamp The 64-bit time stamp.
242 @param Identifier 32-bit identifier. If the value is 0, the created record
243 is same as the one created by StartGauge of PERFORMANCE_PROTOCOL.
245 @retval EFI_SUCCESS The data was read correctly from the device.
246 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.
251 (EFIAPI
* PERFORMANCE_START_GAUGE_EX
)(
252 IN CONST VOID
*Handle
, OPTIONAL
253 IN CONST CHAR8
*Token
, OPTIONAL
254 IN CONST CHAR8
*Module
, OPTIONAL
260 Searches the performance measurement log from the beginning of the log
261 for the first matching record that contains a zero end time and fills in a valid end time.
263 Searches the performance measurement log from the beginning of the log
264 for the first record that matches Handle, Token, Module and Identifier, and has an end time value of zero.
265 If the record can not be found then return EFI_NOT_FOUND.
266 If the record is found and TimeStamp is not zero,
267 then the end time in the record is filled in with the value specified by TimeStamp.
268 If the record is found and TimeStamp is zero, then the end time in the matching record
269 is filled in with the current time stamp value.
271 @param Handle The pointer to environment specific context used
272 to identify the component being measured.
273 @param Token The pointer to a Null-terminated ASCII string
274 that identifies the component being measured.
275 @param Module The pointer to a Null-terminated ASCII string
276 that identifies the module being measured.
277 @param TimeStamp The 64-bit time stamp.
278 @param Identifier 32-bit identifier. If the value is 0, the found record
279 is same as the one found by EndGauge of PERFORMANCE_PROTOCOL.
281 @retval EFI_SUCCESS The end of the measurement was recorded.
282 @retval EFI_NOT_FOUND The specified measurement record could not be found.
287 (EFIAPI
* PERFORMANCE_END_GAUGE_EX
)(
288 IN CONST VOID
*Handle
, OPTIONAL
289 IN CONST CHAR8
*Token
, OPTIONAL
290 IN CONST CHAR8
*Module
, OPTIONAL
296 Retrieves a previously logged performance measurement.
297 It can also retrieve the log created by StartGauge and EndGauge of PERFORMANCE_PROTOCOL,
298 and then assign the Identifier with 0.
300 Retrieves the performance log entry from the performance log specified by LogEntryKey.
301 If it stands for a valid entry, then EFI_SUCCESS is returned and
302 GaugeDataEntryEx stores the pointer to that entry.
304 @param LogEntryKey The key for the previous performance measurement log entry.
305 If 0, then the first performance measurement log entry is retrieved.
306 @param GaugeDataEntryEx Out parameter for the indirect pointer to the extented gauge data entry specified by LogEntryKey.
308 @retval EFI_SUCCESS The GuageDataEntryEx is successfully found based on LogEntryKey.
309 @retval EFI_NOT_FOUND There is no entry after the measurement referred to by LogEntryKey.
310 @retval EFI_INVALID_PARAMETER The LogEntryKey is not a valid entry, or GaugeDataEntryEx is NULL.
315 (EFIAPI
* PERFORMANCE_GET_GAUGE_EX
)(
316 IN UINTN LogEntryKey
,
317 OUT GAUGE_DATA_ENTRY_EX
**GaugeDataEntryEx
320 struct _PERFORMANCE_PROTOCOL
{
321 PERFORMANCE_START_GAUGE StartGauge
;
322 PERFORMANCE_END_GAUGE EndGauge
;
323 PERFORMANCE_GET_GAUGE GetGauge
;
326 struct _PERFORMANCE_EX_PROTOCOL
{
327 PERFORMANCE_START_GAUGE_EX StartGaugeEx
;
328 PERFORMANCE_END_GAUGE_EX EndGaugeEx
;
329 PERFORMANCE_GET_GAUGE_EX GetGaugeEx
;
332 extern EFI_GUID gPerformanceProtocolGuid
;
333 extern EFI_GUID gSmmPerformanceProtocolGuid
;
334 extern EFI_GUID gPerformanceExProtocolGuid
;
335 extern EFI_GUID gSmmPerformanceExProtocolGuid
;