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 - 2017, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials are licensed and made available under
9 the terms and conditions of the BSD License that accompanies this distribution.
10 The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php.
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #ifndef __PERFORMANCE_DATA_H__
19 #define __PERFORMANCE_DATA_H__
21 #define PERFORMANCE_PROPERTY_REVISION 0x1
27 UINT64 TimerStartValue
;
29 } PERFORMANCE_PROPERTY
;
32 // PEI_PERFORMANCE_STRING_SIZE must be a multiple of 8.
34 #define PEI_PERFORMANCE_STRING_SIZE 8
35 #define PEI_PERFORMANCE_STRING_LENGTH (PEI_PERFORMANCE_STRING_SIZE - 1)
38 EFI_PHYSICAL_ADDRESS Handle
;
39 CHAR8 Token
[PEI_PERFORMANCE_STRING_SIZE
]; ///< Measured token string name.
40 CHAR8 Module
[PEI_PERFORMANCE_STRING_SIZE
]; ///< Module string name.
41 UINT64 StartTimeStamp
; ///< Start time point.
42 UINT64 EndTimeStamp
; ///< End time point.
43 } PEI_PERFORMANCE_LOG_ENTRY
;
46 // The header must be aligned at 8 bytes.
49 UINT32 NumberOfEntries
; ///< The number of all performance log entries.
51 } PEI_PERFORMANCE_LOG_HEADER
;
55 // The data structure for performance data in ACPI memory.
57 #define PERFORMANCE_SIGNATURE SIGNATURE_32 ('P', 'e', 'r', 'f')
58 #define PERF_TOKEN_SIZE 28
59 #define PERF_TOKEN_LENGTH (PERF_TOKEN_SIZE - 1)
60 #define PERF_PEI_ENTRY_MAX_NUM 50
61 #define PERF_DATA_MAX_LENGTH 0x4000
64 CHAR8 Token
[PERF_TOKEN_SIZE
];
72 PERF_DATA S3Entry
[PERF_PEI_ENTRY_MAX_NUM
];
79 #define PERFORMANCE_PROTOCOL_GUID \
80 { 0x76b6bdfa, 0x2acd, 0x4462, { 0x9E, 0x3F, 0xcb, 0x58, 0xC9, 0x69, 0xd9, 0x37 } }
82 #define PERFORMANCE_EX_PROTOCOL_GUID \
83 { 0x1ea81bec, 0xf01a, 0x4d98, { 0xa2, 0x1, 0x4a, 0x61, 0xce, 0x2f, 0xc0, 0x22 } }
86 // Forward reference for pure ANSI compatibility
88 typedef struct _PERFORMANCE_PROTOCOL PERFORMANCE_PROTOCOL
;
89 typedef struct _PERFORMANCE_EX_PROTOCOL PERFORMANCE_EX_PROTOCOL
;
92 // DXE_PERFORMANCE_STRING_SIZE must be a multiple of 8.
94 #define DXE_PERFORMANCE_STRING_SIZE 32
95 #define DXE_PERFORMANCE_STRING_LENGTH (DXE_PERFORMANCE_STRING_SIZE - 1)
98 // The default guage entries number for DXE phase.
100 #define INIT_DXE_GAUGE_DATA_ENTRIES 800
103 EFI_PHYSICAL_ADDRESS Handle
;
104 CHAR8 Token
[DXE_PERFORMANCE_STRING_SIZE
]; ///< Measured token string name.
105 CHAR8 Module
[DXE_PERFORMANCE_STRING_SIZE
]; ///< Module string name.
106 UINT64 StartTimeStamp
; ///< Start time point.
107 UINT64 EndTimeStamp
; ///< End time point.
111 EFI_PHYSICAL_ADDRESS Handle
;
112 CHAR8 Token
[DXE_PERFORMANCE_STRING_SIZE
]; ///< Measured token string name.
113 CHAR8 Module
[DXE_PERFORMANCE_STRING_SIZE
]; ///< Module string name.
114 UINT64 StartTimeStamp
; ///< Start time point.
115 UINT64 EndTimeStamp
; ///< End time point.
116 UINT32 Identifier
; ///< Identifier.
117 } GAUGE_DATA_ENTRY_EX
;
120 // The header must be aligned at 8 bytes
123 UINT32 NumberOfEntries
; ///< The number of all performance gauge entries.
128 // SMM Performance Protocol definitions
131 #define SMM_PERFORMANCE_PROTOCOL_GUID \
132 { 0xf866226a, 0xeaa5, 0x4f5a, { 0xa9, 0xa, 0x6c, 0xfb, 0xa5, 0x7c, 0x58, 0x8e } }
134 #define SMM_PERFORMANCE_EX_PROTOCOL_GUID \
135 { 0x931fc048, 0xc71d, 0x4455, { 0x89, 0x30, 0x47, 0x6, 0x30, 0xe3, 0xe, 0xe5 } }
138 // SMM_PERFORMANCE_STRING_SIZE.
140 #define SMM_PERFORMANCE_STRING_SIZE 32
141 #define SMM_PERFORMANCE_STRING_LENGTH (SMM_PERFORMANCE_STRING_SIZE - 1)
144 // The default guage entries number for SMM phase.
146 #define INIT_SMM_GAUGE_DATA_ENTRIES 200
150 EFI_STATUS ReturnStatus
;
151 UINTN NumberOfEntries
;
153 GAUGE_DATA_ENTRY
*GaugeData
;
154 } SMM_PERF_COMMUNICATE
;
158 EFI_STATUS ReturnStatus
;
159 UINTN NumberOfEntries
;
161 GAUGE_DATA_ENTRY_EX
*GaugeDataEx
;
162 } SMM_PERF_COMMUNICATE_EX
;
164 #define SMM_PERF_FUNCTION_GET_GAUGE_ENTRY_NUMBER 1
165 #define SMM_PERF_FUNCTION_GET_GAUGE_DATA 2
168 Adds a record at the end of the performance measurement log
169 that records the start time of a performance measurement.
171 The added record contains the Handle, Token, and Module.
172 The end time of the new record is not recorded, so it is set to zero.
173 If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.
174 If TimeStamp is zero, the start time in the record is filled in with the value
175 read from the current time stamp.
177 @param Handle The pointer to environment specific context used
178 to identify the component being measured.
179 @param Token The pointer to a Null-terminated ASCII string
180 that identifies the component being measured.
181 @param Module The pointer to a Null-terminated ASCII string
182 that identifies the module being measured.
183 @param TimeStamp The 64-bit time stamp.
185 @retval EFI_SUCCESS The data was read correctly from the device.
186 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.
191 (EFIAPI
* PERFORMANCE_START_GAUGE
)(
192 IN CONST VOID
*Handle
, OPTIONAL
193 IN CONST CHAR8
*Token
, OPTIONAL
194 IN CONST CHAR8
*Module
, OPTIONAL
199 Searches the performance measurement log from the beginning of the log
200 for the first matching record that contains a zero end time and fills in a valid end time.
202 Searches the performance measurement log from the beginning of the log
203 for the first record that matches Handle, Token, and Module, and has an end time value of zero.
204 If the record can not be found then return EFI_NOT_FOUND.
205 If the record is found and TimeStamp is not zero,
206 then the end time in the record is filled in with the value specified by TimeStamp.
207 If the record is found and TimeStamp is zero, then the end time in the matching record
208 is filled in with the current time stamp value.
210 @param Handle The pointer to environment specific context used
211 to identify the component being measured.
212 @param Token The pointer to a Null-terminated ASCII string
213 that identifies the component being measured.
214 @param Module The pointer to a Null-terminated ASCII string
215 that identifies the module being measured.
216 @param TimeStamp The 64-bit time stamp.
218 @retval EFI_SUCCESS The end of the measurement was recorded.
219 @retval EFI_NOT_FOUND The specified measurement record could not be found.
224 (EFIAPI
* PERFORMANCE_END_GAUGE
)(
225 IN CONST VOID
*Handle
, OPTIONAL
226 IN CONST CHAR8
*Token
, OPTIONAL
227 IN CONST CHAR8
*Module
, OPTIONAL
232 Retrieves a previously logged performance measurement.
233 It can also retrieve the log created by StartGaugeEx and EndGaugeEx of PERFORMANCE_EX_PROTOCOL,
234 and then eliminate the Identifier.
236 Retrieves the performance log entry from the performance log specified by LogEntryKey.
237 If it stands for a valid entry, then EFI_SUCCESS is returned and
238 GaugeDataEntry stores the pointer to that entry.
240 @param LogEntryKey The key for the previous performance measurement log entry.
241 If 0, then the first performance measurement log entry is retrieved.
242 @param GaugeDataEntry Out parameter for the indirect pointer to the gauge data entry specified by LogEntryKey.
244 @retval EFI_SUCCESS The GuageDataEntry is successfully found based on LogEntryKey.
245 @retval EFI_NOT_FOUND There is no entry after the measurement referred to by LogEntryKey.
246 @retval EFI_INVALID_PARAMETER The LogEntryKey is not a valid entry, or GaugeDataEntry is NULL.
251 (EFIAPI
* PERFORMANCE_GET_GAUGE
)(
252 IN UINTN LogEntryKey
,
253 OUT GAUGE_DATA_ENTRY
**GaugeDataEntry
257 Adds a record at the end of the performance measurement log
258 that records the start time of a performance measurement.
260 The added record contains the Handle, Token, Module and Identifier.
261 The end time of the new record is not recorded, so it is set to zero.
262 If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.
263 If TimeStamp is zero, the start time in the record is filled in with the value
264 read from the current time stamp.
266 @param Handle The pointer to environment specific context used
267 to identify the component being measured.
268 @param Token The pointer to a Null-terminated ASCII string
269 that identifies the component being measured.
270 @param Module The pointer to a Null-terminated ASCII string
271 that identifies the module being measured.
272 @param TimeStamp The 64-bit time stamp.
273 @param Identifier 32-bit identifier. If the value is 0, the created record
274 is same as the one created by StartGauge of PERFORMANCE_PROTOCOL.
276 @retval EFI_SUCCESS The data was read correctly from the device.
277 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.
282 (EFIAPI
* PERFORMANCE_START_GAUGE_EX
)(
283 IN CONST VOID
*Handle
, OPTIONAL
284 IN CONST CHAR8
*Token
, OPTIONAL
285 IN CONST CHAR8
*Module
, OPTIONAL
291 Searches the performance measurement log from the beginning of the log
292 for the first matching record that contains a zero end time and fills in a valid end time.
294 Searches the performance measurement log from the beginning of the log
295 for the first record that matches Handle, Token, Module and Identifier, and has an end time value of zero.
296 If the record can not be found then return EFI_NOT_FOUND.
297 If the record is found and TimeStamp is not zero,
298 then the end time in the record is filled in with the value specified by TimeStamp.
299 If the record is found and TimeStamp is zero, then the end time in the matching record
300 is filled in with the current time stamp value.
302 @param Handle The pointer to environment specific context used
303 to identify the component being measured.
304 @param Token The pointer to a Null-terminated ASCII string
305 that identifies the component being measured.
306 @param Module The pointer to a Null-terminated ASCII string
307 that identifies the module being measured.
308 @param TimeStamp The 64-bit time stamp.
309 @param Identifier 32-bit identifier. If the value is 0, the found record
310 is same as the one found by EndGauge of PERFORMANCE_PROTOCOL.
312 @retval EFI_SUCCESS The end of the measurement was recorded.
313 @retval EFI_NOT_FOUND The specified measurement record could not be found.
318 (EFIAPI
* PERFORMANCE_END_GAUGE_EX
)(
319 IN CONST VOID
*Handle
, OPTIONAL
320 IN CONST CHAR8
*Token
, OPTIONAL
321 IN CONST CHAR8
*Module
, OPTIONAL
327 Retrieves a previously logged performance measurement.
328 It can also retrieve the log created by StartGauge and EndGauge of PERFORMANCE_PROTOCOL,
329 and then assign the Identifier with 0.
331 Retrieves the performance log entry from the performance log specified by LogEntryKey.
332 If it stands for a valid entry, then EFI_SUCCESS is returned and
333 GaugeDataEntryEx stores the pointer to that entry.
335 @param LogEntryKey The key for the previous performance measurement log entry.
336 If 0, then the first performance measurement log entry is retrieved.
337 @param GaugeDataEntryEx Out parameter for the indirect pointer to the extented gauge data entry specified by LogEntryKey.
339 @retval EFI_SUCCESS The GuageDataEntryEx is successfully found based on LogEntryKey.
340 @retval EFI_NOT_FOUND There is no entry after the measurement referred to by LogEntryKey.
341 @retval EFI_INVALID_PARAMETER The LogEntryKey is not a valid entry, or GaugeDataEntryEx is NULL.
346 (EFIAPI
* PERFORMANCE_GET_GAUGE_EX
)(
347 IN UINTN LogEntryKey
,
348 OUT GAUGE_DATA_ENTRY_EX
**GaugeDataEntryEx
351 struct _PERFORMANCE_PROTOCOL
{
352 PERFORMANCE_START_GAUGE StartGauge
;
353 PERFORMANCE_END_GAUGE EndGauge
;
354 PERFORMANCE_GET_GAUGE GetGauge
;
357 struct _PERFORMANCE_EX_PROTOCOL
{
358 PERFORMANCE_START_GAUGE_EX StartGaugeEx
;
359 PERFORMANCE_END_GAUGE_EX EndGaugeEx
;
360 PERFORMANCE_GET_GAUGE_EX GetGaugeEx
;
363 extern EFI_GUID gPerformanceProtocolGuid
;
364 extern EFI_GUID gSmmPerformanceProtocolGuid
;
365 extern EFI_GUID gPerformanceExProtocolGuid
;
366 extern EFI_GUID gSmmPerformanceExProtocolGuid
;