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