]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLibInternal.h
Use SmmMemLib to check communication buffer.
[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
842b1242 7Copyright (c) 2011 - 2015, 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
23\r
24#include <Library/SmmServicesTableLib.h>\r
25#include <Library/DebugLib.h>\r
26#include <Library/PerformanceLib.h>\r
27#include <Library/BaseLib.h>\r
28#include <Library/BaseMemoryLib.h>\r
29#include <Library/TimerLib.h>\r
30#include <Library/PcdLib.h>\r
31#include <Library/UefiLib.h> \r
32#include <Library/UefiBootServicesTableLib.h>\r
33#include <Library/MemoryAllocationLib.h>\r
34#include <Library/SynchronizationLib.h>\r
842b1242 35#include <Library/SmmMemLib.h>\r
d042c6e8 36\r
37#include <Protocol/SmmBase2.h>\r
38#include <Protocol/SmmAccess2.h>\r
39\r
40//\r
f0da4d7d
SZ
41// Interface declarations for SMM PerformanceEx Protocol.\r
42//\r
43/**\r
44 Adds a record at the end of the performance measurement log\r
45 that records the start time of a performance measurement.\r
46\r
47 Adds a record to the end of the performance measurement log\r
48 that contains the Handle, Token, Module and Identifier.\r
49 The end time of the new record must be set to zero.\r
50 If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.\r
51 If TimeStamp is zero, the start time in the record is filled in with the value\r
52 read from the current time stamp.\r
53\r
54 @param Handle Pointer to environment specific context used\r
55 to identify the component being measured.\r
56 @param Token Pointer to a Null-terminated ASCII string\r
57 that identifies the component being measured.\r
58 @param Module Pointer to a Null-terminated ASCII string\r
59 that identifies the module being measured.\r
60 @param TimeStamp 64-bit time stamp.\r
61 @param Identifier 32-bit identifier. If the value is 0, the created record\r
62 is same as the one created by StartGauge of PERFORMANCE_PROTOCOL.\r
63\r
64 @retval EFI_SUCCESS The data was read correctly from the device.\r
65 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.\r
66\r
67**/\r
68EFI_STATUS\r
69EFIAPI\r
70StartGaugeEx (\r
71 IN CONST VOID *Handle, OPTIONAL\r
72 IN CONST CHAR8 *Token, OPTIONAL\r
73 IN CONST CHAR8 *Module, OPTIONAL\r
74 IN UINT64 TimeStamp,\r
75 IN UINT32 Identifier\r
76 );\r
77\r
78/**\r
79 Searches the performance measurement log from the beginning of the log\r
80 for the first matching record that contains a zero end time and fills in a valid end time.\r
81\r
82 Searches the performance measurement log from the beginning of the log\r
83 for the first record that matches Handle, Token, Module and Identifier and has an end time value of zero.\r
84 If the record can not be found then return EFI_NOT_FOUND.\r
85 If the record is found and TimeStamp is not zero,\r
86 then the end time in the record is filled in with the value specified by TimeStamp.\r
87 If the record is found and TimeStamp is zero, then the end time in the matching record\r
88 is filled in with the current time stamp value.\r
89\r
90 @param Handle Pointer to environment specific context used\r
91 to identify the component being measured.\r
92 @param Token Pointer to a Null-terminated ASCII string\r
93 that identifies the component being measured.\r
94 @param Module Pointer to a Null-terminated ASCII string\r
95 that identifies the module being measured.\r
96 @param TimeStamp 64-bit time stamp.\r
97 @param Identifier 32-bit identifier. If the value is 0, the found record\r
98 is same as the one found by EndGauge of PERFORMANCE_PROTOCOL.\r
99\r
100 @retval EFI_SUCCESS The end of the measurement was recorded.\r
101 @retval EFI_NOT_FOUND The specified measurement record could not be found.\r
102\r
103**/\r
104EFI_STATUS\r
105EFIAPI\r
106EndGaugeEx (\r
107 IN CONST VOID *Handle, OPTIONAL\r
108 IN CONST CHAR8 *Token, OPTIONAL\r
109 IN CONST CHAR8 *Module, OPTIONAL\r
110 IN UINT64 TimeStamp,\r
111 IN UINT32 Identifier\r
112 );\r
113\r
114/**\r
115 Retrieves a previously logged performance measurement.\r
116 It can also retrieve the log created by StartGauge and EndGauge of PERFORMANCE_PROTOCOL,\r
117 and then assign the Identifier with 0.\r
118\r
119 Retrieves the performance log entry from the performance log specified by LogEntryKey.\r
120 If it stands for a valid entry, then EFI_SUCCESS is returned and\r
121 GaugeDataEntryEx stores the pointer to that entry.\r
122\r
123 @param LogEntryKey The key for the previous performance measurement log entry.\r
124 If 0, then the first performance measurement log entry is retrieved.\r
125 @param GaugeDataEntryEx The indirect pointer to the extended gauge data entry specified by LogEntryKey\r
126 if the retrieval is successful.\r
127\r
128 @retval EFI_SUCCESS The GuageDataEntryEx is successfully found based on LogEntryKey.\r
129 @retval EFI_NOT_FOUND The LogEntryKey is the last entry (equals to the total entry number).\r
130 @retval EFI_INVALIDE_PARAMETER The LogEntryKey is not a valid entry (greater than the total entry number).\r
131 @retval EFI_INVALIDE_PARAMETER GaugeDataEntryEx is NULL.\r
132\r
133**/\r
134EFI_STATUS\r
135EFIAPI\r
136GetGaugeEx (\r
137 IN UINTN LogEntryKey,\r
138 OUT GAUGE_DATA_ENTRY_EX **GaugeDataEntryEx\r
139 );\r
140\r
141//\r
142// Interface declarations for SMM Performance Protocol.\r
d042c6e8 143//\r
144/**\r
145 Adds a record at the end of the performance measurement log\r
146 that records the start time of a performance measurement.\r
147\r
148 Adds a record to the end of the performance measurement log\r
149 that contains the Handle, Token, and Module.\r
150 The end time of the new record must be set to zero.\r
151 If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.\r
152 If TimeStamp is zero, the start time in the record is filled in with the value\r
153 read from the current time stamp.\r
154\r
155 @param Handle Pointer to environment specific context used\r
156 to identify the component being measured.\r
157 @param Token Pointer to a Null-terminated ASCII string\r
158 that identifies the component being measured.\r
159 @param Module Pointer to a Null-terminated ASCII string\r
160 that identifies the module being measured.\r
161 @param TimeStamp 64-bit time stamp.\r
162\r
163 @retval EFI_SUCCESS The data was read correctly from the device.\r
164 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.\r
165\r
166**/\r
167EFI_STATUS\r
168EFIAPI\r
169StartGauge (\r
170 IN CONST VOID *Handle, OPTIONAL\r
171 IN CONST CHAR8 *Token, OPTIONAL\r
172 IN CONST CHAR8 *Module, OPTIONAL\r
173 IN UINT64 TimeStamp\r
174 );\r
175\r
176/**\r
177 Searches the performance measurement log from the beginning of the log\r
178 for the first matching record that contains a zero end time and fills in a valid end time.\r
179\r
180 Searches the performance measurement log from the beginning of the log\r
181 for the first record that matches Handle, Token, and Module and has an end time value of zero.\r
182 If the record can not be found then return EFI_NOT_FOUND.\r
183 If the record is found and TimeStamp is not zero,\r
184 then the end time in the record is filled in with the value specified by TimeStamp.\r
185 If the record is found and TimeStamp is zero, then the end time in the matching record\r
186 is filled in with the current time stamp value.\r
187\r
188 @param Handle Pointer to environment specific context used\r
189 to identify the component being measured.\r
190 @param Token Pointer to a Null-terminated ASCII string\r
191 that identifies the component being measured.\r
192 @param Module Pointer to a Null-terminated ASCII string\r
193 that identifies the module being measured.\r
194 @param TimeStamp 64-bit time stamp.\r
195\r
196 @retval EFI_SUCCESS The end of the measurement was recorded.\r
197 @retval EFI_NOT_FOUND The specified measurement record could not be found.\r
198\r
199**/\r
200EFI_STATUS\r
201EFIAPI\r
202EndGauge (\r
203 IN CONST VOID *Handle, OPTIONAL\r
204 IN CONST CHAR8 *Token, OPTIONAL\r
205 IN CONST CHAR8 *Module, OPTIONAL\r
206 IN UINT64 TimeStamp\r
207 );\r
208\r
209/**\r
210 Retrieves a previously logged performance measurement.\r
f0da4d7d
SZ
211 It can also retrieve the log created by StartGaugeEx and EndGaugeEx of PERFORMANCE_EX_PROTOCOL,\r
212 and then eliminate the Identifier.\r
d042c6e8 213\r
214 Retrieves the performance log entry from the performance log specified by LogEntryKey.\r
215 If it stands for a valid entry, then EFI_SUCCESS is returned and\r
216 GaugeDataEntry stores the pointer to that entry.\r
217\r
218 @param LogEntryKey The key for the previous performance measurement log entry.\r
219 If 0, then the first performance measurement log entry is retrieved.\r
220 @param GaugeDataEntry The indirect pointer to the gauge data entry specified by LogEntryKey\r
221 if the retrieval is successful.\r
222\r
223 @retval EFI_SUCCESS The GuageDataEntry is successfully found based on LogEntryKey.\r
224 @retval EFI_NOT_FOUND The LogEntryKey is the last entry (equals to the total entry number).\r
225 @retval EFI_INVALIDE_PARAMETER The LogEntryKey is not a valid entry (greater than the total entry number).\r
226 @retval EFI_INVALIDE_PARAMETER GaugeDataEntry is NULL.\r
227\r
228**/\r
229EFI_STATUS\r
230EFIAPI\r
231GetGauge (\r
232 IN UINTN LogEntryKey,\r
233 OUT GAUGE_DATA_ENTRY **GaugeDataEntry\r
234 );\r
235\r
236\r
237#endif\r