summaryrefslogtreecommitdiffstats
path: root/DynamicTablesPkg
diff options
context:
space:
mode:
Diffstat (limited to 'DynamicTablesPkg')
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/AcpiFadtLib.inf7
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/Arm/ArmFadtGenerator.c126
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGenerator.c86
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGenerator.h35
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGeneratorNull.c47
5 files changed, 225 insertions, 76 deletions
diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/AcpiFadtLib.inf b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/AcpiFadtLib.inf
index c9cd850faa..67c7fdbd23 100644
--- a/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/AcpiFadtLib.inf
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/AcpiFadtLib.inf
@@ -18,6 +18,13 @@
[Sources]
FadtGenerator.c
+ FadtGenerator.h
+
+[Sources.ARM, Sources.AARCH64]
+ Arm/ArmFadtGenerator.c
+
+[Sources.IA32, Sources.X64]
+ FadtGeneratorNull.c
[Packages]
MdePkg/MdePkg.dec
diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/Arm/ArmFadtGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/Arm/ArmFadtGenerator.c
new file mode 100644
index 0000000000..2d2afe98ab
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/Arm/ArmFadtGenerator.c
@@ -0,0 +1,126 @@
+/** @file
+ ARM FADT Table Helpers
+
+ Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Reference(s):
+ - ACPI 6.5 Specification, Aug 29, 2022
+
+**/
+
+#include <Library/AcpiLib.h>
+#include <Library/DebugLib.h>
+#include <Protocol/AcpiTable.h>
+
+// Module specific include files.
+#include <AcpiTableGenerator.h>
+#include <ConfigurationManagerObject.h>
+#include <ConfigurationManagerHelper.h>
+#include <Library/TableHelperLib.h>
+#include <Protocol/ConfigurationManagerProtocol.h>
+#include "FadtGenerator.h"
+
+/** ARM Standard FADT Generator
+
+Requirements:
+ The following Configuration Manager Object(s) are required by
+ this Generator:
+ - EArmObjBootArchInfo
+*/
+
+/** This macro expands to a function that retrieves the Boot
+ Architecture Information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArm,
+ EArmObjBootArchInfo,
+ CM_ARM_BOOT_ARCH_INFO
+ );
+
+/** This macro defines the FADT flag options for ARM Platforms.
+*/
+#define FADT_FLAGS (EFI_ACPI_6_5_HW_REDUCED_ACPI | \
+ EFI_ACPI_6_5_LOW_POWER_S0_IDLE_CAPABLE)
+
+/** Updates the Architecture specific information in the FADT Table.
+
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [in, out] Fadt Pointer to the constructed ACPI Table.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object was not found.
+ @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
+ Manager is less than the Object size for the
+ requested object.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+ArmFadtBootArchInfoUpdate (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN OUT EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE *Fadt
+ )
+{
+ EFI_STATUS Status;
+ CM_ARM_BOOT_ARCH_INFO *BootArchInfo;
+
+ ASSERT (CfgMgrProtocol != NULL);
+ ASSERT (Fadt != NULL);
+
+ // Get the Boot Architecture flags from the Platform Configuration Manager
+ Status = GetEArmObjBootArchInfo (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &BootArchInfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get Boot Architecture flags. Status = %r\n",
+ Status
+ ));
+ return Status;
+ }
+
+ DEBUG ((
+ DEBUG_INFO,
+ "FADT BootArchFlag = 0x%x\n",
+ BootArchInfo->BootArchFlags
+ ));
+
+ Fadt->ArmBootArch = BootArchInfo->BootArchFlags;
+
+ return Status;
+}
+
+/** Updates the Architecture specific information in the FADT Table.
+
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [in, out] Fadt Pointer to the constructed ACPI Table.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object was not found.
+ @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
+ Manager is less than the Object size for the
+ requested object.
+**/
+EFI_STATUS
+EFIAPI
+FadtArchUpdate (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN OUT EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE *Fadt
+ )
+{
+ ASSERT (CfgMgrProtocol != NULL);
+ ASSERT (Fadt != NULL);
+
+ Fadt->Flags = FADT_FLAGS;
+
+ return ArmFadtBootArchInfoUpdate (CfgMgrProtocol, Fadt);
+}
diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGenerator.c
index 470f1acfd1..c2140ef414 100644
--- a/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGenerator.c
@@ -19,22 +19,17 @@
#include <ConfigurationManagerHelper.h>
#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
+#include "FadtGenerator.h"
-/** ARM standard FADT Generator
+/** Standard FADT Generator
Requirements:
The following Configuration Manager Object(s) are required by
this Generator:
- EArchCommonObjPowerManagementProfileInfo
- - EArmObjBootArchInfo
- EArchCommonObjHypervisorVendorIdentity (OPTIONAL)
*/
-/** This macro defines the FADT flag options for ARM Platforms.
-*/
-#define FADT_FLAGS (EFI_ACPI_6_5_HW_REDUCED_ACPI | \
- EFI_ACPI_6_5_LOW_POWER_S0_IDLE_CAPABLE)
-
/** This macro defines the valid mask for the FADT flag option
if HW_REDUCED_ACPI flag in the table is set.
@@ -159,13 +154,13 @@ EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE AcpiFadt = {
// UINT8 Reserved1
0,
// UINT32 Flags
- FADT_FLAGS,
+ 0,
// EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE ResetReg
NULL_GAS,
// UINT8 ResetValue
0,
// UINT16 ArmBootArch
- EFI_ACPI_6_5_ARM_PSCI_COMPLIANT, // {Template}: ARM Boot Architecture Flags
+ 0, // {Template}: ARM Boot Architecture Flags
// UINT8 MinorRevision
EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE_MINOR_REVISION, // {Template}
// UINT64 XFirmwareCtrl
@@ -207,15 +202,6 @@ GET_OBJECT_LIST (
CM_ARCH_COMMON_POWER_MANAGEMENT_PROFILE_INFO
);
-/** This macro expands to a function that retrieves the Boot
- Architecture Information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjBootArchInfo,
- CM_ARM_BOOT_ARCH_INFO
- );
-
/** This macro expands to a function that retrieves the Hypervisor
Vendor ID from the Configuration Manager.
*/
@@ -287,58 +273,6 @@ error_handler:
return Status;
}
-/** Updates the Boot Architecture information in the FADT Table.
-
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager
- Protocol Interface.
-
- @retval EFI_SUCCESS Success.
- @retval EFI_INVALID_PARAMETER A parameter is invalid.
- @retval EFI_NOT_FOUND The required object was not found.
- @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
- Manager is less than the Object size for the
- requested object.
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-FadtAddBootArchInfo (
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol
- )
-{
- EFI_STATUS Status;
- CM_ARM_BOOT_ARCH_INFO *BootArchInfo;
-
- ASSERT (CfgMgrProtocol != NULL);
-
- // Get the Boot Architecture flags from the Platform Configuration Manager
- Status = GetEArmObjBootArchInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &BootArchInfo,
- NULL
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: FADT: Failed to get Boot Architecture flags. Status = %r\n",
- Status
- ));
- goto error_handler;
- }
-
- DEBUG ((
- DEBUG_INFO,
- "FADT BootArchFlag = 0x%x\n",
- BootArchInfo->BootArchFlags
- ));
-
- AcpiFadt.ArmBootArch = BootArchInfo->BootArchFlags;
-
-error_handler:
- return Status;
-}
-
/** Update the Hypervisor Vendor ID in the FADT Table.
@param [in] CfgMgrProtocol Pointer to the Configuration Manager
@@ -577,12 +511,6 @@ BuildFadtTable (
goto error_handler;
}
- // Update BootArch Info
- Status = FadtAddBootArchInfo (CfgMgrProtocol);
- if (EFI_ERROR (Status)) {
- goto error_handler;
- }
-
// Add the Hypervisor Vendor Id if present
// Note if no hypervisor is present the zero bytes
// will be placed in this field.
@@ -623,6 +551,12 @@ BuildFadtTable (
}
}
+ // Update Arch specific Info
+ Status = FadtArchUpdate (CfgMgrProtocol, &AcpiFadt);
+ if (EFI_ERROR (Status)) {
+ goto error_handler;
+ }
+
*Table = (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiFadt;
error_handler:
return Status;
diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGenerator.h b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGenerator.h
new file mode 100644
index 0000000000..08ac59e006
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGenerator.h
@@ -0,0 +1,35 @@
+/** @file
+ FADT Table Generator
+
+ Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Reference(s):
+ - ACPI 6.5 Specification, Aug 29, 2022
+
+**/
+
+#ifndef FADT_GENERATOR_H_
+#define FADT_GENERATOR_H_
+
+/** Updates the Architecture specific information in the FADT Table.
+
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [in, out] Fadt Pointer to the constructed ACPI Table.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object was not found.
+ @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
+ Manager is less than the Object size for the
+ requested object.
+**/
+EFI_STATUS
+EFIAPI
+FadtArchUpdate (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN OUT EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE *Fadt
+ );
+
+#endif // FADT_GENERATOR_H_
diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGeneratorNull.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGeneratorNull.c
new file mode 100644
index 0000000000..7868aae742
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGeneratorNull.c
@@ -0,0 +1,47 @@
+/** @file
+ Common FADT Table Helpers
+
+ Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Reference(s):
+ - ACPI 6.5 Specification, Aug 29, 2022
+
+**/
+
+#include <Library/AcpiLib.h>
+#include <Library/DebugLib.h>
+#include <Protocol/AcpiTable.h>
+
+// Module specific include files.
+#include <AcpiTableGenerator.h>
+#include <ConfigurationManagerObject.h>
+#include <ConfigurationManagerHelper.h>
+#include <Library/TableHelperLib.h>
+#include <Protocol/ConfigurationManagerProtocol.h>
+#include "FadtGenerator.h"
+
+/** Updates the Architecture specific information in the FADT Table.
+
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [in, out] Fadt Pointer to the constructed ACPI Table.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_UNSUPPORTED Unsupported.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object was not found.
+ @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
+ Manager is less than the Object size for the
+ requested object.
+**/
+EFI_STATUS
+EFIAPI
+FadtArchUpdate (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN OUT EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE *Fadt
+ )
+{
+ // Not implemented.
+ return EFI_UNSUPPORTED;
+}