]> git.proxmox.com Git - mirror_edk2.git/blob - DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c
DynamicTablesPkg: Apply uncrustify changes
[mirror_edk2.git] / DynamicTablesPkg / Drivers / DynamicTableManagerDxe / DynamicTableManagerDxe.c
1 /** @file
2 Dynamic Table Manager Dxe
3
4 Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #include <Library/DebugLib.h>
11 #include <Library/PcdLib.h>
12 #include <Library/UefiBootServicesTableLib.h>
13 #include <Protocol/AcpiTable.h>
14
15 // Module specific include files.
16 #include <AcpiTableGenerator.h>
17 #include <ConfigurationManagerObject.h>
18 #include <ConfigurationManagerHelper.h>
19 #include <DeviceTreeTableGenerator.h>
20 #include <Library/TableHelperLib.h>
21 #include <Protocol/ConfigurationManagerProtocol.h>
22 #include <Protocol/DynamicTableFactoryProtocol.h>
23 #include <SmbiosTableGenerator.h>
24
25 /** This macro expands to a function that retrieves the ACPI Table
26 List from the Configuration Manager.
27 */
28 GET_OBJECT_LIST (
29 EObjNameSpaceStandard,
30 EStdObjAcpiTableList,
31 CM_STD_OBJ_ACPI_TABLE_INFO
32 )
33
34 /** A helper function to build and install a single ACPI table.
35
36 This is a helper function that invokes the Table generator interface
37 for building an ACPI table. It uses the AcpiTableProtocol to install the
38 table, then frees the resources allocated for generating it.
39
40 @param [in] TableFactoryProtocol Pointer to the Table Factory Protocol
41 interface.
42 @param [in] CfgMgrProtocol Pointer to the Configuration Manager
43 Protocol Interface.
44 @param [in] Generator Pointer to the AcpiTable generator.
45 @param [in] AcpiTableProtocol Pointer to the AcpiTable protocol.
46 @param [in] AcpiTableInfo Pointer to the ACPI table Info.
47
48 @retval EFI_SUCCESS Success.
49 @retval EFI_INVALID_PARAMETER A parameter is invalid.
50 @retval EFI_NOT_FOUND Required object is not found.
51 @retval EFI_BAD_BUFFER_SIZE Size returned by the Configuration Manager
52 is less than the Object size for the
53 requested object.
54 **/
55 STATIC
56 EFI_STATUS
57 EFIAPI
58 BuildAndInstallSingleAcpiTable (
59 IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol,
60 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
61 IN CONST ACPI_TABLE_GENERATOR *CONST Generator,
62 IN EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol,
63 IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo
64 )
65 {
66 EFI_STATUS Status;
67 EFI_STATUS Status1;
68 EFI_ACPI_DESCRIPTION_HEADER *AcpiTable;
69 UINTN TableHandle;
70
71 AcpiTable = NULL;
72 Status = Generator->BuildAcpiTable (
73 Generator,
74 AcpiTableInfo,
75 CfgMgrProtocol,
76 &AcpiTable
77 );
78 if (EFI_ERROR (Status)) {
79 DEBUG ((
80 DEBUG_ERROR,
81 "ERROR: Failed to Build Table." \
82 " TableGeneratorId = 0x%x. Status = %r\n",
83 AcpiTableInfo->TableGeneratorId,
84 Status
85 ));
86 // Free any allocated resources.
87 goto exit_handler;
88 }
89
90 if (AcpiTable == NULL) {
91 Status = EFI_NOT_FOUND;
92 goto exit_handler;
93 }
94
95 // Dump ACPI Table Header
96 DUMP_ACPI_TABLE_HEADER (AcpiTable);
97
98 // Install ACPI table
99 Status = AcpiTableProtocol->InstallAcpiTable (
100 AcpiTableProtocol,
101 AcpiTable,
102 AcpiTable->Length,
103 &TableHandle
104 );
105 if (EFI_ERROR (Status)) {
106 DEBUG ((
107 DEBUG_ERROR,
108 "ERROR: Failed to Install ACPI Table. Status = %r\n",
109 Status
110 ));
111 // Free any allocated resources.
112 goto exit_handler;
113 }
114
115 DEBUG ((
116 DEBUG_INFO,
117 "INFO: ACPI Table installed. Status = %r\n",
118 Status
119 ));
120
121 exit_handler:
122 // Free any resources allocated for generating the tables.
123 if (Generator->FreeTableResources != NULL) {
124 Status1 = Generator->FreeTableResources (
125 Generator,
126 AcpiTableInfo,
127 CfgMgrProtocol,
128 &AcpiTable
129 );
130 if (EFI_ERROR (Status1)) {
131 DEBUG ((
132 DEBUG_ERROR,
133 "ERROR: Failed to Free Table Resources." \
134 "TableGeneratorId = 0x%x. Status = %r\n",
135 AcpiTableInfo->TableGeneratorId,
136 Status1
137 ));
138 }
139
140 // Return the first error status in case of failure
141 if (!EFI_ERROR (Status)) {
142 Status = Status1;
143 }
144 }
145
146 return Status;
147 }
148
149 /** A helper function to build and install multiple ACPI tables.
150
151 This is a helper function that invokes the Table generator interface
152 for building an ACPI table. It uses the AcpiTableProtocol to install the
153 table, then frees the resources allocated for generating it.
154
155 @param [in] TableFactoryProtocol Pointer to the Table Factory Protocol
156 interface.
157 @param [in] CfgMgrProtocol Pointer to the Configuration Manager
158 Protocol Interface.
159 @param [in] Generator Pointer to the AcpiTable generator.
160 @param [in] AcpiTableProtocol Pointer to the AcpiTable protocol.
161 @param [in] AcpiTableInfo Pointer to the ACPI table Info.
162
163 @retval EFI_SUCCESS Success.
164 @retval EFI_INVALID_PARAMETER A parameter is invalid.
165 @retval EFI_NOT_FOUND Required object is not found.
166 @retval EFI_BAD_BUFFER_SIZE Size returned by the Configuration Manager
167 is less than the Object size for the
168 requested object.
169 **/
170 STATIC
171 EFI_STATUS
172 EFIAPI
173 BuildAndInstallMultipleAcpiTable (
174 IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol,
175 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
176 IN CONST ACPI_TABLE_GENERATOR *CONST Generator,
177 IN EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol,
178 IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo
179 )
180 {
181 EFI_STATUS Status;
182 EFI_STATUS Status1;
183 EFI_ACPI_DESCRIPTION_HEADER **AcpiTable;
184 UINTN TableCount;
185 UINTN TableHandle;
186 UINTN Index;
187
188 AcpiTable = NULL;
189 TableCount = 0;
190 Status = Generator->BuildAcpiTableEx (
191 Generator,
192 AcpiTableInfo,
193 CfgMgrProtocol,
194 &AcpiTable,
195 &TableCount
196 );
197 if (EFI_ERROR (Status)) {
198 DEBUG ((
199 DEBUG_ERROR,
200 "ERROR: Failed to Build Table." \
201 " TableGeneratorId = 0x%x. Status = %r\n",
202 AcpiTableInfo->TableGeneratorId,
203 Status
204 ));
205 // Free any allocated resources.
206 goto exit_handler;
207 }
208
209 if ((AcpiTable == NULL) || (TableCount == 0)) {
210 Status = EFI_NOT_FOUND;
211 goto exit_handler;
212 }
213
214 for (Index = 0; Index < TableCount; Index++) {
215 // Dump ACPI Table Header
216 DUMP_ACPI_TABLE_HEADER (AcpiTable[Index]);
217 // Install ACPI table
218 Status = AcpiTableProtocol->InstallAcpiTable (
219 AcpiTableProtocol,
220 AcpiTable[Index],
221 AcpiTable[Index]->Length,
222 &TableHandle
223 );
224 if (EFI_ERROR (Status)) {
225 DEBUG ((
226 DEBUG_ERROR,
227 "ERROR: Failed to Install ACPI Table. Status = %r\n",
228 Status
229 ));
230 // Free any allocated resources.
231 goto exit_handler;
232 }
233
234 DEBUG ((
235 DEBUG_INFO,
236 "INFO: ACPI Table installed. Status = %r\n",
237 Status
238 ));
239 }
240
241 exit_handler:
242 // Free any resources allocated for generating the tables.
243 if (Generator->FreeTableResourcesEx != NULL) {
244 Status1 = Generator->FreeTableResourcesEx (
245 Generator,
246 AcpiTableInfo,
247 CfgMgrProtocol,
248 &AcpiTable,
249 TableCount
250 );
251 if (EFI_ERROR (Status1)) {
252 DEBUG ((
253 DEBUG_ERROR,
254 "ERROR: Failed to Free Table Resources." \
255 "TableGeneratorId = 0x%x. Status = %r\n",
256 AcpiTableInfo->TableGeneratorId,
257 Status1
258 ));
259 }
260
261 // Return the first error status in case of failure
262 if (!EFI_ERROR (Status)) {
263 Status = Status1;
264 }
265 }
266
267 return Status;
268 }
269
270 /** A helper function to invoke a Table generator
271
272 This is a helper function that invokes the Table generator interface
273 for building an ACPI table. It uses the AcpiTableProtocol to install the
274 table, then frees the resources allocated for generating it.
275
276 @param [in] TableFactoryProtocol Pointer to the Table Factory Protocol
277 interface.
278 @param [in] CfgMgrProtocol Pointer to the Configuration Manager
279 Protocol Interface.
280 @param [in] AcpiTableProtocol Pointer to the AcpiTable protocol.
281 @param [in] AcpiTableInfo Pointer to the ACPI table Info.
282
283 @retval EFI_SUCCESS Success.
284 @retval EFI_INVALID_PARAMETER A parameter is invalid.
285 @retval EFI_NOT_FOUND Required object is not found.
286 @retval EFI_BAD_BUFFER_SIZE Size returned by the Configuration Manager
287 is less than the Object size for the
288 requested object.
289 **/
290 STATIC
291 EFI_STATUS
292 EFIAPI
293 BuildAndInstallAcpiTable (
294 IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol,
295 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
296 IN EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol,
297 IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo
298 )
299 {
300 EFI_STATUS Status;
301 CONST ACPI_TABLE_GENERATOR *Generator;
302
303 ASSERT (TableFactoryProtocol != NULL);
304 ASSERT (CfgMgrProtocol != NULL);
305 ASSERT (AcpiTableProtocol != NULL);
306 ASSERT (AcpiTableInfo != NULL);
307
308 DEBUG ((
309 DEBUG_INFO,
310 "INFO: EStdObjAcpiTableList: Address = 0x%p," \
311 " TableGeneratorId = 0x%x\n",
312 AcpiTableInfo,
313 AcpiTableInfo->TableGeneratorId
314 ));
315
316 Generator = NULL;
317 Status = TableFactoryProtocol->GetAcpiTableGenerator (
318 TableFactoryProtocol,
319 AcpiTableInfo->TableGeneratorId,
320 &Generator
321 );
322 if (EFI_ERROR (Status)) {
323 DEBUG ((
324 DEBUG_ERROR,
325 "ERROR: Table Generator not found." \
326 " TableGeneratorId = 0x%x. Status = %r\n",
327 AcpiTableInfo->TableGeneratorId,
328 Status
329 ));
330 return Status;
331 }
332
333 if (Generator == NULL) {
334 return EFI_NOT_FOUND;
335 }
336
337 DEBUG ((
338 DEBUG_INFO,
339 "INFO: Generator found : %s\n",
340 Generator->Description
341 ));
342
343 if (Generator->BuildAcpiTableEx != NULL) {
344 Status = BuildAndInstallMultipleAcpiTable (
345 TableFactoryProtocol,
346 CfgMgrProtocol,
347 Generator,
348 AcpiTableProtocol,
349 AcpiTableInfo
350 );
351 if (EFI_ERROR (Status)) {
352 DEBUG ((
353 DEBUG_ERROR,
354 "ERROR: Failed to find build and install ACPI Table." \
355 " Status = %r\n",
356 Status
357 ));
358 }
359 } else if (Generator->BuildAcpiTable != NULL) {
360 Status = BuildAndInstallSingleAcpiTable (
361 TableFactoryProtocol,
362 CfgMgrProtocol,
363 Generator,
364 AcpiTableProtocol,
365 AcpiTableInfo
366 );
367 if (EFI_ERROR (Status)) {
368 DEBUG ((
369 DEBUG_ERROR,
370 "ERROR: Failed to find build and install ACPI Table." \
371 " Status = %r\n",
372 Status
373 ));
374 }
375 } else {
376 Status = EFI_INVALID_PARAMETER;
377 DEBUG ((
378 DEBUG_ERROR,
379 "ERROR: Table Generator does not implement the" \
380 " ACPI_TABLE_GENERATOR_BUILD_TABLE interface." \
381 " TableGeneratorId = 0x%x. Status = %r\n",
382 AcpiTableInfo->TableGeneratorId,
383 Status
384 ));
385 }
386
387 return Status;
388 }
389
390 /** The function checks if the Configuration Manager has provided the
391 mandatory ACPI tables for installation.
392
393 @param [in] AcpiTableInfo Pointer to the ACPI Table Info list.
394 @param [in] AcpiTableCount Count of ACPI Table Info.
395
396 @retval EFI_SUCCESS Success.
397 @retval EFI_NOT_FOUND If mandatory table is not found.
398 **/
399 STATIC
400 EFI_STATUS
401 EFIAPI
402 VerifyMandatoryTablesArePresent (
403 IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
404 IN UINT32 AcpiTableCount
405 )
406 {
407 EFI_STATUS Status;
408 BOOLEAN FadtFound;
409 BOOLEAN MadtFound;
410 BOOLEAN GtdtFound;
411 BOOLEAN DsdtFound;
412 BOOLEAN Dbg2Found;
413 BOOLEAN SpcrFound;
414
415 Status = EFI_SUCCESS;
416 FadtFound = FALSE;
417 MadtFound = FALSE;
418 GtdtFound = FALSE;
419 DsdtFound = FALSE;
420 Dbg2Found = FALSE;
421 SpcrFound = FALSE;
422 ASSERT (AcpiTableInfo != NULL);
423
424 while (AcpiTableCount-- != 0) {
425 switch (AcpiTableInfo[AcpiTableCount].AcpiTableSignature) {
426 case EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE:
427 FadtFound = TRUE;
428 break;
429 case EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE:
430 MadtFound = TRUE;
431 break;
432 case EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE:
433 GtdtFound = TRUE;
434 break;
435 case EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE:
436 DsdtFound = TRUE;
437 break;
438 case EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE:
439 Dbg2Found = TRUE;
440 break;
441 case EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE:
442 SpcrFound = TRUE;
443 break;
444 default:
445 break;
446 }
447 }
448
449 // We need at least the FADT, MADT, GTDT and the DSDT tables to boot
450 if (!FadtFound) {
451 DEBUG ((DEBUG_ERROR, "ERROR: FADT Table not found\n"));
452 Status = EFI_NOT_FOUND;
453 }
454
455 if (!MadtFound) {
456 DEBUG ((DEBUG_ERROR, "ERROR: MADT Table not found.\n"));
457 Status = EFI_NOT_FOUND;
458 }
459
460 if (!GtdtFound) {
461 DEBUG ((DEBUG_ERROR, "ERROR: GTDT Table not found.\n"));
462 Status = EFI_NOT_FOUND;
463 }
464
465 if (!DsdtFound) {
466 DEBUG ((DEBUG_ERROR, "ERROR: DSDT Table not found.\n"));
467 Status = EFI_NOT_FOUND;
468 }
469
470 if (!Dbg2Found) {
471 DEBUG ((DEBUG_WARN, "WARNING: DBG2 Table not found.\n"));
472 }
473
474 if (!SpcrFound) {
475 DEBUG ((DEBUG_WARN, "WARNING: SPCR Table not found.\n"));
476 }
477
478 return Status;
479 }
480
481 /** Generate and install ACPI tables.
482
483 The function gathers the information necessary for installing the
484 ACPI tables from the Configuration Manager, invokes the generators
485 and installs them (via BuildAndInstallAcpiTable).
486
487 @param [in] TableFactoryProtocol Pointer to the Table Factory Protocol
488 interface.
489 @param [in] CfgMgrProtocol Pointer to the Configuration Manager
490 Protocol Interface.
491
492 @retval EFI_SUCCESS Success.
493 @retval EFI_NOT_FOUND If a mandatory table or a generator is not found.
494 **/
495 STATIC
496 EFI_STATUS
497 EFIAPI
498 ProcessAcpiTables (
499 IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol,
500 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol
501 )
502 {
503 EFI_STATUS Status;
504 EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol;
505 CM_STD_OBJ_ACPI_TABLE_INFO *AcpiTableInfo;
506 UINT32 AcpiTableCount;
507 UINT32 Idx;
508
509 ASSERT (TableFactoryProtocol != NULL);
510 ASSERT (CfgMgrProtocol != NULL);
511
512 // Find the AcpiTable protocol
513 Status = gBS->LocateProtocol (
514 &gEfiAcpiTableProtocolGuid,
515 NULL,
516 (VOID **)&AcpiTableProtocol
517 );
518 if (EFI_ERROR (Status)) {
519 DEBUG ((
520 DEBUG_ERROR,
521 "ERROR: Failed to find AcpiTable protocol. Status = %r\n",
522 Status
523 ));
524 return Status;
525 }
526
527 Status = GetEStdObjAcpiTableList (
528 CfgMgrProtocol,
529 CM_NULL_TOKEN,
530 &AcpiTableInfo,
531 &AcpiTableCount
532 );
533 if (EFI_ERROR (Status)) {
534 DEBUG ((
535 DEBUG_ERROR,
536 "ERROR: Failed to get ACPI Table List. Status = %r\n",
537 Status
538 ));
539 return Status;
540 }
541
542 if (0 == AcpiTableCount) {
543 DEBUG ((
544 DEBUG_ERROR,
545 "ERROR: EStdObjAcpiTableList: AcpiTableCount = %d\n",
546 AcpiTableCount
547 ));
548 return EFI_NOT_FOUND;
549 }
550
551 DEBUG ((
552 DEBUG_INFO,
553 "INFO: EStdObjAcpiTableList: AcpiTableCount = %d\n",
554 AcpiTableCount
555 ));
556
557 // Check if mandatory ACPI tables are present.
558 Status = VerifyMandatoryTablesArePresent (
559 AcpiTableInfo,
560 AcpiTableCount
561 );
562 if (EFI_ERROR (Status)) {
563 DEBUG ((
564 DEBUG_ERROR,
565 "ERROR: Failed to find mandatory ACPI Table(s)."
566 " Status = %r\n",
567 Status
568 ));
569 return Status;
570 }
571
572 // Add the FADT Table first.
573 for (Idx = 0; Idx < AcpiTableCount; Idx++) {
574 if (CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt) ==
575 AcpiTableInfo[Idx].TableGeneratorId)
576 {
577 Status = BuildAndInstallAcpiTable (
578 TableFactoryProtocol,
579 CfgMgrProtocol,
580 AcpiTableProtocol,
581 &AcpiTableInfo[Idx]
582 );
583 if (EFI_ERROR (Status)) {
584 DEBUG ((
585 DEBUG_ERROR,
586 "ERROR: Failed to find build and install ACPI FADT Table." \
587 " Status = %r\n",
588 Status
589 ));
590 return Status;
591 }
592
593 break;
594 }
595 } // for
596
597 // Add remaining ACPI Tables
598 for (Idx = 0; Idx < AcpiTableCount; Idx++) {
599 DEBUG ((
600 DEBUG_INFO,
601 "INFO: AcpiTableInfo[%d].TableGeneratorId = 0x%x\n",
602 Idx,
603 AcpiTableInfo[Idx].TableGeneratorId
604 ));
605
606 // Skip FADT Table since we have already added
607 if (CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt) ==
608 AcpiTableInfo[Idx].TableGeneratorId)
609 {
610 continue;
611 }
612
613 // Skip the Reserved table Generator ID for standard generators
614 if ((IS_GENERATOR_NAMESPACE_STD (AcpiTableInfo[Idx].TableGeneratorId)) &&
615 ((CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdReserved) >=
616 AcpiTableInfo[Idx].TableGeneratorId) ||
617 (CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMax) <=
618 AcpiTableInfo[Idx].TableGeneratorId)))
619 {
620 DEBUG ((
621 DEBUG_WARN,
622 "WARNING: Invalid ACPI Generator table ID = 0x%x, Skipping...\n",
623 AcpiTableInfo[Idx].TableGeneratorId
624 ));
625 continue;
626 }
627
628 Status = BuildAndInstallAcpiTable (
629 TableFactoryProtocol,
630 CfgMgrProtocol,
631 AcpiTableProtocol,
632 &AcpiTableInfo[Idx]
633 );
634 if (EFI_ERROR (Status)) {
635 DEBUG ((
636 DEBUG_ERROR,
637 "ERROR: Failed to find, build, and install ACPI Table." \
638 " Status = %r\n",
639 Status
640 ));
641 return Status;
642 }
643 } // for
644
645 return Status;
646 }
647
648 /** Entrypoint of Dynamic Table Manager Dxe.
649
650 The Dynamic Table Manager uses the Configuration Manager Protocol
651 to get the list of ACPI and SMBIOS tables to install. For each table
652 in the list it requests the corresponding ACPI/SMBIOS table factory for
653 a generator capable of building the ACPI/SMBIOS table.
654 If a suitable table generator is found, it invokes the generator interface
655 to build the table. The Dynamic Table Manager then installs the
656 table and invokes another generator interface to free any resources
657 allocated for building the table.
658
659 @param ImageHandle
660 @param SystemTable
661
662 @retval EFI_SUCCESS Success.
663 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
664 @retval EFI_NOT_FOUND Required interface/object was not found.
665 @retval EFI_INVALID_PARAMETER Some parameter is incorrect/invalid.
666 **/
667 EFI_STATUS
668 EFIAPI
669 DynamicTableManagerDxeInitialize (
670 IN EFI_HANDLE ImageHandle,
671 IN EFI_SYSTEM_TABLE *SystemTable
672 )
673 {
674 EFI_STATUS Status;
675 EDKII_CONFIGURATION_MANAGER_PROTOCOL *CfgMgrProtocol;
676 CM_STD_OBJ_CONFIGURATION_MANAGER_INFO *CfgMfrInfo;
677 EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *TableFactoryProtocol;
678
679 // Locate the Dynamic Table Factory
680 Status = gBS->LocateProtocol (
681 &gEdkiiDynamicTableFactoryProtocolGuid,
682 NULL,
683 (VOID **)&TableFactoryProtocol
684 );
685 if (EFI_ERROR (Status)) {
686 DEBUG ((
687 DEBUG_ERROR,
688 "ERROR: Failed to find Dynamic Table Factory protocol." \
689 " Status = %r\n",
690 Status
691 ));
692 return Status;
693 }
694
695 // Locate the Configuration Manager for the Platform
696 Status = gBS->LocateProtocol (
697 &gEdkiiConfigurationManagerProtocolGuid,
698 NULL,
699 (VOID **)&CfgMgrProtocol
700 );
701 if (EFI_ERROR (Status)) {
702 DEBUG ((
703 DEBUG_ERROR,
704 "ERROR: Failed to find Configuration Manager protocol. Status = %r\n",
705 Status
706 ));
707 return Status;
708 }
709
710 Status = GetCgfMgrInfo (CfgMgrProtocol, &CfgMfrInfo);
711 if (EFI_ERROR (Status)) {
712 DEBUG ((
713 DEBUG_ERROR,
714 "ERROR: Failed to get Configuration Manager info. Status = %r\n",
715 Status
716 ));
717 return Status;
718 }
719
720 DEBUG ((
721 DEBUG_INFO,
722 "INFO: Configuration Manager Version = 0x%x, OemID = %c%c%c%c%c%c\n",
723 CfgMfrInfo->Revision,
724 CfgMfrInfo->OemId[0],
725 CfgMfrInfo->OemId[1],
726 CfgMfrInfo->OemId[2],
727 CfgMfrInfo->OemId[3],
728 CfgMfrInfo->OemId[4],
729 CfgMfrInfo->OemId[5]
730 ));
731
732 Status = ProcessAcpiTables (TableFactoryProtocol, CfgMgrProtocol);
733 if (EFI_ERROR (Status)) {
734 DEBUG ((
735 DEBUG_ERROR,
736 "ERROR: ACPI Table processing failure. Status = %r\n",
737 Status
738 ));
739 }
740
741 return Status;
742 }