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