* [edk2-devel] [PATCH v1 0/3] DynamicTablesPkg: Adds generic FADT, HPET and WSMT table generators
@ 2024-02-20 6:48 Abdul Lateef Attar via groups.io
2024-02-20 6:48 ` [edk2-devel] [PATCH v1 1/3] DynamicTablesPkg: Adds ACPI FADT Table generator Abdul Lateef Attar via groups.io
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Abdul Lateef Attar via groups.io @ 2024-02-20 6:48 UTC (permalink / raw)
To: devel; +Cc: Abdul Lateef Attar, Sami Mujawar, Pierre Gondois
From: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
PR: https://github.com/tianocore/edk2/pull/5384
Adds new space for ArchNameSpaceObjects.
Adds generic FADT table generator.
Adds generic HPET table generator.
Adds generic WSMT table generator.
Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Pierre Gondois <pierre.gondois@arm.com>
Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
Abdul Lateef Attar (3):
DynamicTablesPkg: Adds ACPI FADT Table generator
DynamicTablesPkg: Adds ACPI HPET Table generator
DynamicTablesPkg: Adds ACPI WSMT Table generator
DynamicTablesPkg/DynamicTables.dsc.inc | 14 +-
DynamicTablesPkg/DynamicTablesPkg.ci.yaml | 7 +-
DynamicTablesPkg/Include/AcpiTableGenerator.h | 2 +
.../Include/ArchNameSpaceObjects.h | 227 ++++++
.../Include/ConfigurationManagerObject.h | 6 +
.../Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf | 42 +
.../Library/Acpi/AcpiFadtLib/FadtGenerator.c | 737 ++++++++++++++++++
.../Library/Acpi/AcpiFadtLib/FadtUpdate.h | 28 +
.../Library/Acpi/AcpiFadtLib/X64/FadtUpdate.c | 32 +
.../Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf | 38 +
.../Library/Acpi/AcpiHpetLib/HpetGenerator.c | 208 +++++
.../Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf | 34 +
.../Library/Acpi/AcpiWsmtLib/WsmtGenerator.c | 221 ++++++
13 files changed, 1593 insertions(+), 3 deletions(-)
create mode 100644 DynamicTablesPkg/Include/ArchNameSpaceObjects.h
create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/FadtGenerator.c
create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/FadtUpdate.h
create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/X64/FadtUpdate.c
create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiHpetLib/HpetGenerator.c
create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c
--
2.34.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115632): https://edk2.groups.io/g/devel/message/115632
Mute This Topic: https://groups.io/mt/104463459/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 8+ messages in thread
* [edk2-devel] [PATCH v1 1/3] DynamicTablesPkg: Adds ACPI FADT Table generator
2024-02-20 6:48 [edk2-devel] [PATCH v1 0/3] DynamicTablesPkg: Adds generic FADT, HPET and WSMT table generators Abdul Lateef Attar via groups.io
@ 2024-02-20 6:48 ` Abdul Lateef Attar via groups.io
2024-02-27 16:02 ` PierreGondois
2024-02-20 6:48 ` [edk2-devel] [PATCH v1 2/3] DynamicTablesPkg: Adds ACPI HPET " Abdul Lateef Attar via groups.io
2024-02-20 6:48 ` [edk2-devel] [PATCH v1 3/3] DynamicTablesPkg: Adds ACPI WSMT " Abdul Lateef Attar via groups.io
2 siblings, 1 reply; 8+ messages in thread
From: Abdul Lateef Attar via groups.io @ 2024-02-20 6:48 UTC (permalink / raw)
To: devel; +Cc: Abdul Lateef Attar, Sami Mujawar, Pierre Gondois
From: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
Adds generic ACPI FADT table generator library.
Register/Deregister FADT table.
Adds Arch namespace ids.
Update the FADT table during boot as per specification.
Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Pierre Gondois <pierre.gondois@arm.com>
Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
---
DynamicTablesPkg/DynamicTables.dsc.inc | 10 +-
DynamicTablesPkg/DynamicTablesPkg.ci.yaml | 4 +-
.../Include/ArchNameSpaceObjects.h | 217 ++++++
.../Include/ConfigurationManagerObject.h | 6 +
.../Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf | 42 +
.../Library/Acpi/AcpiFadtLib/FadtGenerator.c | 737 ++++++++++++++++++
.../Library/Acpi/AcpiFadtLib/FadtUpdate.h | 28 +
.../Library/Acpi/AcpiFadtLib/X64/FadtUpdate.c | 32 +
8 files changed, 1074 insertions(+), 2 deletions(-)
create mode 100644 DynamicTablesPkg/Include/ArchNameSpaceObjects.h
create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/FadtGenerator.c
create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/FadtUpdate.h
create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/X64/FadtUpdate.c
diff --git a/DynamicTablesPkg/DynamicTables.dsc.inc b/DynamicTablesPkg/DynamicTables.dsc.inc
index 19ca62d6a8..5ec9ffac06 100644
--- a/DynamicTablesPkg/DynamicTables.dsc.inc
+++ b/DynamicTablesPkg/DynamicTables.dsc.inc
@@ -31,10 +31,18 @@
DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf
[Components.IA32, Components.X64]
+ #
+ # Generators
+ #
+ DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
+
#
# Dynamic Table Factory Dxe
#
- DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf
+ DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf {
+ <LibraryClasses>
+ NULL|DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
+ }
[Components.ARM, Components.AARCH64]
#
diff --git a/DynamicTablesPkg/DynamicTablesPkg.ci.yaml b/DynamicTablesPkg/DynamicTablesPkg.ci.yaml
index 42829f393e..1ad5540e24 100644
--- a/DynamicTablesPkg/DynamicTablesPkg.ci.yaml
+++ b/DynamicTablesPkg/DynamicTablesPkg.ci.yaml
@@ -128,7 +128,9 @@
"TABLEEX",
"TNSID",
"Vatos",
- "WBINVD"
+ "WBINVD",
+ "NAMESPACEID",
+ "aswell"
], # words to extend to the dictionary for this package
"IgnoreStandardPaths": [], # Standard Plugin defined paths that
# should be ignore
diff --git a/DynamicTablesPkg/Include/ArchNameSpaceObjects.h b/DynamicTablesPkg/Include/ArchNameSpaceObjects.h
new file mode 100644
index 0000000000..b421c4cd29
--- /dev/null
+++ b/DynamicTablesPkg/Include/ArchNameSpaceObjects.h
@@ -0,0 +1,217 @@
+/** @file
+ ARCH Name space object definations.
+
+ Defines namespace objects which are common across platform.
+ Platform can implements these optional namespace depends on
+ their requirements.
+
+ Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Glossary:
+ - Cm or CM - Configuration Manager
+ - Obj or OBJ - Object
+ - Std or STD - Standard
+**/
+
+#ifndef ARCH_NAMESPACE_OBJECTS_H_
+#define ARCH_NAMESPACE_OBJECTS_H_
+
+#include <Uefi/UefiBaseType.h>
+#include <IndustryStandard/Acpi65.h>
+
+/** The E_ARCH_OBJECT_ID enum describes the Object IDs
+ in the ARCH Namespace
+*/
+typedef enum ArchObjectID {
+ EArchObjReserved, ///< 0 - Reserved
+ EArchObjFadtPreferredPmProfile, ///< 1 - Preferred Power Management Profile Info
+ EArchObjFadtSciInterrupt, ///< 2 - SCI Interrupt information
+ EArchObjFadtSciCmdInfo, ///< 3 - SCI CMD information
+ EArchObjFadtPmBlockInfo, ///< 4 - Power management block info
+ EArchObjFadtGpeBlockInfo, ///< 5 - GPE block info
+ EArchObjFadtXpmBlockInfo, ///< 6 - 64-bit Power Management block info
+ EArchObjFadtXgpeBlockInfo, ///< 7 - 64-bit GPE block info
+ EArchObjFadtSleepBlockInfo, ///< 8 - SLEEP block info
+ EArchObjFadtResetBlockInfo, ///< 9 - Reset block info
+ EArchObjFadtFlags, ///< 10 - FADT flags
+ EArchObjFadtArmBootArch, ///< 11 - ARM boot arch information
+ EArchObjFadtHypervisorVendorId, ///< 12 - Hypervisor vendor identity information
+ EArchObjFadtMiscInfo, ///< 13 - Legacy fields; RTC, latency, flush stride, etc
+ EArchObjMax
+} E_ARCH_OBJECT_ID;
+
+/** A structure that describes the
+ Power Management Profile Information for the Platform.
+
+ ID: EArchObjFadtPreferredPmProfile
+*/
+typedef struct CmArchPreferredPmProfile {
+ /** This is the Preferred_PM_Profile field of the FADT Table
+ described in the ACPI Specification
+ */
+ UINT8 PreferredPmProfile;
+} CM_ARCH_FADT_PREFERRED_PM_PROFILE;
+
+/** A structure that describes the
+ SCI interrupt Information for the Platform.
+
+ ID: EArchObjFadtSciInterrupt
+*/
+typedef struct CmArchSciInterrupt {
+ /** This is the Preferred_PM_Profile field of the FADT Table
+ described in the ACPI Specification
+ */
+ UINT16 SciInterrupt;
+} CM_ARCH_FADT_SCI_INTERRUPT;
+
+/** A structure that describes the
+ SCI CMD Information for the Platform.
+
+ ID: EArchObjFadtSciCmdInfo
+*/
+typedef struct CmArchSciCmdInfo {
+ /** This is the System control interrupt command information of the FADT Table
+ described in the ACPI Specification
+ */
+ UINT32 SciCmd;
+ UINT8 AcpiEnable;
+ UINT8 AcpiDisable;
+ UINT8 S4BiosReq;
+ UINT8 PstateCnt;
+ UINT8 CstCnt;
+} CM_ARCH_FADT_SCI_CMD_INFO;
+
+/** A structure that describes the
+ power management block information.
+
+ ID: EArchObjFadtPmBlockInfo
+*/
+typedef struct CmArchPmBlockInfo {
+ /** This is the System control interrupt command information of the FADT Table
+ described in the ACPI Specification
+ */
+ UINT32 Pm1aEvtBlk;
+ UINT32 Pm1bEvtBlk;
+ UINT32 Pm1aCntBlk;
+ UINT32 Pm1bCntBlk;
+ UINT32 Pm2CntBlk;
+ UINT32 PmTmrBlk;
+ UINT8 Pm1EvtLen;
+ UINT8 Pm1CntLen;
+ UINT8 Pm2CntLen;
+ UINT8 PmTmrLen;
+} CM_ARCH_FADT_PM_BLOCK_INFO;
+
+/** A structure that describes the
+ GPE block information.
+
+ ID: EArchObjFadtGpeBlockInfo
+*/
+typedef struct CmArchGpeBlockInfo {
+ /** This is the GPE Block information of the FADT Table
+ described in the ACPI Specification
+ */
+ UINT32 Gpe0Blk;
+ UINT32 Gpe1Blk;
+ UINT8 Gpe0BlkLen;
+ UINT8 Gpe1BlkLen;
+ UINT8 Gpe1Base;
+} CM_ARCH_FADT_GPE_BLOCK_INFO;
+
+/** A structure that describes the
+ FADT flags Information for the Platform.
+
+ ID: EArchObjFadtFlags
+*/
+typedef struct CmArchFadtFlags {
+ UINT32 Flags;
+} CM_ARCH_FADT_FLAGS;
+
+/** A structure that describes the
+ ARM Boot Architecture flags.
+
+ ID: EArchObjFadtArmBootArch
+*/
+typedef struct CmArchArmBootArch {
+ UINT16 ArmBootArch;
+} CM_ARCH_FADT_ARM_BOOT_ARCH;
+
+/** A structure that describes the
+ Hypervisor vendor identity information.
+
+ ID: EArchObjFadtHypervisorVendorId
+*/
+typedef struct CmArchHypervisorVendorId {
+ UINT64 HypervisorVendorIdentity;
+} CM_ARCH_FADT_HYPERVISOR_VENDOR_ID;
+
+/** A structure that describes the
+ 64bit power management block information.
+
+ ID: EArchObjFadtXpmBlockInfo
+*/
+typedef struct CmArchXpmBlockInfo {
+ /** This is the System control interrupt command information of the FADT Table
+ described in the ACPI Specification
+ */
+ EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPm1aEvtBlk;
+ EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPm1bEvtBlk;
+ EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPm1aCntBlk;
+ EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPm1bCntBlk;
+ EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPm2CntBlk;
+ EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPmTmrBlk;
+} CM_ARCH_FADT_X_PM_BLOCK_INFO;
+
+/** A structure that describes the
+ 64-bit GPE block information.
+
+ ID: EArchObjFadtXgpeBlockInfo
+*/
+typedef struct CmArchXgpeBlockInfo {
+ /** This is the GPE Block information of the FADT Table
+ described in the ACPI Specification
+ */
+ EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XGpe0Blk;
+ EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XGpe1Blk;
+} CM_ARCH_FADT_X_GPE_BLOCK_INFO;
+
+/** A structure that describes the
+ sleep control block information.
+
+ ID: EArchObjFadtSleepBlockInfo
+*/
+typedef struct CmArchSleepBlockInfo {
+ EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE SleepControlReg;
+ EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE SleepStatusReg;
+} CM_ARCH_FADT_SLEEP_BLOCK_INFO;
+
+/** A structure that describes the
+ Reset control block information.
+
+ ID: EArchObjFadtResetBlockInfo
+*/
+typedef struct CmArchResetBlockInfo {
+ EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE ResetReg;
+ UINT8 ResetValue;
+} CM_ARCH_FADT_RESET_BLOCK_INFO;
+
+/** A structure that describes the
+ miscellaneous FADT fields information.
+
+ ID: EArchObjFadtMiscInfo
+*/
+typedef struct CmArchFadtMiscInfo {
+ UINT16 PLvl2Lat;
+ UINT16 PLvl3Lat;
+ UINT16 FlushSize;
+ UINT16 FlushStride;
+ UINT8 DutyOffset;
+ UINT8 DutyWidth;
+ UINT8 DayAlrm;
+ UINT8 MonAlrm;
+ UINT8 Century;
+} CM_ARCH_FADT_MISC_INFO;
+
+#endif
diff --git a/DynamicTablesPkg/Include/ConfigurationManagerObject.h b/DynamicTablesPkg/Include/ConfigurationManagerObject.h
index 74ad25d5d9..f2cfadf3d4 100644
--- a/DynamicTablesPkg/Include/ConfigurationManagerObject.h
+++ b/DynamicTablesPkg/Include/ConfigurationManagerObject.h
@@ -1,6 +1,7 @@
/** @file
Copyright (c) 2017 - 2022, ARM Limited. All rights reserved.
+ Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -14,6 +15,7 @@
#include <ArmNameSpaceObjects.h>
#include <StandardNameSpaceObjects.h>
+#include <ArchNameSpaceObjects.h>
#pragma pack(1)
@@ -107,6 +109,7 @@ typedef UINT32 CM_OBJECT_ID;
typedef enum ObjectNameSpaceID {
EObjNameSpaceStandard, ///< Standard Objects Namespace
EObjNameSpaceArm, ///< ARM Objects Namespace
+ EObjNameSpaceArch, ///< Arch Objects Namespace
EObjNameSpaceOem = 0x8, ///< OEM Objects Namespace
EObjNameSpaceMax
} EOBJECT_NAMESPACE_ID;
@@ -172,6 +175,9 @@ typedef struct CmObjDescriptor {
#define CREATE_CM_STD_OBJECT_ID(ObjectId) \
(CREATE_CM_OBJECT_ID (EObjNameSpaceStandard, ObjectId))
+#define CREATE_CM_ARCH_OBJECT_ID(ObjectId) \
+ (CREATE_CM_OBJECT_ID (EObjNameSpaceArch, ObjectId))
+
/** This macro returns a Configuration Manager Object ID
in the ARM Object Namespace.
diff --git a/DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf b/DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
new file mode 100644
index 0000000000..036ac3251e
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
@@ -0,0 +1,42 @@
+## @file
+# FADT Table Generator
+#
+# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+ INF_VERSION = 1.27
+ BASE_NAME = AcpiFadtLib
+ FILE_GUID = 2EBCA674-3849-4D02-A456-3E0495297FCC
+ VERSION_STRING = 1.0
+ MODULE_TYPE = DXE_DRIVER
+ LIBRARY_CLASS = NULL|DXE_DRIVER
+ CONSTRUCTOR = AcpiFadtLibConstructor
+ DESTRUCTOR = AcpiFadtLibDestructor
+
+[Sources]
+ FadtGenerator.c
+ FadtUpdate.h
+
+[Sources.IA32, Sources.X64]
+ X64/FadtUpdate.c
+
+[Sources.ARM, Sources.AARCH64]
+ Arm/FadtUpdate.c
+
+[Packages]
+ DynamicTablesPkg/DynamicTablesPkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ BaseLib
+ DebugLib
+ PcdLib
+
+[Pcd]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId
+ gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision
diff --git a/DynamicTablesPkg/Library/Acpi/AcpiFadtLib/FadtGenerator.c b/DynamicTablesPkg/Library/Acpi/AcpiFadtLib/FadtGenerator.c
new file mode 100644
index 0000000000..0db97878ec
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiFadtLib/FadtGenerator.c
@@ -0,0 +1,737 @@
+/** @file
+ FADT Table Generator
+
+ Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.
+ Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Reference(s):
+ - ACPI 6.5 Specification, Aug 29, 2022
+
+**/
+
+#include <AcpiTableGenerator.h>
+#include <ArchNameSpaceObjects.h>
+#include <ConfigurationManagerHelper.h>
+#include <ConfigurationManagerObject.h>
+#include <IndustryStandard/WindowsSmmSecurityMitigationTable.h>
+#include <Library/AcpiLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/TableHelperLib.h>
+#include <Protocol/ConfigurationManagerProtocol.h>
+#include <Uefi/UefiBaseType.h>
+#include <Uefi/UefiSpec.h>
+#include "FadtUpdate.h"
+
+/** This macro expands to a function that retrieves the Power
+ Management Profile Information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArch,
+ EArchObjFadtPreferredPmProfile,
+ CM_ARCH_FADT_PREFERRED_PM_PROFILE
+ );
+
+/** This macro expands to a function that retrieves the
+ SCI interrupt information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArch,
+ EArchObjFadtSciInterrupt,
+ CM_ARCH_FADT_SCI_INTERRUPT
+ );
+
+/** This macro expands to a function that retrieves the
+ SCI command information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArch,
+ EArchObjFadtSciCmdInfo,
+ CM_ARCH_FADT_SCI_CMD_INFO
+ );
+
+/** This macro expands to a function that retrieves the
+ legacy power management information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArch,
+ EArchObjFadtPmBlockInfo,
+ CM_ARCH_FADT_PM_BLOCK_INFO
+ );
+
+/** This macro expands to a function that retrieves the
+ legacy GPE block information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArch,
+ EArchObjFadtGpeBlockInfo,
+ CM_ARCH_FADT_GPE_BLOCK_INFO
+ );
+
+/** This macro expands to a function that retrieves the
+ FADT flags information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArch,
+ EArchObjFadtFlags,
+ CM_ARCH_FADT_FLAGS
+ )
+
+/** This macro expands to a function that retrieves the
+ ARM boot arch information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArch,
+ EArchObjFadtArmBootArch,
+ CM_ARCH_FADT_ARM_BOOT_ARCH
+ )
+
+/** This macro expands to a function that retrieves the
+ hypervisor vendor identity information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArch,
+ EArchObjFadtHypervisorVendorId,
+ CM_ARCH_FADT_HYPERVISOR_VENDOR_ID
+ )
+
+/** This macro expands to a function that retrieves the
+ legacy level2 latency, level 3 latency, RTC information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArch,
+ EArchObjFadtMiscInfo,
+ CM_ARCH_FADT_MISC_INFO
+ )
+
+/** This macro expands to a function that retrieves the
+ 64-bit power management information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArch,
+ EArchObjFadtXpmBlockInfo,
+ CM_ARCH_FADT_X_PM_BLOCK_INFO
+ );
+
+/** This macro expands to a function that retrieves the
+ 64-bit GPE block information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArch,
+ EArchObjFadtXgpeBlockInfo,
+ CM_ARCH_FADT_X_GPE_BLOCK_INFO
+ );
+
+/** This macro expands to a function that retrieves the
+ sleep block information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArch,
+ EArchObjFadtSleepBlockInfo,
+ CM_ARCH_FADT_SLEEP_BLOCK_INFO
+ );
+
+/** This macro expands to a function that retrieves the
+ reset block information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArch,
+ EArchObjFadtResetBlockInfo,
+ CM_ARCH_FADT_RESET_BLOCK_INFO
+ );
+
+/** The AcpiFadt is a template EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE
+ structure used for generating the FADT Table.
+*/
+STATIC
+EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE mAcpiFadt = {
+ ACPI_HEADER (
+ EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
+ EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE,
+ EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE_REVISION
+ ),
+ // UINT32 FirmwareCtrl
+ 0,
+ // UINT32 Dsdt
+ 0,
+ // UINT8 Reserved0
+ EFI_ACPI_RESERVED_BYTE,
+ // UINT8 PreferredPmProfile
+ EFI_ACPI_6_5_PM_PROFILE_UNSPECIFIED,
+ // UINT16 SciInt
+ 0,
+ // UINT32 SmiCmd
+ 0,
+ // UINT8 AcpiEnable
+ 0,
+ // UINT8 AcpiDisable
+ 0,
+ // UINT8 S4BiosReq
+ 0,
+ // UINT8 PstateCnt
+ 0,
+ // UINT32 Pm1aEvtBlk
+ 0,
+ // UINT32 Pm1bEvtBlk
+ 0,
+ // UINT32 Pm1aCntBlk
+ 0,
+ // UINT32 Pm1bCntBlk
+ 0,
+ // UINT32 Pm2CntBlk
+ 0,
+ // UINT32 PmTmrBlk
+ 0,
+ // UINT32 Gpe0Blk
+ 0,
+ // UINT32 Gpe1Blk
+ 0,
+ // UINT8 Pm1EvtLen
+ 0,
+ // UINT8 Pm1CntLen
+ 0,
+ // UINT8 Pm2CntLen
+ 0,
+ // UINT8 PmTmrLen
+ 0,
+ // UINT8 Gpe0BlkLen
+ 0,
+ // UINT8 Gpe1BlkLen
+ 0,
+ // UINT8 Gpe1Base
+ 0,
+ // UINT8 CstCnt
+ 0,
+ // UINT16 PLvl2Lat
+ 0,
+ // UINT16 PLvl3Lat
+ 0,
+ // UINT16 FlushSize
+ 0,
+ // UINT16 FlushStride
+ 0,
+ // UINT8 DutyOffset
+ 0,
+ // UINT8 DutyWidth
+ 0,
+ // UINT8 DayAlrm
+ 0,
+ // UINT8 MonAlrm
+ 0,
+ // UINT8 Century
+ 0,
+ // UINT16 IaPcBootArch
+ 0,
+ // UINT8 Reserved1
+ 0,
+ // UINT32 Flags
+ 0,
+ // EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE ResetReg
+ NULL_GAS,
+ // UINT8 ResetValue
+ 0,
+ // UINT16 ArmBootArch
+ 0,
+ // UINT8 MinorRevision
+ EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE_MINOR_REVISION,
+ // UINT64 XFirmwareCtrl
+ 0,
+ // UINT64 XDsdt
+ 0,
+ // EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPm1aEvtBlk
+ NULL_GAS,
+ // EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPm1bEvtBlk
+ NULL_GAS,
+ // EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPm1aCntBlk
+ NULL_GAS,
+ // EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPm1bCntBlk
+ NULL_GAS,
+ // EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPm2CntBlk
+ NULL_GAS,
+ // EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPmTmrBlk
+ NULL_GAS,
+ // EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XGpe0Blk
+ NULL_GAS,
+ // EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XGpe1Blk
+ NULL_GAS,
+ // EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE SleepControlReg
+ NULL_GAS,
+ // EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE SleepStatusReg
+ NULL_GAS,
+ // UINT64 HypervisorVendorIdentity
+ EFI_ACPI_RESERVED_QWORD
+};
+
+/** Construct the FADT table.
+
+ This function invokes the Configuration Manager protocol interface
+ to get the required hardware information for generating the ACPI
+ table.
+
+ If this function allocates any resources then they must be freed
+ in the FreeXXXXTableResources function.
+
+ @param [in] This Pointer to the table generator.
+ @param [in] AcpiTableInfo Pointer to the ACPI Table Info.
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [out] Table Pointer to the constructed ACPI Table.
+
+ @retval EFI_SUCCESS Table generated successfully.
+ @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
+BuildFadtTable (
+ IN CONST ACPI_TABLE_GENERATOR *CONST This,
+ IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
+ )
+{
+ EFI_STATUS Status;
+ CM_ARCH_FADT_PREFERRED_PM_PROFILE *PmProfile;
+ CM_ARCH_FADT_SCI_INTERRUPT *SciInterrupt;
+ CM_ARCH_FADT_SCI_CMD_INFO *SciCmdinfo;
+ CM_ARCH_FADT_PM_BLOCK_INFO *PmBlockInfo;
+ CM_ARCH_FADT_GPE_BLOCK_INFO *GpeBlockInfo;
+ CM_ARCH_FADT_X_PM_BLOCK_INFO *XpmBlockInfo;
+ CM_ARCH_FADT_X_GPE_BLOCK_INFO *XgpeBlockInfo;
+ CM_ARCH_FADT_SLEEP_BLOCK_INFO *SleepBlockInfo;
+ CM_ARCH_FADT_RESET_BLOCK_INFO *ResetBlockInfo;
+ CM_ARCH_FADT_FLAGS *FadtFlags;
+ CM_ARCH_FADT_ARM_BOOT_ARCH *ArmBootArch;
+ CM_ARCH_FADT_HYPERVISOR_VENDOR_ID *HypervisorVendorId;
+ CM_ARCH_FADT_MISC_INFO *FadtMiscInfo;
+ UINT64 EArchObjFadtMask;
+
+ ASSERT (This != NULL);
+ ASSERT (AcpiTableInfo != NULL);
+ ASSERT (CfgMgrProtocol != NULL);
+ ASSERT (Table != NULL);
+ ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
+ ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
+
+ if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
+ (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
+ {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Requested table revision = %d, is not supported."
+ "Supported table revision: Minimum = %d, Maximum = %d\n",
+ AcpiTableInfo->AcpiTableRevision,
+ This->MinAcpiTableRevision,
+ This->AcpiTableRevision
+ ));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *Table = NULL;
+
+ Status = AddAcpiHeader (
+ CfgMgrProtocol,
+ This,
+ (EFI_ACPI_DESCRIPTION_HEADER *)&mAcpiFadt,
+ AcpiTableInfo,
+ sizeof (EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE)
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to add ACPI header. Status = %r\n",
+ Status
+ ));
+ return Status;
+ }
+
+ EArchObjFadtMask = 0;
+ DEBUG ((DEBUG_ERROR, "before 0x%x\n", EArchObjFadtMask));
+ GetPlatformNameSpaceMask (&EArchObjFadtMask);
+ DEBUG ((DEBUG_ERROR, "after 0x%x\n", EArchObjFadtMask));
+
+ if (!(EArchObjFadtMask & (1 << EArchObjFadtPreferredPmProfile))) {
+ // Get the Power Management Profile from the Platform Configuration Manager
+ Status = GetEArchObjFadtPreferredPmProfile (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &PmProfile,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get Power Management Profile information." \
+ " Status = %r\n",
+ Status
+ ));
+ } else {
+ mAcpiFadt.PreferredPmProfile = PmProfile->PreferredPmProfile;
+ }
+ }
+
+ if (!(EArchObjFadtMask & (1 << EArchObjFadtSciInterrupt))) {
+ // Get the SCI interrupt from the Platform Configuration Manager
+ Status = GetEArchObjFadtSciInterrupt (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &SciInterrupt,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get SCI Interrupt information." \
+ " Status = %r\n",
+ Status
+ ));
+ } else {
+ mAcpiFadt.SciInt = SciInterrupt->SciInterrupt;
+ }
+ }
+
+ if (!(EArchObjFadtMask & (1 << EArchObjFadtSciCmdInfo))) {
+ // Get the SCI CMD information from the Platform Configuration Manager
+ Status = GetEArchObjFadtSciCmdInfo (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &SciCmdinfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get SCI CMD information." \
+ " Status = %r\n",
+ Status
+ ));
+ } else {
+ mAcpiFadt.SmiCmd = SciCmdinfo->SciCmd;
+ mAcpiFadt.AcpiEnable = SciCmdinfo->AcpiEnable;
+ mAcpiFadt.AcpiDisable = SciCmdinfo->AcpiDisable;
+ mAcpiFadt.S4BiosReq = SciCmdinfo->S4BiosReq;
+ mAcpiFadt.PstateCnt = SciCmdinfo->PstateCnt;
+ mAcpiFadt.CstCnt = SciCmdinfo->CstCnt;
+ }
+ }
+
+ if (!(EArchObjFadtMask & (1 << EArchObjFadtPmBlockInfo))) {
+ // Get the SCI PM Block information from the Platform Configuration Manager
+ Status = GetEArchObjFadtPmBlockInfo (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &PmBlockInfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get PM Block information." \
+ " Status = %r\n",
+ Status
+ ));
+ } else {
+ mAcpiFadt.Pm1aEvtBlk = PmBlockInfo->Pm1aEvtBlk;
+ mAcpiFadt.Pm1bEvtBlk = PmBlockInfo->Pm1bEvtBlk;
+ mAcpiFadt.Pm1aCntBlk = PmBlockInfo->Pm1aCntBlk;
+ mAcpiFadt.Pm1bCntBlk = PmBlockInfo->Pm1bCntBlk;
+ mAcpiFadt.Pm2CntBlk = PmBlockInfo->Pm2CntBlk;
+ mAcpiFadt.PmTmrBlk = PmBlockInfo->PmTmrBlk;
+ mAcpiFadt.Pm1EvtLen = PmBlockInfo->Pm1EvtLen;
+ mAcpiFadt.Pm1CntLen = PmBlockInfo->Pm1CntLen;
+ mAcpiFadt.Pm2CntLen = PmBlockInfo->Pm2CntLen;
+ mAcpiFadt.PmTmrLen = PmBlockInfo->PmTmrLen;
+ }
+ }
+
+ if (!(EArchObjFadtMask & (1 << EArchObjFadtGpeBlockInfo))) {
+ // Get the SCI PM Block information from the Platform Configuration Manager
+ Status = GetEArchObjFadtGpeBlockInfo (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &GpeBlockInfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get PM Block information." \
+ " Status = %r\n",
+ Status
+ ));
+ } else {
+ mAcpiFadt.Gpe0Blk = GpeBlockInfo->Gpe0Blk;
+ mAcpiFadt.Gpe1Blk = GpeBlockInfo->Gpe1Blk;
+ mAcpiFadt.Gpe0BlkLen = GpeBlockInfo->Gpe0BlkLen;
+ mAcpiFadt.Gpe1BlkLen = GpeBlockInfo->Gpe1BlkLen;
+ mAcpiFadt.Gpe1Base = GpeBlockInfo->Gpe1Base;
+ }
+ }
+
+ if (!(EArchObjFadtMask & (1 << EArchObjFadtFlags))) {
+ // Get the Power Management Profile from the Platform Configuration Manager
+ Status = GetEArchObjFadtFlags (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &FadtFlags,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get FADT flags information." \
+ " Status = %r\n",
+ Status
+ ));
+ } else {
+ mAcpiFadt.Flags = FadtFlags->Flags;
+ }
+ }
+
+ if (!(EArchObjFadtMask & (1 << EArchObjFadtArmBootArch))) {
+ // Get the Arm boot arch information from the Platform Configuration Manager
+ Status = GetEArchObjFadtArmBootArch (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &ArmBootArch,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get ARM boot arch flags information." \
+ " Status = %r\n",
+ Status
+ ));
+ } else {
+ mAcpiFadt.ArmBootArch = ArmBootArch->ArmBootArch;
+ }
+ }
+
+ if (!(EArchObjFadtMask & (1 << EArchObjFadtArmBootArch))) {
+ // Get the Hypervisor Vendor Identity information from the Platform Configuration Manager
+ Status = GetEArchObjFadtHypervisorVendorId (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &HypervisorVendorId,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get Hypervisor Vendor Identity flags information." \
+ " Status = %r\n",
+ Status
+ ));
+ } else {
+ mAcpiFadt.HypervisorVendorIdentity = HypervisorVendorId->HypervisorVendorIdentity;
+ }
+ }
+
+ if (!(EArchObjFadtMask & (1 << EArchObjFadtXpmBlockInfo))) {
+ // Get the 64-bit PM Block information from the Platform Configuration Manager
+ Status = GetEArchObjFadtXpmBlockInfo (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &XpmBlockInfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get 64-bit PM Block information." \
+ " Status = %r\n",
+ Status
+ ));
+ } else {
+ CopyMem (&mAcpiFadt.XPm1aCntBlk, &XpmBlockInfo->XPm1aCntBlk, sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE));
+ CopyMem (&mAcpiFadt.XPm1bEvtBlk, &XpmBlockInfo->XPm1bEvtBlk, sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE));
+ CopyMem (&mAcpiFadt.XPm1aCntBlk, &XpmBlockInfo->XPm1aCntBlk, sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE));
+ CopyMem (&mAcpiFadt.XPm1bCntBlk, &XpmBlockInfo->XPm1bCntBlk, sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE));
+ CopyMem (&mAcpiFadt.XPm2CntBlk, &XpmBlockInfo->XPm2CntBlk, sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE));
+ CopyMem (&mAcpiFadt.XPmTmrBlk, &XpmBlockInfo->XPmTmrBlk, sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE));
+ }
+ }
+
+ if (!(EArchObjFadtMask & (1 << EArchObjFadtMiscInfo))) {
+ // Get the various platform information from the Platform Configuration manager
+ Status = GetEArchObjFadtMiscInfo (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &FadtMiscInfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get various platform information." \
+ " Status = %r\n",
+ Status
+ ));
+ } else {
+ mAcpiFadt.PLvl2Lat = FadtMiscInfo->PLvl2Lat;
+ mAcpiFadt.PLvl3Lat = FadtMiscInfo->PLvl3Lat;
+ mAcpiFadt.FlushSize = FadtMiscInfo->FlushSize;
+ mAcpiFadt.FlushStride = FadtMiscInfo->FlushStride;
+ mAcpiFadt.DutyOffset = FadtMiscInfo->DutyOffset;
+ mAcpiFadt.DutyWidth = FadtMiscInfo->DutyWidth;
+ mAcpiFadt.DayAlrm = FadtMiscInfo->DayAlrm;
+ mAcpiFadt.MonAlrm = FadtMiscInfo->MonAlrm;
+ mAcpiFadt.Century = FadtMiscInfo->Century;
+ }
+ }
+
+ if (!(EArchObjFadtMask & (1 << EArchObjFadtXgpeBlockInfo))) {
+ // Get the 64-bit GPE Block information from the Platform Configuration Manager
+ Status = GetEArchObjFadtXgpeBlockInfo (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &XgpeBlockInfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get 64-bit GPE Block information." \
+ " Status = %r\n",
+ Status
+ ));
+ } else {
+ CopyMem (&mAcpiFadt.XGpe0Blk, &XgpeBlockInfo->XGpe0Blk, sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE));
+ CopyMem (&mAcpiFadt.XGpe1Blk, &XgpeBlockInfo->XGpe1Blk, sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE));
+ }
+ }
+
+ if (!(EArchObjFadtMask & (1 << EArchObjFadtSleepBlockInfo))) {
+ // Get the sleep Block information from the Platform Configuration Manager
+ Status = GetEArchObjFadtSleepBlockInfo (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &SleepBlockInfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get Sleep Block information." \
+ " Status = %r\n",
+ Status
+ ));
+ } else {
+ CopyMem (&mAcpiFadt.SleepControlReg, &SleepBlockInfo->SleepControlReg, sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE));
+ CopyMem (&mAcpiFadt.SleepStatusReg, &SleepBlockInfo->SleepStatusReg, sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE));
+ }
+ }
+
+ if (!(EArchObjFadtMask & (1 << EArchObjFadtResetBlockInfo))) {
+ // Get the sleep Block information from the Platform Configuration Manager
+ Status = GetEArchObjFadtResetBlockInfo (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &ResetBlockInfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get Reset Block information." \
+ " Status = %r\n",
+ Status
+ ));
+ } else {
+ CopyMem (&mAcpiFadt.ResetReg, &ResetBlockInfo->ResetReg, sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE));
+ mAcpiFadt.ResetValue = ResetBlockInfo->ResetValue;
+ }
+ }
+
+ Status = EFI_SUCCESS;
+
+ *Table = (EFI_ACPI_DESCRIPTION_HEADER *)&mAcpiFadt;
+
+ return Status;
+}
+
+/** The interface for the FADT Table Generator.
+*/
+STATIC
+CONST
+ACPI_TABLE_GENERATOR mFadtGenerator = {
+ // Generator ID
+ CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt),
+ // Generator Description
+ L"ACPI.STD.FADT.GENERATOR",
+ // ACPI Table Signature
+ EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
+ // ACPI Table Revision supported by this Generator
+ EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
+ // Minimum supported ACPI Table Revision
+ EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
+ // Creator ID
+ FixedPcdGet32 (PcdAcpiDefaultCreatorId),
+ // Creator Revision
+ FixedPcdGet32 (PcdAcpiDefaultCreatorRevision),
+ // Build Table function
+ BuildFadtTable,
+ // No additional resources are allocated by the generator.
+ // Hence the Free Resource function is not required.
+ NULL,
+ // Extended build function not needed
+ NULL,
+ // Extended build function not implemented by the generator.
+ // Hence extended free resource function is not required.
+ NULL
+};
+
+/** Register the Generator with the ACPI Table Factory.
+
+ @param [in] ImageHandle The handle to the image.
+ @param [in] SystemTable Pointer to the System Table.
+
+ @retval EFI_SUCCESS The Generator is registered.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_ALREADY_STARTED The Generator for the Table ID
+ is already registered.
+**/
+EFI_STATUS
+EFIAPI
+AcpiFadtLibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status = RegisterAcpiTableGenerator (&mFadtGenerator);
+ DEBUG ((DEBUG_INFO, "FADT: Register Generator. Status = %r\n", Status));
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
+
+/** Deregister the Generator from the ACPI Table Factory.
+
+ @param [in] ImageHandle The handle to the image.
+ @param [in] SystemTable Pointer to the System Table.
+
+ @retval EFI_SUCCESS The Generator is deregistered.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The Generator is not registered.
+**/
+EFI_STATUS
+EFIAPI
+AcpiFadtLibDestructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status = DeregisterAcpiTableGenerator (&mFadtGenerator);
+ DEBUG ((DEBUG_INFO, "FADT: Deregister Generator. Status = %r\n", Status));
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
diff --git a/DynamicTablesPkg/Library/Acpi/AcpiFadtLib/FadtUpdate.h b/DynamicTablesPkg/Library/Acpi/AcpiFadtLib/FadtUpdate.h
new file mode 100644
index 0000000000..8cc083c95e
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiFadtLib/FadtUpdate.h
@@ -0,0 +1,28 @@
+/** @file
+ FADT Update header file
+ Defines architecture specific function headers.
+
+ Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef FADT_UPDATE_H_
+#define FADT_UPDATE_H_
+
+#include <Uefi/UefiBaseType.h>
+
+/** Gets Architecture specific bitmask for EObjNameSpaceArch namespace.
+
+ @param [out] EArchObjFadtMask Pointer to the Mask bit variable.
+
+ @retval None
+**/
+VOID
+EFIAPI
+GetPlatformNameSpaceMask (
+ OUT UINT64 *EArchObjFadtMask
+ );
+
+#endif // FADT_UPDATE_H_
diff --git a/DynamicTablesPkg/Library/Acpi/AcpiFadtLib/X64/FadtUpdate.c b/DynamicTablesPkg/Library/Acpi/AcpiFadtLib/X64/FadtUpdate.c
new file mode 100644
index 0000000000..eebb282c18
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiFadtLib/X64/FadtUpdate.c
@@ -0,0 +1,32 @@
+/** @file
+ FADT Update header file
+ Defines architecture specific function headers.
+
+ Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+#include "../FadtUpdate.h"
+#include <ArchNameSpaceObjects.h>
+
+/** Gets Architecture specific bitmask for EObjNameSpaceArch namespace.
+
+ @param [out] EArchObjFadtMask Pointer to the Mask bit variable.
+
+**/
+VOID
+EFIAPI
+GetPlatformNameSpaceMask (
+ OUT UINT64 *EArchObjFadtMask
+ )
+{
+ if (EArchObjFadtMask == NULL) {
+ return;
+ }
+
+ *EArchObjFadtMask = ((*EArchObjFadtMask) |
+ (1 << EArchObjFadtArmBootArch) |
+ (1 << EArchObjFadtHypervisorVendorId)
+ );
+}
--
2.34.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115634): https://edk2.groups.io/g/devel/message/115634
Mute This Topic: https://groups.io/mt/104463461/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [edk2-devel] [PATCH v1 2/3] DynamicTablesPkg: Adds ACPI HPET Table generator
2024-02-20 6:48 [edk2-devel] [PATCH v1 0/3] DynamicTablesPkg: Adds generic FADT, HPET and WSMT table generators Abdul Lateef Attar via groups.io
2024-02-20 6:48 ` [edk2-devel] [PATCH v1 1/3] DynamicTablesPkg: Adds ACPI FADT Table generator Abdul Lateef Attar via groups.io
@ 2024-02-20 6:48 ` Abdul Lateef Attar via groups.io
2024-02-27 16:02 ` PierreGondois
2024-02-20 6:48 ` [edk2-devel] [PATCH v1 3/3] DynamicTablesPkg: Adds ACPI WSMT " Abdul Lateef Attar via groups.io
2 siblings, 1 reply; 8+ messages in thread
From: Abdul Lateef Attar via groups.io @ 2024-02-20 6:48 UTC (permalink / raw)
To: devel; +Cc: Abdul Lateef Attar, Sami Mujawar, Pierre Gondois
From: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
Adds generic ACPI HPET table generator library.
Register/Deregister HPET table.
Update the HPET table during boot as per specification.
Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Pierre Gondois <pierre.gondois@arm.com>
Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
---
DynamicTablesPkg/DynamicTables.dsc.inc | 2 +
DynamicTablesPkg/DynamicTablesPkg.ci.yaml | 3 +-
DynamicTablesPkg/Include/AcpiTableGenerator.h | 1 +
.../Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf | 38 ++++
.../Library/Acpi/AcpiHpetLib/HpetGenerator.c | 208 ++++++++++++++++++
5 files changed, 251 insertions(+), 1 deletion(-)
create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiHpetLib/HpetGenerator.c
diff --git a/DynamicTablesPkg/DynamicTables.dsc.inc b/DynamicTablesPkg/DynamicTables.dsc.inc
index 5ec9ffac06..af70785520 100644
--- a/DynamicTablesPkg/DynamicTables.dsc.inc
+++ b/DynamicTablesPkg/DynamicTables.dsc.inc
@@ -35,6 +35,7 @@
# Generators
#
DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
+ DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
#
# Dynamic Table Factory Dxe
@@ -42,6 +43,7 @@
DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf {
<LibraryClasses>
NULL|DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
+ NULL|DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
}
[Components.ARM, Components.AARCH64]
diff --git a/DynamicTablesPkg/DynamicTablesPkg.ci.yaml b/DynamicTablesPkg/DynamicTablesPkg.ci.yaml
index 1ad5540e24..cacdaa1df6 100644
--- a/DynamicTablesPkg/DynamicTablesPkg.ci.yaml
+++ b/DynamicTablesPkg/DynamicTablesPkg.ci.yaml
@@ -53,7 +53,8 @@
"EmbeddedPkg/EmbeddedPkg.dec",
"DynamicTablesPkg/DynamicTablesPkg.dec",
"MdeModulePkg/MdeModulePkg.dec",
- "MdePkg/MdePkg.dec"
+ "MdePkg/MdePkg.dec",
+ "PcAtChipsetPkg/PcAtChipsetPkg.dec"
],
# For host based unit tests
"AcceptableDependencies-HOST_APPLICATION":[
diff --git a/DynamicTablesPkg/Include/AcpiTableGenerator.h b/DynamicTablesPkg/Include/AcpiTableGenerator.h
index d0eda011c3..18b5f99f47 100644
--- a/DynamicTablesPkg/Include/AcpiTableGenerator.h
+++ b/DynamicTablesPkg/Include/AcpiTableGenerator.h
@@ -99,6 +99,7 @@ typedef enum StdAcpiTableId {
EStdAcpiTableIdSsdtCpuTopology, ///< SSDT Cpu Topology
EStdAcpiTableIdSsdtPciExpress, ///< SSDT Pci Express Generator
EStdAcpiTableIdPcct, ///< PCCT Generator
+ EStdAcpiTableIdHpet, ///< HPET Generator
EStdAcpiTableIdMax
} ESTD_ACPI_TABLE_ID;
diff --git a/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf b/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
new file mode 100644
index 0000000000..74a1358ffe
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
@@ -0,0 +1,38 @@
+## @file
+# HPET Table Generator
+#
+# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+ INF_VERSION = 1.27
+ BASE_NAME = AcpiHpetLib
+ FILE_GUID = 4E75F653-C356-48B3-B32C-D1B901ECF90A
+ VERSION_STRING = 1.0
+ MODULE_TYPE = DXE_DRIVER
+ LIBRARY_CLASS = NULL|DXE_DRIVER
+ CONSTRUCTOR = AcpiHpetLibConstructor
+ DESTRUCTOR = AcpiHpetLibDestructor
+
+[Sources]
+ HpetGenerator.c
+
+[Packages]
+ DynamicTablesPkg/DynamicTablesPkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ MdePkg/MdePkg.dec
+ PcAtChipsetPkg/PcAtChipsetPkg.dec
+
+[LibraryClasses]
+ BaseLib
+ DebugLib
+ IoLib
+ PcdLib
+
+[Pcd]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId
+ gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision
+ gPcAtChipsetPkgTokenSpaceGuid.PcdHpetBaseAddress
diff --git a/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/HpetGenerator.c b/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/HpetGenerator.c
new file mode 100644
index 0000000000..e365746556
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/HpetGenerator.c
@@ -0,0 +1,208 @@
+/** @file
+ HPET Table Generator
+
+ Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.
+ Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Reference(s):
+ - ACPI 6.5 Specification, Aug 29, 2022
+ - HPET spec, version 1.0a
+
+**/
+
+#include <AcpiTableGenerator.h>
+#include <ConfigurationManagerHelper.h>
+#include <ConfigurationManagerObject.h>
+#include <IndustryStandard/HighPrecisionEventTimerTable.h>
+#include <Library/AcpiLib.h>
+#include <Library/DebugLib.h>
+#include <Library/IoLib.h>
+#include <Library/PcdLib.h>
+#include <Library/TableHelperLib.h>
+#include <Protocol/AcpiTable.h>
+#include <Protocol/ConfigurationManagerProtocol.h>
+#include <Register/Hpet.h>
+
+/** The AcpiHpet is a template EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_TABLE_HEADER
+ structure used for generating the HPET Table.
+*/
+STATIC
+EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_TABLE_HEADER mAcpiHpet = {
+ ACPI_HEADER (
+ EFI_ACPI_6_5_HIGH_PRECISION_EVENT_TIMER_TABLE_SIGNATURE,
+ EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_TABLE_HEADER,
+ EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_TABLE_REVISION
+ ),
+ // EventTimerBlockId
+ 0,
+ // BaseAddressLower32Bit
+ { EFI_ACPI_6_5_SYSTEM_MEMORY, 0,0, EFI_ACPI_RESERVED_BYTE, 0 },
+ // HpetNumber
+ 0,
+ // MainCounterMinimumClockTickInPeriodicMode
+ 0,
+ // PageProtectionAndOemAttribute
+ EFI_ACPI_NO_PAGE_PROTECTION
+};
+
+/** Construct the HPET table.
+
+ This function invokes the Configuration Manager protocol interface
+ to get the required hardware information for generating the ACPI
+ table.
+
+ If this function allocates any resources then they must be freed
+ in the FreeXXXXTableResources function.
+
+ @param [in] This Pointer to the table generator.
+ @param [in] AcpiTableInfo Pointer to the ACPI Table Info.
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [out] Table Pointer to the constructed ACPI Table.
+
+ @retval EFI_SUCCESS Table generated successfully.
+ @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
+BuildHpetTable (
+ IN CONST ACPI_TABLE_GENERATOR *CONST This,
+ IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
+ )
+{
+ EFI_STATUS Status;
+
+ ASSERT (This != NULL);
+ ASSERT (AcpiTableInfo != NULL);
+ ASSERT (CfgMgrProtocol != NULL);
+ ASSERT (Table != NULL);
+ ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
+ ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
+
+ if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
+ (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
+ {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: HPET: Requested table revision = %d, is not supported."
+ "Supported table revision: Minimum = %d, Maximum = %d\n",
+ AcpiTableInfo->AcpiTableRevision,
+ This->MinAcpiTableRevision,
+ This->AcpiTableRevision
+ ));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *Table = NULL;
+
+ Status = AddAcpiHeader (
+ CfgMgrProtocol,
+ This,
+ (EFI_ACPI_DESCRIPTION_HEADER *)&mAcpiHpet,
+ AcpiTableInfo,
+ sizeof (EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_TABLE_HEADER)
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: HPET: Failed to add ACPI header. Status = %r\n",
+ Status
+ ));
+ return Status;
+ }
+
+ mAcpiHpet.BaseAddressLower32Bit.Address = PcdGet32 (PcdHpetBaseAddress);
+ mAcpiHpet.EventTimerBlockId = MmioRead32 (PcdGet32 (PcdHpetBaseAddress) + HPET_GENERAL_CAPABILITIES_ID_OFFSET);
+ mAcpiHpet.MainCounterMinimumClockTickInPeriodicMode = (UINT16)MmioRead32 (PcdGet32 (PcdHpetBaseAddress) + HPET_GENERAL_CAPABILITIES_ID_OFFSET + 4);
+ *Table = (EFI_ACPI_DESCRIPTION_HEADER *)&mAcpiHpet;
+
+ return Status;
+}
+
+/** The interface for the HPET Table Generator.
+*/
+STATIC
+CONST
+ACPI_TABLE_GENERATOR mHpetGenerator = {
+ // Generator ID
+ CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdHpet),
+ // Generator Description
+ L"ACPI.STD.HPET.GENERATOR",
+ // ACPI Table Signature
+ EFI_ACPI_6_5_HIGH_PRECISION_EVENT_TIMER_TABLE_SIGNATURE,
+ // ACPI Table Revision supported by this Generator
+ EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_TABLE_REVISION,
+ // Minimum supported ACPI Table Revision
+ EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_TABLE_REVISION,
+ // Creator ID
+ FixedPcdGet32 (PcdAcpiDefaultCreatorId),
+ // Creator Revision
+ FixedPcdGet32 (PcdAcpiDefaultCreatorRevision),
+ // Build Table function
+ BuildHpetTable,
+ // No additional resources are allocated by the generator.
+ // Hence the Free Resource function is not required.
+ NULL,
+ // Extended build function not needed
+ NULL,
+ // Extended build function not implemented by the generator.
+ // Hence extended free resource function is not required.
+ NULL
+};
+
+/** Register the Generator with the ACPI Table Factory.
+
+ @param [in] ImageHandle The handle to the image.
+ @param [in] SystemTable Pointer to the System Table.
+
+ @retval EFI_SUCCESS The Generator is registered.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_ALREADY_STARTED The Generator for the Table ID
+ is already registered.
+**/
+EFI_STATUS
+EFIAPI
+AcpiHpetLibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status = RegisterAcpiTableGenerator (&mHpetGenerator);
+ DEBUG ((DEBUG_INFO, "HPET: Register Generator. Status = %r\n", Status));
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
+
+/** Deregister the Generator from the ACPI Table Factory.
+
+ @param [in] ImageHandle The handle to the image.
+ @param [in] SystemTable Pointer to the System Table.
+
+ @retval EFI_SUCCESS The Generator is deregistered.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The Generator is not registered.
+**/
+EFI_STATUS
+EFIAPI
+AcpiHpetLibDestructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status = DeregisterAcpiTableGenerator (&mHpetGenerator);
+ DEBUG ((DEBUG_INFO, "HPET: Deregister Generator. Status = %r\n", Status));
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
--
2.34.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115633): https://edk2.groups.io/g/devel/message/115633
Mute This Topic: https://groups.io/mt/104463460/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [edk2-devel] [PATCH v1 3/3] DynamicTablesPkg: Adds ACPI WSMT Table generator
2024-02-20 6:48 [edk2-devel] [PATCH v1 0/3] DynamicTablesPkg: Adds generic FADT, HPET and WSMT table generators Abdul Lateef Attar via groups.io
2024-02-20 6:48 ` [edk2-devel] [PATCH v1 1/3] DynamicTablesPkg: Adds ACPI FADT Table generator Abdul Lateef Attar via groups.io
2024-02-20 6:48 ` [edk2-devel] [PATCH v1 2/3] DynamicTablesPkg: Adds ACPI HPET " Abdul Lateef Attar via groups.io
@ 2024-02-20 6:48 ` Abdul Lateef Attar via groups.io
2024-02-27 16:02 ` PierreGondois
2 siblings, 1 reply; 8+ messages in thread
From: Abdul Lateef Attar via groups.io @ 2024-02-20 6:48 UTC (permalink / raw)
To: devel; +Cc: Abdul Lateef Attar, Sami Mujawar, Pierre Gondois
From: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
Adds generic ACPI WSMT table generator library.
Register/Deregister WSMT table.
Update the WSMT table during boot as per specification.
Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Pierre Gondois <pierre.gondois@arm.com>
Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
---
DynamicTablesPkg/DynamicTables.dsc.inc | 2 +
DynamicTablesPkg/Include/AcpiTableGenerator.h | 1 +
.../Include/ArchNameSpaceObjects.h | 10 +
.../Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf | 34 +++
.../Library/Acpi/AcpiWsmtLib/WsmtGenerator.c | 221 ++++++++++++++++++
5 files changed, 268 insertions(+)
create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c
diff --git a/DynamicTablesPkg/DynamicTables.dsc.inc b/DynamicTablesPkg/DynamicTables.dsc.inc
index af70785520..5e66f5cd02 100644
--- a/DynamicTablesPkg/DynamicTables.dsc.inc
+++ b/DynamicTablesPkg/DynamicTables.dsc.inc
@@ -36,6 +36,7 @@
#
DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
+ DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
#
# Dynamic Table Factory Dxe
@@ -44,6 +45,7 @@
<LibraryClasses>
NULL|DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
NULL|DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
+ NULL|DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
}
[Components.ARM, Components.AARCH64]
diff --git a/DynamicTablesPkg/Include/AcpiTableGenerator.h b/DynamicTablesPkg/Include/AcpiTableGenerator.h
index 18b5f99f47..a32ef46ecb 100644
--- a/DynamicTablesPkg/Include/AcpiTableGenerator.h
+++ b/DynamicTablesPkg/Include/AcpiTableGenerator.h
@@ -100,6 +100,7 @@ typedef enum StdAcpiTableId {
EStdAcpiTableIdSsdtPciExpress, ///< SSDT Pci Express Generator
EStdAcpiTableIdPcct, ///< PCCT Generator
EStdAcpiTableIdHpet, ///< HPET Generator
+ EStdAcpiTableIdWsmt, ///< WSMT Generator
EStdAcpiTableIdMax
} ESTD_ACPI_TABLE_ID;
diff --git a/DynamicTablesPkg/Include/ArchNameSpaceObjects.h b/DynamicTablesPkg/Include/ArchNameSpaceObjects.h
index b421c4cd29..ad3045dfec 100644
--- a/DynamicTablesPkg/Include/ArchNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/ArchNameSpaceObjects.h
@@ -39,6 +39,7 @@ typedef enum ArchObjectID {
EArchObjFadtArmBootArch, ///< 11 - ARM boot arch information
EArchObjFadtHypervisorVendorId, ///< 12 - Hypervisor vendor identity information
EArchObjFadtMiscInfo, ///< 13 - Legacy fields; RTC, latency, flush stride, etc
+ EArchObjWsmtProtectionFlags, ///< 14 - WSMT protection flags
EArchObjMax
} E_ARCH_OBJECT_ID;
@@ -214,4 +215,13 @@ typedef struct CmArchFadtMiscInfo {
UINT8 Century;
} CM_ARCH_FADT_MISC_INFO;
+/** A structure that describes the
+ protection flags for the WSMT fields information.
+
+ ID: EArchObjWsmtProtectionFlags
+*/
+typedef struct CmArchWsmtProtectionFlags {
+ UINT32 ProtectionFlags;
+} CM_ARCH_WSMT_PROTECTION_FLAGS;
+
#endif
diff --git a/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf b/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
new file mode 100644
index 0000000000..f8683a5005
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
@@ -0,0 +1,34 @@
+## @file
+# WSMT Table Generator
+#
+# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+ INF_VERSION = 1.27
+ BASE_NAME = AcpiWsmtLib
+ FILE_GUID = D6C34086-C914-4F8E-B56A-08329B4D1271
+ VERSION_STRING = 1.0
+ MODULE_TYPE = DXE_DRIVER
+ LIBRARY_CLASS = NULL|DXE_DRIVER
+ CONSTRUCTOR = AcpiWsmtLibConstructor
+ DESTRUCTOR = AcpiWsmtLibDestructor
+
+[Sources]
+ WsmtGenerator.c
+
+[Packages]
+ DynamicTablesPkg/DynamicTablesPkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ BaseLib
+ DebugLib
+ PcdLib
+
+[Pcd]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId
+ gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision
diff --git a/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c b/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c
new file mode 100644
index 0000000000..c102152974
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c
@@ -0,0 +1,221 @@
+/** @file
+ WSMT Table Generator
+
+ Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.
+ Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Reference(s):
+ - ACPI 6.5 Specification, Aug 29, 2022
+ - WSMT spec, version 1.0, April 18, 2016
+
+**/
+
+#include <AcpiTableGenerator.h>
+#include <ConfigurationManagerHelper.h>
+#include <ConfigurationManagerObject.h>
+#include <IndustryStandard/WindowsSmmSecurityMitigationTable.h>
+#include <Library/DebugLib.h>
+#include <Library/TableHelperLib.h>
+#include <Protocol/ConfigurationManagerProtocol.h>
+#include <Uefi/UefiBaseType.h>
+#include <Uefi/UefiSpec.h>
+#include <ArchNameSpaceObjects.h>
+
+/** This macro expands to a function that retrieves the
+ protection flags information for WSMT Table.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArch,
+ EArchObjWsmtProtectionFlags,
+ CM_ARCH_WSMT_PROTECTION_FLAGS
+ );
+
+/** The AcpiWsmt is a template EFI_ACPI_WSMT_TABLE
+ structure used for generating the WSMT Table.
+*/
+STATIC
+EFI_ACPI_WSMT_TABLE mAcpiWsmt = {
+ ACPI_HEADER (
+ EFI_ACPI_WINDOWS_SMM_SECURITY_MITIGATION_TABLE_SIGNATURE,
+ EFI_ACPI_WSMT_TABLE,
+ EFI_WSMT_TABLE_REVISION
+ ),
+ EFI_WSMT_PROTECTION_FLAGS_SYSTEM_RESOURCE_PROTECTION|EFI_WSMT_PROTECTION_FLAGS_COMM_BUFFER_NESTED_PTR_PROTECTION|EFI_WSMT_PROTECTION_FLAGS_FIXED_COMM_BUFFERS
+};
+
+/** Construct the WSMT table.
+
+ This function invokes the Configuration Manager protocol interface
+ to get the required hardware information for generating the ACPI
+ table.
+
+ If this function allocates any resources then they must be freed
+ in the FreeXXXXTableResources function.
+
+ @param [in] This Pointer to the table generator.
+ @param [in] AcpiTableInfo Pointer to the ACPI Table Info.
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [out] Table Pointer to the constructed ACPI Table.
+
+ @retval EFI_SUCCESS Table generated successfully.
+ @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
+BuildWsmtTable (
+ IN CONST ACPI_TABLE_GENERATOR *CONST This,
+ IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
+ )
+{
+ EFI_STATUS Status;
+ CM_ARCH_WSMT_PROTECTION_FLAGS *ProtectionFlags;
+
+ ASSERT (This != NULL);
+ ASSERT (AcpiTableInfo != NULL);
+ ASSERT (CfgMgrProtocol != NULL);
+ ASSERT (Table != NULL);
+ ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
+ ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
+
+ if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
+ (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
+ {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: WSMT: Requested table revision = %d, is not supported."
+ "Supported table revision: Minimum = %d, Maximum = %d\n",
+ AcpiTableInfo->AcpiTableRevision,
+ This->MinAcpiTableRevision,
+ This->AcpiTableRevision
+ ));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *Table = NULL;
+
+ Status = AddAcpiHeader (
+ CfgMgrProtocol,
+ This,
+ (EFI_ACPI_DESCRIPTION_HEADER *)&mAcpiWsmt,
+ AcpiTableInfo,
+ sizeof (EFI_ACPI_WSMT_TABLE)
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: WSMT: Failed to add ACPI header. Status = %r\n",
+ Status
+ ));
+ return Status;
+ }
+
+ Status = GetEArchObjWsmtProtectionFlags (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &ProtectionFlags,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: WSMT: Failed to get protection flags information." \
+ " Status = %r\n",
+ Status
+ ));
+ } else {
+ mAcpiWsmt.ProtectionFlags = ProtectionFlags->ProtectionFlags;
+ }
+
+ *Table = (EFI_ACPI_DESCRIPTION_HEADER *)&mAcpiWsmt;
+
+ return Status;
+}
+
+/** The interface for the WSMT Table Generator.
+*/
+STATIC
+CONST
+ACPI_TABLE_GENERATOR mWsmtGenerator = {
+ // Generator ID
+ CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdWsmt),
+ // Generator Description
+ L"ACPI.STD.WSMT.GENERATOR",
+ // ACPI Table Signature
+ EFI_ACPI_WINDOWS_SMM_SECURITY_MITIGATION_TABLE_SIGNATURE,
+ // ACPI Table Revision supported by this Generator
+ EFI_WSMT_TABLE_REVISION,
+ // Minimum supported ACPI Table Revision
+ EFI_WSMT_TABLE_REVISION,
+ // Creator ID
+ FixedPcdGet32 (PcdAcpiDefaultCreatorId),
+ // Creator Revision
+ FixedPcdGet32 (PcdAcpiDefaultCreatorRevision),
+ // Build Table function
+ BuildWsmtTable,
+ // No additional resources are allocated by the generator.
+ // Hence the Free Resource function is not required.
+ NULL,
+ // Extended build function not needed
+ NULL,
+ // Extended build function not implemented by the generator.
+ // Hence extended free resource function is not required.
+ NULL
+};
+
+/** Register the Generator with the ACPI Table Factory.
+
+ @param [in] ImageHandle The handle to the image.
+ @param [in] SystemTable Pointer to the System Table.
+
+ @retval EFI_SUCCESS The Generator is registered.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_ALREADY_STARTED The Generator for the Table ID
+ is already registered.
+**/
+EFI_STATUS
+EFIAPI
+AcpiWsmtLibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status = RegisterAcpiTableGenerator (&mWsmtGenerator);
+ DEBUG ((DEBUG_INFO, "WSMT: Register Generator. Status = %r\n", Status));
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
+
+/** Deregister the Generator from the ACPI Table Factory.
+
+ @param [in] ImageHandle The handle to the image.
+ @param [in] SystemTable Pointer to the System Table.
+
+ @retval EFI_SUCCESS The Generator is deregistered.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The Generator is not registered.
+**/
+EFI_STATUS
+EFIAPI
+AcpiWsmtLibDestructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status = DeregisterAcpiTableGenerator (&mWsmtGenerator);
+ DEBUG ((DEBUG_INFO, "WSMT: Deregister Generator. Status = %r\n", Status));
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
--
2.34.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115635): https://edk2.groups.io/g/devel/message/115635
Mute This Topic: https://groups.io/mt/104463462/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [edk2-devel] [PATCH v1 3/3] DynamicTablesPkg: Adds ACPI WSMT Table generator
2024-02-20 6:48 ` [edk2-devel] [PATCH v1 3/3] DynamicTablesPkg: Adds ACPI WSMT " Abdul Lateef Attar via groups.io
@ 2024-02-27 16:02 ` PierreGondois
0 siblings, 0 replies; 8+ messages in thread
From: PierreGondois @ 2024-02-27 16:02 UTC (permalink / raw)
To: Abdul Lateef Attar, devel; +Cc: Abdul Lateef Attar, Sami Mujawar
Hello Abdul,
I reviewed this patch first, so comments here may apply to other patches.
---
AcpiView (ShellPkg/Library/UefiShellAcpiViewCommandLib) doesn't seem
to be able to parse this ACPI table. Maybe a parser could also be added
along with the table generation.
On 2/20/24 07:48, Abdul Lateef Attar wrote:
> From: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
>
> Adds generic ACPI WSMT table generator library.
> Register/Deregister WSMT table.
> Update the WSMT table during boot as per specification.
>
> Cc: Sami Mujawar <Sami.Mujawar@arm.com>
> Cc: Pierre Gondois <pierre.gondois@arm.com>
> Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
> ---
> DynamicTablesPkg/DynamicTables.dsc.inc | 2 +
> DynamicTablesPkg/Include/AcpiTableGenerator.h | 1 +
> .../Include/ArchNameSpaceObjects.h | 10 +
> .../Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf | 34 +++
> .../Library/Acpi/AcpiWsmtLib/WsmtGenerator.c | 221 ++++++++++++++++++
> 5 files changed, 268 insertions(+)
> create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
> create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c
>
> diff --git a/DynamicTablesPkg/DynamicTables.dsc.inc b/DynamicTablesPkg/DynamicTables.dsc.inc
> index af70785520..5e66f5cd02 100644
> --- a/DynamicTablesPkg/DynamicTables.dsc.inc
> +++ b/DynamicTablesPkg/DynamicTables.dsc.inc
> @@ -36,6 +36,7 @@
> #
> DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
> DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
> + DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
>
> #
> # Dynamic Table Factory Dxe
> @@ -44,6 +45,7 @@
> <LibraryClasses>
> NULL|DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
> NULL|DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
> + NULL|DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
The table should be available for all architectures right ?
This should not be in a [Components] section instead of a more limiting
[Components.IA32, Components.X64] section I assume.
> }
>
> [Components.ARM, Components.AARCH64]
> diff --git a/DynamicTablesPkg/Include/AcpiTableGenerator.h b/DynamicTablesPkg/Include/AcpiTableGenerator.h
> index 18b5f99f47..a32ef46ecb 100644
> --- a/DynamicTablesPkg/Include/AcpiTableGenerator.h
> +++ b/DynamicTablesPkg/Include/AcpiTableGenerator.h
> @@ -100,6 +100,7 @@ typedef enum StdAcpiTableId {
> EStdAcpiTableIdSsdtPciExpress, ///< SSDT Pci Express Generator
> EStdAcpiTableIdPcct, ///< PCCT Generator
> EStdAcpiTableIdHpet, ///< HPET Generator
> + EStdAcpiTableIdWsmt, ///< WSMT Generator
> EStdAcpiTableIdMax
> } ESTD_ACPI_TABLE_ID;
>
> diff --git a/DynamicTablesPkg/Include/ArchNameSpaceObjects.h b/DynamicTablesPkg/Include/ArchNameSpaceObjects.h
> index b421c4cd29..ad3045dfec 100644
> --- a/DynamicTablesPkg/Include/ArchNameSpaceObjects.h
> +++ b/DynamicTablesPkg/Include/ArchNameSpaceObjects.h
> @@ -39,6 +39,7 @@ typedef enum ArchObjectID {
> EArchObjFadtArmBootArch, ///< 11 - ARM boot arch information
> EArchObjFadtHypervisorVendorId, ///< 12 - Hypervisor vendor identity information
> EArchObjFadtMiscInfo, ///< 13 - Legacy fields; RTC, latency, flush stride, etc
> + EArchObjWsmtProtectionFlags, ///< 14 - WSMT protection flags
> EArchObjMax
> } E_ARCH_OBJECT_ID;
>
> @@ -214,4 +215,13 @@ typedef struct CmArchFadtMiscInfo {
> UINT8 Century;
> } CM_ARCH_FADT_MISC_INFO;
>
> +/** A structure that describes the
> + protection flags for the WSMT fields information.
> +
> + ID: EArchObjWsmtProtectionFlags
> +*/
> +typedef struct CmArchWsmtProtectionFlags {
> + UINT32 ProtectionFlags;
> +} CM_ARCH_WSMT_PROTECTION_FLAGS;
> +
There is an ongoing effort to open the package a bit more to other
architectures (https://edk2.groups.io/g/devel/message/114790).
The common Arch namespace will be created in the (to be created) staging
branch.
Maybe we could add the object to the Arm namespace for now ?
Sami, what do you think ?
> #endif
> diff --git a/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf b/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
> new file mode 100644
> index 0000000000..f8683a5005
> --- /dev/null
> +++ b/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
> @@ -0,0 +1,34 @@
> +## @file
> +# WSMT Table Generator
> +#
> +# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
> +#
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +##
> +
> +[Defines]
> + INF_VERSION = 1.27
> + BASE_NAME = AcpiWsmtLib
> + FILE_GUID = D6C34086-C914-4F8E-B56A-08329B4D1271
> + VERSION_STRING = 1.0
> + MODULE_TYPE = DXE_DRIVER
> + LIBRARY_CLASS = NULL|DXE_DRIVER
> + CONSTRUCTOR = AcpiWsmtLibConstructor
> + DESTRUCTOR = AcpiWsmtLibDestructor
> +
> +[Sources]
> + WsmtGenerator.c
> +
> +[Packages]
> + DynamicTablesPkg/DynamicTablesPkg.dec
> + MdeModulePkg/MdeModulePkg.dec
> + MdePkg/MdePkg.dec
> +
> +[LibraryClasses]
> + BaseLib
> + DebugLib
> + PcdLib
> +
> +[Pcd]
> + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId
> + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision
> diff --git a/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c b/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c
> new file mode 100644
> index 0000000000..c102152974
> --- /dev/null
> +++ b/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c
> @@ -0,0 +1,221 @@
> +/** @file
> + WSMT Table Generator
> +
> + Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.
> + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
> +
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> + @par Reference(s):
> + - ACPI 6.5 Specification, Aug 29, 2022
> + - WSMT spec, version 1.0, April 18, 2016
> +
> +**/
> +
> +#include <AcpiTableGenerator.h>
> +#include <ConfigurationManagerHelper.h>
> +#include <ConfigurationManagerObject.h>
> +#include <IndustryStandard/WindowsSmmSecurityMitigationTable.h>
> +#include <Library/DebugLib.h>
> +#include <Library/TableHelperLib.h>
> +#include <Protocol/ConfigurationManagerProtocol.h>
> +#include <Uefi/UefiBaseType.h>
> +#include <Uefi/UefiSpec.h>
These 2 includes don't seem to be necessary.
> +#include <ArchNameSpaceObjects.h>
> +
> +/** This macro expands to a function that retrieves the
> + protection flags information for WSMT Table.
> +*/
> +GET_OBJECT_LIST (
> + EObjNameSpaceArch,
> + EArchObjWsmtProtectionFlags,
> + CM_ARCH_WSMT_PROTECTION_FLAGS
> + );
> +
> +/** The AcpiWsmt is a template EFI_ACPI_WSMT_TABLE
> + structure used for generating the WSMT Table.
> +*/
> +STATIC
> +EFI_ACPI_WSMT_TABLE mAcpiWsmt = {
> + ACPI_HEADER (
> + EFI_ACPI_WINDOWS_SMM_SECURITY_MITIGATION_TABLE_SIGNATURE,
> + EFI_ACPI_WSMT_TABLE,
> + EFI_WSMT_TABLE_REVISION
> + ),
> + EFI_WSMT_PROTECTION_FLAGS_SYSTEM_RESOURCE_PROTECTION|EFI_WSMT_PROTECTION_FLAGS_COMM_BUFFER_NESTED_PTR_PROTECTION|EFI_WSMT_PROTECTION_FLAGS_FIXED_COMM_BUFFERS
I think there is a 100 chars limit. It could be compacted with a macro (like):
#define WSMT_DEFAULT_PROTECTION_FLAGS \
EFI_WSMT_PROTECTION_FLAGS_SYSTEM_RESOURCE_PROTECTION \
EFI_WSMT_PROTECTION_FLAGS_COMM_BUFFER_NESTED_PTR_PROTECTION \
EFI_WSMT_PROTECTION_FLAGS_FIXED_COMM_BUFFERS
> +};
> +
> +/** Construct the WSMT table.
> +
> + This function invokes the Configuration Manager protocol interface
> + to get the required hardware information for generating the ACPI
> + table.
> +
> + If this function allocates any resources then they must be freed
> + in the FreeXXXXTableResources function.
> +
> + @param [in] This Pointer to the table generator.
> + @param [in] AcpiTableInfo Pointer to the ACPI Table Info.
> + @param [in] CfgMgrProtocol Pointer to the Configuration Manager
> + Protocol Interface.
> + @param [out] Table Pointer to the constructed ACPI Table.
> +
> + @retval EFI_SUCCESS Table generated successfully.
> + @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
> +BuildWsmtTable (
> + IN CONST ACPI_TABLE_GENERATOR *CONST This,
> + IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
> + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
> + OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
> + )
> +{
> + EFI_STATUS Status;
> + CM_ARCH_WSMT_PROTECTION_FLAGS *ProtectionFlags;
> +
> + ASSERT (This != NULL);
> + ASSERT (AcpiTableInfo != NULL);
> + ASSERT (CfgMgrProtocol != NULL);
> + ASSERT (Table != NULL);
> + ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
> + ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
> +
> + if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
> + (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
> + {
> + DEBUG ((
> + DEBUG_ERROR,
> + "ERROR: WSMT: Requested table revision = %d, is not supported."
> + "Supported table revision: Minimum = %d, Maximum = %d\n",
> + AcpiTableInfo->AcpiTableRevision,
> + This->MinAcpiTableRevision,
> + This->AcpiTableRevision
> + ));
> + return EFI_INVALID_PARAMETER;
> + }
> +
> + *Table = NULL;
> +
> + Status = AddAcpiHeader (
> + CfgMgrProtocol,
> + This,
> + (EFI_ACPI_DESCRIPTION_HEADER *)&mAcpiWsmt,
> + AcpiTableInfo,
> + sizeof (EFI_ACPI_WSMT_TABLE)
> + );
> + if (EFI_ERROR (Status)) {
> + DEBUG ((
> + DEBUG_ERROR,
> + "ERROR: WSMT: Failed to add ACPI header. Status = %r\n",
> + Status
> + ));
> + return Status;
> + }
> +
> + Status = GetEArchObjWsmtProtectionFlags (
> + CfgMgrProtocol,
> + CM_NULL_TOKEN,
> + &ProtectionFlags,
> + NULL
> + );
> + if (EFI_ERROR (Status)) {
> + DEBUG ((
> + DEBUG_ERROR,
> + "ERROR: WSMT: Failed to get protection flags information." \
> + " Status = %r\n",
> + Status
> + ));
> + } else {
> + mAcpiWsmt.ProtectionFlags = ProtectionFlags->ProtectionFlags;
> + }
It seems that EFI_WSMT_PROTECTION_FLAGS_COMM_BUFFER_NESTED_PTR_PROTECTION
bit can only be set if EFI_WSMT_PROTECTION_FLAGS_FIXED_COMM_BUFFERS
is set. Maybe this should be checked here.
> +
> + *Table = (EFI_ACPI_DESCRIPTION_HEADER *)&mAcpiWsmt;
> +
> + return Status;
> +}
> +
> +/** The interface for the WSMT Table Generator.
> +*/
> +STATIC
> +CONST
> +ACPI_TABLE_GENERATOR mWsmtGenerator = {
> + // Generator ID
> + CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdWsmt),
> + // Generator Description
> + L"ACPI.STD.WSMT.GENERATOR",
> + // ACPI Table Signature
> + EFI_ACPI_WINDOWS_SMM_SECURITY_MITIGATION_TABLE_SIGNATURE,
> + // ACPI Table Revision supported by this Generator
> + EFI_WSMT_TABLE_REVISION,
> + // Minimum supported ACPI Table Revision
> + EFI_WSMT_TABLE_REVISION,
> + // Creator ID
> + FixedPcdGet32 (PcdAcpiDefaultCreatorId),
The Creator Id should be, from the ACPI spec:
"""
The vendor ID of the utility that created the table
"""
and/or:
"""
Vendor ID of utility that created the table. For tables
containing Definition Blocks, this is the ID for the ASL
Compiler.
"""
As the DynamicTables framework is creating the tables, a value
representing that should be used. Other generators use:
#define TABLE_GENERATOR_CREATOR_ID_ARM SIGNATURE_32('A', 'R', 'M', 'H')
but this might be wrong to use this.
It might be necessary to either:
- Change the creator Id for all tables and update for instance:
#define TABLE_GENERATOR_CREATOR_ID SIGNATURE_32('D', 'Y', 'N', 'T')
- Create a Pcd
> + // Creator Revision
> + FixedPcdGet32 (PcdAcpiDefaultCreatorRevision),
Similar remark for the Creator Revision:
I think it should dependent on this present generator and
not be common to all generators. This would allow to identify
which version of the DynamicTables Generator created the table.
> + // Build Table function
> + BuildWsmtTable,
> + // No additional resources are allocated by the generator.
> + // Hence the Free Resource function is not required.
> + NULL,
> + // Extended build function not needed
> + NULL,
> + // Extended build function not implemented by the generator.
> + // Hence extended free resource function is not required.
> + NULL
> +};
> +
> +/** Register the Generator with the ACPI Table Factory.
> +
> + @param [in] ImageHandle The handle to the image.
> + @param [in] SystemTable Pointer to the System Table.
> +
> + @retval EFI_SUCCESS The Generator is registered.
> + @retval EFI_INVALID_PARAMETER A parameter is invalid.
> + @retval EFI_ALREADY_STARTED The Generator for the Table ID
> + is already registered.
> +**/
> +EFI_STATUS
> +EFIAPI
> +AcpiWsmtLibConstructor (
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE *SystemTable
> + )
> +{
> + EFI_STATUS Status;
> +
> + Status = RegisterAcpiTableGenerator (&mWsmtGenerator);
> + DEBUG ((DEBUG_INFO, "WSMT: Register Generator. Status = %r\n", Status));
> + ASSERT_EFI_ERROR (Status);
> + return Status;
> +}
> +
> +/** Deregister the Generator from the ACPI Table Factory.
> +
> + @param [in] ImageHandle The handle to the image.
> + @param [in] SystemTable Pointer to the System Table.
> +
> + @retval EFI_SUCCESS The Generator is deregistered.
> + @retval EFI_INVALID_PARAMETER A parameter is invalid.
> + @retval EFI_NOT_FOUND The Generator is not registered.
> +**/
> +EFI_STATUS
> +EFIAPI
> +AcpiWsmtLibDestructor (
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE *SystemTable
> + )
> +{
> + EFI_STATUS Status;
> +
> + Status = DeregisterAcpiTableGenerator (&mWsmtGenerator);
> + DEBUG ((DEBUG_INFO, "WSMT: Deregister Generator. Status = %r\n", Status));
> + ASSERT_EFI_ERROR (Status);
> + return Status;
> +}
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116051): https://edk2.groups.io/g/devel/message/116051
Mute This Topic: https://groups.io/mt/104463462/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [edk2-devel] [PATCH v1 1/3] DynamicTablesPkg: Adds ACPI FADT Table generator
2024-02-20 6:48 ` [edk2-devel] [PATCH v1 1/3] DynamicTablesPkg: Adds ACPI FADT Table generator Abdul Lateef Attar via groups.io
@ 2024-02-27 16:02 ` PierreGondois
0 siblings, 0 replies; 8+ messages in thread
From: PierreGondois @ 2024-02-27 16:02 UTC (permalink / raw)
To: Abdul Lateef Attar, devel; +Cc: Abdul Lateef Attar, Sami Mujawar
Hello Abdul,
There is an ongoing effort to open the package a bit more to other
architectures (https://edk2.groups.io/g/devel/message/114790).
This patch seems to duplicate some objects from the Arm namespace:
- EArmObjPowerManagementProfileInfo
- EArmObjBootArchInfo
to the Arch namespace:
- EArchObjFadtPreferredPmProfile
- EArchObjFadtArmBootArch
and adding many objects to the common Arch namespace.
The Fadt Generator will be moved to a common folder to allow other
architectures to re-use the code. I think it might be good to put
this patch aside for now and integrate it to the (to be created)
staging branch instead,
Regards,
Pierre
On 2/20/24 07:48, Abdul Lateef Attar wrote:
> From: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
>
> Adds generic ACPI FADT table generator library.
> Register/Deregister FADT table.
> Adds Arch namespace ids.
> Update the FADT table during boot as per specification.
>
> Cc: Sami Mujawar <Sami.Mujawar@arm.com>
> Cc: Pierre Gondois <pierre.gondois@arm.com>
> Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
> ---
> DynamicTablesPkg/DynamicTables.dsc.inc | 10 +-
> DynamicTablesPkg/DynamicTablesPkg.ci.yaml | 4 +-
> .../Include/ArchNameSpaceObjects.h | 217 ++++++
> .../Include/ConfigurationManagerObject.h | 6 +
> .../Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf | 42 +
> .../Library/Acpi/AcpiFadtLib/FadtGenerator.c | 737 ++++++++++++++++++
> .../Library/Acpi/AcpiFadtLib/FadtUpdate.h | 28 +
> .../Library/Acpi/AcpiFadtLib/X64/FadtUpdate.c | 32 +
> 8 files changed, 1074 insertions(+), 2 deletions(-)
> create mode 100644 DynamicTablesPkg/Include/ArchNameSpaceObjects.h
> create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
> create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/FadtGenerator.c
> create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/FadtUpdate.h
> create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/X64/FadtUpdate.c
>
[snip]
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116052): https://edk2.groups.io/g/devel/message/116052
Mute This Topic: https://groups.io/mt/104463461/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [edk2-devel] [PATCH v1 2/3] DynamicTablesPkg: Adds ACPI HPET Table generator
2024-02-20 6:48 ` [edk2-devel] [PATCH v1 2/3] DynamicTablesPkg: Adds ACPI HPET " Abdul Lateef Attar via groups.io
@ 2024-02-27 16:02 ` PierreGondois
2024-02-28 12:53 ` Abdul Lateef Attar via groups.io
0 siblings, 1 reply; 8+ messages in thread
From: PierreGondois @ 2024-02-27 16:02 UTC (permalink / raw)
To: Abdul Lateef Attar, devel; +Cc: Abdul Lateef Attar, Sami Mujawar
Hello Abdul,
From the HPET spec:
"""
For the case where there may be additional Event Timer Blocks implemented in the system, their base
addresses would be described in ACPI Name space.
"""
So it seems it might be good (but not necessary) to to add a description in
a SSDT/DSDT table of the object (with _HID=PNP0103).
---
Same comment about than for the other patches about adding objects to
the common Arch namespace.`
On 2/20/24 07:48, Abdul Lateef Attar wrote:
> From: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
>
> Adds generic ACPI HPET table generator library.
> Register/Deregister HPET table.
> Update the HPET table during boot as per specification.
>
> Cc: Sami Mujawar <Sami.Mujawar@arm.com>
> Cc: Pierre Gondois <pierre.gondois@arm.com>
> Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
> ---
> DynamicTablesPkg/DynamicTables.dsc.inc | 2 +
> DynamicTablesPkg/DynamicTablesPkg.ci.yaml | 3 +-
> DynamicTablesPkg/Include/AcpiTableGenerator.h | 1 +
> .../Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf | 38 ++++
> .../Library/Acpi/AcpiHpetLib/HpetGenerator.c | 208 ++++++++++++++++++
> 5 files changed, 251 insertions(+), 1 deletion(-)
> create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
> create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiHpetLib/HpetGenerator.c
>
> diff --git a/DynamicTablesPkg/DynamicTables.dsc.inc b/DynamicTablesPkg/DynamicTables.dsc.inc
> index 5ec9ffac06..af70785520 100644
> --- a/DynamicTablesPkg/DynamicTables.dsc.inc
> +++ b/DynamicTablesPkg/DynamicTables.dsc.inc
> @@ -35,6 +35,7 @@
> # Generators
> #
> DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
> + DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
>
> #
> # Dynamic Table Factory Dxe
> @@ -42,6 +43,7 @@
> DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf {
> <LibraryClasses>
> NULL|DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
> + NULL|DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
> }
>
> [Components.ARM, Components.AARCH64]
> diff --git a/DynamicTablesPkg/DynamicTablesPkg.ci.yaml b/DynamicTablesPkg/DynamicTablesPkg.ci.yaml
> index 1ad5540e24..cacdaa1df6 100644
> --- a/DynamicTablesPkg/DynamicTablesPkg.ci.yaml
> +++ b/DynamicTablesPkg/DynamicTablesPkg.ci.yaml
> @@ -53,7 +53,8 @@
> "EmbeddedPkg/EmbeddedPkg.dec",
> "DynamicTablesPkg/DynamicTablesPkg.dec",
> "MdeModulePkg/MdeModulePkg.dec",
> - "MdePkg/MdePkg.dec"
> + "MdePkg/MdePkg.dec",
> + "PcAtChipsetPkg/PcAtChipsetPkg.dec"
> ],
> # For host based unit tests
> "AcceptableDependencies-HOST_APPLICATION":[
> diff --git a/DynamicTablesPkg/Include/AcpiTableGenerator.h b/DynamicTablesPkg/Include/AcpiTableGenerator.h
> index d0eda011c3..18b5f99f47 100644and
> --- a/DynamicTablesPkg/Include/AcpiTableGenerator.h
> +++ b/DynamicTablesPkg/Include/AcpiTableGenerator.h
> @@ -99,6 +99,7 @@ typedef enum StdAcpiTableId {
> EStdAcpiTableIdSsdtCpuTopology, ///< SSDT Cpu Topology
> EStdAcpiTableIdSsdtPciExpress, ///< SSDT Pci Express Generator
> EStdAcpiTableIdPcct, ///< PCCT Generator
> + EStdAcpiTableIdHpet, ///< HPET Generator
> EStdAcpiTableIdMax
> } ESTD_ACPI_TABLE_ID;
>
> diff --git a/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf b/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
> new file mode 100644
> index 0000000000..74a1358ffe
> --- /dev/null
> +++ b/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
> @@ -0,0 +1,38 @@
> +## @file
> +# HPET Table Generator
> +#
> +# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
> +#
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +##
> +
> +[Defines]
> + INF_VERSION = 1.27
> + BASE_NAME = AcpiHpetLib
> + FILE_GUID = 4E75F653-C356-48B3-B32C-D1B901ECF90A
> + VERSION_STRING = 1.0
> + MODULE_TYPE = DXE_DRIVER
> + LIBRARY_CLASS = NULL|DXE_DRIVER
> + CONSTRUCTOR = AcpiHpetLibConstructor
> + DESTRUCTOR = AcpiHpetLibDestructor
> +
> +[Sources]
> + HpetGenerator.c
> +
> +[Packages]
> + DynamicTablesPkg/DynamicTablesPkg.dec
> + EmbeddedPkg/EmbeddedPkg.dec
I think the dependency could be deleted, along with:
HpetGenerator.c:19:#include <Library/AcpiLib.h>
> + MdeModulePkg/MdeModulePkg.dec
> + MdePkg/MdePkg.dec
> + PcAtChipsetPkg/PcAtChipsetPkg.dec
(for Sami)
A dependency over the PcAtChipsetPkg is introduced here.
> +
> +[LibraryClasses]
> + BaseLib
> + DebugLib
> + IoLib
> + PcdLib
> +
> +[Pcd]
> + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId
> + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision
> + gPcAtChipsetPkgTokenSpaceGuid.PcdHpetBaseAddress
[snip]
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116053): https://edk2.groups.io/g/devel/message/116053
Mute This Topic: https://groups.io/mt/104463460/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [edk2-devel] [PATCH v1 2/3] DynamicTablesPkg: Adds ACPI HPET Table generator
2024-02-27 16:02 ` PierreGondois
@ 2024-02-28 12:53 ` Abdul Lateef Attar via groups.io
0 siblings, 0 replies; 8+ messages in thread
From: Abdul Lateef Attar via groups.io @ 2024-02-28 12:53 UTC (permalink / raw)
To: Pierre Gondois, Abdul Lateef Attar, devel; +Cc: Sami Mujawar
Hi Pierre Gondois,
Thanks for review the comment, i will make the changes accordingly.
Please find my response in line.
Thanks
AbduL
On 27-02-2024 21:32, Pierre Gondois wrote:
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> Hello Abdul,
>
> From the HPET spec:
> """
> For the case where there may be additional Event Timer Blocks
> implemented in the system, their base
> addresses would be described in ACPI Name space.
> """
> So it seems it might be good (but not necessary) to to add a
> description in
> a SSDT/DSDT table of the object (with _HID=PNP0103).
[Abdul] I will submit another Generator library for creating the
platform devices in ACPI namespace.
>
> ---
>
> Same comment about than for the other patches about adding objects to
> the common Arch namespace.`
>
[Abdul] This Arch namespace changes are non-disruptive and wont cause
any failure to existing ARM namespace.
I'll submit a separate patch for acpiview to parse the HPET and WSMT table.
>
> On 2/20/24 07:48, Abdul Lateef Attar wrote:
>> From: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
>>
>> Adds generic ACPI HPET table generator library.
>> Register/Deregister HPET table.
>> Update the HPET table during boot as per specification.
>>
>> Cc: Sami Mujawar <Sami.Mujawar@arm.com>
>> Cc: Pierre Gondois <pierre.gondois@arm.com>
>> Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
>> ---
>> DynamicTablesPkg/DynamicTables.dsc.inc | 2 +
>> DynamicTablesPkg/DynamicTablesPkg.ci.yaml | 3 +-
>> DynamicTablesPkg/Include/AcpiTableGenerator.h | 1 +
>> .../Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf | 38 ++++
>> .../Library/Acpi/AcpiHpetLib/HpetGenerator.c | 208 ++++++++++++++++++
>> 5 files changed, 251 insertions(+), 1 deletion(-)
>> create mode 100644
>> DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
>> create mode 100644
>> DynamicTablesPkg/Library/Acpi/AcpiHpetLib/HpetGenerator.c
>>
>> diff --git a/DynamicTablesPkg/DynamicTables.dsc.inc
>> b/DynamicTablesPkg/DynamicTables.dsc.inc
>> index 5ec9ffac06..af70785520 100644
>> --- a/DynamicTablesPkg/DynamicTables.dsc.inc
>> +++ b/DynamicTablesPkg/DynamicTables.dsc.inc
>> @@ -35,6 +35,7 @@
>> # Generators
>> #
>> DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
>> + DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
>>
>> #
>> # Dynamic Table Factory Dxe
>> @@ -42,6 +43,7 @@
>> DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf
>> {
>> <LibraryClasses>
>> NULL|DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
>> + NULL|DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
>> }
>>
>> [Components.ARM, Components.AARCH64]
>> diff --git a/DynamicTablesPkg/DynamicTablesPkg.ci.yaml
>> b/DynamicTablesPkg/DynamicTablesPkg.ci.yaml
>> index 1ad5540e24..cacdaa1df6 100644
>> --- a/DynamicTablesPkg/DynamicTablesPkg.ci.yaml
>> +++ b/DynamicTablesPkg/DynamicTablesPkg.ci.yaml
>> @@ -53,7 +53,8 @@
>> "EmbeddedPkg/EmbeddedPkg.dec",
>> "DynamicTablesPkg/DynamicTablesPkg.dec",
>> "MdeModulePkg/MdeModulePkg.dec",
>> - "MdePkg/MdePkg.dec"
>> + "MdePkg/MdePkg.dec",
>> + "PcAtChipsetPkg/PcAtChipsetPkg.dec"
>> ],
>> # For host based unit tests
>> "AcceptableDependencies-HOST_APPLICATION":[
>> diff --git a/DynamicTablesPkg/Include/AcpiTableGenerator.h
>> b/DynamicTablesPkg/Include/AcpiTableGenerator.h
>> index d0eda011c3..18b5f99f47 100644and
>> --- a/DynamicTablesPkg/Include/AcpiTableGenerator.h
>> +++ b/DynamicTablesPkg/Include/AcpiTableGenerator.h
>> @@ -99,6 +99,7 @@ typedef enum StdAcpiTableId {
>> EStdAcpiTableIdSsdtCpuTopology, ///< SSDT Cpu Topology
>> EStdAcpiTableIdSsdtPciExpress, ///< SSDT Pci
>> Express Generator
>> EStdAcpiTableIdPcct, ///< PCCT Generator
>> + EStdAcpiTableIdHpet, ///< HPET Generator
>> EStdAcpiTableIdMax
>> } ESTD_ACPI_TABLE_ID;
>>
>> diff --git
>> a/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
>> b/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
>> new file mode 100644
>> index 0000000000..74a1358ffe
>> --- /dev/null
>> +++ b/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
>> @@ -0,0 +1,38 @@
>> +## @file
>> +# HPET Table Generator
>> +#
>> +# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
>> +#
>> +# SPDX-License-Identifier: BSD-2-Clause-Patent
>> +##
>> +
>> +[Defines]
>> + INF_VERSION = 1.27
>> + BASE_NAME = AcpiHpetLib
>> + FILE_GUID = 4E75F653-C356-48B3-B32C-D1B901ECF90A
>> + VERSION_STRING = 1.0
>> + MODULE_TYPE = DXE_DRIVER
>> + LIBRARY_CLASS = NULL|DXE_DRIVER
>> + CONSTRUCTOR = AcpiHpetLibConstructor
>> + DESTRUCTOR = AcpiHpetLibDestructor
>> +
>> +[Sources]
>> + HpetGenerator.c
>> +
>> +[Packages]
>> + DynamicTablesPkg/DynamicTablesPkg.dec
>> + EmbeddedPkg/EmbeddedPkg.dec
>
> I think the dependency could be deleted, along with:
> HpetGenerator.c:19:#include <Library/AcpiLib.h>
>
>> + MdeModulePkg/MdeModulePkg.dec
>> + MdePkg/MdePkg.dec
>> + PcAtChipsetPkg/PcAtChipsetPkg.dec
>
> (for Sami)
> A dependency over the PcAtChipsetPkg is introduced here.
>
>> +
>> +[LibraryClasses]
>> + BaseLib
>> + DebugLib
>> + IoLib
>> + PcdLib
>> +
>> +[Pcd]
>> + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId
>> + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision
>> + gPcAtChipsetPkgTokenSpaceGuid.PcdHpetBaseAddress
>
>
> [snip]
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116116): https://edk2.groups.io/g/devel/message/116116
Mute This Topic: https://groups.io/mt/104463460/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-02-28 12:53 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-20 6:48 [edk2-devel] [PATCH v1 0/3] DynamicTablesPkg: Adds generic FADT, HPET and WSMT table generators Abdul Lateef Attar via groups.io
2024-02-20 6:48 ` [edk2-devel] [PATCH v1 1/3] DynamicTablesPkg: Adds ACPI FADT Table generator Abdul Lateef Attar via groups.io
2024-02-27 16:02 ` PierreGondois
2024-02-20 6:48 ` [edk2-devel] [PATCH v1 2/3] DynamicTablesPkg: Adds ACPI HPET " Abdul Lateef Attar via groups.io
2024-02-27 16:02 ` PierreGondois
2024-02-28 12:53 ` Abdul Lateef Attar via groups.io
2024-02-20 6:48 ` [edk2-devel] [PATCH v1 3/3] DynamicTablesPkg: Adds ACPI WSMT " Abdul Lateef Attar via groups.io
2024-02-27 16:02 ` PierreGondois
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox