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