]>
Commit | Line | Data |
---|---|---|
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 | 7 | Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>\r |
d042c6e8 | 8 | This program and the accompanying materials\r |
9 | are licensed and made available under the terms and conditions of the BSD License\r | |
10 | which accompanies this distribution. The full text of the license may be found at\r | |
11 | http://opensource.org/licenses/bsd-license.php\r | |
12 | \r | |
13 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
14 | WITHOUT 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 | |
d042c6e8 | 38 | \r |
39 | //\r | |
f0da4d7d SZ |
40 | // Interface declarations for SMM PerformanceEx Protocol.\r |
41 | //\r | |
42 | /**\r | |
43 | Adds a record at the end of the performance measurement log\r | |
44 | that records the start time of a performance measurement.\r | |
45 | \r | |
46 | Adds a record to the end of the performance measurement log\r | |
47 | that contains the Handle, Token, Module and Identifier.\r | |
48 | The end time of the new record must be set to zero.\r | |
49 | If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.\r | |
50 | If TimeStamp is zero, the start time in the record is filled in with the value\r | |
51 | read from the current time stamp.\r | |
52 | \r | |
53 | @param Handle Pointer to environment specific context used\r | |
54 | to identify the component being measured.\r | |
55 | @param Token Pointer to a Null-terminated ASCII string\r | |
56 | that identifies the component being measured.\r | |
57 | @param Module Pointer to a Null-terminated ASCII string\r | |
58 | that identifies the module being measured.\r | |
59 | @param TimeStamp 64-bit time stamp.\r | |
60 | @param Identifier 32-bit identifier. If the value is 0, the created record\r | |
61 | is same as the one created by StartGauge of PERFORMANCE_PROTOCOL.\r | |
62 | \r | |
63 | @retval EFI_SUCCESS The data was read correctly from the device.\r | |
64 | @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.\r | |
65 | \r | |
66 | **/\r | |
67 | EFI_STATUS\r | |
68 | EFIAPI\r | |
69 | StartGaugeEx (\r | |
70 | IN CONST VOID *Handle, OPTIONAL\r | |
71 | IN CONST CHAR8 *Token, OPTIONAL\r | |
72 | IN CONST CHAR8 *Module, OPTIONAL\r | |
73 | IN UINT64 TimeStamp,\r | |
74 | IN UINT32 Identifier\r | |
75 | );\r | |
76 | \r | |
77 | /**\r | |
78 | Searches the performance measurement log from the beginning of the log\r | |
79 | for the first matching record that contains a zero end time and fills in a valid end time.\r | |
80 | \r | |
81 | Searches the performance measurement log from the beginning of the log\r | |
82 | for the first record that matches Handle, Token, Module and Identifier and has an end time value of zero.\r | |
83 | If the record can not be found then return EFI_NOT_FOUND.\r | |
84 | If the record is found and TimeStamp is not zero,\r | |
85 | then the end time in the record is filled in with the value specified by TimeStamp.\r | |
86 | If the record is found and TimeStamp is zero, then the end time in the matching record\r | |
87 | is filled in with the current time stamp value.\r | |
88 | \r | |
89 | @param Handle Pointer to environment specific context used\r | |
90 | to identify the component being measured.\r | |
91 | @param Token Pointer to a Null-terminated ASCII string\r | |
92 | that identifies the component being measured.\r | |
93 | @param Module Pointer to a Null-terminated ASCII string\r | |
94 | that identifies the module being measured.\r | |
95 | @param TimeStamp 64-bit time stamp.\r | |
96 | @param Identifier 32-bit identifier. If the value is 0, the found record\r | |
97 | is same as the one found by EndGauge of PERFORMANCE_PROTOCOL.\r | |
98 | \r | |
99 | @retval EFI_SUCCESS The end of the measurement was recorded.\r | |
100 | @retval EFI_NOT_FOUND The specified measurement record could not be found.\r | |
101 | \r | |
102 | **/\r | |
103 | EFI_STATUS\r | |
104 | EFIAPI\r | |
105 | EndGaugeEx (\r | |
106 | IN CONST VOID *Handle, OPTIONAL\r | |
107 | IN CONST CHAR8 *Token, OPTIONAL\r | |
108 | IN CONST CHAR8 *Module, OPTIONAL\r | |
109 | IN UINT64 TimeStamp,\r | |
110 | IN UINT32 Identifier\r | |
111 | );\r | |
112 | \r | |
113 | /**\r | |
114 | Retrieves a previously logged performance measurement.\r | |
115 | It can also retrieve the log created by StartGauge and EndGauge of PERFORMANCE_PROTOCOL,\r | |
116 | and then assign the Identifier with 0.\r | |
117 | \r | |
118 | Retrieves the performance log entry from the performance log specified by LogEntryKey.\r | |
119 | If it stands for a valid entry, then EFI_SUCCESS is returned and\r | |
120 | GaugeDataEntryEx stores the pointer to that entry.\r | |
121 | \r | |
122 | @param LogEntryKey The key for the previous performance measurement log entry.\r | |
123 | If 0, then the first performance measurement log entry is retrieved.\r | |
124 | @param GaugeDataEntryEx The indirect pointer to the extended gauge data entry specified by LogEntryKey\r | |
125 | if the retrieval is successful.\r | |
126 | \r | |
127 | @retval EFI_SUCCESS The GuageDataEntryEx is successfully found based on LogEntryKey.\r | |
128 | @retval EFI_NOT_FOUND The LogEntryKey is the last entry (equals to the total entry number).\r | |
129 | @retval EFI_INVALIDE_PARAMETER The LogEntryKey is not a valid entry (greater than the total entry number).\r | |
130 | @retval EFI_INVALIDE_PARAMETER GaugeDataEntryEx is NULL.\r | |
131 | \r | |
132 | **/\r | |
133 | EFI_STATUS\r | |
134 | EFIAPI\r | |
135 | GetGaugeEx (\r | |
136 | IN UINTN LogEntryKey,\r | |
137 | OUT GAUGE_DATA_ENTRY_EX **GaugeDataEntryEx\r | |
138 | );\r | |
139 | \r | |
140 | //\r | |
141 | // Interface declarations for SMM Performance Protocol.\r | |
d042c6e8 | 142 | //\r |
143 | /**\r | |
144 | Adds a record at the end of the performance measurement log\r | |
145 | that records the start time of a performance measurement.\r | |
146 | \r | |
147 | Adds a record to the end of the performance measurement log\r | |
148 | that contains the Handle, Token, and Module.\r | |
149 | The end time of the new record must be set to zero.\r | |
150 | If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.\r | |
151 | If TimeStamp is zero, the start time in the record is filled in with the value\r | |
152 | read from the current time stamp.\r | |
153 | \r | |
154 | @param Handle Pointer to environment specific context used\r | |
155 | to identify the component being measured.\r | |
156 | @param Token Pointer to a Null-terminated ASCII string\r | |
157 | that identifies the component being measured.\r | |
158 | @param Module Pointer to a Null-terminated ASCII string\r | |
159 | that identifies the module being measured.\r | |
160 | @param TimeStamp 64-bit time stamp.\r | |
161 | \r | |
162 | @retval EFI_SUCCESS The data was read correctly from the device.\r | |
163 | @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.\r | |
164 | \r | |
165 | **/\r | |
166 | EFI_STATUS\r | |
167 | EFIAPI\r | |
168 | StartGauge (\r | |
169 | IN CONST VOID *Handle, OPTIONAL\r | |
170 | IN CONST CHAR8 *Token, OPTIONAL\r | |
171 | IN CONST CHAR8 *Module, OPTIONAL\r | |
172 | IN UINT64 TimeStamp\r | |
173 | );\r | |
174 | \r | |
175 | /**\r | |
176 | Searches the performance measurement log from the beginning of the log\r | |
177 | for the first matching record that contains a zero end time and fills in a valid end time.\r | |
178 | \r | |
179 | Searches the performance measurement log from the beginning of the log\r | |
180 | for the first record that matches Handle, Token, and Module and has an end time value of zero.\r | |
181 | If the record can not be found then return EFI_NOT_FOUND.\r | |
182 | If the record is found and TimeStamp is not zero,\r | |
183 | then the end time in the record is filled in with the value specified by TimeStamp.\r | |
184 | If the record is found and TimeStamp is zero, then the end time in the matching record\r | |
185 | is filled in with the current time stamp value.\r | |
186 | \r | |
187 | @param Handle Pointer to environment specific context used\r | |
188 | to identify the component being measured.\r | |
189 | @param Token Pointer to a Null-terminated ASCII string\r | |
190 | that identifies the component being measured.\r | |
191 | @param Module Pointer to a Null-terminated ASCII string\r | |
192 | that identifies the module being measured.\r | |
193 | @param TimeStamp 64-bit time stamp.\r | |
194 | \r | |
195 | @retval EFI_SUCCESS The end of the measurement was recorded.\r | |
196 | @retval EFI_NOT_FOUND The specified measurement record could not be found.\r | |
197 | \r | |
198 | **/\r | |
199 | EFI_STATUS\r | |
200 | EFIAPI\r | |
201 | EndGauge (\r | |
202 | IN CONST VOID *Handle, OPTIONAL\r | |
203 | IN CONST CHAR8 *Token, OPTIONAL\r | |
204 | IN CONST CHAR8 *Module, OPTIONAL\r | |
205 | IN UINT64 TimeStamp\r | |
206 | );\r | |
207 | \r | |
208 | /**\r | |
209 | Retrieves a previously logged performance measurement.\r | |
f0da4d7d SZ |
210 | It can also retrieve the log created by StartGaugeEx and EndGaugeEx of PERFORMANCE_EX_PROTOCOL,\r |
211 | and then eliminate the Identifier.\r | |
d042c6e8 | 212 | \r |
213 | Retrieves the performance log entry from the performance log specified by LogEntryKey.\r | |
214 | If it stands for a valid entry, then EFI_SUCCESS is returned and\r | |
215 | GaugeDataEntry stores the pointer to that entry.\r | |
216 | \r | |
217 | @param LogEntryKey The key for the previous performance measurement log entry.\r | |
218 | If 0, then the first performance measurement log entry is retrieved.\r | |
219 | @param GaugeDataEntry The indirect pointer to the gauge data entry specified by LogEntryKey\r | |
220 | if the retrieval is successful.\r | |
221 | \r | |
222 | @retval EFI_SUCCESS The GuageDataEntry is successfully found based on LogEntryKey.\r | |
223 | @retval EFI_NOT_FOUND The LogEntryKey is the last entry (equals to the total entry number).\r | |
224 | @retval EFI_INVALIDE_PARAMETER The LogEntryKey is not a valid entry (greater than the total entry number).\r | |
225 | @retval EFI_INVALIDE_PARAMETER GaugeDataEntry is NULL.\r | |
226 | \r | |
227 | **/\r | |
228 | EFI_STATUS\r | |
229 | EFIAPI\r | |
230 | GetGauge (\r | |
231 | IN UINTN LogEntryKey,\r | |
232 | OUT GAUGE_DATA_ENTRY **GaugeDataEntry\r | |
233 | );\r | |
234 | \r | |
235 | \r | |
236 | #endif\r |