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