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