]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Guid/Performance.h
retire gEfiBootStateGuid and replace it with dynamic hii pcd. so the different boot...
[mirror_edk2.git] / MdeModulePkg / Include / Guid / Performance.h
CommitLineData
1e354c03 1/** @file\r
72aff63a 2 This file defines performance related definitions: the format of performance\r
3 GUID HOB, performance protocol interfaces and performance variable format. \r
88f20127 4\r
72aff63a 5Copyright (c) 2009, Intel Corporation. <BR>\r
88f20127 6All rights reserved. This program and the accompanying materials\r
7are licensed and made available under the terms and conditions of the BSD License\r
8which accompanies this distribution. The 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
1e354c03 14**/\r
88f20127 15\r
72aff63a 16#ifndef __PERFORMANCE_DATA_H__\r
17#define __PERFORMANCE_DATA_H__\r
18\r
19//\r
20// PEI_PERFORMANCE_STRING_SIZE must be a multiple of 8.\r
21//\r
22#define PEI_PERFORMANCE_STRING_SIZE 8\r
23#define PEI_PERFORMANCE_STRING_LENGTH (PEI_PERFORMANCE_STRING_SIZE - 1)\r
24\r
25typedef struct {\r
26 EFI_PHYSICAL_ADDRESS Handle;\r
27 CHAR8 Token[PEI_PERFORMANCE_STRING_SIZE]; ///> Measured token string name \r
28 CHAR8 Module[PEI_PERFORMANCE_STRING_SIZE]; ///> Module string name\r
29 UINT64 StartTimeStamp; ///> Start time point\r
30 UINT64 EndTimeStamp; ///> End time point\r
31} PEI_PERFORMANCE_LOG_ENTRY;\r
32\r
33//\r
34// The header must be aligned at 8 bytes.\r
35// \r
36typedef struct {\r
37 UINT32 NumberOfEntries; ///> The number of all performance log entries\r
38 UINT32 Reserved;\r
39} PEI_PERFORMANCE_LOG_HEADER;\r
40\r
41\r
42//\r
43// The data structure for performance data in ACPI memory.\r
44//\r
45#define PERFORMANCE_SIGNATURE SIGNATURE_32 ('P', 'e', 'r', 'f')\r
46#define PERF_TOKEN_SIZE 28\r
47#define PERF_TOKEN_LENGTH (PERF_TOKEN_SIZE - 1)\r
48#define PERF_PEI_ENTRY_MAX_NUM 50\r
49\r
50typedef struct {\r
51 CHAR8 Token[PERF_TOKEN_SIZE];\r
52 UINT32 Duration;\r
53} PERF_DATA;\r
54\r
55typedef struct {\r
56 UINT64 BootToOs;\r
57 UINT64 S3Resume;\r
58 UINT32 S3EntryNum;\r
59 PERF_DATA S3Entry[PERF_PEI_ENTRY_MAX_NUM];\r
60 UINT64 CpuFreq;\r
61 UINT64 BDSRaw;\r
62 UINT32 Count;\r
63 UINT32 Signiture;\r
64} PERF_HEADER;\r
88f20127 65\r
66#define PERFORMANCE_PROTOCOL_GUID \\r
67 { 0x76b6bdfa, 0x2acd, 0x4462, {0x9E, 0x3F, 0xcb, 0x58, 0xC9, 0x69, 0xd9, 0x37 } }\r
68\r
69//\r
72aff63a 70// Forward reference for pure ANSI compatibility\r
88f20127 71//\r
72typedef struct _PERFORMANCE_PROTOCOL PERFORMANCE_PROTOCOL;\r
73\r
88f20127 74//\r
75// DXE_PERFORMANCE_STRING_SIZE must be a multiple of 8.\r
76//\r
77#define DXE_PERFORMANCE_STRING_SIZE 32\r
78#define DXE_PERFORMANCE_STRING_LENGTH (DXE_PERFORMANCE_STRING_SIZE - 1)\r
79\r
80//\r
81// The default guage entries number for DXE phase.\r
82//\r
83#define INIT_DXE_GAUGE_DATA_ENTRIES 800\r
84\r
85typedef struct {\r
86 EFI_PHYSICAL_ADDRESS Handle;\r
b9982883
LG
87 CHAR8 Token[DXE_PERFORMANCE_STRING_SIZE]; ///> Measured token string name \r
88 CHAR8 Module[DXE_PERFORMANCE_STRING_SIZE]; ///> Module string name\r
89 UINT64 StartTimeStamp; ///> Start time point\r
90 UINT64 EndTimeStamp; ///> End time point\r
88f20127 91} GAUGE_DATA_ENTRY;\r
92\r
93//\r
94// The header must be aligned at 8 bytes\r
95//\r
96typedef struct {\r
b9982883 97 UINT32 NumberOfEntries; ///> The number of all performance guage entries\r
88f20127 98 UINT32 Reserved;\r
99} GAUGE_DATA_HEADER;\r
100\r
101/**\r
102 Adds a record at the end of the performance measurement log\r
103 that records the start time of a performance measurement.\r
104\r
105 Adds a record to the end of the performance measurement log\r
106 that contains the Handle, Token, and Module.\r
107 The end time of the new record must be set to zero.\r
108 If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.\r
109 If TimeStamp is zero, the start time in the record is filled in with the value\r
110 read from the current time stamp.\r
111\r
112 @param Handle Pointer to environment specific context used\r
113 to identify the component being measured.\r
114 @param Token Pointer to a Null-terminated ASCII string\r
115 that identifies the component being measured.\r
116 @param Module Pointer to a Null-terminated ASCII string\r
117 that identifies the module being measured.\r
118 @param TimeStamp 64-bit time stamp.\r
119\r
120 @retval EFI_SUCCESS The data was read correctly from the device.\r
121 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.\r
122\r
123**/\r
124typedef\r
125EFI_STATUS\r
7d839888 126(EFIAPI * PERFORMANCE_START_GAUGE)(\r
88f20127 127 IN CONST VOID *Handle, OPTIONAL\r
128 IN CONST CHAR8 *Token, OPTIONAL\r
129 IN CONST CHAR8 *Module, OPTIONAL\r
130 IN UINT64 TimeStamp\r
131 );\r
132\r
133/**\r
134 Searches the performance measurement log from the beginning of the log\r
135 for the first matching record that contains a zero end time and fills in a valid end time.\r
136\r
137 Searches the performance measurement log from the beginning of the log\r
138 for the first record that matches Handle, Token, and Module and has an end time value of zero.\r
139 If the record can not be found then return EFI_NOT_FOUND.\r
140 If the record is found and TimeStamp is not zero,\r
141 then the end time in the record is filled in with the value specified by TimeStamp.\r
142 If the record is found and TimeStamp is zero, then the end time in the matching record\r
143 is filled in with the current time stamp value.\r
144\r
145 @param Handle Pointer to environment specific context used\r
146 to identify the component being measured.\r
147 @param Token Pointer to a Null-terminated ASCII string\r
148 that identifies the component being measured.\r
149 @param Module Pointer to a Null-terminated ASCII string\r
150 that identifies the module being measured.\r
151 @param TimeStamp 64-bit time stamp.\r
152\r
153 @retval EFI_SUCCESS The end of the measurement was recorded.\r
154 @retval EFI_NOT_FOUND The specified measurement record could not be found.\r
155\r
156**/\r
157typedef\r
158EFI_STATUS\r
7d839888 159(EFIAPI * PERFORMANCE_END_GAUGE)(\r
88f20127 160 IN CONST VOID *Handle, OPTIONAL\r
161 IN CONST CHAR8 *Token, OPTIONAL\r
162 IN CONST CHAR8 *Module, OPTIONAL\r
163 IN UINT64 TimeStamp\r
164 );\r
165\r
166/**\r
167 Retrieves a previously logged performance measurement.\r
168\r
169 Retrieves the performance log entry from the performance log specified by LogEntryKey.\r
170 If it stands for a valid entry, then EFI_SUCCESS is returned and\r
171 GaugeDataEntry stores the pointer to that entry.\r
172\r
173 @param LogEntryKey The key for the previous performance measurement log entry.\r
174 If 0, then the first performance measurement log entry is retrieved.\r
175 @param GaugeDataEntry The indirect pointer to the gauge data entry specified by LogEntryKey\r
176 if the retrieval is successful.\r
177\r
d7db0902 178 @retval EFI_SUCCESS The GuageDataEntry is successfully found based on LogEntryKey.\r
88f20127 179 @retval EFI_NOT_FOUND The LogEntryKey is the last entry (equals to the total entry number).\r
180 @retval EFI_INVALIDE_PARAMETER The LogEntryKey is not a valid entry (greater than the total entry number).\r
181 @retval EFI_INVALIDE_PARAMETER GaugeDataEntry is NULL.\r
182\r
183**/\r
184typedef\r
185EFI_STATUS\r
7d839888 186(EFIAPI * PERFORMANCE_GET_GAUGE)(\r
88f20127 187 IN UINTN LogEntryKey,\r
188 OUT GAUGE_DATA_ENTRY **GaugeDataEntry\r
189 );\r
190\r
191struct _PERFORMANCE_PROTOCOL {\r
192 PERFORMANCE_START_GAUGE StartGauge;\r
193 PERFORMANCE_END_GAUGE EndGauge;\r
194 PERFORMANCE_GET_GAUGE GetGauge;\r
195};\r
196\r
197extern EFI_GUID gPerformanceProtocolGuid;\r
198\r
199#endif\r