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