]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Guid/Performance.h
Patch from open source community for CryptoPkg to allow it to build for ARM using...
[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
d042c6e8 7Copyright (c) 2009 - 2011, 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
69 { 0x76b6bdfa, 0x2acd, 0x4462, {0x9E, 0x3F, 0xcb, 0x58, 0xC9, 0x69, 0xd9, 0x37 } }\r
70\r
71//\r
72aff63a 72// Forward reference for pure ANSI compatibility\r
88f20127 73//\r
74typedef struct _PERFORMANCE_PROTOCOL PERFORMANCE_PROTOCOL;\r
75\r
88f20127 76//\r
77// DXE_PERFORMANCE_STRING_SIZE must be a multiple of 8.\r
78//\r
79#define DXE_PERFORMANCE_STRING_SIZE 32\r
80#define DXE_PERFORMANCE_STRING_LENGTH (DXE_PERFORMANCE_STRING_SIZE - 1)\r
81\r
82//\r
83// The default guage entries number for DXE phase.\r
84//\r
85#define INIT_DXE_GAUGE_DATA_ENTRIES 800\r
86\r
87typedef struct {\r
88 EFI_PHYSICAL_ADDRESS Handle;\r
64a80549 89 CHAR8 Token[DXE_PERFORMANCE_STRING_SIZE]; ///< Measured token string name. \r
90 CHAR8 Module[DXE_PERFORMANCE_STRING_SIZE]; ///< Module string name.\r
91 UINT64 StartTimeStamp; ///< Start time point.\r
92 UINT64 EndTimeStamp; ///< End time point.\r
88f20127 93} GAUGE_DATA_ENTRY;\r
94\r
95//\r
96// The header must be aligned at 8 bytes\r
97//\r
98typedef struct {\r
64a80549 99 UINT32 NumberOfEntries; ///< The number of all performance gauge entries.\r
88f20127 100 UINT32 Reserved;\r
101} GAUGE_DATA_HEADER;\r
102\r
d042c6e8 103//\r
104// SMM Performance Protocol definitions\r
105//\r
106\r
107#define SMM_PERFORMANCE_PROTOCOL_GUID \\r
108 { 0xf866226a, 0xeaa5, 0x4f5a, { 0xa9, 0xa, 0x6c, 0xfb, 0xa5, 0x7c, 0x58, 0x8e } }\r
109\r
110//\r
111// SMM_PERFORMANCE_STRING_SIZE.\r
112//\r
113#define SMM_PERFORMANCE_STRING_SIZE 32\r
114#define SMM_PERFORMANCE_STRING_LENGTH (SMM_PERFORMANCE_STRING_SIZE - 1)\r
115\r
116//\r
117// The default guage entries number for SMM phase.\r
118//\r
119#define INIT_SMM_GAUGE_DATA_ENTRIES 200\r
120\r
121typedef struct {\r
122 UINTN Function;\r
123 EFI_STATUS ReturnStatus;\r
124 UINTN NumberOfEntries;\r
125 UINTN LogEntryKey;\r
126 GAUGE_DATA_ENTRY *GaugeData;\r
127} SMM_PERF_COMMUNICATE;\r
128\r
129#define SMM_PERF_FUNCTION_GET_GAUGE_ENTRY_NUMBER 1\r
130#define SMM_PERF_FUNCTION_GET_GAUGE_DATA 2\r
131\r
88f20127 132/**\r
133 Adds a record at the end of the performance measurement log\r
134 that records the start time of a performance measurement.\r
135\r
e9b67286 136 The added record contains the Handle, Token, and Module.\r
137 The end time of the new record is not recorded, so it is set to zero.\r
88f20127 138 If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.\r
139 If TimeStamp is zero, the start time in the record is filled in with the value\r
140 read from the current time stamp.\r
141\r
64a80549 142 @param Handle The pointer to environment specific context used\r
88f20127 143 to identify the component being measured.\r
64a80549 144 @param Token The pointer to a Null-terminated ASCII string\r
88f20127 145 that identifies the component being measured.\r
64a80549 146 @param Module The pointer to a Null-terminated ASCII string\r
88f20127 147 that identifies the module being measured.\r
64a80549 148 @param TimeStamp The 64-bit time stamp.\r
88f20127 149\r
150 @retval EFI_SUCCESS The data was read correctly from the device.\r
151 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.\r
152\r
153**/\r
154typedef\r
155EFI_STATUS\r
7d839888 156(EFIAPI * PERFORMANCE_START_GAUGE)(\r
88f20127 157 IN CONST VOID *Handle, OPTIONAL\r
158 IN CONST CHAR8 *Token, OPTIONAL\r
159 IN CONST CHAR8 *Module, OPTIONAL\r
160 IN UINT64 TimeStamp\r
161 );\r
162\r
163/**\r
164 Searches the performance measurement log from the beginning of the log\r
165 for the first matching record that contains a zero end time and fills in a valid end time.\r
166\r
167 Searches the performance measurement log from the beginning of the log\r
64a80549 168 for the first record that matches Handle, Token, and Module, and has an end time value of zero.\r
88f20127 169 If the record can not be found then return EFI_NOT_FOUND.\r
170 If the record is found and TimeStamp is not zero,\r
171 then the end time in the record is filled in with the value specified by TimeStamp.\r
172 If the record is found and TimeStamp is zero, then the end time in the matching record\r
173 is filled in with the current time stamp value.\r
174\r
64a80549 175 @param Handle The pointer to environment specific context used\r
88f20127 176 to identify the component being measured.\r
64a80549 177 @param Token The pointer to a Null-terminated ASCII string\r
88f20127 178 that identifies the component being measured.\r
64a80549 179 @param Module The pointer to a Null-terminated ASCII string\r
88f20127 180 that identifies the module being measured.\r
64a80549 181 @param TimeStamp The 64-bit time stamp.\r
88f20127 182\r
183 @retval EFI_SUCCESS The end of the measurement was recorded.\r
184 @retval EFI_NOT_FOUND The specified measurement record could not be found.\r
185\r
186**/\r
187typedef\r
188EFI_STATUS\r
7d839888 189(EFIAPI * PERFORMANCE_END_GAUGE)(\r
88f20127 190 IN CONST VOID *Handle, OPTIONAL\r
191 IN CONST CHAR8 *Token, OPTIONAL\r
192 IN CONST CHAR8 *Module, OPTIONAL\r
193 IN UINT64 TimeStamp\r
194 );\r
195\r
196/**\r
197 Retrieves a previously logged performance measurement.\r
198\r
199 Retrieves the performance log entry from the performance log specified by LogEntryKey.\r
200 If it stands for a valid entry, then EFI_SUCCESS is returned and\r
201 GaugeDataEntry stores the pointer to that entry.\r
202\r
203 @param LogEntryKey The key for the previous performance measurement log entry.\r
204 If 0, then the first performance measurement log entry is retrieved.\r
e9b67286 205 @param GaugeDataEntry Out parameter for the indirect pointer to the gauge data entry specified by LogEntryKey.\r
206 \r
d7db0902 207 @retval EFI_SUCCESS The GuageDataEntry is successfully found based on LogEntryKey.\r
e9b67286 208 @retval EFI_NOT_FOUND There is no entry after the measurement referred to by LogEntryKey.\r
209 @retval EFI_INVALID_PARAMETER The LogEntryKey is not a valid entry, or GaugeDataEntry is NULL.\r
88f20127 210\r
211**/\r
212typedef\r
213EFI_STATUS\r
7d839888 214(EFIAPI * PERFORMANCE_GET_GAUGE)(\r
88f20127 215 IN UINTN LogEntryKey,\r
216 OUT GAUGE_DATA_ENTRY **GaugeDataEntry\r
217 );\r
218\r
219struct _PERFORMANCE_PROTOCOL {\r
220 PERFORMANCE_START_GAUGE StartGauge;\r
221 PERFORMANCE_END_GAUGE EndGauge;\r
222 PERFORMANCE_GET_GAUGE GetGauge;\r
223};\r
224\r
225extern EFI_GUID gPerformanceProtocolGuid;\r
d042c6e8 226extern EFI_GUID gSmmPerformanceProtocolGuid;\r
88f20127 227\r
228#endif\r