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