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