]> git.proxmox.com Git - mirror_edk2.git/blob - DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c
62927b51d6d7c1585da1cb0d59785e2382639002
[mirror_edk2.git] / DynamicTablesPkg / Library / Acpi / Arm / AcpiFadtLibArm / FadtGenerator.c
1 /** @file
2 FADT Table Generator
3
4 Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 @par Reference(s):
14 - ACPI 6.2 Specification - Errata A, September 2017
15
16 **/
17
18 #include <Library/AcpiLib.h>
19 #include <Library/DebugLib.h>
20 #include <Protocol/AcpiTable.h>
21
22 // Module specific include files.
23 #include <AcpiTableGenerator.h>
24 #include <ConfigurationManagerObject.h>
25 #include <ConfigurationManagerHelper.h>
26 #include <Library/TableHelperLib.h>
27 #include <Protocol/ConfigurationManagerProtocol.h>
28
29 /** ARM standard FADT Generator
30
31 Requirements:
32 The following Configuration Manager Object(s) are required by
33 this Generator:
34 - EArmObjPowerManagementProfileInfo
35 - EArmObjBootArchInfo
36 - EArmObjHypervisorVendorIdentity (OPTIONAL)
37 */
38
39 /** This macro defines the FADT flag options for ARM Platforms.
40 */
41 #define FADT_FLAGS (EFI_ACPI_6_2_HW_REDUCED_ACPI | \
42 EFI_ACPI_6_2_LOW_POWER_S0_IDLE_CAPABLE)
43
44 /** This macro defines the valid mask for the FADT flag option
45 if HW_REDUCED_ACPI flag in the table is set.
46
47 Invalid bits are: 1, 2, 3,7, 8, 13, 14,16, 17 and
48 22-31 (reserved).
49
50 Valid bits are:
51 EFI_ACPI_6_2_WBINVD BIT0
52 EFI_ACPI_6_2_PWR_BUTTON BIT4
53 EFI_ACPI_6_2_SLP_BUTTON BIT5
54 EFI_ACPI_6_2_FIX_RTC BIT6
55 EFI_ACPI_6_2_DCK_CAP BIT9
56 EFI_ACPI_6_2_RESET_REG_SUP BIT10
57 EFI_ACPI_6_2_SEALED_CASE BIT11
58 EFI_ACPI_6_2_HEADLESS BIT12
59 EFI_ACPI_6_2_USE_PLATFORM_CLOCK BIT15
60 EFI_ACPI_6_2_FORCE_APIC_CLUSTER_MODEL BIT18
61 EFI_ACPI_6_2_FORCE_APIC_PHYSICAL_DESTINATION_MODE BIT19
62 EFI_ACPI_6_2_HW_REDUCED_ACPI BIT20
63 EFI_ACPI_6_2_LOW_POWER_S0_IDLE_CAPABLE BIT21
64 */
65 #define VALID_HARDWARE_REDUCED_FLAG_MASK ( \
66 EFI_ACPI_6_2_WBINVD | \
67 EFI_ACPI_6_2_PWR_BUTTON | \
68 EFI_ACPI_6_2_SLP_BUTTON | \
69 EFI_ACPI_6_2_FIX_RTC | \
70 EFI_ACPI_6_2_DCK_CAP | \
71 EFI_ACPI_6_2_RESET_REG_SUP | \
72 EFI_ACPI_6_2_SEALED_CASE | \
73 EFI_ACPI_6_2_HEADLESS | \
74 EFI_ACPI_6_2_USE_PLATFORM_CLOCK | \
75 EFI_ACPI_6_2_FORCE_APIC_CLUSTER_MODEL | \
76 EFI_ACPI_6_2_FORCE_APIC_PHYSICAL_DESTINATION_MODE | \
77 EFI_ACPI_6_2_HW_REDUCED_ACPI | \
78 EFI_ACPI_6_2_LOW_POWER_S0_IDLE_CAPABLE)
79
80 #pragma pack(1)
81
82 /** The AcpiFadt is a template EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE
83 structure used for generating the FADT Table.
84 Note: fields marked with "{Template}" will be updated dynamically.
85 */
86 STATIC
87 EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE AcpiFadt = {
88 ACPI_HEADER (
89 EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
90 EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE,
91 EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_REVISION
92 ),
93 // UINT32 FirmwareCtrl
94 0,
95 // UINT32 Dsdt
96 0,
97 // UINT8 Reserved0
98 EFI_ACPI_RESERVED_BYTE,
99 // UINT8 PreferredPmProfile
100 EFI_ACPI_6_2_PM_PROFILE_UNSPECIFIED, // {Template}: Power Management Profile
101 // UINT16 SciInt
102 0,
103 // UINT32 SmiCmd
104 0,
105 // UINT8 AcpiEnable
106 0,
107 // UINT8 AcpiDisable
108 0,
109 // UINT8 S4BiosReq
110 0,
111 // UINT8 PstateCnt
112 0,
113 // UINT32 Pm1aEvtBlk
114 0,
115 // UINT32 Pm1bEvtBlk
116 0,
117 // UINT32 Pm1aCntBlk
118 0,
119 // UINT32 Pm1bCntBlk
120 0,
121 // UINT32 Pm2CntBlk
122 0,
123 // UINT32 PmTmrBlk
124 0,
125 // UINT32 Gpe0Blk
126 0,
127 // UINT32 Gpe1Blk
128 0,
129 // UINT8 Pm1EvtLen
130 0,
131 // UINT8 Pm1CntLen
132 0,
133 // UINT8 Pm2CntLen
134 0,
135 // UINT8 PmTmrLen
136 0,
137 // UINT8 Gpe0BlkLen
138 0,
139 // UINT8 Gpe1BlkLen
140 0,
141 // UINT8 Gpe1Base
142 0,
143 // UINT8 CstCnt
144 0,
145 // UINT16 PLvl2Lat
146 0,
147 // UINT16 PLvl3Lat
148 0,
149 // UINT16 FlushSize
150 0,
151 // UINT16 FlushStride
152 0,
153 // UINT8 DutyOffset
154 0,
155 // UINT8 DutyWidth
156 0,
157 // UINT8 DayAlrm
158 0,
159 // UINT8 MonAlrm
160 0,
161 // UINT8 Century
162 0,
163 // UINT16 IaPcBootArch
164 0,
165 // UINT8 Reserved1
166 0,
167 // UINT32 Flags
168 FADT_FLAGS,
169 // EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE ResetReg
170 NULL_GAS,
171 // UINT8 ResetValue
172 0,
173 // UINT16 ArmBootArch
174 EFI_ACPI_6_2_ARM_PSCI_COMPLIANT, // {Template}: ARM Boot Architecture Flags
175 // UINT8 MinorRevision
176 EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_MINOR_REVISION,
177 // UINT64 XFirmwareCtrl
178 0,
179 // UINT64 XDsdt
180 0,
181 // EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE XPm1aEvtBlk
182 NULL_GAS,
183 // EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE XPm1bEvtBlk
184 NULL_GAS,
185 // EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE XPm1aCntBlk
186 NULL_GAS,
187 // EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE XPm1bCntBlk
188 NULL_GAS,
189 // EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE XPm2CntBlk
190 NULL_GAS,
191 // EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE XPmTmrBlk
192 NULL_GAS,
193 // EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE XGpe0Blk
194 NULL_GAS,
195 // EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE XGpe1Blk
196 NULL_GAS,
197 // EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE SleepControlReg
198 NULL_GAS,
199 // EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE SleepStatusReg
200 NULL_GAS,
201 // UINT64 HypervisorVendorIdentity
202 EFI_ACPI_RESERVED_QWORD // {Template}: Hypervisor Vendor ID
203 };
204
205 #pragma pack()
206
207 /** This macro expands to a function that retrieves the Power
208 Management Profile Information from the Configuration Manager.
209 */
210 GET_OBJECT_LIST (
211 EObjNameSpaceArm,
212 EArmObjPowerManagementProfileInfo,
213 CM_ARM_POWER_MANAGEMENT_PROFILE_INFO
214 );
215
216 /** This macro expands to a function that retrieves the Boot
217 Architecture Information from the Configuration Manager.
218 */
219 GET_OBJECT_LIST (
220 EObjNameSpaceArm,
221 EArmObjBootArchInfo,
222 CM_ARM_BOOT_ARCH_INFO
223 );
224
225 /** This macro expands to a function that retrieves the Hypervisor
226 Vendor ID from the Configuration Manager.
227 */
228 GET_OBJECT_LIST (
229 EObjNameSpaceArm,
230 EArmObjHypervisorVendorIdentity,
231 CM_ARM_HYPERVISOR_VENDOR_ID
232 );
233
234 /** This macro expands to a function that retrieves the Fixed
235 feature flags for the platform from the Configuration Manager.
236 */
237 GET_OBJECT_LIST (
238 EObjNameSpaceArm,
239 EArmObjFixedFeatureFlags,
240 CM_ARM_FIXED_FEATURE_FLAGS
241 );
242
243 /** Update the Power Management Profile information in the FADT Table.
244
245 @param [in] CfgMgrProtocol Pointer to the Configuration Manager
246 Protocol Interface.
247
248 @retval EFI_SUCCESS Success.
249 @retval EFI_INVALID_PARAMETER A parameter is invalid.
250 @retval EFI_NOT_FOUND The required object was not found.
251 @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
252 Manager is less than the Object size for the
253 requested object.
254 **/
255 STATIC
256 EFI_STATUS
257 EFIAPI
258 FadtAddPmProfileInfo (
259 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol
260 )
261 {
262 EFI_STATUS Status;
263 CM_ARM_POWER_MANAGEMENT_PROFILE_INFO * PmProfile;
264
265 ASSERT (CfgMgrProtocol != NULL);
266
267 // Get the Power Management Profile from the Platform Configuration Manager
268 Status = GetEArmObjPowerManagementProfileInfo (
269 CfgMgrProtocol,
270 CM_NULL_TOKEN,
271 &PmProfile,
272 NULL
273 );
274 if (EFI_ERROR (Status)) {
275 DEBUG ((
276 DEBUG_ERROR,
277 "ERROR: FADT: Failed to get Power Management Profile information." \
278 " Status = %r\n",
279 Status
280 ));
281 goto error_handler;
282 }
283
284 DEBUG ((
285 DEBUG_INFO,
286 "FADT: PreferredPmProfile = 0x%x\n",
287 PmProfile->PowerManagementProfile
288 ));
289
290 AcpiFadt.PreferredPmProfile = PmProfile->PowerManagementProfile;
291
292 error_handler:
293 return Status;
294 }
295
296 /** Updates the Boot Architecture information in the FADT Table.
297
298 @param [in] CfgMgrProtocol Pointer to the Configuration Manager
299 Protocol Interface.
300
301 @retval EFI_SUCCESS Success.
302 @retval EFI_INVALID_PARAMETER A parameter is invalid.
303 @retval EFI_NOT_FOUND The required object was not found.
304 @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
305 Manager is less than the Object size for the
306 requested object.
307 **/
308 STATIC
309 EFI_STATUS
310 EFIAPI
311 FadtAddBootArchInfo (
312 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol
313 )
314 {
315 EFI_STATUS Status;
316 CM_ARM_BOOT_ARCH_INFO * BootArchInfo;
317
318 ASSERT (CfgMgrProtocol != NULL);
319
320 // Get the Boot Architecture flags from the Platform Configuration Manager
321 Status = GetEArmObjBootArchInfo (
322 CfgMgrProtocol,
323 CM_NULL_TOKEN,
324 &BootArchInfo,
325 NULL
326 );
327 if (EFI_ERROR (Status)) {
328 DEBUG ((
329 DEBUG_ERROR,
330 "ERROR: FADT: Failed to get Boot Architecture flags. Status = %r\n",
331 Status
332 ));
333 goto error_handler;
334 }
335
336 DEBUG ((
337 DEBUG_INFO,
338 "FADT BootArchFlag = 0x%x\n",
339 BootArchInfo->BootArchFlags
340 ));
341
342 AcpiFadt.ArmBootArch = BootArchInfo->BootArchFlags;
343
344 error_handler:
345 return Status;
346 }
347
348 /** Update the Hypervisor Vendor ID in the FADT Table.
349
350 @param [in] CfgMgrProtocol Pointer to the Configuration Manager
351 Protocol Interface.
352
353 @retval EFI_SUCCESS Success.
354 @retval EFI_INVALID_PARAMETER A parameter is invalid.
355 @retval EFI_NOT_FOUND The required object was not found.
356 @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
357 Manager is less than the Object size for the
358 requested object.
359 **/
360 STATIC
361 EFI_STATUS
362 EFIAPI
363 FadtAddHypervisorVendorId (
364 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol
365 )
366 {
367 EFI_STATUS Status;
368 CM_ARM_HYPERVISOR_VENDOR_ID * HypervisorVendorInfo;
369
370 ASSERT (CfgMgrProtocol != NULL);
371
372 // Get the Hypervisor Vendor ID from the Platform Configuration Manager
373 Status = GetEArmObjHypervisorVendorIdentity (
374 CfgMgrProtocol,
375 CM_NULL_TOKEN,
376 &HypervisorVendorInfo,
377 NULL
378 );
379 if (EFI_ERROR (Status)) {
380 if (Status == EFI_NOT_FOUND) {
381 DEBUG ((
382 DEBUG_INFO,
383 "INFO: FADT: Platform does not have a Hypervisor Vendor ID."
384 "Status = %r\n",
385 Status
386 ));
387 } else {
388 DEBUG ((
389 DEBUG_ERROR,
390 "ERROR: FADT: Failed to get Hypervisor Vendor ID. Status = %r\n",
391 Status
392 ));
393 }
394 goto error_handler;
395 }
396
397 DEBUG ((
398 DEBUG_INFO,
399 "FADT: EArmObjHypervisorVendorIdentity = 0x%lx\n",
400 HypervisorVendorInfo->HypervisorVendorId
401 ));
402
403 AcpiFadt.HypervisorVendorIdentity = HypervisorVendorInfo->HypervisorVendorId;
404
405 error_handler:
406 return Status;
407 }
408
409 /** Update the Fixed Feature Flags in the FADT Table.
410
411 @param [in] CfgMgrProtocol Pointer to the Configuration Manager
412 Protocol Interface.
413
414 @retval EFI_SUCCESS Success.
415 @retval EFI_INVALID_PARAMETER A parameter is invalid.
416 @retval EFI_NOT_FOUND The required object was not found.
417 @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
418 Manager is less than the Object size for the
419 requested object.
420 **/
421 STATIC
422 EFI_STATUS
423 EFIAPI
424 FadtAddFixedFeatureFlags (
425 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol
426 )
427 {
428 EFI_STATUS Status;
429 CM_ARM_FIXED_FEATURE_FLAGS * FixedFeatureFlags;
430
431 ASSERT (CfgMgrProtocol != NULL);
432
433 // Get the Fixed feature flags from the Platform Configuration Manager
434 Status = GetEArmObjFixedFeatureFlags (
435 CfgMgrProtocol,
436 CM_NULL_TOKEN,
437 &FixedFeatureFlags,
438 NULL
439 );
440 if (EFI_ERROR (Status)) {
441 if (Status == EFI_NOT_FOUND) {
442 DEBUG ((
443 DEBUG_INFO,
444 "INFO: FADT: Platform does not define additional Fixed feature flags."
445 "Status = %r\n",
446 Status
447 ));
448 } else {
449 DEBUG ((
450 DEBUG_ERROR,
451 "ERROR: FADT: Failed to get Fixed feature flags. Status = %r\n",
452 Status
453 ));
454 }
455 goto error_handler;
456 }
457
458 DEBUG ((
459 DEBUG_INFO,
460 "FADT: EArmObjFixedFeatureFlags = 0x%x\n",
461 FixedFeatureFlags->Flags
462 ));
463
464 if ((FixedFeatureFlags->Flags & ~(VALID_HARDWARE_REDUCED_FLAG_MASK)) != 0) {
465 DEBUG ((
466 DEBUG_WARN,
467 "FADT: Invalid Fixed feature flags defined by platform,"
468 "Invalid Flags bits are = 0x%x\n",
469 (FixedFeatureFlags->Flags & ~(VALID_HARDWARE_REDUCED_FLAG_MASK))
470 ));
471 }
472
473 AcpiFadt.Flags |= (FixedFeatureFlags->Flags &
474 VALID_HARDWARE_REDUCED_FLAG_MASK);
475
476 error_handler:
477 return Status;
478 }
479
480 /** Construct the FADT table.
481
482 This function invokes the Configuration Manager protocol interface
483 to get the required hardware information for generating the ACPI
484 table.
485
486 If this function allocates any resources then they must be freed
487 in the FreeXXXXTableResources function.
488
489 @param [in] This Pointer to the table generator.
490 @param [in] AcpiTableInfo Pointer to the ACPI Table Info.
491 @param [in] CfgMgrProtocol Pointer to the Configuration Manager
492 Protocol Interface.
493 @param [out] Table Pointer to the constructed ACPI Table.
494
495 @retval EFI_SUCCESS Table generated successfully.
496 @retval EFI_INVALID_PARAMETER A parameter is invalid.
497 @retval EFI_NOT_FOUND The required object was not found.
498 @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
499 Manager is less than the Object size for the
500 requested object.
501 **/
502 STATIC
503 EFI_STATUS
504 EFIAPI
505 BuildFadtTable (
506 IN CONST ACPI_TABLE_GENERATOR * CONST This,
507 IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo,
508 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
509 OUT EFI_ACPI_DESCRIPTION_HEADER ** CONST Table
510 )
511 {
512 EFI_STATUS Status;
513
514 ASSERT (This != NULL);
515 ASSERT (AcpiTableInfo != NULL);
516 ASSERT (CfgMgrProtocol != NULL);
517 ASSERT (Table != NULL);
518 ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
519 ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
520
521 if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
522 (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) {
523 DEBUG ((
524 DEBUG_ERROR,
525 "ERROR: FADT: Requested table revision = %d, is not supported."
526 "Supported table revision: Minimum = %d, Maximum = %d\n",
527 AcpiTableInfo->AcpiTableRevision,
528 This->MinAcpiTableRevision,
529 This->AcpiTableRevision
530 ));
531 return EFI_INVALID_PARAMETER;
532 }
533
534 *Table = NULL;
535
536 Status = AddAcpiHeader (
537 CfgMgrProtocol,
538 This,
539 (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiFadt,
540 AcpiTableInfo->AcpiTableRevision,
541 sizeof (EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE)
542 );
543 if (EFI_ERROR (Status)) {
544 DEBUG ((
545 DEBUG_ERROR,
546 "ERROR: FADT: Failed to add ACPI header. Status = %r\n",
547 Status
548 ));
549 goto error_handler;
550 }
551
552 // Update PmProfile Info
553 Status = FadtAddPmProfileInfo (CfgMgrProtocol);
554 if (EFI_ERROR (Status)) {
555 goto error_handler;
556 }
557
558 // Update BootArch Info
559 Status = FadtAddBootArchInfo (CfgMgrProtocol);
560 if (EFI_ERROR (Status)) {
561 goto error_handler;
562 }
563
564 // Add the Hypervisor Vendor Id if present
565 // Note if no hypervisor is present the zero bytes
566 // will be placed in this field.
567 Status = FadtAddHypervisorVendorId (CfgMgrProtocol);
568 if (EFI_ERROR (Status)) {
569 if (Status == EFI_NOT_FOUND) {
570 DEBUG ((
571 DEBUG_INFO,
572 "INFO: FADT: No Hypervisor Vendor ID found," \
573 " assuming no Hypervisor is present in the firmware.\n"
574 ));
575 } else {
576 DEBUG ((
577 DEBUG_ERROR,
578 "ERROR: FADT: Error reading Hypervisor Vendor ID, Status = %r",
579 Status
580 ));
581 goto error_handler;
582 }
583 }
584
585 Status = FadtAddFixedFeatureFlags (CfgMgrProtocol);
586 if (EFI_ERROR (Status)) {
587 if (Status == EFI_NOT_FOUND) {
588 DEBUG ((
589 DEBUG_INFO,
590 "INFO: FADT: No Fixed feature flags found," \
591 " assuming no additional flags are defined for the platform.\n"
592 ));
593 Status = EFI_SUCCESS;
594 } else {
595 DEBUG ((
596 DEBUG_ERROR,
597 "ERROR: FADT: Error reading Fixed feature flags, Status = %r",
598 Status
599 ));
600 goto error_handler;
601 }
602 }
603
604 *Table = (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiFadt;
605 error_handler:
606 return Status;
607 }
608
609 /** This macro defines the FADT Table Generator revision.
610 */
611 #define FADT_GENERATOR_REVISION CREATE_REVISION (1, 0)
612
613 /** The interface for the FADT Table Generator.
614 */
615 STATIC
616 CONST
617 ACPI_TABLE_GENERATOR FadtGenerator = {
618 // Generator ID
619 CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt),
620 // Generator Description
621 L"ACPI.STD.FADT.GENERATOR",
622 // ACPI Table Signature
623 EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
624 // ACPI Table Revision supported by this Generator
625 EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
626 // Minimum supported ACPI Table Revision
627 EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
628 // Creator ID
629 TABLE_GENERATOR_CREATOR_ID_ARM,
630 // Creator Revision
631 FADT_GENERATOR_REVISION,
632 // Build Table function
633 BuildFadtTable,
634 // No additional resources are allocated by the generator.
635 // Hence the Free Resource function is not required.
636 NULL,
637 // Extended build function not needed
638 NULL,
639 // Extended build function not implemented by the generator.
640 // Hence extended free resource function is not required.
641 NULL
642 };
643
644 /** Register the Generator with the ACPI Table Factory.
645
646 @param [in] ImageHandle The handle to the image.
647 @param [in] SystemTable Pointer to the System Table.
648
649 @retval EFI_SUCCESS The Generator is registered.
650 @retval EFI_INVALID_PARAMETER A parameter is invalid.
651 @retval EFI_ALREADY_STARTED The Generator for the Table ID
652 is already registered.
653 **/
654 EFI_STATUS
655 EFIAPI
656 AcpiFadtLibConstructor (
657 IN CONST EFI_HANDLE ImageHandle,
658 IN EFI_SYSTEM_TABLE * CONST SystemTable
659 )
660 {
661 EFI_STATUS Status;
662 Status = RegisterAcpiTableGenerator (&FadtGenerator);
663 DEBUG ((DEBUG_INFO, "FADT: Register Generator. Status = %r\n", Status));
664 ASSERT_EFI_ERROR (Status);
665 return Status;
666 }
667
668 /** Deregister the Generator from the ACPI Table Factory.
669
670 @param [in] ImageHandle The handle to the image.
671 @param [in] SystemTable Pointer to the System Table.
672
673 @retval EFI_SUCCESS The Generator is deregistered.
674 @retval EFI_INVALID_PARAMETER A parameter is invalid.
675 @retval EFI_NOT_FOUND The Generator is not registered.
676 **/
677 EFI_STATUS
678 EFIAPI
679 AcpiFadtLibDestructor (
680 IN CONST EFI_HANDLE ImageHandle,
681 IN EFI_SYSTEM_TABLE * CONST SystemTable
682 )
683 {
684 EFI_STATUS Status;
685 Status = DeregisterAcpiTableGenerator (&FadtGenerator);
686 DEBUG ((DEBUG_INFO, "FADT: Deregister Generator. Status = %r\n", Status));
687 ASSERT_EFI_ERROR (Status);
688 return Status;
689 }