]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Guid/Performance.h
MdeModulePkg: Apply uncrustify changes
[mirror_edk2.git] / MdeModulePkg / Include / Guid / Performance.h
CommitLineData
1e354c03 1/** @file\r
e9b67286 2 This file defines performance-related definitions, including the format of:\r
64a80549 3 * performance GUID HOB.\r
4 * performance protocol interfaces.\r
d1102dba 5 * performance variables.\r
88f20127 6\r
ae957a59 7Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
9d510e61 8SPDX-License-Identifier: BSD-2-Clause-Patent\r
88f20127 9\r
1e354c03 10**/\r
88f20127 11\r
72aff63a 12#ifndef __PERFORMANCE_DATA_H__\r
13#define __PERFORMANCE_DATA_H__\r
14\r
1436aea4 15#define PERFORMANCE_PROPERTY_REVISION 0x1\r
cfb0aba7
SZ
16\r
17typedef struct {\r
1436aea4
MK
18 UINT32 Revision;\r
19 UINT32 Reserved;\r
20 UINT64 Frequency;\r
21 UINT64 TimerStartValue;\r
22 UINT64 TimerEndValue;\r
cfb0aba7
SZ
23} PERFORMANCE_PROPERTY;\r
24\r
72aff63a 25//\r
26// PEI_PERFORMANCE_STRING_SIZE must be a multiple of 8.\r
27//\r
1436aea4
MK
28#define PEI_PERFORMANCE_STRING_SIZE 8\r
29#define PEI_PERFORMANCE_STRING_LENGTH (PEI_PERFORMANCE_STRING_SIZE - 1)\r
72aff63a 30\r
31typedef struct {\r
1436aea4
MK
32 EFI_PHYSICAL_ADDRESS Handle;\r
33 CHAR8 Token[PEI_PERFORMANCE_STRING_SIZE]; ///< Measured token string name.\r
34 CHAR8 Module[PEI_PERFORMANCE_STRING_SIZE]; ///< Module string name.\r
35 UINT64 StartTimeStamp; ///< Start time point.\r
36 UINT64 EndTimeStamp; ///< End time point.\r
72aff63a 37} PEI_PERFORMANCE_LOG_ENTRY;\r
38\r
39//\r
40// The header must be aligned at 8 bytes.\r
d1102dba 41//\r
72aff63a 42typedef struct {\r
1436aea4
MK
43 UINT32 NumberOfEntries; ///< The number of all performance log entries.\r
44 UINT32 Reserved;\r
72aff63a 45} PEI_PERFORMANCE_LOG_HEADER;\r
46\r
88f20127 47#define PERFORMANCE_PROTOCOL_GUID \\r
f0da4d7d
SZ
48 { 0x76b6bdfa, 0x2acd, 0x4462, { 0x9E, 0x3F, 0xcb, 0x58, 0xC9, 0x69, 0xd9, 0x37 } }\r
49\r
50#define PERFORMANCE_EX_PROTOCOL_GUID \\r
51 { 0x1ea81bec, 0xf01a, 0x4d98, { 0xa2, 0x1, 0x4a, 0x61, 0xce, 0x2f, 0xc0, 0x22 } }\r
88f20127 52\r
53//\r
72aff63a 54// Forward reference for pure ANSI compatibility\r
88f20127 55//\r
1436aea4
MK
56typedef struct _PERFORMANCE_PROTOCOL PERFORMANCE_PROTOCOL;\r
57typedef struct _PERFORMANCE_EX_PROTOCOL PERFORMANCE_EX_PROTOCOL;\r
88f20127 58\r
88f20127 59//\r
60// DXE_PERFORMANCE_STRING_SIZE must be a multiple of 8.\r
61//\r
1436aea4
MK
62#define DXE_PERFORMANCE_STRING_SIZE 32\r
63#define DXE_PERFORMANCE_STRING_LENGTH (DXE_PERFORMANCE_STRING_SIZE - 1)\r
88f20127 64\r
65//\r
66// The default guage entries number for DXE phase.\r
67//\r
1436aea4 68#define INIT_DXE_GAUGE_DATA_ENTRIES 800\r
88f20127 69\r
70typedef struct {\r
1436aea4
MK
71 EFI_PHYSICAL_ADDRESS Handle;\r
72 CHAR8 Token[DXE_PERFORMANCE_STRING_SIZE]; ///< Measured token string name.\r
73 CHAR8 Module[DXE_PERFORMANCE_STRING_SIZE]; ///< Module string name.\r
74 UINT64 StartTimeStamp; ///< Start time point.\r
75 UINT64 EndTimeStamp; ///< End time point.\r
88f20127 76} GAUGE_DATA_ENTRY;\r
77\r
f0da4d7d 78typedef struct {\r
1436aea4
MK
79 EFI_PHYSICAL_ADDRESS Handle;\r
80 CHAR8 Token[DXE_PERFORMANCE_STRING_SIZE]; ///< Measured token string name.\r
81 CHAR8 Module[DXE_PERFORMANCE_STRING_SIZE]; ///< Module string name.\r
82 UINT64 StartTimeStamp; ///< Start time point.\r
83 UINT64 EndTimeStamp; ///< End time point.\r
84 UINT32 Identifier; ///< Identifier.\r
f0da4d7d
SZ
85} GAUGE_DATA_ENTRY_EX;\r
86\r
88f20127 87//\r
88// The header must be aligned at 8 bytes\r
89//\r
90typedef struct {\r
1436aea4
MK
91 UINT32 NumberOfEntries; ///< The number of all performance gauge entries.\r
92 UINT32 Reserved;\r
88f20127 93} GAUGE_DATA_HEADER;\r
94\r
d042c6e8 95//\r
96// SMM Performance Protocol definitions\r
97//\r
98\r
99#define SMM_PERFORMANCE_PROTOCOL_GUID \\r
f0da4d7d
SZ
100 { 0xf866226a, 0xeaa5, 0x4f5a, { 0xa9, 0xa, 0x6c, 0xfb, 0xa5, 0x7c, 0x58, 0x8e } }\r
101\r
102#define SMM_PERFORMANCE_EX_PROTOCOL_GUID \\r
103 { 0x931fc048, 0xc71d, 0x4455, { 0x89, 0x30, 0x47, 0x6, 0x30, 0xe3, 0xe, 0xe5 } }\r
d042c6e8 104\r
105//\r
106// SMM_PERFORMANCE_STRING_SIZE.\r
107//\r
1436aea4
MK
108#define SMM_PERFORMANCE_STRING_SIZE 32\r
109#define SMM_PERFORMANCE_STRING_LENGTH (SMM_PERFORMANCE_STRING_SIZE - 1)\r
d042c6e8 110\r
111//\r
112// The default guage entries number for SMM phase.\r
113//\r
1436aea4 114#define INIT_SMM_GAUGE_DATA_ENTRIES 200\r
d042c6e8 115\r
116typedef struct {\r
1436aea4
MK
117 UINTN Function;\r
118 EFI_STATUS ReturnStatus;\r
119 UINTN NumberOfEntries;\r
120 UINTN LogEntryKey;\r
121 GAUGE_DATA_ENTRY *GaugeData;\r
d042c6e8 122} SMM_PERF_COMMUNICATE;\r
123\r
f0da4d7d 124typedef struct {\r
1436aea4
MK
125 UINTN Function;\r
126 EFI_STATUS ReturnStatus;\r
127 UINTN NumberOfEntries;\r
128 UINTN LogEntryKey;\r
129 GAUGE_DATA_ENTRY_EX *GaugeDataEx;\r
f0da4d7d
SZ
130} SMM_PERF_COMMUNICATE_EX;\r
131\r
1436aea4
MK
132#define SMM_PERF_FUNCTION_GET_GAUGE_ENTRY_NUMBER 1\r
133#define SMM_PERF_FUNCTION_GET_GAUGE_DATA 2\r
d042c6e8 134\r
88f20127 135/**\r
136 Adds a record at the end of the performance measurement log\r
137 that records the start time of a performance measurement.\r
138\r
e9b67286 139 The added record contains the Handle, Token, and Module.\r
140 The end time of the new record is not recorded, so it is set to zero.\r
88f20127 141 If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.\r
142 If TimeStamp is zero, the start time in the record is filled in with the value\r
143 read from the current time stamp.\r
144\r
64a80549 145 @param Handle The pointer to environment specific context used\r
88f20127 146 to identify the component being measured.\r
64a80549 147 @param Token The pointer to a Null-terminated ASCII string\r
88f20127 148 that identifies the component being measured.\r
64a80549 149 @param Module The pointer to a Null-terminated ASCII string\r
88f20127 150 that identifies the module being measured.\r
64a80549 151 @param TimeStamp The 64-bit time stamp.\r
88f20127 152\r
153 @retval EFI_SUCCESS The data was read correctly from the device.\r
154 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.\r
155\r
156**/\r
157typedef\r
158EFI_STATUS\r
1436aea4 159(EFIAPI *PERFORMANCE_START_GAUGE)(\r
e3917e22
MK
160 IN CONST VOID *Handle OPTIONAL,\r
161 IN CONST CHAR8 *Token OPTIONAL,\r
162 IN CONST CHAR8 *Module OPTIONAL,\r
88f20127 163 IN UINT64 TimeStamp\r
164 );\r
165\r
166/**\r
167 Searches the performance measurement log from the beginning of the log\r
168 for the first matching record that contains a zero end time and fills in a valid end time.\r
169\r
170 Searches the performance measurement log from the beginning of the log\r
64a80549 171 for the first record that matches Handle, Token, and Module, and has an end time value of zero.\r
88f20127 172 If the record can not be found then return EFI_NOT_FOUND.\r
173 If the record is found and TimeStamp is not zero,\r
174 then the end time in the record is filled in with the value specified by TimeStamp.\r
175 If the record is found and TimeStamp is zero, then the end time in the matching record\r
176 is filled in with the current time stamp value.\r
177\r
64a80549 178 @param Handle The pointer to environment specific context used\r
88f20127 179 to identify the component being measured.\r
64a80549 180 @param Token The pointer to a Null-terminated ASCII string\r
88f20127 181 that identifies the component being measured.\r
64a80549 182 @param Module The pointer to a Null-terminated ASCII string\r
88f20127 183 that identifies the module being measured.\r
64a80549 184 @param TimeStamp The 64-bit time stamp.\r
88f20127 185\r
186 @retval EFI_SUCCESS The end of the measurement was recorded.\r
187 @retval EFI_NOT_FOUND The specified measurement record could not be found.\r
188\r
189**/\r
190typedef\r
191EFI_STATUS\r
1436aea4 192(EFIAPI *PERFORMANCE_END_GAUGE)(\r
e3917e22
MK
193 IN CONST VOID *Handle OPTIONAL,\r
194 IN CONST CHAR8 *Token OPTIONAL,\r
195 IN CONST CHAR8 *Module OPTIONAL,\r
88f20127 196 IN UINT64 TimeStamp\r
197 );\r
198\r
199/**\r
200 Retrieves a previously logged performance measurement.\r
f0da4d7d
SZ
201 It can also retrieve the log created by StartGaugeEx and EndGaugeEx of PERFORMANCE_EX_PROTOCOL,\r
202 and then eliminate the Identifier.\r
88f20127 203\r
204 Retrieves the performance log entry from the performance log specified by LogEntryKey.\r
205 If it stands for a valid entry, then EFI_SUCCESS is returned and\r
206 GaugeDataEntry stores the pointer to that entry.\r
207\r
208 @param LogEntryKey The key for the previous performance measurement log entry.\r
209 If 0, then the first performance measurement log entry is retrieved.\r
e9b67286 210 @param GaugeDataEntry Out parameter for the indirect pointer to the gauge data entry specified by LogEntryKey.\r
d1102dba 211\r
d7db0902 212 @retval EFI_SUCCESS The GuageDataEntry is successfully found based on LogEntryKey.\r
e9b67286 213 @retval EFI_NOT_FOUND There is no entry after the measurement referred to by LogEntryKey.\r
214 @retval EFI_INVALID_PARAMETER The LogEntryKey is not a valid entry, or GaugeDataEntry is NULL.\r
88f20127 215\r
216**/\r
217typedef\r
218EFI_STATUS\r
1436aea4 219(EFIAPI *PERFORMANCE_GET_GAUGE)(\r
88f20127 220 IN UINTN LogEntryKey,\r
221 OUT GAUGE_DATA_ENTRY **GaugeDataEntry\r
222 );\r
223\r
f0da4d7d
SZ
224/**\r
225 Adds a record at the end of the performance measurement log\r
226 that records the start time of a performance measurement.\r
227\r
228 The added record contains the Handle, Token, Module and Identifier.\r
229 The end time of the new record is not recorded, so it is set to zero.\r
230 If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.\r
231 If TimeStamp is zero, the start time in the record is filled in with the value\r
232 read from the current time stamp.\r
233\r
234 @param Handle The pointer to environment specific context used\r
235 to identify the component being measured.\r
236 @param Token The pointer to a Null-terminated ASCII string\r
237 that identifies the component being measured.\r
238 @param Module The pointer to a Null-terminated ASCII string\r
239 that identifies the module being measured.\r
240 @param TimeStamp The 64-bit time stamp.\r
241 @param Identifier 32-bit identifier. If the value is 0, the created record\r
242 is same as the one created by StartGauge of PERFORMANCE_PROTOCOL.\r
243\r
244 @retval EFI_SUCCESS The data was read correctly from the device.\r
245 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.\r
246\r
247**/\r
248typedef\r
249EFI_STATUS\r
1436aea4 250(EFIAPI *PERFORMANCE_START_GAUGE_EX)(\r
e3917e22
MK
251 IN CONST VOID *Handle OPTIONAL,\r
252 IN CONST CHAR8 *Token OPTIONAL,\r
253 IN CONST CHAR8 *Module OPTIONAL,\r
f0da4d7d
SZ
254 IN UINT64 TimeStamp,\r
255 IN UINT32 Identifier\r
256 );\r
257\r
258/**\r
259 Searches the performance measurement log from the beginning of the log\r
260 for the first matching record that contains a zero end time and fills in a valid end time.\r
261\r
262 Searches the performance measurement log from the beginning of the log\r
263 for the first record that matches Handle, Token, Module and Identifier, and has an end time value of zero.\r
264 If the record can not be found then return EFI_NOT_FOUND.\r
265 If the record is found and TimeStamp is not zero,\r
266 then the end time in the record is filled in with the value specified by TimeStamp.\r
267 If the record is found and TimeStamp is zero, then the end time in the matching record\r
268 is filled in with the current time stamp value.\r
269\r
270 @param Handle The pointer to environment specific context used\r
271 to identify the component being measured.\r
272 @param Token The pointer to a Null-terminated ASCII string\r
273 that identifies the component being measured.\r
274 @param Module The pointer to a Null-terminated ASCII string\r
275 that identifies the module being measured.\r
276 @param TimeStamp The 64-bit time stamp.\r
277 @param Identifier 32-bit identifier. If the value is 0, the found record\r
278 is same as the one found by EndGauge of PERFORMANCE_PROTOCOL.\r
279\r
280 @retval EFI_SUCCESS The end of the measurement was recorded.\r
281 @retval EFI_NOT_FOUND The specified measurement record could not be found.\r
282\r
283**/\r
284typedef\r
285EFI_STATUS\r
1436aea4 286(EFIAPI *PERFORMANCE_END_GAUGE_EX)(\r
e3917e22
MK
287 IN CONST VOID *Handle OPTIONAL,\r
288 IN CONST CHAR8 *Token OPTIONAL,\r
289 IN CONST CHAR8 *Module OPTIONAL,\r
f0da4d7d
SZ
290 IN UINT64 TimeStamp,\r
291 IN UINT32 Identifier\r
292 );\r
293\r
294/**\r
295 Retrieves a previously logged performance measurement.\r
296 It can also retrieve the log created by StartGauge and EndGauge of PERFORMANCE_PROTOCOL,\r
297 and then assign the Identifier with 0.\r
298\r
299 Retrieves the performance log entry from the performance log specified by LogEntryKey.\r
300 If it stands for a valid entry, then EFI_SUCCESS is returned and\r
301 GaugeDataEntryEx stores the pointer to that entry.\r
302\r
303 @param LogEntryKey The key for the previous performance measurement log entry.\r
304 If 0, then the first performance measurement log entry is retrieved.\r
305 @param GaugeDataEntryEx Out parameter for the indirect pointer to the extented gauge data entry specified by LogEntryKey.\r
d1102dba 306\r
f0da4d7d
SZ
307 @retval EFI_SUCCESS The GuageDataEntryEx is successfully found based on LogEntryKey.\r
308 @retval EFI_NOT_FOUND There is no entry after the measurement referred to by LogEntryKey.\r
309 @retval EFI_INVALID_PARAMETER The LogEntryKey is not a valid entry, or GaugeDataEntryEx is NULL.\r
310\r
311**/\r
312typedef\r
313EFI_STATUS\r
1436aea4 314(EFIAPI *PERFORMANCE_GET_GAUGE_EX)(\r
f0da4d7d
SZ
315 IN UINTN LogEntryKey,\r
316 OUT GAUGE_DATA_ENTRY_EX **GaugeDataEntryEx\r
317 );\r
318\r
88f20127 319struct _PERFORMANCE_PROTOCOL {\r
1436aea4
MK
320 PERFORMANCE_START_GAUGE StartGauge;\r
321 PERFORMANCE_END_GAUGE EndGauge;\r
322 PERFORMANCE_GET_GAUGE GetGauge;\r
88f20127 323};\r
324\r
f0da4d7d 325struct _PERFORMANCE_EX_PROTOCOL {\r
1436aea4
MK
326 PERFORMANCE_START_GAUGE_EX StartGaugeEx;\r
327 PERFORMANCE_END_GAUGE_EX EndGaugeEx;\r
328 PERFORMANCE_GET_GAUGE_EX GetGaugeEx;\r
f0da4d7d
SZ
329};\r
330\r
1436aea4
MK
331extern EFI_GUID gPerformanceProtocolGuid;\r
332extern EFI_GUID gSmmPerformanceProtocolGuid;\r
333extern EFI_GUID gPerformanceExProtocolGuid;\r
334extern EFI_GUID gSmmPerformanceExProtocolGuid;\r
88f20127 335\r
336#endif\r