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
;
47 #define PERFORMANCE_PROTOCOL_GUID \
48 { 0x76b6bdfa, 0x2acd, 0x4462, { 0x9E, 0x3F, 0xcb, 0x58, 0xC9, 0x69, 0xd9, 0x37 } }
50 #define PERFORMANCE_EX_PROTOCOL_GUID \
51 { 0x1ea81bec, 0xf01a, 0x4d98, { 0xa2, 0x1, 0x4a, 0x61, 0xce, 0x2f, 0xc0, 0x22 } }
54 // Forward reference for pure ANSI compatibility
56 typedef struct _PERFORMANCE_PROTOCOL PERFORMANCE_PROTOCOL
;
57 typedef struct _PERFORMANCE_EX_PROTOCOL PERFORMANCE_EX_PROTOCOL
;
60 // DXE_PERFORMANCE_STRING_SIZE must be a multiple of 8.
62 #define DXE_PERFORMANCE_STRING_SIZE 32
63 #define DXE_PERFORMANCE_STRING_LENGTH (DXE_PERFORMANCE_STRING_SIZE - 1)
66 // The default guage entries number for DXE phase.
68 #define INIT_DXE_GAUGE_DATA_ENTRIES 800
71 EFI_PHYSICAL_ADDRESS Handle
;
72 CHAR8 Token
[DXE_PERFORMANCE_STRING_SIZE
]; ///< Measured token string name.
73 CHAR8 Module
[DXE_PERFORMANCE_STRING_SIZE
]; ///< Module string name.
74 UINT64 StartTimeStamp
; ///< Start time point.
75 UINT64 EndTimeStamp
; ///< End time point.
79 EFI_PHYSICAL_ADDRESS Handle
;
80 CHAR8 Token
[DXE_PERFORMANCE_STRING_SIZE
]; ///< Measured token string name.
81 CHAR8 Module
[DXE_PERFORMANCE_STRING_SIZE
]; ///< Module string name.
82 UINT64 StartTimeStamp
; ///< Start time point.
83 UINT64 EndTimeStamp
; ///< End time point.
84 UINT32 Identifier
; ///< Identifier.
85 } GAUGE_DATA_ENTRY_EX
;
88 // The header must be aligned at 8 bytes
91 UINT32 NumberOfEntries
; ///< The number of all performance gauge entries.
96 // SMM Performance Protocol definitions
99 #define SMM_PERFORMANCE_PROTOCOL_GUID \
100 { 0xf866226a, 0xeaa5, 0x4f5a, { 0xa9, 0xa, 0x6c, 0xfb, 0xa5, 0x7c, 0x58, 0x8e } }
102 #define SMM_PERFORMANCE_EX_PROTOCOL_GUID \
103 { 0x931fc048, 0xc71d, 0x4455, { 0x89, 0x30, 0x47, 0x6, 0x30, 0xe3, 0xe, 0xe5 } }
106 // SMM_PERFORMANCE_STRING_SIZE.
108 #define SMM_PERFORMANCE_STRING_SIZE 32
109 #define SMM_PERFORMANCE_STRING_LENGTH (SMM_PERFORMANCE_STRING_SIZE - 1)
112 // The default guage entries number for SMM phase.
114 #define INIT_SMM_GAUGE_DATA_ENTRIES 200
118 EFI_STATUS ReturnStatus
;
119 UINTN NumberOfEntries
;
121 GAUGE_DATA_ENTRY
*GaugeData
;
122 } SMM_PERF_COMMUNICATE
;
126 EFI_STATUS ReturnStatus
;
127 UINTN NumberOfEntries
;
129 GAUGE_DATA_ENTRY_EX
*GaugeDataEx
;
130 } SMM_PERF_COMMUNICATE_EX
;
132 #define SMM_PERF_FUNCTION_GET_GAUGE_ENTRY_NUMBER 1
133 #define SMM_PERF_FUNCTION_GET_GAUGE_DATA 2
136 Adds a record at the end of the performance measurement log
137 that records the start time of a performance measurement.
139 The added record contains the Handle, Token, and Module.
140 The end time of the new record is not recorded, so it is set to zero.
141 If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.
142 If TimeStamp is zero, the start time in the record is filled in with the value
143 read from the current time stamp.
145 @param Handle The pointer to environment specific context used
146 to identify the component being measured.
147 @param Token The pointer to a Null-terminated ASCII string
148 that identifies the component being measured.
149 @param Module The pointer to a Null-terminated ASCII string
150 that identifies the module being measured.
151 @param TimeStamp The 64-bit time stamp.
153 @retval EFI_SUCCESS The data was read correctly from the device.
154 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.
159 (EFIAPI
*PERFORMANCE_START_GAUGE
)(
160 IN CONST VOID
*Handle OPTIONAL
,
161 IN CONST CHAR8
*Token OPTIONAL
,
162 IN CONST CHAR8
*Module OPTIONAL
,
167 Searches the performance measurement log from the beginning of the log
168 for the first matching record that contains a zero end time and fills in a valid end time.
170 Searches the performance measurement log from the beginning of the log
171 for the first record that matches Handle, Token, and Module, and has an end time value of zero.
172 If the record can not be found then return EFI_NOT_FOUND.
173 If the record is found and TimeStamp is not zero,
174 then the end time in the record is filled in with the value specified by TimeStamp.
175 If the record is found and TimeStamp is zero, then the end time in the matching record
176 is filled in with the current time stamp value.
178 @param Handle The pointer to environment specific context used
179 to identify the component being measured.
180 @param Token The pointer to a Null-terminated ASCII string
181 that identifies the component being measured.
182 @param Module The pointer to a Null-terminated ASCII string
183 that identifies the module being measured.
184 @param TimeStamp The 64-bit time stamp.
186 @retval EFI_SUCCESS The end of the measurement was recorded.
187 @retval EFI_NOT_FOUND The specified measurement record could not be found.
192 (EFIAPI
*PERFORMANCE_END_GAUGE
)(
193 IN CONST VOID
*Handle OPTIONAL
,
194 IN CONST CHAR8
*Token OPTIONAL
,
195 IN CONST CHAR8
*Module OPTIONAL
,
200 Retrieves a previously logged performance measurement.
201 It can also retrieve the log created by StartGaugeEx and EndGaugeEx of PERFORMANCE_EX_PROTOCOL,
202 and then eliminate the Identifier.
204 Retrieves the performance log entry from the performance log specified by LogEntryKey.
205 If it stands for a valid entry, then EFI_SUCCESS is returned and
206 GaugeDataEntry stores the pointer to that entry.
208 @param LogEntryKey The key for the previous performance measurement log entry.
209 If 0, then the first performance measurement log entry is retrieved.
210 @param GaugeDataEntry Out parameter for the indirect pointer to the gauge data entry specified by LogEntryKey.
212 @retval EFI_SUCCESS The GuageDataEntry is successfully found based on LogEntryKey.
213 @retval EFI_NOT_FOUND There is no entry after the measurement referred to by LogEntryKey.
214 @retval EFI_INVALID_PARAMETER The LogEntryKey is not a valid entry, or GaugeDataEntry is NULL.
219 (EFIAPI
*PERFORMANCE_GET_GAUGE
)(
220 IN UINTN LogEntryKey
,
221 OUT GAUGE_DATA_ENTRY
**GaugeDataEntry
225 Adds a record at the end of the performance measurement log
226 that records the start time of a performance measurement.
228 The added record contains the Handle, Token, Module and Identifier.
229 The end time of the new record is not recorded, so it is set to zero.
230 If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.
231 If TimeStamp is zero, the start time in the record is filled in with the value
232 read from the current time stamp.
234 @param Handle The pointer to environment specific context used
235 to identify the component being measured.
236 @param Token The pointer to a Null-terminated ASCII string
237 that identifies the component being measured.
238 @param Module The pointer to a Null-terminated ASCII string
239 that identifies the module being measured.
240 @param TimeStamp The 64-bit time stamp.
241 @param Identifier 32-bit identifier. If the value is 0, the created record
242 is same as the one created by StartGauge of PERFORMANCE_PROTOCOL.
244 @retval EFI_SUCCESS The data was read correctly from the device.
245 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.
250 (EFIAPI
*PERFORMANCE_START_GAUGE_EX
)(
251 IN CONST VOID
*Handle OPTIONAL
,
252 IN CONST CHAR8
*Token OPTIONAL
,
253 IN CONST CHAR8
*Module OPTIONAL
,
259 Searches the performance measurement log from the beginning of the log
260 for the first matching record that contains a zero end time and fills in a valid end time.
262 Searches the performance measurement log from the beginning of the log
263 for the first record that matches Handle, Token, Module and Identifier, and has an end time value of zero.
264 If the record can not be found then return EFI_NOT_FOUND.
265 If the record is found and TimeStamp is not zero,
266 then the end time in the record is filled in with the value specified by TimeStamp.
267 If the record is found and TimeStamp is zero, then the end time in the matching record
268 is filled in with the current time stamp value.
270 @param Handle The pointer to environment specific context used
271 to identify the component being measured.
272 @param Token The pointer to a Null-terminated ASCII string
273 that identifies the component being measured.
274 @param Module The pointer to a Null-terminated ASCII string
275 that identifies the module being measured.
276 @param TimeStamp The 64-bit time stamp.
277 @param Identifier 32-bit identifier. If the value is 0, the found record
278 is same as the one found by EndGauge of PERFORMANCE_PROTOCOL.
280 @retval EFI_SUCCESS The end of the measurement was recorded.
281 @retval EFI_NOT_FOUND The specified measurement record could not be found.
286 (EFIAPI
*PERFORMANCE_END_GAUGE_EX
)(
287 IN CONST VOID
*Handle OPTIONAL
,
288 IN CONST CHAR8
*Token OPTIONAL
,
289 IN CONST CHAR8
*Module OPTIONAL
,
295 Retrieves a previously logged performance measurement.
296 It can also retrieve the log created by StartGauge and EndGauge of PERFORMANCE_PROTOCOL,
297 and then assign the Identifier with 0.
299 Retrieves the performance log entry from the performance log specified by LogEntryKey.
300 If it stands for a valid entry, then EFI_SUCCESS is returned and
301 GaugeDataEntryEx stores the pointer to that entry.
303 @param LogEntryKey The key for the previous performance measurement log entry.
304 If 0, then the first performance measurement log entry is retrieved.
305 @param GaugeDataEntryEx Out parameter for the indirect pointer to the extented gauge data entry specified by LogEntryKey.
307 @retval EFI_SUCCESS The GuageDataEntryEx is successfully found based on LogEntryKey.
308 @retval EFI_NOT_FOUND There is no entry after the measurement referred to by LogEntryKey.
309 @retval EFI_INVALID_PARAMETER The LogEntryKey is not a valid entry, or GaugeDataEntryEx is NULL.
314 (EFIAPI
*PERFORMANCE_GET_GAUGE_EX
)(
315 IN UINTN LogEntryKey
,
316 OUT GAUGE_DATA_ENTRY_EX
**GaugeDataEntryEx
319 struct _PERFORMANCE_PROTOCOL
{
320 PERFORMANCE_START_GAUGE StartGauge
;
321 PERFORMANCE_END_GAUGE EndGauge
;
322 PERFORMANCE_GET_GAUGE GetGauge
;
325 struct _PERFORMANCE_EX_PROTOCOL
{
326 PERFORMANCE_START_GAUGE_EX StartGaugeEx
;
327 PERFORMANCE_END_GAUGE_EX EndGaugeEx
;
328 PERFORMANCE_GET_GAUGE_EX GetGaugeEx
;
331 extern EFI_GUID gPerformanceProtocolGuid
;
332 extern EFI_GUID gSmmPerformanceProtocolGuid
;
333 extern EFI_GUID gPerformanceExProtocolGuid
;
334 extern EFI_GUID gSmmPerformanceExProtocolGuid
;