]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLibInternal.h
MdeModulePkg/SmmCorePerformanceLib:Track FPDT record in SMM phase
[mirror_edk2.git] / MdeModulePkg / Library / SmmCorePerformanceLib / SmmCorePerformanceLibInternal.h
CommitLineData
d042c6e8 1/** @file\r
2 Master header files for SmmCorePerformanceLib instance.\r
3\r
f0da4d7d 4 This header file holds the prototypes of the SMM Performance and PerformanceEx Protocol published by this\r
d042c6e8 5 library instance at its constructor.\r
6\r
2001f84e 7Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>\r
d042c6e8 8This program and the accompanying materials\r
9are licensed and made available under the terms and conditions of the BSD License\r
10which accompanies this distribution. The full text of the license may be found at\r
11http://opensource.org/licenses/bsd-license.php\r
12\r
13THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
16**/\r
17 \r
18#ifndef _SMM_CORE_PERFORMANCE_LIB_INTERNAL_H_\r
19#define _SMM_CORE_PERFORMANCE_LIB_INTERNAL_H_\r
20\r
21\r
22#include <Guid/Performance.h>\r
2001f84e
DB
23#include <Guid/ExtendedFirmwarePerformance.h>\r
24#include <Guid/FirmwarePerformance.h>\r
25#include <Guid/ZeroGuid.h>\r
26#include <Guid/EventGroup.h>\r
d042c6e8 27\r
28#include <Library/SmmServicesTableLib.h>\r
29#include <Library/DebugLib.h>\r
30#include <Library/PerformanceLib.h>\r
31#include <Library/BaseLib.h>\r
32#include <Library/BaseMemoryLib.h>\r
33#include <Library/TimerLib.h>\r
34#include <Library/PcdLib.h>\r
35#include <Library/UefiLib.h> \r
36#include <Library/UefiBootServicesTableLib.h>\r
37#include <Library/MemoryAllocationLib.h>\r
38#include <Library/SynchronizationLib.h>\r
842b1242 39#include <Library/SmmMemLib.h>\r
2001f84e
DB
40#include <Library/ReportStatusCodeLib.h>\r
41#include <Library/DxeServicesLib.h>\r
42#include <Library/PeCoffGetEntryPointLib.h>\r
d042c6e8 43\r
44#include <Protocol/SmmBase2.h>\r
2001f84e
DB
45#include <Protocol/LoadedImage.h>\r
46#include <Protocol/DevicePathToText.h>\r
d042c6e8 47\r
48//\r
f0da4d7d
SZ
49// Interface declarations for SMM PerformanceEx Protocol.\r
50//\r
51/**\r
52 Adds a record at the end of the performance measurement log\r
53 that records the start time of a performance measurement.\r
54\r
55 Adds a record to the end of the performance measurement log\r
56 that contains the Handle, Token, Module and Identifier.\r
57 The end time of the new record must be set to zero.\r
58 If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.\r
59 If TimeStamp is zero, the start time in the record is filled in with the value\r
60 read from the current time stamp.\r
61\r
62 @param Handle Pointer to environment specific context used\r
63 to identify the component being measured.\r
64 @param Token Pointer to a Null-terminated ASCII string\r
65 that identifies the component being measured.\r
66 @param Module Pointer to a Null-terminated ASCII string\r
67 that identifies the module being measured.\r
68 @param TimeStamp 64-bit time stamp.\r
69 @param Identifier 32-bit identifier. If the value is 0, the created record\r
70 is same as the one created by StartGauge of PERFORMANCE_PROTOCOL.\r
71\r
72 @retval EFI_SUCCESS The data was read correctly from the device.\r
73 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.\r
74\r
75**/\r
76EFI_STATUS\r
77EFIAPI\r
78StartGaugeEx (\r
79 IN CONST VOID *Handle, OPTIONAL\r
80 IN CONST CHAR8 *Token, OPTIONAL\r
81 IN CONST CHAR8 *Module, OPTIONAL\r
82 IN UINT64 TimeStamp,\r
83 IN UINT32 Identifier\r
84 );\r
85\r
86/**\r
87 Searches the performance measurement log from the beginning of the log\r
88 for the first matching record that contains a zero end time and fills in a valid end time.\r
89\r
90 Searches the performance measurement log from the beginning of the log\r
91 for the first record that matches Handle, Token, Module and Identifier and has an end time value of zero.\r
92 If the record can not be found then return EFI_NOT_FOUND.\r
93 If the record is found and TimeStamp is not zero,\r
94 then the end time in the record is filled in with the value specified by TimeStamp.\r
95 If the record is found and TimeStamp is zero, then the end time in the matching record\r
96 is filled in with the current time stamp value.\r
97\r
98 @param Handle Pointer to environment specific context used\r
99 to identify the component being measured.\r
100 @param Token Pointer to a Null-terminated ASCII string\r
101 that identifies the component being measured.\r
102 @param Module Pointer to a Null-terminated ASCII string\r
103 that identifies the module being measured.\r
104 @param TimeStamp 64-bit time stamp.\r
105 @param Identifier 32-bit identifier. If the value is 0, the found record\r
106 is same as the one found by EndGauge of PERFORMANCE_PROTOCOL.\r
107\r
108 @retval EFI_SUCCESS The end of the measurement was recorded.\r
109 @retval EFI_NOT_FOUND The specified measurement record could not be found.\r
110\r
111**/\r
112EFI_STATUS\r
113EFIAPI\r
114EndGaugeEx (\r
115 IN CONST VOID *Handle, OPTIONAL\r
116 IN CONST CHAR8 *Token, OPTIONAL\r
117 IN CONST CHAR8 *Module, OPTIONAL\r
118 IN UINT64 TimeStamp,\r
119 IN UINT32 Identifier\r
120 );\r
121\r
122/**\r
123 Retrieves a previously logged performance measurement.\r
124 It can also retrieve the log created by StartGauge and EndGauge of PERFORMANCE_PROTOCOL,\r
125 and then assign the Identifier with 0.\r
126\r
127 Retrieves the performance log entry from the performance log specified by LogEntryKey.\r
128 If it stands for a valid entry, then EFI_SUCCESS is returned and\r
129 GaugeDataEntryEx stores the pointer to that entry.\r
130\r
131 @param LogEntryKey The key for the previous performance measurement log entry.\r
132 If 0, then the first performance measurement log entry is retrieved.\r
133 @param GaugeDataEntryEx The indirect pointer to the extended gauge data entry specified by LogEntryKey\r
134 if the retrieval is successful.\r
135\r
136 @retval EFI_SUCCESS The GuageDataEntryEx is successfully found based on LogEntryKey.\r
137 @retval EFI_NOT_FOUND The LogEntryKey is the last entry (equals to the total entry number).\r
138 @retval EFI_INVALIDE_PARAMETER The LogEntryKey is not a valid entry (greater than the total entry number).\r
139 @retval EFI_INVALIDE_PARAMETER GaugeDataEntryEx is NULL.\r
140\r
141**/\r
142EFI_STATUS\r
143EFIAPI\r
144GetGaugeEx (\r
145 IN UINTN LogEntryKey,\r
146 OUT GAUGE_DATA_ENTRY_EX **GaugeDataEntryEx\r
147 );\r
148\r
149//\r
150// Interface declarations for SMM Performance Protocol.\r
d042c6e8 151//\r
152/**\r
153 Adds a record at the end of the performance measurement log\r
154 that records the start time of a performance measurement.\r
155\r
156 Adds a record to the end of the performance measurement log\r
157 that contains the Handle, Token, and Module.\r
158 The end time of the new record must be set to zero.\r
159 If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.\r
160 If TimeStamp is zero, the start time in the record is filled in with the value\r
161 read from the current time stamp.\r
162\r
163 @param Handle Pointer to environment specific context used\r
164 to identify the component being measured.\r
165 @param Token Pointer to a Null-terminated ASCII string\r
166 that identifies the component being measured.\r
167 @param Module Pointer to a Null-terminated ASCII string\r
168 that identifies the module being measured.\r
169 @param TimeStamp 64-bit time stamp.\r
170\r
171 @retval EFI_SUCCESS The data was read correctly from the device.\r
172 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.\r
173\r
174**/\r
175EFI_STATUS\r
176EFIAPI\r
177StartGauge (\r
178 IN CONST VOID *Handle, OPTIONAL\r
179 IN CONST CHAR8 *Token, OPTIONAL\r
180 IN CONST CHAR8 *Module, OPTIONAL\r
181 IN UINT64 TimeStamp\r
182 );\r
183\r
184/**\r
185 Searches the performance measurement log from the beginning of the log\r
186 for the first matching record that contains a zero end time and fills in a valid end time.\r
187\r
188 Searches the performance measurement log from the beginning of the log\r
189 for the first record that matches Handle, Token, and Module and has an end time value of zero.\r
190 If the record can not be found then return EFI_NOT_FOUND.\r
191 If the record is found and TimeStamp is not zero,\r
192 then the end time in the record is filled in with the value specified by TimeStamp.\r
193 If the record is found and TimeStamp is zero, then the end time in the matching record\r
194 is filled in with the current time stamp value.\r
195\r
196 @param Handle Pointer to environment specific context used\r
197 to identify the component being measured.\r
198 @param Token Pointer to a Null-terminated ASCII string\r
199 that identifies the component being measured.\r
200 @param Module Pointer to a Null-terminated ASCII string\r
201 that identifies the module being measured.\r
202 @param TimeStamp 64-bit time stamp.\r
203\r
204 @retval EFI_SUCCESS The end of the measurement was recorded.\r
205 @retval EFI_NOT_FOUND The specified measurement record could not be found.\r
206\r
207**/\r
208EFI_STATUS\r
209EFIAPI\r
210EndGauge (\r
211 IN CONST VOID *Handle, OPTIONAL\r
212 IN CONST CHAR8 *Token, OPTIONAL\r
213 IN CONST CHAR8 *Module, OPTIONAL\r
214 IN UINT64 TimeStamp\r
215 );\r
216\r
217/**\r
218 Retrieves a previously logged performance measurement.\r
f0da4d7d
SZ
219 It can also retrieve the log created by StartGaugeEx and EndGaugeEx of PERFORMANCE_EX_PROTOCOL,\r
220 and then eliminate the Identifier.\r
d042c6e8 221\r
222 Retrieves the performance log entry from the performance log specified by LogEntryKey.\r
223 If it stands for a valid entry, then EFI_SUCCESS is returned and\r
224 GaugeDataEntry stores the pointer to that entry.\r
225\r
226 @param LogEntryKey The key for the previous performance measurement log entry.\r
227 If 0, then the first performance measurement log entry is retrieved.\r
228 @param GaugeDataEntry The indirect pointer to the gauge data entry specified by LogEntryKey\r
229 if the retrieval is successful.\r
230\r
231 @retval EFI_SUCCESS The GuageDataEntry is successfully found based on LogEntryKey.\r
232 @retval EFI_NOT_FOUND The LogEntryKey is the last entry (equals to the total entry number).\r
233 @retval EFI_INVALIDE_PARAMETER The LogEntryKey is not a valid entry (greater than the total entry number).\r
234 @retval EFI_INVALIDE_PARAMETER GaugeDataEntry is NULL.\r
235\r
236**/\r
237EFI_STATUS\r
238EFIAPI\r
239GetGauge (\r
240 IN UINTN LogEntryKey,\r
241 OUT GAUGE_DATA_ENTRY **GaugeDataEntry\r
242 );\r
243\r
244\r
245#endif\r