]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Include/Guid/ExtendedFirmwarePerformance.h
MdeModulePkg:Add definitions for new Performance infrastructure
[mirror_edk2.git] / MdeModulePkg / Include / Guid / ExtendedFirmwarePerformance.h
1 /** @file
2 This file defines edk2 extended firmware performance records.
3 These records will be added into ACPI FPDT Firmware Basic Boot Performance Table.
4
5 Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials are licensed and made available under
7 the terms and conditions of the BSD License that accompanies this distribution.
8 The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 #ifndef __EXTENDED_FIRMWARE_PERFORMANCE_H__
17 #define __EXTENDED_FIRMWARE_PERFORMANCE_H__
18
19 #include <IndustryStandard/Acpi.h>
20
21 //
22 // Known performance tokens
23 //
24 #define SEC_TOK "SEC" ///< SEC Phase
25 #define DXE_TOK "DXE" ///< DXE Phase
26 #define PEI_TOK "PEI" ///< PEI Phase
27 #define BDS_TOK "BDS" ///< BDS Phase
28 #define DRIVERBINDING_START_TOK "DB:Start:" ///< Driver Binding Start() function call
29 #define DRIVERBINDING_SUPPORT_TOK "DB:Support:" ///< Driver Binding Support() function call
30 #define DRIVERBINDING_STOP_TOK "DB:Stop:" ///< Driver Binding Stop() function call
31 #define LOAD_IMAGE_TOK "LoadImage:" ///< Load a dispatched module
32 #define START_IMAGE_TOK "StartImage:" ///< Dispatched Modules Entry Point execution
33 #define PEIM_TOK "PEIM" ///< PEIM Modules Entry Point execution
34
35 //
36 // Public Progress Identifiers for Event Records to map the above known token
37 //
38 #define MODULE_START_ID 0x01
39 #define MODULE_END_ID 0x02
40 #define MODULE_LOADIMAGE_START_ID 0x03
41 #define MODULE_LOADIMAGE_END_ID 0x04
42 #define MODULE_DB_START_ID 0x05
43 #define MODULE_DB_END_ID 0x06
44 #define MODULE_DB_SUPPORT_START_ID 0x07
45 #define MODULE_DB_SUPPORT_END_ID 0x08
46 #define MODULE_DB_STOP_START_ID 0x09
47 #define MODULE_DB_STOP_END_ID 0x0A
48
49 #define PERF_EVENTSIGNAL_START_ID 0x10
50 #define PERF_EVENTSIGNAL_END_ID 0x11
51 #define PERF_CALLBACK_START_ID 0x20
52 #define PERF_CALLBACK_END_ID 0x21
53 #define PERF_FUNCTION_START_ID 0x30
54 #define PERF_FUNCTION_END_ID 0x31
55 #define PERF_INMODULE_START_ID 0x40
56 #define PERF_INMODULE_END_ID 0x41
57 #define PERF_CROSSMODULE_START_ID 0x50
58 #define PERF_CROSSMODULE_END_ID 0x51
59
60 //
61 // Misc defines
62 //
63 #define FPDT_RECORD_REVISION_1 (0x01)
64
65 //
66 // Length field in EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER is a UINT8, thus:
67 //
68 #define FPDT_MAX_PERF_RECORD_SIZE (MAX_UINT8)
69
70 //
71 // FPDT Record Types
72 //
73 #define FPDT_GUID_EVENT_TYPE 0x1010
74 #define FPDT_DYNAMIC_STRING_EVENT_TYPE 0x1011
75 #define FPDT_DUAL_GUID_STRING_EVENT_TYPE 0x1012
76 #define FPDT_GUID_QWORD_EVENT_TYPE 0x1013
77 #define FPDT_GUID_QWORD_STRING_EVENT_TYPE 0x1014
78
79 //
80 // EDKII extended Fpdt record structures
81 //
82 #define FPDT_STRING_EVENT_RECORD_NAME_LENGTH 24
83
84 #pragma pack(1)
85 //
86 // FPDT Boot Performance Guid Event Record Structure
87 //
88 typedef struct {
89 EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER Header;
90 ///
91 /// ProgressID < 0x10 are reserved for core performance entries.
92 /// Start measurement point shall have lowered one nibble set to zero and
93 /// corresponding end points shall have lowered one nibble set to non-zero value;
94 /// keeping other nibbles same as start point.
95 ///
96 UINT16 ProgressID;
97 ///
98 /// APIC ID for the processor in the system used as a timestamp clock source.
99 /// If only one timestamp clock source is used, this field is Reserved and populated as 0.
100 ///
101 UINT32 ApicID;
102 ///
103 /// 64-bit value (nanosecond) describing elapsed time since the most recent deassertion of processor reset.
104 ///
105 UINT64 Timestamp;
106 ///
107 /// If ProgressID < 0x10, GUID of the referenced module; otherwise, GUID of the module logging the event.
108 ///
109 EFI_GUID Guid;
110 } FPDT_GUID_EVENT_RECORD;
111
112 //
113 // FPDT Boot Performance Dynamic String Event Record Structure
114 //
115 typedef struct {
116 EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER Header;
117 ///
118 /// ProgressID < 0x10 are reserved for core performance entries.
119 /// Start measurement point shall have lowered one nibble set to zero and
120 /// corresponding end points shall have lowered one nibble set to non-zero value;
121 /// keeping other nibbles same as start point.
122 ///
123 UINT16 ProgressID;
124 ///
125 /// APIC ID for the processor in the system used as a timestamp clock source.
126 /// If only one timestamp clock source is used, this field is Reserved and populated as 0.
127 ///
128 UINT32 ApicID;
129 ///
130 /// 64-bit value (nanosecond) describing elapsed time since the most recent deassertion of processor reset.
131 ///
132 UINT64 Timestamp;
133 ///
134 /// If ProgressID < 0x10, GUID of the referenced module; otherwise, GUID of the module logging the event.
135 ///
136 EFI_GUID Guid;
137 ///
138 /// ASCII string describing the module. Padding supplied at the end if necessary with null characters (0x00).
139 /// It may be module name, function name, or token name.
140 ///
141 CHAR8 String[0];
142 } FPDT_DYNAMIC_STRING_EVENT_RECORD;
143
144 //
145 // FPDT Boot Performance Dual GUID String Event Record Structure
146 //
147 typedef struct {
148 EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER Header;
149 ///
150 /// ProgressID < 0x10 are reserved for core performance entries.
151 /// Start measurement point shall have lowered one nibble set to zero and
152 /// corresponding end points shall have lowered one nibble set to non-zero value;
153 /// keeping other nibbles same as start point.
154 ///
155 UINT16 ProgressID;
156 ///
157 /// APIC ID for the processor in the system used as a timestamp clock source.
158 /// If only one timestamp clock source is used, this field is Reserved and populated as 0.
159 ///
160 UINT32 ApicID;
161 ///
162 /// 64-bit value (nanosecond) describing elapsed time since the most recent deassertion of processor reset.
163 ///
164 UINT64 Timestamp;
165 ///
166 /// GUID of the module logging the event.
167 ///
168 EFI_GUID Guid1;
169 ///
170 /// Event or Ppi or Protocol GUID for Callback.
171 ///
172 EFI_GUID Guid2;
173 ///
174 /// ASCII string describing the module. Padding supplied at the end if necessary with null characters (0x00).
175 /// It is the function name.
176 ///
177 CHAR8 String[0];
178 } FPDT_DUAL_GUID_STRING_EVENT_RECORD;
179
180 //
181 // FPDT Boot Performance GUID Qword Event Record Structure
182 //
183 typedef struct {
184 EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER Header;
185 ///
186 /// ProgressID < 0x10 are reserved for core performance entries.
187 /// Start measurement point shall have lowered one nibble set to zero and
188 /// corresponding end points shall have lowered one nibble set to non-zero value;
189 /// keeping other nibbles same as start point.
190 ///
191 UINT16 ProgressID;
192 ///
193 /// APIC ID for the processor in the system used as a timestamp clock source.
194 /// If only one timestamp clock source is used, this field is Reserved and populated as 0.
195 ///
196 UINT32 ApicID;
197 ///
198 /// 64-bit value (nanosecond) describing elapsed time since the most recent deassertion of processor reset.
199 ///
200 UINT64 Timestamp;
201 ///
202 /// GUID of the module logging the event
203 ///
204 EFI_GUID Guid;
205 ///
206 /// Qword of misc data, meaning depends on the ProgressId
207 ///
208 UINT64 Qword;
209 } FPDT_GUID_QWORD_EVENT_RECORD;
210
211 //
212 // FPDT Boot Performance GUID Qword String Event Record Structure
213 //
214 typedef struct {
215 EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER Header;
216 ///
217 /// ProgressID < 0x10 are reserved for core performance entries.
218 /// Start measurement point shall have lowered one nibble set to zero and
219 /// corresponding end points shall have lowered one nibble set to non-zero value;
220 /// keeping other nibbles same as start point.
221 ///
222 UINT16 ProgressID;
223 ///
224 /// APIC ID for the processor in the system used as a timestamp clock source.
225 /// If only one timestamp clock source is used, this field is Reserved and populated as 0.
226 ///
227 UINT32 ApicID;
228 ///
229 /// 64-bit value (nanosecond) describing elapsed time since the most recent deassertion of processor reset.
230 ///
231 UINT64 Timestamp;
232 ///
233 /// GUID of the module logging the event
234 ///
235 EFI_GUID Guid;
236 ///
237 /// Qword of misc data, meaning depends on the ProgressId
238 ///
239 UINT64 Qword;
240 ///
241 /// ASCII string describing the module. Padding supplied at the end if necessary with null characters (0x00).
242 ///
243 CHAR8 String[0];
244 } FPDT_GUID_QWORD_STRING_EVENT_RECORD;
245
246 #pragma pack()
247
248 typedef struct {
249 UINT16 ProgressID;
250 UINT16 Type;
251 UINT8 RecordSize;
252 } FPDT_BASIC_RECORD_INFO;
253
254 //
255 // Union of all FPDT records
256 //
257 typedef union {
258 EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER RecordHeader;
259 FPDT_GUID_EVENT_RECORD GuidEvent;
260 FPDT_DYNAMIC_STRING_EVENT_RECORD DynamicStringEvent;
261 FPDT_DUAL_GUID_STRING_EVENT_RECORD DualGuidStringEvent;
262 FPDT_GUID_QWORD_EVENT_RECORD GuidQwordEvent;
263 FPDT_GUID_QWORD_STRING_EVENT_RECORD GuidQwordStringEvent;
264 } FPDT_RECORD;
265
266 //
267 // Union of all pointers to FPDT records
268 //
269 typedef union {
270 EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER *RecordHeader;
271 FPDT_GUID_EVENT_RECORD *GuidEvent;
272 FPDT_DYNAMIC_STRING_EVENT_RECORD *DynamicStringEvent;
273 FPDT_DUAL_GUID_STRING_EVENT_RECORD *DualGuidStringEvent;
274 FPDT_GUID_QWORD_EVENT_RECORD *GuidQwordEvent;
275 FPDT_GUID_QWORD_STRING_EVENT_RECORD *GuidQwordStringEvent;
276 } FPDT_RECORD_PTR;
277
278 ///
279 /// Hob:
280 /// GUID - gEdkiiFpdtExtendedFirmwarePerformanceGuid;
281 /// Data - FPDT_PEI_EXT_PERF_HEADER + one or more FPDT records
282 ///
283 typedef struct {
284 UINT32 SizeOfAllEntries;
285 UINT32 LoadImageCount;
286 UINT32 HobIsFull;
287 } FPDT_PEI_EXT_PERF_HEADER;
288
289 extern EFI_GUID gEdkiiFpdtExtendedFirmwarePerformanceGuid;
290
291 #endif