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