]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | This module install ACPI Firmware Performance Data Table (FPDT).\r | |
3 | \r | |
4 | This module register report status code listener to collect performance data\r | |
5 | for Firmware Basic Boot Performance Record and other boot performance records, \r | |
6 | and install FPDT to ACPI table.\r | |
7 | \r | |
8 | Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>\r | |
9 | This program and the accompanying materials\r | |
10 | are licensed and made available under the terms and conditions of the BSD License\r | |
11 | which accompanies this distribution. The full text of the license may be found at\r | |
12 | http://opensource.org/licenses/bsd-license.php\r | |
13 | \r | |
14 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
15 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
16 | \r | |
17 | **/\r | |
18 | \r | |
19 | #include <PiDxe.h>\r | |
20 | \r | |
21 | #include <Protocol/ReportStatusCodeHandler.h>\r | |
22 | #include <Protocol/AcpiTable.h>\r | |
23 | #include <Protocol/SmmCommunication.h>\r | |
24 | #include <Protocol/LockBox.h>\r | |
25 | #include <Protocol/Variable.h>\r | |
26 | \r | |
27 | #include <Guid/Acpi.h>\r | |
28 | #include <Guid/FirmwarePerformance.h>\r | |
29 | #include <Guid/EventGroup.h>\r | |
30 | #include <Guid/EventLegacyBios.h>\r | |
31 | \r | |
32 | #include <Library/UefiBootServicesTableLib.h>\r | |
33 | #include <Library/UefiRuntimeServicesTableLib.h>\r | |
34 | #include <Library/BaseLib.h>\r | |
35 | #include <Library/DebugLib.h>\r | |
36 | #include <Library/TimerLib.h>\r | |
37 | #include <Library/BaseMemoryLib.h>\r | |
38 | #include <Library/MemoryAllocationLib.h>\r | |
39 | #include <Library/PcdLib.h>\r | |
40 | #include <Library/HobLib.h>\r | |
41 | #include <Library/LockBoxLib.h>\r | |
42 | #include <Library/UefiLib.h>\r | |
43 | \r | |
44 | #define EXTENSION_RECORD_SIZE 0x10000\r | |
45 | #define SMM_BOOT_RECORD_COMM_SIZE OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof(SMM_BOOT_RECORD_COMMUNICATE)\r | |
46 | \r | |
47 | EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;\r | |
48 | \r | |
49 | BOOLEAN mLockBoxReady = FALSE;\r | |
50 | EFI_EVENT mReadyToBootEvent;\r | |
51 | EFI_EVENT mLegacyBootEvent;\r | |
52 | EFI_EVENT mExitBootServicesEvent;\r | |
53 | UINTN mFirmwarePerformanceTableTemplateKey = 0;\r | |
54 | UINT32 mBootRecordSize = 0;\r | |
55 | UINT32 mBootRecordMaxSize = 0;\r | |
56 | UINT8 *mBootRecordBuffer = NULL;\r | |
57 | BOOLEAN mDxeCoreReportStatusCodeEnable = FALSE;\r | |
58 | \r | |
59 | BOOT_PERFORMANCE_TABLE *mAcpiBootPerformanceTable = NULL;\r | |
60 | S3_PERFORMANCE_TABLE *mAcpiS3PerformanceTable = NULL;\r | |
61 | \r | |
62 | FIRMWARE_PERFORMANCE_TABLE mFirmwarePerformanceTableTemplate = {\r | |
63 | {\r | |
64 | EFI_ACPI_5_0_FIRMWARE_PERFORMANCE_DATA_TABLE_SIGNATURE,\r | |
65 | sizeof (FIRMWARE_PERFORMANCE_TABLE),\r | |
66 | EFI_ACPI_5_0_FIRMWARE_PERFORMANCE_DATA_TABLE_REVISION, // Revision\r | |
67 | 0x00, // Checksum will be updated at runtime\r | |
68 | //\r | |
69 | // It is expected that these values will be updated at EntryPoint.\r | |
70 | //\r | |
71 | {0x00}, // OEM ID is a 6 bytes long field\r | |
72 | 0x00, // OEM Table ID(8 bytes long)\r | |
73 | 0x00, // OEM Revision\r | |
74 | 0x00, // Creator ID\r | |
75 | 0x00, // Creator Revision\r | |
76 | },\r | |
77 | //\r | |
78 | // Firmware Basic Boot Performance Table Pointer Record.\r | |
79 | //\r | |
80 | {\r | |
81 | {\r | |
82 | EFI_ACPI_5_0_FPDT_RECORD_TYPE_FIRMWARE_BASIC_BOOT_POINTER , // Type\r | |
83 | sizeof (EFI_ACPI_5_0_FPDT_BOOT_PERFORMANCE_TABLE_POINTER_RECORD), // Length\r | |
84 | EFI_ACPI_5_0_FPDT_RECORD_REVISION_FIRMWARE_BASIC_BOOT_POINTER // Revision\r | |
85 | },\r | |
86 | 0, // Reserved\r | |
87 | 0 // BootPerformanceTablePointer will be updated at runtime.\r | |
88 | },\r | |
89 | //\r | |
90 | // S3 Performance Table Pointer Record.\r | |
91 | //\r | |
92 | {\r | |
93 | {\r | |
94 | EFI_ACPI_5_0_FPDT_RECORD_TYPE_S3_PERFORMANCE_TABLE_POINTER, // Type\r | |
95 | sizeof (EFI_ACPI_5_0_FPDT_S3_PERFORMANCE_TABLE_POINTER_RECORD), // Length\r | |
96 | EFI_ACPI_5_0_FPDT_RECORD_REVISION_S3_PERFORMANCE_TABLE_POINTER // Revision\r | |
97 | },\r | |
98 | 0, // Reserved\r | |
99 | 0 // S3PerformanceTablePointer will be updated at runtime.\r | |
100 | }\r | |
101 | };\r | |
102 | \r | |
103 | BOOT_PERFORMANCE_TABLE mBootPerformanceTableTemplate = {\r | |
104 | {\r | |
105 | EFI_ACPI_5_0_FPDT_BOOT_PERFORMANCE_TABLE_SIGNATURE,\r | |
106 | sizeof (BOOT_PERFORMANCE_TABLE)\r | |
107 | },\r | |
108 | {\r | |
109 | {\r | |
110 | EFI_ACPI_5_0_FPDT_RUNTIME_RECORD_TYPE_FIRMWARE_BASIC_BOOT, // Type\r | |
111 | sizeof (EFI_ACPI_5_0_FPDT_FIRMWARE_BASIC_BOOT_RECORD), // Length\r | |
112 | EFI_ACPI_5_0_FPDT_RUNTIME_RECORD_REVISION_FIRMWARE_BASIC_BOOT // Revision\r | |
113 | },\r | |
114 | 0, // Reserved\r | |
115 | //\r | |
116 | // These values will be updated at runtime.\r | |
117 | //\r | |
118 | 0, // ResetEnd\r | |
119 | 0, // OsLoaderLoadImageStart\r | |
120 | 0, // OsLoaderStartImageStart\r | |
121 | 0, // ExitBootServicesEntry\r | |
122 | 0 // ExitBootServicesExit\r | |
123 | }\r | |
124 | };\r | |
125 | \r | |
126 | S3_PERFORMANCE_TABLE mS3PerformanceTableTemplate = {\r | |
127 | {\r | |
128 | EFI_ACPI_5_0_FPDT_S3_PERFORMANCE_TABLE_SIGNATURE,\r | |
129 | sizeof (S3_PERFORMANCE_TABLE)\r | |
130 | },\r | |
131 | {\r | |
132 | {\r | |
133 | EFI_ACPI_5_0_FPDT_RUNTIME_RECORD_TYPE_S3_RESUME, // Type\r | |
134 | sizeof (EFI_ACPI_5_0_FPDT_S3_RESUME_RECORD), // Length\r | |
135 | EFI_ACPI_5_0_FPDT_RUNTIME_RECORD_REVISION_S3_RESUME // Revision\r | |
136 | },\r | |
137 | //\r | |
138 | // These values will be updated by Firmware Performance PEIM.\r | |
139 | //\r | |
140 | 0, // ResumeCount\r | |
141 | 0, // FullResume\r | |
142 | 0 // AverageResume\r | |
143 | },\r | |
144 | {\r | |
145 | {\r | |
146 | EFI_ACPI_5_0_FPDT_RUNTIME_RECORD_TYPE_S3_SUSPEND, // Type\r | |
147 | sizeof (EFI_ACPI_5_0_FPDT_S3_SUSPEND_RECORD), // Length\r | |
148 | EFI_ACPI_5_0_FPDT_RUNTIME_RECORD_REVISION_S3_SUSPEND // Revision\r | |
149 | },\r | |
150 | //\r | |
151 | // These values will be updated bye Firmware Performance SMM driver.\r | |
152 | //\r | |
153 | 0, // SuspendStart\r | |
154 | 0 // SuspendEnd\r | |
155 | }\r | |
156 | };\r | |
157 | \r | |
158 | /**\r | |
159 | This function calculates and updates an UINT8 checksum.\r | |
160 | \r | |
161 | @param[in] Buffer Pointer to buffer to checksum\r | |
162 | @param[in] Size Number of bytes to checksum\r | |
163 | \r | |
164 | **/\r | |
165 | VOID\r | |
166 | FpdtAcpiTableChecksum (\r | |
167 | IN UINT8 *Buffer,\r | |
168 | IN UINTN Size\r | |
169 | )\r | |
170 | {\r | |
171 | UINTN ChecksumOffset;\r | |
172 | \r | |
173 | ChecksumOffset = OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER, Checksum);\r | |
174 | \r | |
175 | //\r | |
176 | // Set checksum to 0 first.\r | |
177 | //\r | |
178 | Buffer[ChecksumOffset] = 0;\r | |
179 | \r | |
180 | //\r | |
181 | // Update checksum value.\r | |
182 | //\r | |
183 | Buffer[ChecksumOffset] = CalculateCheckSum8 (Buffer, Size);\r | |
184 | }\r | |
185 | \r | |
186 | /**\r | |
187 | Allocate EfiReservedMemoryType below 4G memory address.\r | |
188 | \r | |
189 | This function allocates EfiReservedMemoryType below 4G memory address.\r | |
190 | \r | |
191 | @param[in] Size Size of memory to allocate.\r | |
192 | \r | |
193 | @return Allocated address for output.\r | |
194 | \r | |
195 | **/\r | |
196 | VOID *\r | |
197 | FpdtAllocateReservedMemoryBelow4G (\r | |
198 | IN UINTN Size\r | |
199 | )\r | |
200 | {\r | |
201 | UINTN Pages;\r | |
202 | EFI_PHYSICAL_ADDRESS Address;\r | |
203 | EFI_STATUS Status;\r | |
204 | VOID *Buffer;\r | |
205 | \r | |
206 | Buffer = NULL;\r | |
207 | Pages = EFI_SIZE_TO_PAGES (Size);\r | |
208 | Address = 0xffffffff;\r | |
209 | \r | |
210 | Status = gBS->AllocatePages (\r | |
211 | AllocateMaxAddress,\r | |
212 | EfiReservedMemoryType,\r | |
213 | Pages,\r | |
214 | &Address\r | |
215 | );\r | |
216 | ASSERT_EFI_ERROR (Status);\r | |
217 | \r | |
218 | if (!EFI_ERROR (Status)) {\r | |
219 | Buffer = (VOID *) (UINTN) Address;\r | |
220 | ZeroMem (Buffer, Size);\r | |
221 | }\r | |
222 | \r | |
223 | return Buffer;\r | |
224 | }\r | |
225 | \r | |
226 | /**\r | |
227 | Callback function upon VariableArchProtocol and LockBoxProtocol\r | |
228 | to allocate S3 performance table memory and save the pointer to LockBox.\r | |
229 | \r | |
230 | @param[in] Event Event whose notification function is being invoked.\r | |
231 | @param[in] Context Pointer to the notification function's context.\r | |
232 | **/\r | |
233 | VOID\r | |
234 | EFIAPI\r | |
235 | FpdtAllocateS3PerformanceTableMemory (\r | |
236 | IN EFI_EVENT Event,\r | |
237 | IN VOID *Context\r | |
238 | )\r | |
239 | {\r | |
240 | EFI_STATUS Status;\r | |
241 | VOID *Interface;\r | |
242 | FIRMWARE_PERFORMANCE_VARIABLE PerformanceVariable;\r | |
243 | UINTN Size;\r | |
244 | EFI_PHYSICAL_ADDRESS S3PerformanceTablePointer;\r | |
245 | \r | |
246 | if (mLockBoxReady && (mAcpiS3PerformanceTable != NULL)) {\r | |
247 | //\r | |
248 | // The memory for S3 performance table should have been ready,\r | |
249 | // and the pointer should have been saved to LockBox, just return.\r | |
250 | //\r | |
251 | return;\r | |
252 | }\r | |
253 | \r | |
254 | if (!mLockBoxReady) {\r | |
255 | Status = gBS->LocateProtocol (&gEfiLockBoxProtocolGuid, NULL, &Interface);\r | |
256 | if (!EFI_ERROR (Status)) {\r | |
257 | //\r | |
258 | // LockBox services has been ready.\r | |
259 | //\r | |
260 | mLockBoxReady = TRUE;\r | |
261 | }\r | |
262 | }\r | |
263 | \r | |
264 | if (mAcpiS3PerformanceTable == NULL) {\r | |
265 | Status = gBS->LocateProtocol (&gEfiVariableArchProtocolGuid, NULL, &Interface);\r | |
266 | if (!EFI_ERROR (Status)) {\r | |
267 | //\r | |
268 | // Try to allocate the same runtime buffer as last time boot.\r | |
269 | //\r | |
270 | ZeroMem (&PerformanceVariable, sizeof (PerformanceVariable));\r | |
271 | Size = sizeof (PerformanceVariable);\r | |
272 | Status = gRT->GetVariable (\r | |
273 | EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,\r | |
274 | &gEfiFirmwarePerformanceGuid,\r | |
275 | NULL,\r | |
276 | &Size,\r | |
277 | &PerformanceVariable\r | |
278 | );\r | |
279 | if (!EFI_ERROR (Status)) {\r | |
280 | Status = gBS->AllocatePages (\r | |
281 | AllocateAddress,\r | |
282 | EfiReservedMemoryType,\r | |
283 | EFI_SIZE_TO_PAGES (sizeof (S3_PERFORMANCE_TABLE)),\r | |
284 | &PerformanceVariable.S3PerformanceTablePointer\r | |
285 | );\r | |
286 | if (!EFI_ERROR (Status)) {\r | |
287 | mAcpiS3PerformanceTable = (S3_PERFORMANCE_TABLE *) (UINTN) PerformanceVariable.S3PerformanceTablePointer;\r | |
288 | }\r | |
289 | }\r | |
290 | if (mAcpiS3PerformanceTable == NULL) {\r | |
291 | //\r | |
292 | // Fail to allocate at specified address, continue to allocate at any address.\r | |
293 | //\r | |
294 | mAcpiS3PerformanceTable = (S3_PERFORMANCE_TABLE *) FpdtAllocateReservedMemoryBelow4G (sizeof (S3_PERFORMANCE_TABLE));\r | |
295 | }\r | |
296 | DEBUG ((EFI_D_INFO, "FPDT: ACPI S3 Performance Table address = 0x%x\n", mAcpiS3PerformanceTable));\r | |
297 | if (mAcpiS3PerformanceTable != NULL) {\r | |
298 | CopyMem (mAcpiS3PerformanceTable, &mS3PerformanceTableTemplate, sizeof (mS3PerformanceTableTemplate));\r | |
299 | }\r | |
300 | }\r | |
301 | }\r | |
302 | \r | |
303 | if (mLockBoxReady && (mAcpiS3PerformanceTable != NULL)) {\r | |
304 | //\r | |
305 | // If LockBox services has been ready and memory for FPDT S3 performance table has been allocated,\r | |
306 | // save the pointer to LockBox for use in S3 resume.\r | |
307 | //\r | |
308 | S3PerformanceTablePointer = (EFI_PHYSICAL_ADDRESS) (UINTN) mAcpiS3PerformanceTable;\r | |
309 | Status = SaveLockBox (\r | |
310 | &gFirmwarePerformanceS3PointerGuid,\r | |
311 | &S3PerformanceTablePointer,\r | |
312 | sizeof (EFI_PHYSICAL_ADDRESS)\r | |
313 | );\r | |
314 | ASSERT_EFI_ERROR (Status);\r | |
315 | }\r | |
316 | }\r | |
317 | \r | |
318 | /**\r | |
319 | Install ACPI Firmware Performance Data Table (FPDT).\r | |
320 | \r | |
321 | @return Status code.\r | |
322 | \r | |
323 | **/\r | |
324 | EFI_STATUS\r | |
325 | InstallFirmwarePerformanceDataTable (\r | |
326 | VOID\r | |
327 | )\r | |
328 | {\r | |
329 | EFI_STATUS Status;\r | |
330 | EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol;\r | |
331 | UINTN Size;\r | |
332 | UINT8 *SmmBootRecordCommBuffer;\r | |
333 | EFI_SMM_COMMUNICATE_HEADER *SmmCommBufferHeader;\r | |
334 | SMM_BOOT_RECORD_COMMUNICATE *SmmCommData;\r | |
335 | UINTN CommSize;\r | |
336 | UINTN BootPerformanceDataSize;\r | |
337 | UINT8 *BootPerformanceData; \r | |
338 | EFI_SMM_COMMUNICATION_PROTOCOL *Communication;\r | |
339 | FIRMWARE_PERFORMANCE_VARIABLE PerformanceVariable;\r | |
340 | \r | |
341 | //\r | |
342 | // Get AcpiTable Protocol.\r | |
343 | //\r | |
344 | Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTableProtocol);\r | |
345 | if (EFI_ERROR (Status)) {\r | |
346 | return Status;\r | |
347 | }\r | |
348 | \r | |
349 | //\r | |
350 | // Collect boot records from SMM drivers.\r | |
351 | //\r | |
352 | SmmBootRecordCommBuffer = NULL;\r | |
353 | SmmCommData = NULL;\r | |
354 | Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &Communication);\r | |
355 | if (!EFI_ERROR (Status)) {\r | |
356 | //\r | |
357 | // Initialize communicate buffer \r | |
358 | //\r | |
359 | SmmBootRecordCommBuffer = AllocateZeroPool (SMM_BOOT_RECORD_COMM_SIZE);\r | |
360 | ASSERT (SmmBootRecordCommBuffer != NULL);\r | |
361 | SmmCommBufferHeader = (EFI_SMM_COMMUNICATE_HEADER*)SmmBootRecordCommBuffer;\r | |
362 | SmmCommData = (SMM_BOOT_RECORD_COMMUNICATE*)SmmCommBufferHeader->Data;\r | |
363 | ZeroMem((UINT8*)SmmCommData, sizeof(SMM_BOOT_RECORD_COMMUNICATE));\r | |
364 | \r | |
365 | CopyGuid (&SmmCommBufferHeader->HeaderGuid, &gEfiFirmwarePerformanceGuid);\r | |
366 | SmmCommBufferHeader->MessageLength = sizeof(SMM_BOOT_RECORD_COMMUNICATE);\r | |
367 | CommSize = SMM_BOOT_RECORD_COMM_SIZE;\r | |
368 | \r | |
369 | //\r | |
370 | // Get the size of boot records.\r | |
371 | //\r | |
372 | SmmCommData->Function = SMM_FPDT_FUNCTION_GET_BOOT_RECORD_SIZE;\r | |
373 | SmmCommData->BootRecordData = NULL;\r | |
374 | Status = Communication->Communicate (Communication, SmmBootRecordCommBuffer, &CommSize);\r | |
375 | ASSERT_EFI_ERROR (Status);\r | |
376 | \r | |
377 | if (!EFI_ERROR (SmmCommData->ReturnStatus) && SmmCommData->BootRecordSize != 0) {\r | |
378 | //\r | |
379 | // Get all boot records\r | |
380 | //\r | |
381 | SmmCommData->Function = SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA;\r | |
382 | SmmCommData->BootRecordData = AllocateZeroPool(SmmCommData->BootRecordSize);\r | |
383 | ASSERT (SmmCommData->BootRecordData != NULL);\r | |
384 | \r | |
385 | Status = Communication->Communicate (Communication, SmmBootRecordCommBuffer, &CommSize);\r | |
386 | ASSERT_EFI_ERROR (Status);\r | |
387 | ASSERT_EFI_ERROR(SmmCommData->ReturnStatus);\r | |
388 | }\r | |
389 | }\r | |
390 | \r | |
391 | //\r | |
392 | // Prepare memory for Boot Performance table.\r | |
393 | // Boot Performance table includes BasicBoot record, and one or more appended Boot Records. \r | |
394 | //\r | |
395 | BootPerformanceDataSize = sizeof (BOOT_PERFORMANCE_TABLE) + mBootRecordSize + PcdGet32 (PcdExtFpdtBootRecordPadSize);\r | |
396 | if (SmmCommData != NULL) {\r | |
397 | BootPerformanceDataSize += SmmCommData->BootRecordSize;\r | |
398 | }\r | |
399 | \r | |
400 | //\r | |
401 | // Try to allocate the same runtime buffer as last time boot.\r | |
402 | //\r | |
403 | ZeroMem (&PerformanceVariable, sizeof (PerformanceVariable));\r | |
404 | Size = sizeof (PerformanceVariable);\r | |
405 | Status = gRT->GetVariable (\r | |
406 | EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,\r | |
407 | &gEfiFirmwarePerformanceGuid,\r | |
408 | NULL,\r | |
409 | &Size,\r | |
410 | &PerformanceVariable\r | |
411 | );\r | |
412 | if (!EFI_ERROR (Status)) {\r | |
413 | Status = gBS->AllocatePages (\r | |
414 | AllocateAddress,\r | |
415 | EfiReservedMemoryType,\r | |
416 | EFI_SIZE_TO_PAGES (BootPerformanceDataSize),\r | |
417 | &PerformanceVariable.BootPerformanceTablePointer\r | |
418 | );\r | |
419 | if (!EFI_ERROR (Status)) {\r | |
420 | mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *) (UINTN) PerformanceVariable.BootPerformanceTablePointer;\r | |
421 | }\r | |
422 | }\r | |
423 | \r | |
424 | if (mAcpiBootPerformanceTable == NULL) {\r | |
425 | //\r | |
426 | // Fail to allocate at specified address, continue to allocate at any address.\r | |
427 | //\r | |
428 | mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *) FpdtAllocateReservedMemoryBelow4G (BootPerformanceDataSize);\r | |
429 | }\r | |
430 | DEBUG ((EFI_D_INFO, "FPDT: ACPI Boot Performance Table address = 0x%x\n", mAcpiBootPerformanceTable));\r | |
431 | \r | |
432 | if (mAcpiBootPerformanceTable == NULL) {\r | |
433 | if (SmmCommData != NULL && SmmCommData->BootRecordData != NULL) {\r | |
434 | FreePool (SmmCommData->BootRecordData);\r | |
435 | }\r | |
436 | if (SmmBootRecordCommBuffer != NULL) {\r | |
437 | FreePool (SmmBootRecordCommBuffer);\r | |
438 | }\r | |
439 | if (mAcpiS3PerformanceTable != NULL) {\r | |
440 | FreePages (mAcpiS3PerformanceTable, EFI_SIZE_TO_PAGES (sizeof (S3_PERFORMANCE_TABLE)));\r | |
441 | }\r | |
442 | return EFI_OUT_OF_RESOURCES;\r | |
443 | }\r | |
444 | \r | |
445 | //\r | |
446 | // Prepare Boot Performance Table.\r | |
447 | //\r | |
448 | BootPerformanceData = (UINT8 *) mAcpiBootPerformanceTable;\r | |
449 | //\r | |
450 | // Fill Basic Boot record to Boot Performance Table.\r | |
451 | //\r | |
452 | CopyMem (mAcpiBootPerformanceTable, &mBootPerformanceTableTemplate, sizeof (mBootPerformanceTableTemplate));\r | |
453 | BootPerformanceData = BootPerformanceData + mAcpiBootPerformanceTable->Header.Length;\r | |
454 | //\r | |
455 | // Fill Boot records from boot drivers.\r | |
456 | //\r | |
457 | CopyMem (BootPerformanceData, mBootRecordBuffer, mBootRecordSize);\r | |
458 | mAcpiBootPerformanceTable->Header.Length += mBootRecordSize;\r | |
459 | BootPerformanceData = BootPerformanceData + mBootRecordSize;\r | |
460 | if (SmmCommData != NULL && SmmCommData->BootRecordData != NULL) {\r | |
461 | //\r | |
462 | // Fill Boot records from SMM drivers.\r | |
463 | //\r | |
464 | CopyMem (BootPerformanceData, SmmCommData->BootRecordData, SmmCommData->BootRecordSize);\r | |
465 | FreePool (SmmCommData->BootRecordData);\r | |
466 | mAcpiBootPerformanceTable->Header.Length = (UINT32) (mAcpiBootPerformanceTable->Header.Length + SmmCommData->BootRecordSize);\r | |
467 | BootPerformanceData = BootPerformanceData + SmmCommData->BootRecordSize;\r | |
468 | }\r | |
469 | if (SmmBootRecordCommBuffer != NULL) {\r | |
470 | FreePool (SmmBootRecordCommBuffer);\r | |
471 | }\r | |
472 | \r | |
473 | //\r | |
474 | // Save Boot Performance Table address to Variable for use in S4 resume.\r | |
475 | //\r | |
476 | PerformanceVariable.BootPerformanceTablePointer = (EFI_PHYSICAL_ADDRESS) (UINTN) mAcpiBootPerformanceTable;\r | |
477 | //\r | |
478 | // Update Boot Performance Table Pointer in template.\r | |
479 | //\r | |
480 | mFirmwarePerformanceTableTemplate.BootPointerRecord.BootPerformanceTablePointer = (UINT64) (UINTN) mAcpiBootPerformanceTable;\r | |
481 | \r | |
482 | //\r | |
483 | // Save S3 Performance Table address to Variable for use in S4 resume.\r | |
484 | //\r | |
485 | PerformanceVariable.S3PerformanceTablePointer = (EFI_PHYSICAL_ADDRESS) (UINTN) mAcpiS3PerformanceTable;\r | |
486 | //\r | |
487 | // Update S3 Performance Table Pointer in template.\r | |
488 | //\r | |
489 | mFirmwarePerformanceTableTemplate.S3PointerRecord.S3PerformanceTablePointer = (UINT64) (UINTN) mAcpiS3PerformanceTable;\r | |
490 | //\r | |
491 | // Save Runtime Performance Table pointers to Variable.\r | |
492 | // Don't check SetVariable return status. It doesn't impact FPDT table generation. \r | |
493 | //\r | |
494 | gRT->SetVariable (\r | |
495 | EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,\r | |
496 | &gEfiFirmwarePerformanceGuid,\r | |
497 | EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r | |
498 | sizeof (PerformanceVariable),\r | |
499 | &PerformanceVariable\r | |
500 | );\r | |
501 | \r | |
502 | //\r | |
503 | // Publish Firmware Performance Data Table.\r | |
504 | //\r | |
505 | FpdtAcpiTableChecksum ((UINT8 *) &mFirmwarePerformanceTableTemplate, mFirmwarePerformanceTableTemplate.Header.Length);\r | |
506 | Status = AcpiTableProtocol->InstallAcpiTable (\r | |
507 | AcpiTableProtocol,\r | |
508 | &mFirmwarePerformanceTableTemplate,\r | |
509 | mFirmwarePerformanceTableTemplate.Header.Length,\r | |
510 | &mFirmwarePerformanceTableTemplateKey\r | |
511 | );\r | |
512 | if (EFI_ERROR (Status)) {\r | |
513 | FreePages (mAcpiBootPerformanceTable, EFI_SIZE_TO_PAGES (BootPerformanceDataSize));\r | |
514 | if (mAcpiS3PerformanceTable != NULL) {\r | |
515 | FreePages (mAcpiS3PerformanceTable, EFI_SIZE_TO_PAGES (sizeof (S3_PERFORMANCE_TABLE)));\r | |
516 | }\r | |
517 | mAcpiBootPerformanceTable = NULL;\r | |
518 | mAcpiS3PerformanceTable = NULL;\r | |
519 | return Status;\r | |
520 | }\r | |
521 | \r | |
522 | //\r | |
523 | // Free temp Boot record, and update Boot Record to point to Basic Boot performance table.\r | |
524 | //\r | |
525 | if (mBootRecordBuffer != NULL) {\r | |
526 | FreePool (mBootRecordBuffer);\r | |
527 | }\r | |
528 | mBootRecordBuffer = (UINT8 *) mAcpiBootPerformanceTable;\r | |
529 | mBootRecordSize = mAcpiBootPerformanceTable->Header.Length;\r | |
530 | mBootRecordMaxSize = mBootRecordSize + PcdGet32 (PcdExtFpdtBootRecordPadSize);\r | |
531 | \r | |
532 | return EFI_SUCCESS;\r | |
533 | }\r | |
534 | \r | |
535 | /**\r | |
536 | Notify function for event group EFI_EVENT_GROUP_READY_TO_BOOT. This is used to\r | |
537 | install the Firmware Performance Data Table.\r | |
538 | \r | |
539 | @param[in] Event The Event that is being processed.\r | |
540 | @param[in] Context The Event Context.\r | |
541 | \r | |
542 | **/\r | |
543 | VOID\r | |
544 | EFIAPI\r | |
545 | FpdtReadyToBootEventNotify (\r | |
546 | IN EFI_EVENT Event,\r | |
547 | IN VOID *Context\r | |
548 | )\r | |
549 | {\r | |
550 | if (mAcpiBootPerformanceTable == NULL) {\r | |
551 | //\r | |
552 | // ACPI Firmware Performance Data Table not installed yet, install it now.\r | |
553 | //\r | |
554 | InstallFirmwarePerformanceDataTable ();\r | |
555 | }\r | |
556 | }\r | |
557 | \r | |
558 | /**\r | |
559 | Notify function for event group EFI_EVENT_LEGACY_BOOT_GUID. This is used to\r | |
560 | record performance data for OsLoaderLoadImageStart in FPDT for legacy boot.\r | |
561 | \r | |
562 | @param[in] Event The Event that is being processed.\r | |
563 | @param[in] Context The Event Context.\r | |
564 | \r | |
565 | **/\r | |
566 | VOID\r | |
567 | EFIAPI\r | |
568 | FpdtLegacyBootEventNotify (\r | |
569 | IN EFI_EVENT Event,\r | |
570 | IN VOID *Context\r | |
571 | )\r | |
572 | {\r | |
573 | if (mAcpiBootPerformanceTable == NULL) {\r | |
574 | //\r | |
575 | // Firmware Performance Data Table not installed, do nothing.\r | |
576 | //\r | |
577 | return ;\r | |
578 | }\r | |
579 | \r | |
580 | //\r | |
581 | // Update Firmware Basic Boot Performance Record for legacy boot.\r | |
582 | //\r | |
583 | mAcpiBootPerformanceTable->BasicBoot.OsLoaderLoadImageStart = 0;\r | |
584 | mAcpiBootPerformanceTable->BasicBoot.OsLoaderStartImageStart = GetTimeInNanoSecond (GetPerformanceCounter ());\r | |
585 | mAcpiBootPerformanceTable->BasicBoot.ExitBootServicesEntry = 0;\r | |
586 | mAcpiBootPerformanceTable->BasicBoot.ExitBootServicesExit = 0;\r | |
587 | \r | |
588 | //\r | |
589 | // Dump FPDT Boot Performance record.\r | |
590 | //\r | |
591 | DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ResetEnd = %ld\n", mAcpiBootPerformanceTable->BasicBoot.ResetEnd));\r | |
592 | DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - OsLoaderLoadImageStart = 0\n"));\r | |
593 | DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - OsLoaderStartImageStart = %ld\n", mAcpiBootPerformanceTable->BasicBoot.OsLoaderStartImageStart));\r | |
594 | DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ExitBootServicesEntry = 0\n"));\r | |
595 | DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ExitBootServicesExit = 0\n"));\r | |
596 | }\r | |
597 | \r | |
598 | /**\r | |
599 | Report status code listener of FPDT. This is used to collect performance data\r | |
600 | for OsLoaderLoadImageStart and OsLoaderStartImageStart in FPDT.\r | |
601 | \r | |
602 | @param[in] CodeType Indicates the type of status code being reported.\r | |
603 | @param[in] Value Describes the current status of a hardware or software entity.\r | |
604 | This included information about the class and subclass that is used to\r | |
605 | classify the entity as well as an operation.\r | |
606 | @param[in] Instance The enumeration of a hardware or software entity within\r | |
607 | the system. Valid instance numbers start with 1.\r | |
608 | @param[in] CallerId This optional parameter may be used to identify the caller.\r | |
609 | This parameter allows the status code driver to apply different rules to\r | |
610 | different callers.\r | |
611 | @param[in] Data This optional parameter may be used to pass additional data.\r | |
612 | \r | |
613 | @retval EFI_SUCCESS Status code is what we expected.\r | |
614 | @retval EFI_UNSUPPORTED Status code not supported.\r | |
615 | \r | |
616 | **/\r | |
617 | EFI_STATUS\r | |
618 | EFIAPI\r | |
619 | FpdtStatusCodeListenerDxe (\r | |
620 | IN EFI_STATUS_CODE_TYPE CodeType,\r | |
621 | IN EFI_STATUS_CODE_VALUE Value,\r | |
622 | IN UINT32 Instance,\r | |
623 | IN EFI_GUID *CallerId,\r | |
624 | IN EFI_STATUS_CODE_DATA *Data\r | |
625 | )\r | |
626 | {\r | |
627 | EFI_STATUS Status;\r | |
628 | \r | |
629 | //\r | |
630 | // Check whether status code is what we are interested in.\r | |
631 | //\r | |
632 | if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) != EFI_PROGRESS_CODE) {\r | |
633 | return EFI_UNSUPPORTED;\r | |
634 | }\r | |
635 | \r | |
636 | if (Value == (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_HANDOFF_TO_NEXT)) {\r | |
637 | //\r | |
638 | // DxeCore ReportStatusCode Enable so that the capability can be supported.\r | |
639 | //\r | |
640 | mDxeCoreReportStatusCodeEnable = TRUE;\r | |
641 | }\r | |
642 | \r | |
643 | Status = EFI_SUCCESS;\r | |
644 | if (Value == PcdGet32 (PcdProgressCodeOsLoaderLoad)) {\r | |
645 | //\r | |
646 | // Progress code for OS Loader LoadImage.\r | |
647 | //\r | |
648 | if (mAcpiBootPerformanceTable == NULL) {\r | |
649 | return Status;\r | |
650 | }\r | |
651 | \r | |
652 | //\r | |
653 | // Update OS Loader LoadImage Start for UEFI boot.\r | |
654 | //\r | |
655 | mAcpiBootPerformanceTable->BasicBoot.OsLoaderLoadImageStart = GetTimeInNanoSecond (GetPerformanceCounter ());\r | |
656 | } else if (Value == PcdGet32 (PcdProgressCodeOsLoaderStart)) {\r | |
657 | //\r | |
658 | // Progress code for OS Loader StartImage.\r | |
659 | //\r | |
660 | if (mAcpiBootPerformanceTable == NULL) {\r | |
661 | return Status;\r | |
662 | }\r | |
663 | \r | |
664 | //\r | |
665 | // Update OS Loader StartImage Start for UEFI boot.\r | |
666 | //\r | |
667 | mAcpiBootPerformanceTable->BasicBoot.OsLoaderStartImageStart = GetTimeInNanoSecond (GetPerformanceCounter ());\r | |
668 | } else if (Value == (EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES)) {\r | |
669 | //\r | |
670 | // Unregister boot time report status code listener.\r | |
671 | //\r | |
672 | mRscHandlerProtocol->Unregister (FpdtStatusCodeListenerDxe);\r | |
673 | \r | |
674 | //\r | |
675 | // Progress code for ExitBootServices.\r | |
676 | //\r | |
677 | if (mAcpiBootPerformanceTable == NULL) {\r | |
678 | return Status;\r | |
679 | }\r | |
680 | \r | |
681 | //\r | |
682 | // Update ExitBootServicesExit for UEFI boot.\r | |
683 | //\r | |
684 | mAcpiBootPerformanceTable->BasicBoot.ExitBootServicesExit = GetTimeInNanoSecond (GetPerformanceCounter ());\r | |
685 | } else if (Data != NULL && CompareGuid (&Data->Type, &gEfiFirmwarePerformanceGuid)) {\r | |
686 | //\r | |
687 | // Append one or more Boot records\r | |
688 | //\r | |
689 | if (mAcpiBootPerformanceTable == NULL) {\r | |
690 | //\r | |
691 | // Append Boot records before FPDT ACPI table is installed. \r | |
692 | //\r | |
693 | if (mBootRecordSize + Data->Size > mBootRecordMaxSize) {\r | |
694 | mBootRecordBuffer = ReallocatePool (mBootRecordSize, mBootRecordSize + Data->Size + EXTENSION_RECORD_SIZE, mBootRecordBuffer);\r | |
695 | ASSERT (mBootRecordBuffer != NULL);\r | |
696 | mBootRecordMaxSize = mBootRecordSize + Data->Size + EXTENSION_RECORD_SIZE;\r | |
697 | }\r | |
698 | //\r | |
699 | // Save boot record into the temp memory space.\r | |
700 | //\r | |
701 | CopyMem (mBootRecordBuffer + mBootRecordSize, Data + 1, Data->Size);\r | |
702 | mBootRecordSize += Data->Size;\r | |
703 | } else {\r | |
704 | //\r | |
705 | // Append Boot records after FPDT ACPI table is installed. \r | |
706 | //\r | |
707 | if (mBootRecordSize + Data->Size > mBootRecordMaxSize) {\r | |
708 | //\r | |
709 | // No enough space to save boot record.\r | |
710 | //\r | |
711 | Status = EFI_OUT_OF_RESOURCES;\r | |
712 | } else {\r | |
713 | //\r | |
714 | // Save boot record into BootPerformance table\r | |
715 | //\r | |
716 | CopyMem (mBootRecordBuffer + mBootRecordSize, Data + 1, Data->Size);\r | |
717 | mBootRecordSize += Data->Size;\r | |
718 | mAcpiBootPerformanceTable->Header.Length = mBootRecordSize;\r | |
719 | }\r | |
720 | }\r | |
721 | } else {\r | |
722 | //\r | |
723 | // Ignore else progress code.\r | |
724 | //\r | |
725 | Status = EFI_UNSUPPORTED;\r | |
726 | }\r | |
727 | \r | |
728 | return Status;\r | |
729 | }\r | |
730 | \r | |
731 | \r | |
732 | /**\r | |
733 | Notify function for event EVT_SIGNAL_EXIT_BOOT_SERVICES. This is used to record\r | |
734 | performance data for ExitBootServicesEntry in FPDT.\r | |
735 | \r | |
736 | @param[in] Event The Event that is being processed.\r | |
737 | @param[in] Context The Event Context.\r | |
738 | \r | |
739 | **/\r | |
740 | VOID\r | |
741 | EFIAPI\r | |
742 | FpdtExitBootServicesEventNotify (\r | |
743 | IN EFI_EVENT Event,\r | |
744 | IN VOID *Context\r | |
745 | )\r | |
746 | {\r | |
747 | if (!mDxeCoreReportStatusCodeEnable) {\r | |
748 | //\r | |
749 | // When DxeCore Report Status Code is disabled, \r | |
750 | // Unregister boot time report status code listener at ExitBootService Event.\r | |
751 | //\r | |
752 | mRscHandlerProtocol->Unregister (FpdtStatusCodeListenerDxe);\r | |
753 | }\r | |
754 | \r | |
755 | if (mAcpiBootPerformanceTable == NULL) {\r | |
756 | //\r | |
757 | // Firmware Performance Data Table not installed, do nothing.\r | |
758 | //\r | |
759 | return ;\r | |
760 | }\r | |
761 | \r | |
762 | //\r | |
763 | // Update Firmware Basic Boot Performance Record for UEFI boot.\r | |
764 | //\r | |
765 | mAcpiBootPerformanceTable->BasicBoot.ExitBootServicesEntry = GetTimeInNanoSecond (GetPerformanceCounter ());\r | |
766 | \r | |
767 | //\r | |
768 | // Dump FPDT Boot Performance record.\r | |
769 | //\r | |
770 | DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ResetEnd = %ld\n", mAcpiBootPerformanceTable->BasicBoot.ResetEnd));\r | |
771 | DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - OsLoaderLoadImageStart = %ld\n", mAcpiBootPerformanceTable->BasicBoot.OsLoaderLoadImageStart));\r | |
772 | DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - OsLoaderStartImageStart = %ld\n", mAcpiBootPerformanceTable->BasicBoot.OsLoaderStartImageStart));\r | |
773 | DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ExitBootServicesEntry = %ld\n", mAcpiBootPerformanceTable->BasicBoot.ExitBootServicesEntry));\r | |
774 | //\r | |
775 | // ExitBootServicesExit will be updated later, so don't dump it here.\r | |
776 | //\r | |
777 | }\r | |
778 | \r | |
779 | /**\r | |
780 | The module Entry Point of the Firmware Performance Data Table DXE driver.\r | |
781 | \r | |
782 | @param[in] ImageHandle The firmware allocated handle for the EFI image.\r | |
783 | @param[in] SystemTable A pointer to the EFI System Table.\r | |
784 | \r | |
785 | @retval EFI_SUCCESS The entry point is executed successfully.\r | |
786 | @retval Other Some error occurs when executing this entry point.\r | |
787 | \r | |
788 | **/\r | |
789 | EFI_STATUS\r | |
790 | EFIAPI\r | |
791 | FirmwarePerformanceDxeEntryPoint (\r | |
792 | IN EFI_HANDLE ImageHandle,\r | |
793 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
794 | )\r | |
795 | {\r | |
796 | EFI_STATUS Status;\r | |
797 | EFI_HOB_GUID_TYPE *GuidHob;\r | |
798 | FIRMWARE_SEC_PERFORMANCE *Performance;\r | |
799 | VOID *Registration;\r | |
800 | UINT64 OemTableId;\r | |
801 | \r | |
802 | CopyMem (\r | |
803 | mFirmwarePerformanceTableTemplate.Header.OemId,\r | |
804 | PcdGetPtr (PcdAcpiDefaultOemId),\r | |
805 | sizeof (mFirmwarePerformanceTableTemplate.Header.OemId)\r | |
806 | );\r | |
807 | OemTableId = PcdGet64 (PcdAcpiDefaultOemTableId);\r | |
808 | CopyMem (&mFirmwarePerformanceTableTemplate.Header.OemTableId, &OemTableId, sizeof (UINT64));\r | |
809 | mFirmwarePerformanceTableTemplate.Header.OemRevision = PcdGet32 (PcdAcpiDefaultOemRevision);\r | |
810 | mFirmwarePerformanceTableTemplate.Header.CreatorId = PcdGet32 (PcdAcpiDefaultCreatorId);\r | |
811 | mFirmwarePerformanceTableTemplate.Header.CreatorRevision = PcdGet32 (PcdAcpiDefaultCreatorRevision);\r | |
812 | \r | |
813 | //\r | |
814 | // Get Report Status Code Handler Protocol.\r | |
815 | //\r | |
816 | Status = gBS->LocateProtocol (&gEfiRscHandlerProtocolGuid, NULL, (VOID **) &mRscHandlerProtocol);\r | |
817 | ASSERT_EFI_ERROR (Status);\r | |
818 | \r | |
819 | //\r | |
820 | // Register report status code listener for OS Loader load and start.\r | |
821 | //\r | |
822 | Status = mRscHandlerProtocol->Register (FpdtStatusCodeListenerDxe, TPL_HIGH_LEVEL);\r | |
823 | ASSERT_EFI_ERROR (Status);\r | |
824 | \r | |
825 | //\r | |
826 | // Register the notify function to update FPDT on ExitBootServices Event.\r | |
827 | //\r | |
828 | Status = gBS->CreateEventEx (\r | |
829 | EVT_NOTIFY_SIGNAL,\r | |
830 | TPL_NOTIFY,\r | |
831 | FpdtExitBootServicesEventNotify,\r | |
832 | NULL,\r | |
833 | &gEfiEventExitBootServicesGuid,\r | |
834 | &mExitBootServicesEvent\r | |
835 | );\r | |
836 | ASSERT_EFI_ERROR (Status);\r | |
837 | \r | |
838 | //\r | |
839 | // Create ready to boot event to install ACPI FPDT table.\r | |
840 | //\r | |
841 | Status = gBS->CreateEventEx (\r | |
842 | EVT_NOTIFY_SIGNAL,\r | |
843 | TPL_NOTIFY,\r | |
844 | FpdtReadyToBootEventNotify,\r | |
845 | NULL,\r | |
846 | &gEfiEventReadyToBootGuid,\r | |
847 | &mReadyToBootEvent\r | |
848 | );\r | |
849 | ASSERT_EFI_ERROR (Status);\r | |
850 | \r | |
851 | //\r | |
852 | // Create legacy boot event to log OsLoaderStartImageStart for legacy boot.\r | |
853 | //\r | |
854 | Status = gBS->CreateEventEx (\r | |
855 | EVT_NOTIFY_SIGNAL,\r | |
856 | TPL_NOTIFY,\r | |
857 | FpdtLegacyBootEventNotify,\r | |
858 | NULL,\r | |
859 | &gEfiEventLegacyBootGuid,\r | |
860 | &mLegacyBootEvent\r | |
861 | );\r | |
862 | ASSERT_EFI_ERROR (Status);\r | |
863 | \r | |
864 | //\r | |
865 | // Retrieve GUID HOB data that contains the ResetEnd.\r | |
866 | //\r | |
867 | GuidHob = GetFirstGuidHob (&gEfiFirmwarePerformanceGuid);\r | |
868 | if (GuidHob != NULL) {\r | |
869 | Performance = (FIRMWARE_SEC_PERFORMANCE *) GET_GUID_HOB_DATA (GuidHob);\r | |
870 | mBootPerformanceTableTemplate.BasicBoot.ResetEnd = Performance->ResetEnd;\r | |
871 | } else {\r | |
872 | //\r | |
873 | // SEC Performance Data Hob not found, ResetEnd in ACPI FPDT table will be 0.\r | |
874 | //\r | |
875 | DEBUG ((EFI_D_ERROR, "FPDT: WARNING: SEC Performance Data Hob not found, ResetEnd will be set to 0!\n"));\r | |
876 | }\r | |
877 | \r | |
878 | if (FeaturePcdGet (PcdFirmwarePerformanceDataTableS3Support)) {\r | |
879 | //\r | |
880 | // Register callback function upon VariableArchProtocol and LockBoxProtocol\r | |
881 | // to allocate S3 performance table memory and save the pointer to LockBox.\r | |
882 | //\r | |
883 | EfiCreateProtocolNotifyEvent (\r | |
884 | &gEfiVariableArchProtocolGuid,\r | |
885 | TPL_CALLBACK,\r | |
886 | FpdtAllocateS3PerformanceTableMemory,\r | |
887 | NULL,\r | |
888 | &Registration\r | |
889 | );\r | |
890 | EfiCreateProtocolNotifyEvent (\r | |
891 | &gEfiLockBoxProtocolGuid,\r | |
892 | TPL_CALLBACK,\r | |
893 | FpdtAllocateS3PerformanceTableMemory,\r | |
894 | NULL,\r | |
895 | &Registration\r | |
896 | );\r | |
897 | } else {\r | |
898 | //\r | |
899 | // Exclude S3 Performance Table Pointer from FPDT table template.\r | |
900 | //\r | |
901 | mFirmwarePerformanceTableTemplate.Header.Length -= sizeof (EFI_ACPI_5_0_FPDT_S3_PERFORMANCE_TABLE_POINTER_RECORD);\r | |
902 | }\r | |
903 | \r | |
904 | return EFI_SUCCESS;\r | |
905 | }\r |