public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [RESEND PATCH v4 0/5] DynamicTablesPkg: Adds FADT, HPET, WSMT and MADT Table generators
@ 2024-04-29  6:03 Abdul Lateef Attar via groups.io
  2024-04-29  6:03 ` [edk2-devel] [RESEND PATCH v4 1/5] DynamicTablesPkg: Adds ACPI FADT Table generator Abdul Lateef Attar via groups.io
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Abdul Lateef Attar via groups.io @ 2024-04-29  6:03 UTC (permalink / raw)
  To: devel; +Cc: Abdul Lateef Attar, Sami Mujawar, Pierre Gondois

PR: https://github.com/tianocore/edk2/pull/5500/
V4: delta changes
  Added X64 arch specific MADT table generator.
V3: delta changes
  Restructure the code as the review comments.
  Added sanity check for WSMT flags.
  Added CM object for HPET base address.
V2: delta changes
  Addressed review comments
  Adds ACPI HPET table to add HPET to ACPI namespace
V1:
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 (5):
  DynamicTablesPkg: Adds ACPI FADT Table generator
  DynamicTablesPkg: Adds ACPI HPET Table generator
  DynamicTablesPkg: Adds ACPI WSMT Table generator
  DynamicTablesPkg: Adds ACPI SSDT HPET Table generator
  DynamicTablesPkg: Adds X64 arch MADT Table generator

 DynamicTablesPkg/DynamicTables.dsc.inc        |  22 +-
 DynamicTablesPkg/DynamicTablesPkg.ci.yaml     |   4 +-
 DynamicTablesPkg/Include/AcpiTableGenerator.h |   4 +
 .../Include/ArchNameSpaceObjects.h            | 237 ++++++
 .../Include/ConfigurationManagerObject.h      |   7 +
 .../Include/X64NameSpaceObjects.h             |  48 ++
 .../Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf  |  36 +
 .../Library/Acpi/AcpiFadtLib/Arm/FadtUpdate.c |  39 +
 .../Library/Acpi/AcpiFadtLib/FadtGenerator.c  | 745 ++++++++++++++++++
 .../Library/Acpi/AcpiFadtLib/FadtUpdate.h     |  26 +
 .../Library/Acpi/AcpiFadtLib/X64/FadtUpdate.c |  32 +
 .../Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf  |  31 +
 .../Library/Acpi/AcpiHpetLib/HpetGenerator.c  | 246 ++++++
 .../Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf  |  32 +
 .../Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c  | 295 +++++++
 .../Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf  |  30 +
 .../Library/Acpi/AcpiWsmtLib/WsmtGenerator.c  | 243 ++++++
 .../X64/AcpiMadtLibX64/AcpiMadtLibX64.inf     |  27 +
 .../Acpi/X64/AcpiMadtLibX64/MadtGenerator.c   | 375 +++++++++
 19 files changed, 2477 insertions(+), 2 deletions(-)
 create mode 100644 DynamicTablesPkg/Include/ArchNameSpaceObjects.h
 create mode 100644 DynamicTablesPkg/Include/X64NameSpaceObjects.h
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/Arm/FadtUpdate.c
 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/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c
 create mode 100644 DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/AcpiMadtLibX64.inf
 create mode 100644 DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/MadtGenerator.c

-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118369): https://edk2.groups.io/g/devel/message/118369
Mute This Topic: https://groups.io/mt/105796049/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 14+ messages in thread

* [edk2-devel] [RESEND PATCH v4 1/5] DynamicTablesPkg: Adds ACPI FADT Table generator
  2024-04-29  6:03 [edk2-devel] [RESEND PATCH v4 0/5] DynamicTablesPkg: Adds FADT, HPET, WSMT and MADT Table generators Abdul Lateef Attar via groups.io
@ 2024-04-29  6:03 ` Abdul Lateef Attar via groups.io
  2024-04-29  6:03 ` [edk2-devel] [RESEND PATCH v4 2/5] DynamicTablesPkg: Adds ACPI HPET " Abdul Lateef Attar via groups.io
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Abdul Lateef Attar via groups.io @ 2024-04-29  6:03 UTC (permalink / raw)
  To: devel; +Cc: Abdul Lateef Attar, Sami Mujawar, Pierre Gondois

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  |  36 +
 .../Library/Acpi/AcpiFadtLib/Arm/FadtUpdate.c |  39 +
 .../Library/Acpi/AcpiFadtLib/FadtGenerator.c  | 745 ++++++++++++++++++
 .../Library/Acpi/AcpiFadtLib/FadtUpdate.h     |  26 +
 .../Library/Acpi/AcpiFadtLib/X64/FadtUpdate.c |  32 +
 9 files changed, 1113 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/Arm/FadtUpdate.c
 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..92f3a138e4 100644
--- a/DynamicTablesPkg/DynamicTables.dsc.inc
+++ b/DynamicTablesPkg/DynamicTables.dsc.inc
@@ -30,11 +30,19 @@
   #
   DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf
 
+  #
+  # Generators
+  #
+  DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
+
 [Components.IA32, Components.X64]
   #
   # 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..6a6656daff
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
@@ -0,0 +1,36 @@
+## @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
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  BaseLib
+  DebugLib
diff --git a/DynamicTablesPkg/Library/Acpi/AcpiFadtLib/Arm/FadtUpdate.c b/DynamicTablesPkg/Library/Acpi/AcpiFadtLib/Arm/FadtUpdate.c
new file mode 100644
index 0000000000..d632d243fa
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiFadtLib/Arm/FadtUpdate.c
@@ -0,0 +1,39 @@
+/** @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 << EArchObjFadtSciInterrupt) |
+                       (1 << EArchObjFadtSciCmdInfo) |
+                       (1 << EArchObjFadtPmBlockInfo) |
+                       (1 << EArchObjFadtGpeBlockInfo) |
+                       (1 << EArchObjFadtXpmBlockInfo) |
+                       (1 << EArchObjFadtXgpeBlockInfo) |
+                       (1 << EArchObjFadtSleepBlockInfo) |
+                       (1 << EArchObjFadtResetBlockInfo) |
+                       (1 << EArchObjFadtMiscInfo)
+                       );
+}
diff --git a/DynamicTablesPkg/Library/Acpi/AcpiFadtLib/FadtGenerator.c b/DynamicTablesPkg/Library/Acpi/AcpiFadtLib/FadtGenerator.c
new file mode 100644
index 0000000000..00b7bc22ed
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiFadtLib/FadtGenerator.c
@@ -0,0 +1,745 @@
+/** @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/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/TableHelperLib.h>
+#include <Protocol/ConfigurationManagerProtocol.h>
+#include "FadtUpdate.h"
+
+/** Empty GAS defintion
+*/
+#define NULL_GAS  { EFI_ACPI_6_5_SYSTEM_MEMORY,  0, 0, EFI_ACPI_6_5_UNDEFINED, 0L }
+
+/** The Creator ID for the ACPI tables generated using
+  the standard ACPI table generators.
+*/
+#define TABLE_GENERATOR_CREATOR_ID_GENERIC  SIGNATURE_32('D', 'Y', 'N', 'T')
+
+/** 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
+};
+
+/** 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
+  );
+
+/** 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;
+  GetPlatformNameSpaceMask (&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;
+}
+
+/** This macro defines the FADT Table Generator revision.
+*/
+#define FADT_GENERATOR_REVISION  CREATE_REVISION (1, 0)
+
+/** 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
+  TABLE_GENERATOR_CREATOR_ID_GENERIC,
+  // Creator Revision
+  FADT_GENERATOR_REVISION,
+  // 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..c70da3131f
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiFadtLib/FadtUpdate.h
@@ -0,0 +1,26 @@
+/** @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_
+
+/** 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 (#118370): https://edk2.groups.io/g/devel/message/118370
Mute This Topic: https://groups.io/mt/105796050/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] 14+ messages in thread

* [edk2-devel] [RESEND PATCH v4 2/5] DynamicTablesPkg: Adds ACPI HPET Table generator
  2024-04-29  6:03 [edk2-devel] [RESEND PATCH v4 0/5] DynamicTablesPkg: Adds FADT, HPET, WSMT and MADT Table generators Abdul Lateef Attar via groups.io
  2024-04-29  6:03 ` [edk2-devel] [RESEND PATCH v4 1/5] DynamicTablesPkg: Adds ACPI FADT Table generator Abdul Lateef Attar via groups.io
@ 2024-04-29  6:03 ` Abdul Lateef Attar via groups.io
  2024-05-02 16:36   ` PierreGondois
  2024-04-29  6:03 ` [edk2-devel] [RESEND PATCH v4 3/5] DynamicTablesPkg: Adds ACPI WSMT " Abdul Lateef Attar via groups.io
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Abdul Lateef Attar via groups.io @ 2024-04-29  6:03 UTC (permalink / raw)
  To: devel; +Cc: Abdul Lateef Attar, Sami Mujawar, Pierre Gondois

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/Include/AcpiTableGenerator.h |   1 +
 .../Include/ArchNameSpaceObjects.h            |   9 +
 .../Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf  |  31 +++
 .../Library/Acpi/AcpiHpetLib/HpetGenerator.c  | 246 ++++++++++++++++++
 5 files changed, 289 insertions(+)
 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 92f3a138e4..b2ef36eb8a 100644
--- a/DynamicTablesPkg/DynamicTables.dsc.inc
+++ b/DynamicTablesPkg/DynamicTables.dsc.inc
@@ -34,6 +34,7 @@
   # Generators
   #
   DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
+  DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
 
 [Components.IA32, Components.X64]
   #
@@ -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/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/Include/ArchNameSpaceObjects.h b/DynamicTablesPkg/Include/ArchNameSpaceObjects.h
index b421c4cd29..b90e573a88 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
+  EArchObjHpetBaseAddress,        ///< 14 - HPET Base Address
   EArchObjMax
 } E_ARCH_OBJECT_ID;
 
@@ -214,4 +215,12 @@ typedef struct CmArchFadtMiscInfo {
   UINT8     Century;
 } CM_ARCH_FADT_MISC_INFO;
 
+/** A structure that describes the
+    HPET Base Address.
+
+    ID: EArchObjHpetBaseAddress
+*/
+typedef struct CmArchHpetBaseAddress {
+  UINT64    BaseAddress;
+} CM_ARCH_HPET_BASE_ADDRESS;
 #endif
diff --git a/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf b/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
new file mode 100644
index 0000000000..f0441107fc
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
@@ -0,0 +1,31 @@
+## @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
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  BaseLib
+  DebugLib
+  IoLib
+
diff --git a/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/HpetGenerator.c b/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/HpetGenerator.c
new file mode 100644
index 0000000000..937879b7b3
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/HpetGenerator.c
@@ -0,0 +1,246 @@
+/** @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
+    http://www.intel.com/content/dam/www/public/us/en/documents/technical-specifications/software-developers-hpet-spec-1-0a.pdf
+
+**/
+
+#include <AcpiTableGenerator.h>
+#include <ConfigurationManagerHelper.h>
+#include <ConfigurationManagerObject.h>
+#include <IndustryStandard/HighPrecisionEventTimerTable.h>
+#include <Library/DebugLib.h>
+#include <Library/IoLib.h>
+#include <Library/TableHelperLib.h>
+#include <Protocol/AcpiTable.h>
+#include <Protocol/ConfigurationManagerProtocol.h>
+
+///
+/// HPET General Register Offsets
+///
+#define HPET_GENERAL_CAPABILITIES_ID_OFFSET  0x000
+
+/** The Creator ID for the ACPI tables generated using
+  the standard ACPI table generators.
+*/
+#define TABLE_GENERATOR_CREATOR_ID_GENERIC  SIGNATURE_32('D', 'Y', 'N', 'T')
+
+/** 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
+};
+
+/** This macro expands to a function that retrieves the
+    HPET base address from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+  EObjNameSpaceArch,
+  EArchObjHpetBaseAddress,
+  CM_ARCH_HPET_BASE_ADDRESS
+  );
+
+/** 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;
+  CM_ARCH_HPET_BASE_ADDRESS  *HpetBaseAddress;
+
+  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;
+  }
+
+  // Get the HPET Base Address from the Platform Configuration Manager
+  Status = GetEArchObjHpetBaseAddress (
+             CfgMgrProtocol,
+             CM_NULL_TOKEN,
+             &HpetBaseAddress,
+             NULL
+             );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "ERROR: HPET: Failed to get HPET Base Address. Status = %r\n",
+      Status
+      ));
+    return Status;
+  }
+
+  mAcpiHpet.BaseAddressLower32Bit.Address             = HpetBaseAddress->BaseAddress;
+  mAcpiHpet.EventTimerBlockId                         = MmioRead32 ((UINTN)(HpetBaseAddress->BaseAddress + HPET_GENERAL_CAPABILITIES_ID_OFFSET));
+  mAcpiHpet.MainCounterMinimumClockTickInPeriodicMode = (UINT16)MmioRead32 ((UINTN)(HpetBaseAddress->BaseAddress + HPET_GENERAL_CAPABILITIES_ID_OFFSET + 4));
+  *Table                                              = (EFI_ACPI_DESCRIPTION_HEADER *)&mAcpiHpet;
+
+  return Status;
+}
+
+/** This macro defines the HPET Table Generator revision.
+*/
+#define HPET_GENERATOR_REVISION  CREATE_REVISION (1, 0)
+
+/** 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
+  TABLE_GENERATOR_CREATOR_ID_GENERIC,
+  // Creator Revision
+  HPET_GENERATOR_REVISION,
+  // 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 (#118371): https://edk2.groups.io/g/devel/message/118371
Mute This Topic: https://groups.io/mt/105796051/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] 14+ messages in thread

* [edk2-devel] [RESEND PATCH v4 3/5] DynamicTablesPkg: Adds ACPI WSMT Table generator
  2024-04-29  6:03 [edk2-devel] [RESEND PATCH v4 0/5] DynamicTablesPkg: Adds FADT, HPET, WSMT and MADT Table generators Abdul Lateef Attar via groups.io
  2024-04-29  6:03 ` [edk2-devel] [RESEND PATCH v4 1/5] DynamicTablesPkg: Adds ACPI FADT Table generator Abdul Lateef Attar via groups.io
  2024-04-29  6:03 ` [edk2-devel] [RESEND PATCH v4 2/5] DynamicTablesPkg: Adds ACPI HPET " Abdul Lateef Attar via groups.io
@ 2024-04-29  6:03 ` Abdul Lateef Attar via groups.io
  2024-05-02 16:36   ` PierreGondois
  2024-04-29  6:03 ` [edk2-devel] [RESEND PATCH v4 4/5] DynamicTablesPkg: Adds ACPI SSDT HPET " Abdul Lateef Attar via groups.io
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Abdul Lateef Attar via groups.io @ 2024-04-29  6:03 UTC (permalink / raw)
  To: devel; +Cc: Abdul Lateef Attar, Sami Mujawar, Pierre Gondois

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            |  11 +
 .../Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf  |  30 +++
 .../Library/Acpi/AcpiWsmtLib/WsmtGenerator.c  | 243 ++++++++++++++++++
 5 files changed, 287 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 b2ef36eb8a..477dc6b6a9 100644
--- a/DynamicTablesPkg/DynamicTables.dsc.inc
+++ b/DynamicTablesPkg/DynamicTables.dsc.inc
@@ -35,6 +35,7 @@
   #
   DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
   DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
+  DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
 
 [Components.IA32, Components.X64]
   #
@@ -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 b90e573a88..8b16056ba1 100644
--- a/DynamicTablesPkg/Include/ArchNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/ArchNameSpaceObjects.h
@@ -40,6 +40,7 @@ typedef enum ArchObjectID {
   EArchObjFadtHypervisorVendorId, ///< 12 - Hypervisor vendor identity information
   EArchObjFadtMiscInfo,           ///< 13 - Legacy fields; RTC, latency, flush stride, etc
   EArchObjHpetBaseAddress,        ///< 14 - HPET Base Address
+  EArchObjWsmtProtectionFlags,    ///< 15 - WSMT protection flags
   EArchObjMax
 } E_ARCH_OBJECT_ID;
 
@@ -223,4 +224,14 @@ typedef struct CmArchFadtMiscInfo {
 typedef struct CmArchHpetBaseAddress {
   UINT64    BaseAddress;
 } CM_ARCH_HPET_BASE_ADDRESS;
+
+/** 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..80ddaf0ab4
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
@@ -0,0 +1,30 @@
+## @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
+
diff --git a/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c b/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c
new file mode 100644
index 0000000000..a63b4b4859
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c
@@ -0,0 +1,243 @@
+/** @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
+    https://msdn.microsoft.com/windows/hardware/drivers/bringup/acpi-system-description-tables#wsmt
+
+**/
+
+#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 <ArchNameSpaceObjects.h>
+
+/** The Creator ID for the ACPI tables generated using
+  the standard ACPI table generators.
+*/
+#define TABLE_GENERATOR_CREATOR_ID_GENERIC  SIGNATURE_32('D', 'Y', 'N', 'T')
+
+/** 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
+};
+
+/** 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
+  );
+
+/** 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;
+  }
+
+  /// Sanity check WSMT Projection Flags
+  if ((mAcpiWsmt.ProtectionFlags & EFI_WSMT_PROTECTION_FLAGS_COMM_BUFFER_NESTED_PTR_PROTECTION) != 0) {
+    if ((mAcpiWsmt.ProtectionFlags & EFI_WSMT_PROTECTION_FLAGS_FIXED_COMM_BUFFERS) == 0) {
+      DEBUG ((
+        DEBUG_ERROR,
+        "ERROR: WSMT: Protection flags are invalid. " \
+        "COMM_BUFFER_NESTED_PTR_PROTECTION is set but FIXED_COMM_BUFFERS is not set.\n"
+        ));
+      return EFI_INVALID_PARAMETER;
+    }
+  }
+
+  *Table = (EFI_ACPI_DESCRIPTION_HEADER *)&mAcpiWsmt;
+
+  return Status;
+}
+
+/** This macro defines the WSMT Table Generator revision.
+*/
+#define WSMT_GENERATOR_REVISION  CREATE_REVISION (1, 0)
+
+/** 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
+  TABLE_GENERATOR_CREATOR_ID_GENERIC,
+  // Creator Revision
+  WSMT_GENERATOR_REVISION,
+  // 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 (#118372): https://edk2.groups.io/g/devel/message/118372
Mute This Topic: https://groups.io/mt/105796052/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] 14+ messages in thread

* [edk2-devel] [RESEND PATCH v4 4/5] DynamicTablesPkg: Adds ACPI SSDT HPET Table generator
  2024-04-29  6:03 [edk2-devel] [RESEND PATCH v4 0/5] DynamicTablesPkg: Adds FADT, HPET, WSMT and MADT Table generators Abdul Lateef Attar via groups.io
                   ` (2 preceding siblings ...)
  2024-04-29  6:03 ` [edk2-devel] [RESEND PATCH v4 3/5] DynamicTablesPkg: Adds ACPI WSMT " Abdul Lateef Attar via groups.io
@ 2024-04-29  6:03 ` Abdul Lateef Attar via groups.io
  2024-05-02 16:37   ` PierreGondois
  2024-04-29  6:03 ` [edk2-devel] [RESEND PATCH v4 5/5] DynamicTablesPkg: Adds X64 arch MADT " Abdul Lateef Attar via groups.io
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Abdul Lateef Attar via groups.io @ 2024-04-29  6:03 UTC (permalink / raw)
  To: devel; +Cc: Abdul Lateef Attar, Sami Mujawar, Pierre Gondois

Adds generic ACPI SSDT HPET table generator library.
Register/Deregister HPET table.
Adds ACPI namespace object for HPET device.
Adds Address space for HPET device.

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 |   2 +
 .../Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf  |  32 ++
 .../Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c  | 295 ++++++++++++++++++
 4 files changed, 331 insertions(+)
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
 create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c

diff --git a/DynamicTablesPkg/DynamicTables.dsc.inc b/DynamicTablesPkg/DynamicTables.dsc.inc
index 477dc6b6a9..fc2ac5962e 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
+  DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
 
 [Components.IA32, Components.X64]
   #
@@ -46,6 +47,7 @@
       NULL|DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
       NULL|DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
       NULL|DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
+      NULL|DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
   }
 
 [Components.ARM, Components.AARCH64]
diff --git a/DynamicTablesPkg/Include/AcpiTableGenerator.h b/DynamicTablesPkg/Include/AcpiTableGenerator.h
index a32ef46ecb..ef651aa2aa 100644
--- a/DynamicTablesPkg/Include/AcpiTableGenerator.h
+++ b/DynamicTablesPkg/Include/AcpiTableGenerator.h
@@ -1,6 +1,7 @@
 /** @file
 
   Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.<BR>
+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -101,6 +102,7 @@ typedef enum StdAcpiTableId {
   EStdAcpiTableIdPcct,                          ///< PCCT Generator
   EStdAcpiTableIdHpet,                          ///< HPET Generator
   EStdAcpiTableIdWsmt,                          ///< WSMT Generator
+  EStdAcpiTableIdSsdtHpet,                      ///< SSDT HPET Generator
   EStdAcpiTableIdMax
 } ESTD_ACPI_TABLE_ID;
 
diff --git a/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf b/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
new file mode 100644
index 0000000000..4dd0a60baf
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
@@ -0,0 +1,32 @@
+## @file
+#  SSDT 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      = AcpiSsdtHpetLib
+  FILE_GUID      = 85262912-AD7F-4EE0-8BB1-EE177275A54E
+  VERSION_STRING = 1.0
+  MODULE_TYPE    = DXE_DRIVER
+  LIBRARY_CLASS  = NULL|DXE_DRIVER
+  CONSTRUCTOR    = AcpiSsdtHpetLibConstructor
+  DESTRUCTOR     = AcpiSsdtHpetLibDestructor
+
+[Sources]
+  SsdtHpetGenerator.c
+
+[Packages]
+  DynamicTablesPkg/DynamicTablesPkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  AcpiHelperLib
+  AmlLib
+  BaseLib
+  DebugLib
+
diff --git a/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c b/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c
new file mode 100644
index 0000000000..5e4f935af8
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c
@@ -0,0 +1,295 @@
+/** @file
+  SSDT 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
+
+**/
+
+#include <AcpiTableGenerator.h>
+#include <ConfigurationManagerHelper.h>
+#include <ConfigurationManagerObject.h>
+#include <IndustryStandard/HighPrecisionEventTimerTable.h>
+#include <Library/AcpiHelperLib.h>
+#include <Library/AmlLib/AmlLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/IoLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/TableHelperLib.h>
+#include <Protocol/AcpiTable.h>
+#include <Protocol/ConfigurationManagerProtocol.h>
+
+/** The Creator ID for the ACPI tables generated using
+  the standard ACPI table generators.
+*/
+#define TABLE_GENERATOR_CREATOR_ID_GENERIC  SIGNATURE_32('D', 'Y', 'N', 'T')
+
+#define SB_SCOPE  "\\_SB_"
+
+/** This macro expands to a function that retrieves the
+    HPET base address from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+  EObjNameSpaceArch,
+  EArchObjHpetBaseAddress,
+  CM_ARCH_HPET_BASE_ADDRESS
+  );
+
+/** Construct the SSDT HPET devices Table.
+
+  This function invokes the Configuration Manager protocol interface
+  to get the required hardware information for generating the ACPI
+  table if required.
+
+  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
+BuildSsdtHpetTable (
+  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;
+  AML_ROOT_NODE_HANDLE       RootNode;
+  AML_OBJECT_NODE_HANDLE     ScopeNode;
+  AML_OBJECT_NODE_HANDLE     HpetNode;
+  AML_OBJECT_NODE_HANDLE     CrsNode;
+  UINT32                     EisaId;
+  CM_ARCH_HPET_BASE_ADDRESS  *HpetBaseAddress;
+
+  ASSERT (This != NULL);
+  ASSERT (AcpiTableInfo != NULL);
+  ASSERT (CfgMgrProtocol != NULL);
+  ASSERT (Table != NULL);
+  ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
+  ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
+
+  // Get the HPET Base Address from the Platform Configuration Manager
+  Status = GetEArchObjHpetBaseAddress (
+             CfgMgrProtocol,
+             CM_NULL_TOKEN,
+             &HpetBaseAddress,
+             NULL
+             );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "ERROR: HPET: Failed to get HPET Base Address. Status = %r\n",
+      Status
+      ));
+    return Status;
+  }
+
+  Status = AddSsdtAcpiHeader (
+             CfgMgrProtocol,
+             This,
+             AcpiTableInfo,
+             &RootNode
+             );
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
+  Status = AmlCodeGenScope (SB_SCOPE, RootNode, &ScopeNode);
+  if (EFI_ERROR (Status)) {
+    goto exit_handler;
+  }
+
+  Status = AmlCodeGenDevice ("HPET", ScopeNode, &HpetNode);
+  if (EFI_ERROR (Status)) {
+    ASSERT_EFI_ERROR (Status);
+    goto exit_handler;
+  }
+
+  Status = AmlGetEisaIdFromString ("PNP0103", &EisaId);
+  if (EFI_ERROR (Status)) {
+    ASSERT_EFI_ERROR (Status);
+    goto exit_handler;
+  }
+
+  Status = AmlCodeGenNameInteger ("_HID", EisaId, HpetNode, NULL);
+  if (EFI_ERROR (Status)) {
+    ASSERT_EFI_ERROR (Status);
+    goto exit_handler;
+  }
+
+  Status = AmlCodeGenNameInteger ("_UID", 0x00, HpetNode, NULL);
+  if (EFI_ERROR (Status)) {
+    ASSERT_EFI_ERROR (Status);
+    goto exit_handler;
+  }
+
+  Status = AmlCodeGenNameResourceTemplate ("_CRS", HpetNode, &CrsNode);
+  if (EFI_ERROR (Status)) {
+    ASSERT_EFI_ERROR (Status);
+    goto exit_handler;
+  }
+
+  Status = AmlCodeGenRdMemory32Fixed (FALSE, (UINT32)HpetBaseAddress->BaseAddress, SIZE_1KB, CrsNode, NULL);
+  if (EFI_ERROR (Status)) {
+    ASSERT_EFI_ERROR (Status);
+    goto exit_handler;
+  }
+
+  Status = AmlSerializeDefinitionBlock (
+             RootNode,
+             Table
+             );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "ERROR: SSDT-HPET: Failed to Serialize SSDT Table Data."
+      " Status = %r\n",
+      Status
+      ));
+    goto exit_handler;
+  }
+
+exit_handler:
+  // Delete the RootNode and its attached children.
+  return AmlDeleteTree (RootNode);
+}
+
+/** Free any resources allocated for constructing the
+    SSDT HPET ACPI table.
+
+  @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 [in, out] Table          Pointer to the ACPI Table.
+
+  @retval EFI_SUCCESS           The resources were freed successfully.
+  @retval EFI_INVALID_PARAMETER The table pointer is NULL or invalid.
+**/
+STATIC
+EFI_STATUS
+FreeSsdtHpetTableResources (
+  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,
+  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          **CONST  Table
+  )
+{
+  ASSERT (This != NULL);
+  ASSERT (AcpiTableInfo != NULL);
+  ASSERT (CfgMgrProtocol != NULL);
+  ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
+  ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
+
+  if ((Table == NULL) || (*Table == NULL)) {
+    DEBUG ((DEBUG_ERROR, "ERROR: SSDT-HPET: Invalid Table Pointer\n"));
+    ASSERT ((Table != NULL) && (*Table != NULL));
+    return EFI_INVALID_PARAMETER;
+  }
+
+  FreePool (*Table);
+  *Table = NULL;
+  return EFI_SUCCESS;
+}
+
+/** This macro defines the HPET Table Generator revision.
+*/
+#define HPET_GENERATOR_REVISION  CREATE_REVISION (1, 0)
+
+/** The interface for the SSDT HPET Table Generator.
+*/
+STATIC
+CONST
+ACPI_TABLE_GENERATOR  mSsdtPlatHpetGenerator = {
+  // Generator ID
+  CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdtHpet),
+  // Generator Description
+  L"ACPI.STD.SSDT.HPET.GENERATOR",
+  // ACPI Table Signature
+  EFI_ACPI_6_5_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
+  // ACPI Table Revision - Unused
+  0,
+  // Minimum ACPI Table Revision - Unused
+  0,
+  // Creator ID
+  TABLE_GENERATOR_CREATOR_ID_GENERIC,
+  // Creator Revision
+  HPET_GENERATOR_REVISION,
+  // Build Table function
+  BuildSsdtHpetTable,
+  // Free Resource function
+  FreeSsdtHpetTableResources,
+  // 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
+AcpiSsdtHpetLibConstructor (
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  EFI_STATUS  Status;
+
+  Status = RegisterAcpiTableGenerator (&mSsdtPlatHpetGenerator);
+  DEBUG ((DEBUG_INFO, "SSDT-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
+AcpiSsdtHpetLibDestructor (
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  EFI_STATUS  Status;
+
+  Status = DeregisterAcpiTableGenerator (&mSsdtPlatHpetGenerator);
+  DEBUG ((DEBUG_INFO, "SSDT-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 (#118373): https://edk2.groups.io/g/devel/message/118373
Mute This Topic: https://groups.io/mt/105796053/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] 14+ messages in thread

* [edk2-devel] [RESEND PATCH v4 5/5] DynamicTablesPkg: Adds X64 arch MADT Table generator
  2024-04-29  6:03 [edk2-devel] [RESEND PATCH v4 0/5] DynamicTablesPkg: Adds FADT, HPET, WSMT and MADT Table generators Abdul Lateef Attar via groups.io
                   ` (3 preceding siblings ...)
  2024-04-29  6:03 ` [edk2-devel] [RESEND PATCH v4 4/5] DynamicTablesPkg: Adds ACPI SSDT HPET " Abdul Lateef Attar via groups.io
@ 2024-04-29  6:03 ` Abdul Lateef Attar via groups.io
  2024-05-02 16:37   ` PierreGondois
  2024-05-02  7:21 ` [edk2-devel] [RESEND PATCH v4 0/5] DynamicTablesPkg: Adds FADT, HPET, WSMT and MADT Table generators Abdul Lateef Attar via groups.io
  2024-05-02 16:35 ` PierreGondois
  6 siblings, 1 reply; 14+ messages in thread
From: Abdul Lateef Attar via groups.io @ 2024-04-29  6:03 UTC (permalink / raw)
  To: devel; +Cc: Abdul Lateef Attar, Sami Mujawar, Pierre Gondois

Adds X64 architecture specific MADT/APIC Table generator.
Register/Deregister MADT table.
Adds X64 architecture namespace objects.

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        |   6 +
 .../Include/ConfigurationManagerObject.h      |   1 +
 .../Include/X64NameSpaceObjects.h             |  48 +++
 .../X64/AcpiMadtLibX64/AcpiMadtLibX64.inf     |  27 ++
 .../Acpi/X64/AcpiMadtLibX64/MadtGenerator.c   | 375 ++++++++++++++++++
 5 files changed, 457 insertions(+)
 create mode 100644 DynamicTablesPkg/Include/X64NameSpaceObjects.h
 create mode 100644 DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/AcpiMadtLibX64.inf
 create mode 100644 DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/MadtGenerator.c

diff --git a/DynamicTablesPkg/DynamicTables.dsc.inc b/DynamicTablesPkg/DynamicTables.dsc.inc
index fc2ac5962e..19034e6f65 100644
--- a/DynamicTablesPkg/DynamicTables.dsc.inc
+++ b/DynamicTablesPkg/DynamicTables.dsc.inc
@@ -39,6 +39,11 @@
   DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
 
 [Components.IA32, Components.X64]
+  #
+  # Generators
+  #
+  DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/AcpiMadtLibX64.inf
+
   #
   # Dynamic Table Factory Dxe
   #
@@ -48,6 +53,7 @@
       NULL|DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
       NULL|DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
       NULL|DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
+      NULL|DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/AcpiMadtLibX64.inf
   }
 
 [Components.ARM, Components.AARCH64]
diff --git a/DynamicTablesPkg/Include/ConfigurationManagerObject.h b/DynamicTablesPkg/Include/ConfigurationManagerObject.h
index f2cfadf3d4..31197eb019 100644
--- a/DynamicTablesPkg/Include/ConfigurationManagerObject.h
+++ b/DynamicTablesPkg/Include/ConfigurationManagerObject.h
@@ -110,6 +110,7 @@ typedef enum ObjectNameSpaceID {
   EObjNameSpaceStandard,      ///< Standard Objects Namespace
   EObjNameSpaceArm,           ///< ARM Objects Namespace
   EObjNameSpaceArch,          ///< Arch Objects Namespace
+  EObjNameSpaceX64,           ///< X64 Objects Namespace
   EObjNameSpaceOem = 0x8,     ///< OEM Objects Namespace
   EObjNameSpaceMax
 } EOBJECT_NAMESPACE_ID;
diff --git a/DynamicTablesPkg/Include/X64NameSpaceObjects.h b/DynamicTablesPkg/Include/X64NameSpaceObjects.h
new file mode 100644
index 0000000000..cd5c1ff43c
--- /dev/null
+++ b/DynamicTablesPkg/Include/X64NameSpaceObjects.h
@@ -0,0 +1,48 @@
+/** @file
+
+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Glossary:
+    - Cm or CM   - Configuration Manager
+    - Obj or OBJ - Object
+    - X64        - X64 processor architecture
+  **/
+
+#ifndef X64_NAMESPACE_OBJECT_H_
+#define X64_NAMESPACE_OBJECT_H_
+
+/** The EX64_OBJECT_ID enum describes the Object IDs
+    in the X64 Namespace
+*/
+typedef enum X64ObjectID {
+  EX64ObjReserved,                         ///<  0 - Reserved
+  EX64ObjMadtLocalInterruptInfo,           ///<  1 - MADT Local Interrupt Information
+  EX64ObjMadtProcessorLocalApicX2ApicInfo, ///<  2 - MADT Local APIC/x2APIC Controller Information
+  EX64ObjMadtIoApicInfo,                   ///<  3 - MADT IOAPIC Information
+  EX64ObjMadtLocalApicX2ApicNmiInfo,       ///<  4 - MADT Local APIC/x2APIC NMI Information
+  EX64ObjMadtInterruptSourceOverrideInfo,  ///<  5 - MADT Interrupt Override Information
+  EX64ObjMax
+} E_X64_OBJECT_ID;
+
+/** A structure that describes the
+    MADT Local Interrupt Information for the Platform.
+
+    ID: EX64ObjMadtLocalInterruptInfo
+*/
+typedef struct CmX64MadtLocalInterruptInfo {
+  UINT32    LocalApicAddress; ///< Local Interrupt Controller Address
+  UINT32    Flags;            ///< Flags
+} CM_X64_MADT_LOCAL_INTERRUPT_INFO;
+
+/** A structure that describes the
+    MADT Interrupt controller type information for the platform.
+
+    ID: EX64ObjMadtInterruptControllerTypeInfo
+*/
+typedef struct CmX64MadtInterruptControllerTypeInfo {
+  VOID     *InterruptControllerTypeInfo; ///< Interrupt Controller Type Information
+  UINTN    Size;                         ///< Size of the Interrupt Controller Type Information
+} CM_X64_MADT_INTERRUPT_CONTROLLER_TYPE_INFO;
+#endif
diff --git a/DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/AcpiMadtLibX64.inf b/DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/AcpiMadtLibX64.inf
new file mode 100644
index 0000000000..4d59e9023c
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/AcpiMadtLibX64.inf
@@ -0,0 +1,27 @@
+## @file
+#  MADT Acpi 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       = AcpiMadtLibX64
+  FILE_GUID       = BF8A63EC-21B9-4531-9866-F3F1593282EC
+  VERSION_STRING  = 1.0
+  MODULE_TYPE     = DXE_DRIVER
+  LIBRARY_CLASS   = NULL|DXE_DRIVER
+  CONSTRUCTOR     = AcpiMadtLibX64Constructor
+  DESTRUCTOR      = AcpiMadtLibX64Destructor
+
+[Sources]
+  MadtGenerator.c
+
+[Packages]
+  DynamicTablesPkg/DynamicTablesPkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+
+
diff --git a/DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/MadtGenerator.c b/DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/MadtGenerator.c
new file mode 100644
index 0000000000..8cfed66c8f
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/MadtGenerator.c
@@ -0,0 +1,375 @@
+/** @file
+  This library provides the implementation of the ACPI Multiple APIC Description Table (MADT)
+  for X64 architecture.
+
+  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
+
+**/
+
+#include <AcpiTableGenerator.h>
+#include <ConfigurationManagerObject.h>
+#include <ConfigurationManagerHelper.h>
+#include <Library/TableHelperLib.h>
+#include <Protocol/ConfigurationManagerProtocol.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <X64NameSpaceObjects.h>
+
+/** The Creator ID for the ACPI tables generated using
+  the standard ACPI table generators.
+*/
+#define TABLE_GENERATOR_CREATOR_ID_GENERIC  SIGNATURE_32('D', 'Y', 'N', 'T')
+
+/// MACRO to create GET_OBJECT_LIST for EX64ObjMadtLocalInterruptInfo
+GET_OBJECT_LIST (
+  EObjNameSpaceX64,
+  EX64ObjMadtLocalInterruptInfo,
+  CM_X64_MADT_LOCAL_INTERRUPT_INFO
+  );
+
+/// MACRO to create GET_OBJECT_LIST for EX64ObjMadtProcessorLocalApicX2ApicInfo
+GET_OBJECT_LIST (
+  EObjNameSpaceX64,
+  EX64ObjMadtProcessorLocalApicX2ApicInfo,
+  CM_X64_MADT_INTERRUPT_CONTROLLER_TYPE_INFO
+  );
+
+/// MACRO to create GET_OBJECT_LIST for EX64ObjMadtIoApicInfo
+GET_OBJECT_LIST (
+  EObjNameSpaceX64,
+  EX64ObjMadtIoApicInfo,
+  CM_X64_MADT_INTERRUPT_CONTROLLER_TYPE_INFO
+  );
+
+/// MACRO to create GET_OBJECT_LIST for EX64ObjMadtLocalApicX2ApicNmiInfo
+GET_OBJECT_LIST (
+  EObjNameSpaceX64,
+  EX64ObjMadtLocalApicX2ApicNmiInfo,
+  CM_X64_MADT_INTERRUPT_CONTROLLER_TYPE_INFO
+  );
+
+/// MACRO to create GET_OBJECT_LIST for EX64ObjMadtInterruptSourceOverrideInfo
+GET_OBJECT_LIST (
+  EObjNameSpaceX64,
+  EX64ObjMadtInterruptSourceOverrideInfo,
+  CM_X64_MADT_INTERRUPT_CONTROLLER_TYPE_INFO
+  );
+
+/**
+  Build the ACPI MADT table.
+
+  This function builds the ACPI MADT table as per the input configuration.
+
+  @param[in]  This              Pointer to the ACPI_TABLE_GENERATOR protocol.
+  @param[in]  AcpiTableInfo     Pointer to the CM_STD_OBJ_ACPI_TABLE_INFO structure.
+  @param[in]  CfgMgrProtocol    Pointer to the EDKII_CONFIGURATION_MANAGER_PROTOCOL protocol.
+  @param[out] Table             Pointer to the ACPI table structure.
+
+  @retval EFI_SUCCESS           The ACPI MADT table is built successfully.
+  @retval EFI_INVALID_PARAMETER The input parameter is invalid.
+**/
+STATIC
+EFI_STATUS
+BuildMadtTable (
+  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;
+  EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER  *Madt;
+  UINTN                                                MadtSize;
+  CM_X64_MADT_LOCAL_INTERRUPT_INFO                     *LocalInterruptInfo;
+  CM_X64_MADT_INTERRUPT_CONTROLLER_TYPE_INFO           *ProcessorLocalApicX2ApicInfo;
+  CM_X64_MADT_INTERRUPT_CONTROLLER_TYPE_INFO           *IoApicInfo;
+  CM_X64_MADT_INTERRUPT_CONTROLLER_TYPE_INFO           *LocalApicX2ApicNmiInfo;
+  CM_X64_MADT_INTERRUPT_CONTROLLER_TYPE_INFO           *InterruptSourceOverrideInfo;
+
+  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: MADT: 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;
+  MadtSize = sizeof (EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER);
+
+  // Get Local Interrupt Info
+  Status = GetEX64ObjMadtLocalInterruptInfo (
+             CfgMgrProtocol,
+             CM_NULL_TOKEN,
+             &LocalInterruptInfo,
+             NULL
+             );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "ERROR: MADT: Failed to get Local Interrupt Info\n"));
+    return Status;
+  }
+
+  // Get Processor Local APIC/x2APIC Info
+  Status = GetEX64ObjMadtProcessorLocalApicX2ApicInfo (
+             CfgMgrProtocol,
+             CM_NULL_TOKEN,
+             &ProcessorLocalApicX2ApicInfo,
+             NULL
+             );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "ERROR: MADT: Failed to get Processor Local APIC/x2APIC Info\n"));
+    return Status;
+  } else {
+    if (ProcessorLocalApicX2ApicInfo->Size == 0) {
+      DEBUG ((DEBUG_ERROR, "ERROR: MADT: Processor Local APIC/x2APIC Info size is 0\n"));
+      return EFI_NOT_FOUND;
+    }
+  }
+
+  MadtSize += ProcessorLocalApicX2ApicInfo->Size;
+
+  // Get IO APIC Info
+  Status = GetEX64ObjMadtIoApicInfo (
+             CfgMgrProtocol,
+             CM_NULL_TOKEN,
+             &IoApicInfo,
+             NULL
+             );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "ERROR: MADT: Failed to get IO APIC Info\n"));
+    return Status;
+  } else {
+    if (IoApicInfo->Size == 0) {
+      DEBUG ((DEBUG_ERROR, "ERROR: MADT: IO APIC Info size is 0\n"));
+      return EFI_NOT_FOUND;
+    }
+  }
+
+  MadtSize += IoApicInfo->Size;
+
+  // Get Local APIC/x2APIC NMI Info
+  Status = GetEX64ObjMadtLocalApicX2ApicNmiInfo (
+             CfgMgrProtocol,
+             CM_NULL_TOKEN,
+             &LocalApicX2ApicNmiInfo,
+             NULL
+             );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "ERROR: MADT: Failed to get Local APIC/x2APIC NMI Info\n"));
+    return Status;
+  } else {
+    if (LocalApicX2ApicNmiInfo->Size == 0) {
+      DEBUG ((DEBUG_ERROR, "ERROR: MADT: Local APIC/x2APIC NMI Info size is 0\n"));
+      return EFI_NOT_FOUND;
+    }
+  }
+
+  MadtSize += LocalApicX2ApicNmiInfo->Size;
+
+  // Get Interrupt Source Override Info
+  Status = GetEX64ObjMadtInterruptSourceOverrideInfo (
+             CfgMgrProtocol,
+             CM_NULL_TOKEN,
+             &InterruptSourceOverrideInfo,
+             NULL
+             );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_WARN, "WARNING: MADT: Failed to get Interrupt Source Override Info\n"));
+  }
+
+  if ((InterruptSourceOverrideInfo != NULL) && (InterruptSourceOverrideInfo->Size != 0)) {
+    MadtSize += InterruptSourceOverrideInfo->Size;
+  }
+
+  // Allocate memory for Madt pointer
+  Madt = (EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER *)AllocateZeroPool (MadtSize);
+  if (Madt == NULL) {
+    DEBUG ((DEBUG_ERROR, "ERROR: MADT: Failed to allocate memory for MADT\n"));
+    return EFI_OUT_OF_RESOURCES;
+  }
+
+  // Initialize the MADT header
+  Status = AddAcpiHeader (
+             CfgMgrProtocol,
+             This,
+             &Madt->Header,
+             AcpiTableInfo,
+             (UINT32)MadtSize
+             );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "ERROR: MADT: Failed to initialize MADT header\n"));
+    FreePool (Madt);
+    return Status;
+  }
+
+  Madt->LocalApicAddress = LocalInterruptInfo->LocalApicAddress;
+  Madt->Flags            = LocalInterruptInfo->Flags;
+
+  CopyMem (
+    (UINT8 *)Madt + sizeof (EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER),
+    ProcessorLocalApicX2ApicInfo->InterruptControllerTypeInfo,
+    ProcessorLocalApicX2ApicInfo->Size
+    );
+
+  CopyMem (
+    (UINT8 *)Madt + sizeof (EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER) + ProcessorLocalApicX2ApicInfo->Size,
+    IoApicInfo->InterruptControllerTypeInfo,
+    IoApicInfo->Size
+    );
+
+  CopyMem (
+    (UINT8 *)Madt + sizeof (EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER) + ProcessorLocalApicX2ApicInfo->Size + IoApicInfo->Size,
+    LocalApicX2ApicNmiInfo->InterruptControllerTypeInfo,
+    LocalApicX2ApicNmiInfo->Size
+    );
+
+  if ((InterruptSourceOverrideInfo != NULL) && (InterruptSourceOverrideInfo->Size != 0)) {
+    CopyMem (
+      (UINT8 *)Madt + sizeof (EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER) + ProcessorLocalApicX2ApicInfo->Size + IoApicInfo->Size + LocalApicX2ApicNmiInfo->Size,
+      InterruptSourceOverrideInfo->InterruptControllerTypeInfo,
+      InterruptSourceOverrideInfo->Size
+      );
+  }
+
+  *Table = (EFI_ACPI_DESCRIPTION_HEADER *)Madt;
+  return EFI_SUCCESS;
+}
+
+/** Free any resources allocated for constructing the MADT
+
+  @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 [in, out] Table          Pointer to the ACPI Table.
+
+  @retval EFI_SUCCESS           The resources were freed successfully.
+  @retval EFI_INVALID_PARAMETER The table pointer is NULL or invalid.
+**/
+STATIC
+EFI_STATUS
+FreeMadtTableResources (
+  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,
+  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          **CONST  Table
+  )
+{
+  ASSERT (This != NULL);
+  ASSERT (AcpiTableInfo != NULL);
+  ASSERT (CfgMgrProtocol != NULL);
+  ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
+  ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
+
+  if ((Table == NULL) || (*Table == NULL)) {
+    DEBUG ((DEBUG_ERROR, "ERROR: MADT: Invalid Table Pointer\n"));
+    ASSERT ((Table != NULL) && (*Table != NULL));
+    return EFI_INVALID_PARAMETER;
+  }
+
+  *Table = NULL;
+  return EFI_SUCCESS;
+}
+
+/// Macro for MADT Table generator revision
+#define MADT_GENERATOR_REVISION  CREATE_REVISION (1, 0)
+
+/// Interface for MADT table generator
+STATIC
+CONST
+ACPI_TABLE_GENERATOR  mMadtTableGenerator = {
+  // Generator ID
+  CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMadt),
+  // Generator Description
+  L"ACPI.STD.MADT.GENERATOR",
+  // ACPI Table Signature
+  EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
+  // ACPI Table Revision supported by this Generator
+  EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION,
+  // Minimum supported ACPI Table Revision
+  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION,
+  // Creator ID
+  TABLE_GENERATOR_CREATOR_ID_GENERIC,
+  // Creator Revision
+  MADT_GENERATOR_REVISION,
+  // Build Table function
+  BuildMadtTable,
+  // Free Resource function
+  FreeMadtTableResources,
+  // Extended build function not needed
+  NULL,
+  // Extended build function not implemented by the generator.
+  // Hence extended free resource function is not required.
+  NULL
+};
+
+/**
+  The constructor function registers the ACPI MADT table generator.
+
+  The constructor function registers the ACPI MADT table generator.
+
+  @param[in]  ImageHandle       The firmware allocated handle for the EFI image.
+  @param[in]  SystemTable       A pointer to the EFI System Table.
+
+  @retval EFI_SUCCESS           The constructor executed successfully.
+  @retval EFI_INVALID_PARAMETER The input parameter is invalid.
+**/
+EFI_STATUS
+EFIAPI
+AcpiMadtLibX64Constructor (
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  EFI_STATUS  Status;
+
+  Status = RegisterAcpiTableGenerator (&mMadtTableGenerator);
+  DEBUG ((DEBUG_INFO, "MADT: Register Generator. Status = %r\n", Status));
+  ASSERT_EFI_ERROR (Status);
+  return Status;
+}
+
+/**
+  The destructor function unregisters the ACPI MADT table generator.
+
+  The destructor function unregisters the ACPI MADT table generator.
+
+  @param[in]  ImageHandle       The firmware allocated handle for the EFI image.
+  @param[in]  SystemTable       A pointer to the EFI System Table.
+
+  @retval EFI_SUCCESS           The destructor executed successfully.
+  @retval EFI_INVALID_PARAMETER The input parameter is invalid.
+**/
+EFI_STATUS
+EFIAPI
+AcpiMadtLibX64Destructor (
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  EFI_STATUS  Status;
+
+  Status = DeregisterAcpiTableGenerator (&mMadtTableGenerator);
+  DEBUG ((DEBUG_INFO, "MADT: Unregister 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 (#118374): https://edk2.groups.io/g/devel/message/118374
Mute This Topic: https://groups.io/mt/105796054/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] 14+ messages in thread

* Re: [edk2-devel] [RESEND PATCH v4 0/5] DynamicTablesPkg: Adds FADT, HPET, WSMT and MADT Table generators
  2024-04-29  6:03 [edk2-devel] [RESEND PATCH v4 0/5] DynamicTablesPkg: Adds FADT, HPET, WSMT and MADT Table generators Abdul Lateef Attar via groups.io
                   ` (4 preceding siblings ...)
  2024-04-29  6:03 ` [edk2-devel] [RESEND PATCH v4 5/5] DynamicTablesPkg: Adds X64 arch MADT " Abdul Lateef Attar via groups.io
@ 2024-05-02  7:21 ` Abdul Lateef Attar via groups.io
  2024-05-02 16:35 ` PierreGondois
  6 siblings, 0 replies; 14+ messages in thread
From: Abdul Lateef Attar via groups.io @ 2024-05-02  7:21 UTC (permalink / raw)
  To: devel, Sami Mujawar, Pierre Gondois

Hi Pierre Gondois and Sami Mujawar,

     Could you please review below patch set and consider for upcoming 
stable release ?

There are non-disruptive patches and won't impact existing ARM platform.

Thanks

AbduL

On 29-04-2024 11:33, Abdul Lateef Attar wrote:
> PR: https://github.com/tianocore/edk2/pull/5500/
> V4: delta changes
>    Added X64 arch specific MADT table generator.
> V3: delta changes
>    Restructure the code as the review comments.
>    Added sanity check for WSMT flags.
>    Added CM object for HPET base address.
> V2: delta changes
>    Addressed review comments
>    Adds ACPI HPET table to add HPET to ACPI namespace
> V1:
> 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 (5):
>    DynamicTablesPkg: Adds ACPI FADT Table generator
>    DynamicTablesPkg: Adds ACPI HPET Table generator
>    DynamicTablesPkg: Adds ACPI WSMT Table generator
>    DynamicTablesPkg: Adds ACPI SSDT HPET Table generator
>    DynamicTablesPkg: Adds X64 arch MADT Table generator
>
>   DynamicTablesPkg/DynamicTables.dsc.inc        |  22 +-
>   DynamicTablesPkg/DynamicTablesPkg.ci.yaml     |   4 +-
>   DynamicTablesPkg/Include/AcpiTableGenerator.h |   4 +
>   .../Include/ArchNameSpaceObjects.h            | 237 ++++++
>   .../Include/ConfigurationManagerObject.h      |   7 +
>   .../Include/X64NameSpaceObjects.h             |  48 ++
>   .../Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf  |  36 +
>   .../Library/Acpi/AcpiFadtLib/Arm/FadtUpdate.c |  39 +
>   .../Library/Acpi/AcpiFadtLib/FadtGenerator.c  | 745 ++++++++++++++++++
>   .../Library/Acpi/AcpiFadtLib/FadtUpdate.h     |  26 +
>   .../Library/Acpi/AcpiFadtLib/X64/FadtUpdate.c |  32 +
>   .../Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf  |  31 +
>   .../Library/Acpi/AcpiHpetLib/HpetGenerator.c  | 246 ++++++
>   .../Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf  |  32 +
>   .../Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c  | 295 +++++++
>   .../Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf  |  30 +
>   .../Library/Acpi/AcpiWsmtLib/WsmtGenerator.c  | 243 ++++++
>   .../X64/AcpiMadtLibX64/AcpiMadtLibX64.inf     |  27 +
>   .../Acpi/X64/AcpiMadtLibX64/MadtGenerator.c   | 375 +++++++++
>   19 files changed, 2477 insertions(+), 2 deletions(-)
>   create mode 100644 DynamicTablesPkg/Include/ArchNameSpaceObjects.h
>   create mode 100644 DynamicTablesPkg/Include/X64NameSpaceObjects.h
>   create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
>   create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/Arm/FadtUpdate.c
>   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/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
>   create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c
>   create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
>   create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c
>   create mode 100644 DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/AcpiMadtLibX64.inf
>   create mode 100644 DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/MadtGenerator.c
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118500): https://edk2.groups.io/g/devel/message/118500
Mute This Topic: https://groups.io/mt/105796049/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [edk2-devel] [RESEND PATCH v4 0/5] DynamicTablesPkg: Adds FADT, HPET, WSMT and MADT Table generators
  2024-04-29  6:03 [edk2-devel] [RESEND PATCH v4 0/5] DynamicTablesPkg: Adds FADT, HPET, WSMT and MADT Table generators Abdul Lateef Attar via groups.io
                   ` (5 preceding siblings ...)
  2024-05-02  7:21 ` [edk2-devel] [RESEND PATCH v4 0/5] DynamicTablesPkg: Adds FADT, HPET, WSMT and MADT Table generators Abdul Lateef Attar via groups.io
@ 2024-05-02 16:35 ` PierreGondois
  2024-05-03  7:41   ` Sami Mujawar
  6 siblings, 1 reply; 14+ messages in thread
From: PierreGondois @ 2024-05-02 16:35 UTC (permalink / raw)
  To: Abdul Lateef Attar, devel; +Cc: Sami Mujawar

Hello Abdul,
I added some comments.
I think that:
a. patches related to HPET/WSMT should require little work
b. MADT patch needs to redefine the CmObjects it uses,
    but it seems ok otherwise (just need to have the right properties
    in the right objects),
c. FADT patch is re-defining CmObjects that are already existing
    in ArmNameSpaceObjects.h. So there is going to be a clash with
    ongoing DynamicTables objects reorganization...

I think that a. could be sent separately and should quickly go in,
b. might require a bit more checking/reviewing, and c. might need
to wait for the re-org to be finished, unless Sami thinks it's ok
to take the patch,

Regards,
Pierre


On 4/29/24 08:03, Abdul Lateef Attar wrote:
> PR: https://github.com/tianocore/edk2/pull/5500/
> V4: delta changes
>    Added X64 arch specific MADT table generator.
> V3: delta changes
>    Restructure the code as the review comments.
>    Added sanity check for WSMT flags.
>    Added CM object for HPET base address.
> V2: delta changes
>    Addressed review comments
>    Adds ACPI HPET table to add HPET to ACPI namespace
> V1:
> 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 (5):
>    DynamicTablesPkg: Adds ACPI FADT Table generator
>    DynamicTablesPkg: Adds ACPI HPET Table generator
>    DynamicTablesPkg: Adds ACPI WSMT Table generator
>    DynamicTablesPkg: Adds ACPI SSDT HPET Table generator
>    DynamicTablesPkg: Adds X64 arch MADT Table generator
> 
>   DynamicTablesPkg/DynamicTables.dsc.inc        |  22 +-
>   DynamicTablesPkg/DynamicTablesPkg.ci.yaml     |   4 +-
>   DynamicTablesPkg/Include/AcpiTableGenerator.h |   4 +
>   .../Include/ArchNameSpaceObjects.h            | 237 ++++++
>   .../Include/ConfigurationManagerObject.h      |   7 +
>   .../Include/X64NameSpaceObjects.h             |  48 ++
>   .../Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf  |  36 +
>   .../Library/Acpi/AcpiFadtLib/Arm/FadtUpdate.c |  39 +
>   .../Library/Acpi/AcpiFadtLib/FadtGenerator.c  | 745 ++++++++++++++++++
>   .../Library/Acpi/AcpiFadtLib/FadtUpdate.h     |  26 +
>   .../Library/Acpi/AcpiFadtLib/X64/FadtUpdate.c |  32 +
>   .../Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf  |  31 +
>   .../Library/Acpi/AcpiHpetLib/HpetGenerator.c  | 246 ++++++
>   .../Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf  |  32 +
>   .../Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c  | 295 +++++++
>   .../Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf  |  30 +
>   .../Library/Acpi/AcpiWsmtLib/WsmtGenerator.c  | 243 ++++++
>   .../X64/AcpiMadtLibX64/AcpiMadtLibX64.inf     |  27 +
>   .../Acpi/X64/AcpiMadtLibX64/MadtGenerator.c   | 375 +++++++++
>   19 files changed, 2477 insertions(+), 2 deletions(-)
>   create mode 100644 DynamicTablesPkg/Include/ArchNameSpaceObjects.h
>   create mode 100644 DynamicTablesPkg/Include/X64NameSpaceObjects.h
>   create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
>   create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/Arm/FadtUpdate.c
>   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/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
>   create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c
>   create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
>   create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c
>   create mode 100644 DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/AcpiMadtLibX64.inf
>   create mode 100644 DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/MadtGenerator.c
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118528): https://edk2.groups.io/g/devel/message/118528
Mute This Topic: https://groups.io/mt/105796049/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [edk2-devel] [RESEND PATCH v4 2/5] DynamicTablesPkg: Adds ACPI HPET Table generator
  2024-04-29  6:03 ` [edk2-devel] [RESEND PATCH v4 2/5] DynamicTablesPkg: Adds ACPI HPET " Abdul Lateef Attar via groups.io
@ 2024-05-02 16:36   ` PierreGondois
  0 siblings, 0 replies; 14+ messages in thread
From: PierreGondois @ 2024-05-02 16:36 UTC (permalink / raw)
  To: Abdul Lateef Attar, devel; +Cc: Sami Mujawar

Hello Abdul,
some comments on the patch:

On 4/29/24 08:03, Abdul Lateef Attar wrote:
> 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/Include/AcpiTableGenerator.h |   1 +
>   .../Include/ArchNameSpaceObjects.h            |   9 +
>   .../Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf  |  31 +++
>   .../Library/Acpi/AcpiHpetLib/HpetGenerator.c  | 246 ++++++++++++++++++
>   5 files changed, 289 insertions(+)
>   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 92f3a138e4..b2ef36eb8a 100644
> --- a/DynamicTablesPkg/DynamicTables.dsc.inc
> +++ b/DynamicTablesPkg/DynamicTables.dsc.inc
> @@ -34,6 +34,7 @@
>     # Generators
>     #
>     DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
> +  DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf

I think this should be moved to the following section if the table if for Intel arch.
Like this it would allow avoiding to build the generator for other archs.

[Components.IA32, Components.X64]
      #
      # Generators
      #
...

also if the table is Intel specific, maybe the generator should be placed under:
    DynamicTablesPkg/Library/Acpi/X64/
    (or a better folder name)
also I think the CmObject should be moved to:
    X64NameSpaceObjects.h

>   
>   [Components.IA32, Components.X64]
>     #
> @@ -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/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/Include/ArchNameSpaceObjects.h b/DynamicTablesPkg/Include/ArchNameSpaceObjects.h
> index b421c4cd29..b90e573a88 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
> +  EArchObjHpetBaseAddress,        ///< 14 - HPET Base Address
>     EArchObjMax
>   } E_ARCH_OBJECT_ID;
>   
> @@ -214,4 +215,12 @@ typedef struct CmArchFadtMiscInfo {
>     UINT8     Century;
>   } CM_ARCH_FADT_MISC_INFO;
>   
> +/** A structure that describes the
> +    HPET Base Address.
> +
> +    ID: EArchObjHpetBaseAddress
> +*/
> +typedef struct CmArchHpetBaseAddress {
> +  UINT64    BaseAddress;
> +} CM_ARCH_HPET_BASE_ADDRESS;

Would it make sense to have these fields for the CmObj ?
typedef struct CmArchHpetBaseAddress {
      UINT32    EventTimerBlockId;
      UINT32    BaseAddressLower32Bit;
      UINT8     HpetNumber;
      UINT16    MainCounterMinimumClockTickInPeriodicMode;
      UINT8     PageProtectionAndOemAttribute;
} CM_ARCH_HPET_BASE_ADDRESS;

The reason being that:
- Ideally the DynamicTables generators should just generate ACPI tables
      from the CmObject they are given. The ConfigurationManager being a
      database providing information.
      Doing Mmio accesses to populate the ACPI tables breaks a bit the design:
      the generators would also become a source of information.
- If the Mmio accesses are possible from the generator, they should also
      be possible from the ConfigurationManager.
- Imagining a platform with an invalid value for the MainCounterMinimumClockTickInPeriodicMode,
      as the generator is generic to all platforms, it becomes hard to patch this.
      The ConfigurationManager is supposed to be platform specific, so if
      the MainCounterMinimumClockTickInPeriodicMode register is invalid,
      it is easy to patch this specific ConfigurationManager and keep a generic
      HPET generator.

(I am refering to MmioRead32 accesses from [1])

>   #endif
> diff --git a/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf b/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
> new file mode 100644
> index 0000000000..f0441107fc
> --- /dev/null
> +++ b/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
> @@ -0,0 +1,31 @@
> +## @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
> +  MdeModulePkg/MdeModulePkg.dec
> +  MdePkg/MdePkg.dec
> +
> +[LibraryClasses]
> +  BaseLib
> +  DebugLib
> +  IoLib
> +
> diff --git a/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/HpetGenerator.c b/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/HpetGenerator.c
> new file mode 100644
> index 0000000000..937879b7b3
> --- /dev/null
> +++ b/DynamicTablesPkg/Library/Acpi/AcpiHpetLib/HpetGenerator.c
> @@ -0,0 +1,246 @@
> +/** @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
> +    http://www.intel.com/content/dam/www/public/us/en/documents/technical-specifications/software-developers-hpet-spec-1-0a.pdf
> +
> +**/
> +
> +#include <AcpiTableGenerator.h>
> +#include <ConfigurationManagerHelper.h>
> +#include <ConfigurationManagerObject.h>
> +#include <IndustryStandard/HighPrecisionEventTimerTable.h>
> +#include <Library/DebugLib.h>
> +#include <Library/IoLib.h>
> +#include <Library/TableHelperLib.h>
> +#include <Protocol/AcpiTable.h>
> +#include <Protocol/ConfigurationManagerProtocol.h>
> +
> +///
> +/// HPET General Register Offsets
> +///
> +#define HPET_GENERAL_CAPABILITIES_ID_OFFSET  0x000
> +
> +/** The Creator ID for the ACPI tables generated using
> +  the standard ACPI table generators.
> +*/
> +#define TABLE_GENERATOR_CREATOR_ID_GENERIC  SIGNATURE_32('D', 'Y', 'N', 'T')
> +
> +/** 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
> +};
> +
> +/** This macro expands to a function that retrieves the
> +    HPET base address from the Configuration Manager.
> +*/
> +GET_OBJECT_LIST (
> +  EObjNameSpaceArch,
> +  EArchObjHpetBaseAddress,
> +  CM_ARCH_HPET_BASE_ADDRESS
> +  );
> +
> +/** 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;
> +  CM_ARCH_HPET_BASE_ADDRESS  *HpetBaseAddress;
> +
> +  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;
> +  }
> +
> +  // Get the HPET Base Address from the Platform Configuration Manager
> +  Status = GetEArchObjHpetBaseAddress (
> +             CfgMgrProtocol,
> +             CM_NULL_TOKEN,
> +             &HpetBaseAddress,
> +             NULL
> +             );
> +  if (EFI_ERROR (Status)) {
> +    DEBUG ((
> +      DEBUG_ERROR,
> +      "ERROR: HPET: Failed to get HPET Base Address. Status = %r\n",
> +      Status
> +      ));
> +    return Status;
> +  }
> +
> +  mAcpiHpet.BaseAddressLower32Bit.Address             = HpetBaseAddress->BaseAddress;
> +  mAcpiHpet.EventTimerBlockId                         = MmioRead32 ((UINTN)(HpetBaseAddress->BaseAddress + HPET_GENERAL_CAPABILITIES_ID_OFFSET));
> +  mAcpiHpet.MainCounterMinimumClockTickInPeriodicMode = (UINT16)MmioRead32 ((UINTN)(HpetBaseAddress->BaseAddress + HPET_GENERAL_CAPABILITIES_ID_OFFSET + 4));

[1]

> +  *Table                                              = (EFI_ACPI_DESCRIPTION_HEADER *)&mAcpiHpet;
> +
> +  return Status;
> +}
> +
> +/** This macro defines the HPET Table Generator revision.
> +*/
> +#define HPET_GENERATOR_REVISION  CREATE_REVISION (1, 0)
> +
> +/** 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
> +  TABLE_GENERATOR_CREATOR_ID_GENERIC,
> +  // Creator Revision
> +  HPET_GENERATOR_REVISION,
> +  // 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;
> +}


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118529): https://edk2.groups.io/g/devel/message/118529
Mute This Topic: https://groups.io/mt/105796051/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [edk2-devel] [RESEND PATCH v4 3/5] DynamicTablesPkg: Adds ACPI WSMT Table generator
  2024-04-29  6:03 ` [edk2-devel] [RESEND PATCH v4 3/5] DynamicTablesPkg: Adds ACPI WSMT " Abdul Lateef Attar via groups.io
@ 2024-05-02 16:36   ` PierreGondois
  0 siblings, 0 replies; 14+ messages in thread
From: PierreGondois @ 2024-05-02 16:36 UTC (permalink / raw)
  To: Abdul Lateef Attar, devel; +Cc: Sami Mujawar

Hello Abdul,
some comments on the patch:

On 4/29/24 08:03, Abdul Lateef Attar wrote:
> 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            |  11 +
>   .../Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf  |  30 +++
>   .../Library/Acpi/AcpiWsmtLib/WsmtGenerator.c  | 243 ++++++++++++++++++
>   5 files changed, 287 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 b2ef36eb8a..477dc6b6a9 100644
> --- a/DynamicTablesPkg/DynamicTables.dsc.inc
> +++ b/DynamicTablesPkg/DynamicTables.dsc.inc
> @@ -35,6 +35,7 @@
>     #
>     DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
>     DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
> +  DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf

Same comment as in:
     [PATCH v4 2/5] DynamicTablesPkg: Adds ACPI HPET Table generator
about:
     [Components.IA32, Components.X64]
also if the table is Intel specific, maybe the generator should be placed under:
    DynamicTablesPkg/Library/Acpi/X64/
    (or a better folder name)
also I think the CmObject should be moved to:
    X64NameSpaceObjects.h

>   
>   [Components.IA32, Components.X64]
>     #
> @@ -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 b90e573a88..8b16056ba1 100644
> --- a/DynamicTablesPkg/Include/ArchNameSpaceObjects.h
> +++ b/DynamicTablesPkg/Include/ArchNameSpaceObjects.h
> @@ -40,6 +40,7 @@ typedef enum ArchObjectID {
>     EArchObjFadtHypervisorVendorId, ///< 12 - Hypervisor vendor identity information
>     EArchObjFadtMiscInfo,           ///< 13 - Legacy fields; RTC, latency, flush stride, etc
>     EArchObjHpetBaseAddress,        ///< 14 - HPET Base Address
> +  EArchObjWsmtProtectionFlags,    ///< 15 - WSMT protection flags
>     EArchObjMax
>   } E_ARCH_OBJECT_ID;
>   
> @@ -223,4 +224,14 @@ typedef struct CmArchFadtMiscInfo {
>   typedef struct CmArchHpetBaseAddress {
>     UINT64    BaseAddress;
>   } CM_ARCH_HPET_BASE_ADDRESS;
> +
> +/** 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..80ddaf0ab4
> --- /dev/null
> +++ b/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
> @@ -0,0 +1,30 @@
> +## @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
> +
> diff --git a/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c b/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c
> new file mode 100644
> index 0000000000..a63b4b4859
> --- /dev/null
> +++ b/DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c
> @@ -0,0 +1,243 @@
> +/** @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
> +    https://msdn.microsoft.com/windows/hardware/drivers/bringup/acpi-system-description-tables#wsmt
> +
> +**/
> +
> +#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 <ArchNameSpaceObjects.h>
> +
> +/** The Creator ID for the ACPI tables generated using
> +  the standard ACPI table generators.
> +*/
> +#define TABLE_GENERATOR_CREATOR_ID_GENERIC  SIGNATURE_32('D', 'Y', 'N', 'T')
> +
> +/** 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
> +};
> +
> +/** 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
> +  );
> +
> +/** 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;
> +  }
> +
> +  /// Sanity check WSMT Projection Flags
> +  if ((mAcpiWsmt.ProtectionFlags & EFI_WSMT_PROTECTION_FLAGS_COMM_BUFFER_NESTED_PTR_PROTECTION) != 0) {
> +    if ((mAcpiWsmt.ProtectionFlags & EFI_WSMT_PROTECTION_FLAGS_FIXED_COMM_BUFFERS) == 0) {
> +      DEBUG ((
> +        DEBUG_ERROR,
> +        "ERROR: WSMT: Protection flags are invalid. " \
> +        "COMM_BUFFER_NESTED_PTR_PROTECTION is set but FIXED_COMM_BUFFERS is not set.\n"
> +        ));
> +      return EFI_INVALID_PARAMETER;
> +    }
> +  }
> +
> +  *Table = (EFI_ACPI_DESCRIPTION_HEADER *)&mAcpiWsmt;
> +
> +  return Status;
> +}
> +
> +/** This macro defines the WSMT Table Generator revision.
> +*/
> +#define WSMT_GENERATOR_REVISION  CREATE_REVISION (1, 0)
> +
> +/** 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
> +  TABLE_GENERATOR_CREATOR_ID_GENERIC,
> +  // Creator Revision
> +  WSMT_GENERATOR_REVISION,
> +  // 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 (#118530): https://edk2.groups.io/g/devel/message/118530
Mute This Topic: https://groups.io/mt/105796052/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [edk2-devel] [RESEND PATCH v4 4/5] DynamicTablesPkg: Adds ACPI SSDT HPET Table generator
  2024-04-29  6:03 ` [edk2-devel] [RESEND PATCH v4 4/5] DynamicTablesPkg: Adds ACPI SSDT HPET " Abdul Lateef Attar via groups.io
@ 2024-05-02 16:37   ` PierreGondois
  0 siblings, 0 replies; 14+ messages in thread
From: PierreGondois @ 2024-05-02 16:37 UTC (permalink / raw)
  To: Abdul Lateef Attar, devel; +Cc: Sami Mujawar

Hello Abdul,
some comments on the patch:

On 4/29/24 08:03, Abdul Lateef Attar wrote:
> Adds generic ACPI SSDT HPET table generator library.
> Register/Deregister HPET table.
> Adds ACPI namespace object for HPET device.
> Adds Address space for HPET device.
> 
> 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 |   2 +
>   .../Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf  |  32 ++
>   .../Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c  | 295 ++++++++++++++++++
>   4 files changed, 331 insertions(+)
>   create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
>   create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c
> 
> diff --git a/DynamicTablesPkg/DynamicTables.dsc.inc b/DynamicTablesPkg/DynamicTables.dsc.inc
> index 477dc6b6a9..fc2ac5962e 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
> +  DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf

Same comment as in:
     [PATCH v4 2/5] DynamicTablesPkg: Adds ACPI HPET Table generator
about:
     [Components.IA32, Components.X64]
also if the table is Intel specific, maybe the generator should be placed under:
    DynamicTablesPkg/Library/Acpi/X64/
    (or a better folder name)
also I think the CmObject should be moved to:
    X64NameSpaceObjects.h

>   
>   [Components.IA32, Components.X64]
>     #
> @@ -46,6 +47,7 @@
>         NULL|DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
>         NULL|DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
>         NULL|DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
> +      NULL|DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
>     }
>   
>   [Components.ARM, Components.AARCH64]
> diff --git a/DynamicTablesPkg/Include/AcpiTableGenerator.h b/DynamicTablesPkg/Include/AcpiTableGenerator.h

[snip]

> +
> +  Status = AmlCodeGenNameInteger ("_HID", EisaId, HpetNode, NULL);
> +  if (EFI_ERROR (Status)) {
> +    ASSERT_EFI_ERROR (Status);
> +    goto exit_handler;
> +  }
> +
> +  Status = AmlCodeGenNameInteger ("_UID", 0x00, HpetNode, NULL);

In case there as multiple HPET,
I think this should be set to HpetBaseAddress->HpetNumber

> +  if (EFI_ERROR (Status)) {
> +    ASSERT_EFI_ERROR (Status);
> +    goto exit_handler;
> +  }
> +
> +  Status = AmlCodeGenNameResourceTemplate ("_CRS", HpetNode, &CrsNode);
> +  if (EFI_ERROR (Status)) {
> +    ASSERT_EFI_ERROR (Status);
> +    goto exit_handler;
> +  }
> +
> +  Status = AmlCodeGenRdMemory32Fixed (FALSE, (UINT32)HpetBaseAddress->BaseAddress, SIZE_1KB, CrsNode, NULL);

Will this always be readonly ? Or could it be a ReadWrite parameter ?
If unsure, this shouldn't be too hard to patch in the future.

> +  if (EFI_ERROR (Status)) {
> +    ASSERT_EFI_ERROR (Status);
> +    goto exit_handler;
> +  }
> +

[snip]


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118531): https://edk2.groups.io/g/devel/message/118531
Mute This Topic: https://groups.io/mt/105796053/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [edk2-devel] [RESEND PATCH v4 5/5] DynamicTablesPkg: Adds X64 arch MADT Table generator
  2024-04-29  6:03 ` [edk2-devel] [RESEND PATCH v4 5/5] DynamicTablesPkg: Adds X64 arch MADT " Abdul Lateef Attar via groups.io
@ 2024-05-02 16:37   ` PierreGondois
  0 siblings, 0 replies; 14+ messages in thread
From: PierreGondois @ 2024-05-02 16:37 UTC (permalink / raw)
  To: Abdul Lateef Attar, devel; +Cc: Sami Mujawar

Hello Abdul,
some comments on the patch:

On 4/29/24 08:03, Abdul Lateef Attar wrote:
> Adds X64 architecture specific MADT/APIC Table generator.
> Register/Deregister MADT table.
> Adds X64 architecture namespace objects.
> 
> 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        |   6 +
>   .../Include/ConfigurationManagerObject.h      |   1 +
>   .../Include/X64NameSpaceObjects.h             |  48 +++
>   .../X64/AcpiMadtLibX64/AcpiMadtLibX64.inf     |  27 ++
>   .../Acpi/X64/AcpiMadtLibX64/MadtGenerator.c   | 375 ++++++++++++++++++
>   5 files changed, 457 insertions(+)
>   create mode 100644 DynamicTablesPkg/Include/X64NameSpaceObjects.h
>   create mode 100644 DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/AcpiMadtLibX64.inf
>   create mode 100644 DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/MadtGenerator.c
> 
> diff --git a/DynamicTablesPkg/DynamicTables.dsc.inc b/DynamicTablesPkg/DynamicTables.dsc.inc
> index fc2ac5962e..19034e6f65 100644
> --- a/DynamicTablesPkg/DynamicTables.dsc.inc
> +++ b/DynamicTablesPkg/DynamicTables.dsc.inc
> @@ -39,6 +39,11 @@
>     DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
>   
>   [Components.IA32, Components.X64]
> +  #
> +  # Generators
> +  #
> +  DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/AcpiMadtLibX64.inf
> +
>     #
>     # Dynamic Table Factory Dxe
>     #
> @@ -48,6 +53,7 @@
>         NULL|DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf
>         NULL|DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
>         NULL|DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
> +      NULL|DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/AcpiMadtLibX64.inf
>     }
>   
>   [Components.ARM, Components.AARCH64]
> diff --git a/DynamicTablesPkg/Include/ConfigurationManagerObject.h b/DynamicTablesPkg/Include/ConfigurationManagerObject.h
> index f2cfadf3d4..31197eb019 100644
> --- a/DynamicTablesPkg/Include/ConfigurationManagerObject.h
> +++ b/DynamicTablesPkg/Include/ConfigurationManagerObject.h
> @@ -110,6 +110,7 @@ typedef enum ObjectNameSpaceID {
>     EObjNameSpaceStandard,      ///< Standard Objects Namespace
>     EObjNameSpaceArm,           ///< ARM Objects Namespace
>     EObjNameSpaceArch,          ///< Arch Objects Namespace
> +  EObjNameSpaceX64,           ///< X64 Objects Namespace
>     EObjNameSpaceOem = 0x8,     ///< OEM Objects Namespace
>     EObjNameSpaceMax
>   } EOBJECT_NAMESPACE_ID;
> diff --git a/DynamicTablesPkg/Include/X64NameSpaceObjects.h b/DynamicTablesPkg/Include/X64NameSpaceObjects.h
> new file mode 100644
> index 0000000000..cd5c1ff43c
> --- /dev/null
> +++ b/DynamicTablesPkg/Include/X64NameSpaceObjects.h
> @@ -0,0 +1,48 @@
> +/** @file
> +
> +  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +  @par Glossary:
> +    - Cm or CM   - Configuration Manager
> +    - Obj or OBJ - Object
> +    - X64        - X64 processor architecture
> +  **/
> +
> +#ifndef X64_NAMESPACE_OBJECT_H_
> +#define X64_NAMESPACE_OBJECT_H_
> +
> +/** The EX64_OBJECT_ID enum describes the Object IDs
> +    in the X64 Namespace
> +*/
> +typedef enum X64ObjectID {
> +  EX64ObjReserved,                         ///<  0 - Reserved
> +  EX64ObjMadtLocalInterruptInfo,           ///<  1 - MADT Local Interrupt Information
> +  EX64ObjMadtProcessorLocalApicX2ApicInfo, ///<  2 - MADT Local APIC/x2APIC Controller Information
> +  EX64ObjMadtIoApicInfo,                   ///<  3 - MADT IOAPIC Information
> +  EX64ObjMadtLocalApicX2ApicNmiInfo,       ///<  4 - MADT Local APIC/x2APIC NMI Information
> +  EX64ObjMadtInterruptSourceOverrideInfo,  ///<  5 - MADT Interrupt Override Information
> +  EX64ObjMax
> +} E_X64_OBJECT_ID;
> +
> +/** A structure that describes the
> +    MADT Local Interrupt Information for the Platform.
> +
> +    ID: EX64ObjMadtLocalInterruptInfo
> +*/
> +typedef struct CmX64MadtLocalInterruptInfo {
> +  UINT32    LocalApicAddress; ///< Local Interrupt Controller Address
> +  UINT32    Flags;            ///< Flags
> +} CM_X64_MADT_LOCAL_INTERRUPT_INFO;
> +
> +/** A structure that describes the
> +    MADT Interrupt controller type information for the platform.
> +
> +    ID: EX64ObjMadtInterruptControllerTypeInfo
> +*/
> +typedef struct CmX64MadtInterruptControllerTypeInfo {
> +  VOID     *InterruptControllerTypeInfo; ///< Interrupt Controller Type Information

Cf. the comment in:
    [PATCH v4 2/5] DynamicTablesPkg: Adds ACPI HPET Table generator
the information should be stored in CmObj, as (for instance):
{
    UINT32   InterruptNumber;
    UINT32   Flags;
    UINT64   BaseAddress;
    ...
}

Here you are kind of bypassing the framework by using a VOID* pointer.
The interest of storing the information in objects is that this information
can be re-used at multiple places.
For instance for Arm, GicC information is used to generate the MADT table,
but also used for to generate the PPTT, SRAT, SSDT topology tables.

If the information is generic, multiple IDs can correspond to on CM_OBJ
structure as you did, but fields containing real data should be used.


For instance there is for Arm:
/** A structure that describes the Arm
      Generic Interrupts.
*/
typedef struct CmArmGenericInterrupt {
    /// Interrupt number
    UINT32    Interrupt;

    /// Flags
    /// BIT0: 0: Interrupt is Level triggered
    ///       1: Interrupt is Edge triggered
    /// BIT1: 0: Interrupt is Active high
    ///       1: Interrupt is Active low
    UINT32    Flags;
} CM_ARM_GENERIC_INTERRUPT;

but I don't think it fully applies to X64 arch as for instance,
the 5.2.12.8 Local APIC Address Override Structure
requires a 'Local APIC Address' field which is not present in here.

> +  UINTN    Size;                         ///< Size of the Interrupt Controller Type Information
> +} CM_X64_MADT_INTERRUPT_CONTROLLER_TYPE_INFO;
> +#endif
> diff --git a/DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/AcpiMadtLibX64.inf b/DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/AcpiMadtLibX64.inf
> new file mode 100644
> index 0000000000..4d59e9023c
> --- /dev/null
> +++ b/DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/AcpiMadtLibX64.inf
> @@ -0,0 +1,27 @@
> +## @file
> +#  MADT Acpi 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       = AcpiMadtLibX64
> +  FILE_GUID       = BF8A63EC-21B9-4531-9866-F3F1593282EC
> +  VERSION_STRING  = 1.0
> +  MODULE_TYPE     = DXE_DRIVER
> +  LIBRARY_CLASS   = NULL|DXE_DRIVER
> +  CONSTRUCTOR     = AcpiMadtLibX64Constructor
> +  DESTRUCTOR      = AcpiMadtLibX64Destructor
> +
> +[Sources]
> +  MadtGenerator.c
> +
> +[Packages]
> +  DynamicTablesPkg/DynamicTablesPkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  MdePkg/MdePkg.dec
> +
> +
> diff --git a/DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/MadtGenerator.c b/DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/MadtGenerator.c
> new file mode 100644
> index 0000000000..8cfed66c8f
> --- /dev/null
> +++ b/DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/MadtGenerator.c
> @@ -0,0 +1,375 @@
> +/** @file
> +  This library provides the implementation of the ACPI Multiple APIC Description Table (MADT)
> +  for X64 architecture.
> +
> +  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
> +
> +**/
> +
> +#include <AcpiTableGenerator.h>
> +#include <ConfigurationManagerObject.h>
> +#include <ConfigurationManagerHelper.h>
> +#include <Library/TableHelperLib.h>
> +#include <Protocol/ConfigurationManagerProtocol.h>
> +#include <Library/UefiBootServicesTableLib.h>
> +#include <Library/DebugLib.h>
> +#include <Library/BaseLib.h>
> +#include <Library/BaseMemoryLib.h>
> +#include <Library/MemoryAllocationLib.h>
> +#include <X64NameSpaceObjects.h>
> +
> +/** The Creator ID for the ACPI tables generated using
> +  the standard ACPI table generators.
> +*/
> +#define TABLE_GENERATOR_CREATOR_ID_GENERIC  SIGNATURE_32('D', 'Y', 'N', 'T')
> +
> +/// MACRO to create GET_OBJECT_LIST for EX64ObjMadtLocalInterruptInfo
> +GET_OBJECT_LIST (
> +  EObjNameSpaceX64,
> +  EX64ObjMadtLocalInterruptInfo,
> +  CM_X64_MADT_LOCAL_INTERRUPT_INFO
> +  );
> +
> +/// MACRO to create GET_OBJECT_LIST for EX64ObjMadtProcessorLocalApicX2ApicInfo
> +GET_OBJECT_LIST (
> +  EObjNameSpaceX64,
> +  EX64ObjMadtProcessorLocalApicX2ApicInfo,
> +  CM_X64_MADT_INTERRUPT_CONTROLLER_TYPE_INFO
> +  );
> +
> +/// MACRO to create GET_OBJECT_LIST for EX64ObjMadtIoApicInfo
> +GET_OBJECT_LIST (
> +  EObjNameSpaceX64,
> +  EX64ObjMadtIoApicInfo,
> +  CM_X64_MADT_INTERRUPT_CONTROLLER_TYPE_INFO
> +  );
> +
> +/// MACRO to create GET_OBJECT_LIST for EX64ObjMadtLocalApicX2ApicNmiInfo
> +GET_OBJECT_LIST (
> +  EObjNameSpaceX64,
> +  EX64ObjMadtLocalApicX2ApicNmiInfo,
> +  CM_X64_MADT_INTERRUPT_CONTROLLER_TYPE_INFO
> +  );
> +
> +/// MACRO to create GET_OBJECT_LIST for EX64ObjMadtInterruptSourceOverrideInfo
> +GET_OBJECT_LIST (
> +  EObjNameSpaceX64,
> +  EX64ObjMadtInterruptSourceOverrideInfo,
> +  CM_X64_MADT_INTERRUPT_CONTROLLER_TYPE_INFO
> +  );
> +
> +/**
> +  Build the ACPI MADT table.
> +
> +  This function builds the ACPI MADT table as per the input configuration.
> +
> +  @param[in]  This              Pointer to the ACPI_TABLE_GENERATOR protocol.
> +  @param[in]  AcpiTableInfo     Pointer to the CM_STD_OBJ_ACPI_TABLE_INFO structure.
> +  @param[in]  CfgMgrProtocol    Pointer to the EDKII_CONFIGURATION_MANAGER_PROTOCOL protocol.
> +  @param[out] Table             Pointer to the ACPI table structure.
> +
> +  @retval EFI_SUCCESS           The ACPI MADT table is built successfully.
> +  @retval EFI_INVALID_PARAMETER The input parameter is invalid.
> +**/
> +STATIC
> +EFI_STATUS
> +BuildMadtTable (
> +  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;
> +  EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER  *Madt;
> +  UINTN                                                MadtSize;
> +  CM_X64_MADT_LOCAL_INTERRUPT_INFO                     *LocalInterruptInfo;
> +  CM_X64_MADT_INTERRUPT_CONTROLLER_TYPE_INFO           *ProcessorLocalApicX2ApicInfo;
> +  CM_X64_MADT_INTERRUPT_CONTROLLER_TYPE_INFO           *IoApicInfo;
> +  CM_X64_MADT_INTERRUPT_CONTROLLER_TYPE_INFO           *LocalApicX2ApicNmiInfo;
> +  CM_X64_MADT_INTERRUPT_CONTROLLER_TYPE_INFO           *InterruptSourceOverrideInfo;
> +
> +  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: MADT: 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;
> +  MadtSize = sizeof (EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER);
> +
> +  // Get Local Interrupt Info
> +  Status = GetEX64ObjMadtLocalInterruptInfo (
> +             CfgMgrProtocol,
> +             CM_NULL_TOKEN,
> +             &LocalInterruptInfo,
> +             NULL
> +             );
> +  if (EFI_ERROR (Status)) {
> +    DEBUG ((DEBUG_ERROR, "ERROR: MADT: Failed to get Local Interrupt Info\n"));
> +    return Status;
> +  }
> +
> +  // Get Processor Local APIC/x2APIC Info
> +  Status = GetEX64ObjMadtProcessorLocalApicX2ApicInfo (
> +             CfgMgrProtocol,
> +             CM_NULL_TOKEN,
> +             &ProcessorLocalApicX2ApicInfo,
> +             NULL
> +             );
> +  if (EFI_ERROR (Status)) {
> +    DEBUG ((DEBUG_ERROR, "ERROR: MADT: Failed to get Processor Local APIC/x2APIC Info\n"));
> +    return Status;
> +  } else {
> +    if (ProcessorLocalApicX2ApicInfo->Size == 0) {
> +      DEBUG ((DEBUG_ERROR, "ERROR: MADT: Processor Local APIC/x2APIC Info size is 0\n"));
> +      return EFI_NOT_FOUND;
> +    }
> +  }
> +
> +  MadtSize += ProcessorLocalApicX2ApicInfo->Size;
> +
> +  // Get IO APIC Info
> +  Status = GetEX64ObjMadtIoApicInfo (
> +             CfgMgrProtocol,
> +             CM_NULL_TOKEN,
> +             &IoApicInfo,
> +             NULL
> +             );
> +  if (EFI_ERROR (Status)) {
> +    DEBUG ((DEBUG_ERROR, "ERROR: MADT: Failed to get IO APIC Info\n"));
> +    return Status;
> +  } else {
> +    if (IoApicInfo->Size == 0) {
> +      DEBUG ((DEBUG_ERROR, "ERROR: MADT: IO APIC Info size is 0\n"));
> +      return EFI_NOT_FOUND;
> +    }
> +  }
> +
> +  MadtSize += IoApicInfo->Size;
> +
> +  // Get Local APIC/x2APIC NMI Info
> +  Status = GetEX64ObjMadtLocalApicX2ApicNmiInfo (
> +             CfgMgrProtocol,
> +             CM_NULL_TOKEN,
> +             &LocalApicX2ApicNmiInfo,
> +             NULL
> +             );
> +  if (EFI_ERROR (Status)) {
> +    DEBUG ((DEBUG_ERROR, "ERROR: MADT: Failed to get Local APIC/x2APIC NMI Info\n"));
> +    return Status;
> +  } else {
> +    if (LocalApicX2ApicNmiInfo->Size == 0) {
> +      DEBUG ((DEBUG_ERROR, "ERROR: MADT: Local APIC/x2APIC NMI Info size is 0\n"));
> +      return EFI_NOT_FOUND;
> +    }
> +  }
> +
> +  MadtSize += LocalApicX2ApicNmiInfo->Size;
> +
> +  // Get Interrupt Source Override Info
> +  Status = GetEX64ObjMadtInterruptSourceOverrideInfo (
> +             CfgMgrProtocol,
> +             CM_NULL_TOKEN,
> +             &InterruptSourceOverrideInfo,
> +             NULL
> +             );
> +  if (EFI_ERROR (Status)) {
> +    DEBUG ((DEBUG_WARN, "WARNING: MADT: Failed to get Interrupt Source Override Info\n"));
> +  }
> +
> +  if ((InterruptSourceOverrideInfo != NULL) && (InterruptSourceOverrideInfo->Size != 0)) {
> +    MadtSize += InterruptSourceOverrideInfo->Size;
> +  }
> +
> +  // Allocate memory for Madt pointer
> +  Madt = (EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER *)AllocateZeroPool (MadtSize);
> +  if (Madt == NULL) {
> +    DEBUG ((DEBUG_ERROR, "ERROR: MADT: Failed to allocate memory for MADT\n"));
> +    return EFI_OUT_OF_RESOURCES;
> +  }
> +
> +  // Initialize the MADT header
> +  Status = AddAcpiHeader (
> +             CfgMgrProtocol,
> +             This,
> +             &Madt->Header,
> +             AcpiTableInfo,
> +             (UINT32)MadtSize
> +             );
> +  if (EFI_ERROR (Status)) {
> +    DEBUG ((DEBUG_ERROR, "ERROR: MADT: Failed to initialize MADT header\n"));
> +    FreePool (Madt);
> +    return Status;
> +  }
> +
> +  Madt->LocalApicAddress = LocalInterruptInfo->LocalApicAddress;
> +  Madt->Flags            = LocalInterruptInfo->Flags;
> +
> +  CopyMem (
> +    (UINT8 *)Madt + sizeof (EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER),
> +    ProcessorLocalApicX2ApicInfo->InterruptControllerTypeInfo,
> +    ProcessorLocalApicX2ApicInfo->Size
> +    );
> +
> +  CopyMem (
> +    (UINT8 *)Madt + sizeof (EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER) + ProcessorLocalApicX2ApicInfo->Size,
> +    IoApicInfo->InterruptControllerTypeInfo,
> +    IoApicInfo->Size
> +    );
> +
> +  CopyMem (
> +    (UINT8 *)Madt + sizeof (EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER) + ProcessorLocalApicX2ApicInfo->Size + IoApicInfo->Size,
> +    LocalApicX2ApicNmiInfo->InterruptControllerTypeInfo,
> +    LocalApicX2ApicNmiInfo->Size
> +    );
> +
> +  if ((InterruptSourceOverrideInfo != NULL) && (InterruptSourceOverrideInfo->Size != 0)) {
> +    CopyMem (
> +      (UINT8 *)Madt + sizeof (EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER) + ProcessorLocalApicX2ApicInfo->Size + IoApicInfo->Size + LocalApicX2ApicNmiInfo->Size,
> +      InterruptSourceOverrideInfo->InterruptControllerTypeInfo,
> +      InterruptSourceOverrideInfo->Size
> +      );
> +  }
> +
> +  *Table = (EFI_ACPI_DESCRIPTION_HEADER *)Madt;
> +  return EFI_SUCCESS;
> +}
> +
> +/** Free any resources allocated for constructing the MADT
> +
> +  @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 [in, out] Table          Pointer to the ACPI Table.
> +
> +  @retval EFI_SUCCESS           The resources were freed successfully.
> +  @retval EFI_INVALID_PARAMETER The table pointer is NULL or invalid.
> +**/
> +STATIC
> +EFI_STATUS
> +FreeMadtTableResources (
> +  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,
> +  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          **CONST  Table
> +  )
> +{
> +  ASSERT (This != NULL);
> +  ASSERT (AcpiTableInfo != NULL);
> +  ASSERT (CfgMgrProtocol != NULL);
> +  ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
> +  ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
> +
> +  if ((Table == NULL) || (*Table == NULL)) {
> +    DEBUG ((DEBUG_ERROR, "ERROR: MADT: Invalid Table Pointer\n"));
> +    ASSERT ((Table != NULL) && (*Table != NULL));
> +    return EFI_INVALID_PARAMETER;
> +  }
> +
> +  *Table = NULL;

I think it misses:
    FreePool (*Table);

> +  return EFI_SUCCESS;
> +}
> +
> +/// Macro for MADT Table generator revision
> +#define MADT_GENERATOR_REVISION  CREATE_REVISION (1, 0)
> +
> +/// Interface for MADT table generator
> +STATIC
> +CONST
> +ACPI_TABLE_GENERATOR  mMadtTableGenerator = {
> +  // Generator ID
> +  CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMadt),
> +  // Generator Description
> +  L"ACPI.STD.MADT.GENERATOR",
> +  // ACPI Table Signature
> +  EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
> +  // ACPI Table Revision supported by this Generator
> +  EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION,
> +  // Minimum supported ACPI Table Revision
> +  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION,
> +  // Creator ID
> +  TABLE_GENERATOR_CREATOR_ID_GENERIC,
> +  // Creator Revision
> +  MADT_GENERATOR_REVISION,
> +  // Build Table function
> +  BuildMadtTable,
> +  // Free Resource function
> +  FreeMadtTableResources,
> +  // Extended build function not needed
> +  NULL,
> +  // Extended build function not implemented by the generator.
> +  // Hence extended free resource function is not required.
> +  NULL
> +};
> +
> +/**
> +  The constructor function registers the ACPI MADT table generator.
> +
> +  The constructor function registers the ACPI MADT table generator.
> +
> +  @param[in]  ImageHandle       The firmware allocated handle for the EFI image.
> +  @param[in]  SystemTable       A pointer to the EFI System Table.
> +
> +  @retval EFI_SUCCESS           The constructor executed successfully.
> +  @retval EFI_INVALID_PARAMETER The input parameter is invalid.
> +**/
> +EFI_STATUS
> +EFIAPI
> +AcpiMadtLibX64Constructor (
> +  IN  EFI_HANDLE        ImageHandle,
> +  IN  EFI_SYSTEM_TABLE  *SystemTable
> +  )
> +{
> +  EFI_STATUS  Status;
> +
> +  Status = RegisterAcpiTableGenerator (&mMadtTableGenerator);
> +  DEBUG ((DEBUG_INFO, "MADT: Register Generator. Status = %r\n", Status));
> +  ASSERT_EFI_ERROR (Status);
> +  return Status;
> +}
> +
> +/**
> +  The destructor function unregisters the ACPI MADT table generator.
> +
> +  The destructor function unregisters the ACPI MADT table generator.
> +
> +  @param[in]  ImageHandle       The firmware allocated handle for the EFI image.
> +  @param[in]  SystemTable       A pointer to the EFI System Table.
> +
> +  @retval EFI_SUCCESS           The destructor executed successfully.
> +  @retval EFI_INVALID_PARAMETER The input parameter is invalid.
> +**/
> +EFI_STATUS
> +EFIAPI
> +AcpiMadtLibX64Destructor (
> +  IN  EFI_HANDLE        ImageHandle,
> +  IN  EFI_SYSTEM_TABLE  *SystemTable
> +  )
> +{
> +  EFI_STATUS  Status;
> +
> +  Status = DeregisterAcpiTableGenerator (&mMadtTableGenerator);
> +  DEBUG ((DEBUG_INFO, "MADT: Unregister 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 (#118532): https://edk2.groups.io/g/devel/message/118532
Mute This Topic: https://groups.io/mt/105796054/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [edk2-devel] [RESEND PATCH v4 0/5] DynamicTablesPkg: Adds FADT, HPET, WSMT and MADT Table generators
  2024-05-02 16:35 ` PierreGondois
@ 2024-05-03  7:41   ` Sami Mujawar
  2024-05-13  4:08     ` Abdul Lateef Attar via groups.io
  0 siblings, 1 reply; 14+ messages in thread
From: Sami Mujawar @ 2024-05-03  7:41 UTC (permalink / raw)
  To: Pierre Gondois, Abdul Lateef Attar, devel@edk2.groups.io

Hi All,

Please find my response inline marked [SAMI].

Regards,

Sami Mujawar

On 02/05/2024, 17:36, "Pierre Gondois" <pierre.gondois@arm.com <mailto:pierre.gondois@arm.com>> wrote:


Hello Abdul,
I added some comments.
I think that:
a. patches related to HPET/WSMT should require little work
b. MADT patch needs to redefine the CmObjects it uses,
but it seems ok otherwise (just need to have the right properties
in the right objects),
c. FADT patch is re-defining CmObjects that are already existing
in ArmNameSpaceObjects.h. So there is going to be a clash with
ongoing DynamicTables objects reorganization...


I think that a. could be sent separately and should quickly go in,
b. might require a bit more checking/reviewing, and c. might need
to wait for the re-org to be finished, unless Sami thinks it's ok
to take the patch,
[SAMI] For c., I think we should not wait for the reorg to be completed. The FADT patch can go it the mainline if it passes the review.
The additional work would be to reorg this patch on the staging branch when rebasing with the edk2 mainline code. However, this can be addressed just before we merge the first set of reorg changes into mainline.
[/SAMI]


Regards,
Pierre




On 4/29/24 08:03, Abdul Lateef Attar wrote:
> PR: https://github.com/tianocore/edk2/pull/5500/ <https://github.com/tianocore/edk2/pull/5500/>
> V4: delta changes
> Added X64 arch specific MADT table generator.
> V3: delta changes
> Restructure the code as the review comments.
> Added sanity check for WSMT flags.
> Added CM object for HPET base address.
> V2: delta changes
> Addressed review comments
> Adds ACPI HPET table to add HPET to ACPI namespace
> V1:
> 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 <mailto:Sami.Mujawar@arm.com>>
> Cc: Pierre Gondois <pierre.gondois@arm.com <mailto:pierre.gondois@arm.com>>
> Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com <mailto:AbdulLateef.Attar@amd.com>>
>
> Abdul Lateef Attar (5):
> DynamicTablesPkg: Adds ACPI FADT Table generator
> DynamicTablesPkg: Adds ACPI HPET Table generator
> DynamicTablesPkg: Adds ACPI WSMT Table generator
> DynamicTablesPkg: Adds ACPI SSDT HPET Table generator
> DynamicTablesPkg: Adds X64 arch MADT Table generator
>
> DynamicTablesPkg/DynamicTables.dsc.inc | 22 +-
> DynamicTablesPkg/DynamicTablesPkg.ci.yaml | 4 +-
> DynamicTablesPkg/Include/AcpiTableGenerator.h | 4 +
> .../Include/ArchNameSpaceObjects.h | 237 ++++++
> .../Include/ConfigurationManagerObject.h | 7 +
> .../Include/X64NameSpaceObjects.h | 48 ++
> .../Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf | 36 +
> .../Library/Acpi/AcpiFadtLib/Arm/FadtUpdate.c | 39 +
> .../Library/Acpi/AcpiFadtLib/FadtGenerator.c | 745 ++++++++++++++++++
> .../Library/Acpi/AcpiFadtLib/FadtUpdate.h | 26 +
> .../Library/Acpi/AcpiFadtLib/X64/FadtUpdate.c | 32 +
> .../Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf | 31 +
> .../Library/Acpi/AcpiHpetLib/HpetGenerator.c | 246 ++++++
> .../Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf | 32 +
> .../Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c | 295 +++++++
> .../Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf | 30 +
> .../Library/Acpi/AcpiWsmtLib/WsmtGenerator.c | 243 ++++++
> .../X64/AcpiMadtLibX64/AcpiMadtLibX64.inf | 27 +
> .../Acpi/X64/AcpiMadtLibX64/MadtGenerator.c | 375 +++++++++
> 19 files changed, 2477 insertions(+), 2 deletions(-)
> create mode 100644 DynamicTablesPkg/Include/ArchNameSpaceObjects.h
> create mode 100644 DynamicTablesPkg/Include/X64NameSpaceObjects.h
> create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
> create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/Arm/FadtUpdate.c
> 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/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
> create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c
> create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
> create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c
> create mode 100644 DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/AcpiMadtLibX64.inf
> create mode 100644 DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/MadtGenerator.c
>



IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118555): https://edk2.groups.io/g/devel/message/118555
Mute This Topic: https://groups.io/mt/105796049/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [edk2-devel] [RESEND PATCH v4 0/5] DynamicTablesPkg: Adds FADT, HPET, WSMT and MADT Table generators
  2024-05-03  7:41   ` Sami Mujawar
@ 2024-05-13  4:08     ` Abdul Lateef Attar via groups.io
  0 siblings, 0 replies; 14+ messages in thread
From: Abdul Lateef Attar via groups.io @ 2024-05-13  4:08 UTC (permalink / raw)
  To: Sami Mujawar, Pierre Gondois, devel@edk2.groups.io

Hi Pierre and Sami,

     I'll submit separate patches for each table, which will be ready 
and easy to merge after the current hard feature freeze over.

Thanks

AbduL


On 03-05-2024 13:11, Sami Mujawar wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> Hi All,
>
> Please find my response inline marked [SAMI].
>
> Regards,
>
> Sami Mujawar
>
> On 02/05/2024, 17:36, "Pierre Gondois" <pierre.gondois@arm.com <mailto:pierre.gondois@arm.com>> wrote:
>
>
> Hello Abdul,
> I added some comments.
> I think that:
> a. patches related to HPET/WSMT should require little work
> b. MADT patch needs to redefine the CmObjects it uses,
> but it seems ok otherwise (just need to have the right properties
> in the right objects),
> c. FADT patch is re-defining CmObjects that are already existing
> in ArmNameSpaceObjects.h. So there is going to be a clash with
> ongoing DynamicTables objects reorganization...
>
>
> I think that a. could be sent separately and should quickly go in,
> b. might require a bit more checking/reviewing, and c. might need
> to wait for the re-org to be finished, unless Sami thinks it's ok
> to take the patch,
> [SAMI] For c., I think we should not wait for the reorg to be completed. The FADT patch can go it the mainline if it passes the review.
> The additional work would be to reorg this patch on the staging branch when rebasing with the edk2 mainline code. However, this can be addressed just before we merge the first set of reorg changes into mainline.
> [/SAMI]
>
>
> Regards,
> Pierre
>
>
>
>
> On 4/29/24 08:03, Abdul Lateef Attar wrote:
>> PR: https://github.com/tianocore/edk2/pull/5500/ <https://github.com/tianocore/edk2/pull/5500/>
>> V4: delta changes
>> Added X64 arch specific MADT table generator.
>> V3: delta changes
>> Restructure the code as the review comments.
>> Added sanity check for WSMT flags.
>> Added CM object for HPET base address.
>> V2: delta changes
>> Addressed review comments
>> Adds ACPI HPET table to add HPET to ACPI namespace
>> V1:
>> 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 <mailto:Sami.Mujawar@arm.com>>
>> Cc: Pierre Gondois <pierre.gondois@arm.com <mailto:pierre.gondois@arm.com>>
>> Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com <mailto:AbdulLateef.Attar@amd.com>>
>>
>> Abdul Lateef Attar (5):
>> DynamicTablesPkg: Adds ACPI FADT Table generator
>> DynamicTablesPkg: Adds ACPI HPET Table generator
>> DynamicTablesPkg: Adds ACPI WSMT Table generator
>> DynamicTablesPkg: Adds ACPI SSDT HPET Table generator
>> DynamicTablesPkg: Adds X64 arch MADT Table generator
>>
>> DynamicTablesPkg/DynamicTables.dsc.inc | 22 +-
>> DynamicTablesPkg/DynamicTablesPkg.ci.yaml | 4 +-
>> DynamicTablesPkg/Include/AcpiTableGenerator.h | 4 +
>> .../Include/ArchNameSpaceObjects.h | 237 ++++++
>> .../Include/ConfigurationManagerObject.h | 7 +
>> .../Include/X64NameSpaceObjects.h | 48 ++
>> .../Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf | 36 +
>> .../Library/Acpi/AcpiFadtLib/Arm/FadtUpdate.c | 39 +
>> .../Library/Acpi/AcpiFadtLib/FadtGenerator.c | 745 ++++++++++++++++++
>> .../Library/Acpi/AcpiFadtLib/FadtUpdate.h | 26 +
>> .../Library/Acpi/AcpiFadtLib/X64/FadtUpdate.c | 32 +
>> .../Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf | 31 +
>> .../Library/Acpi/AcpiHpetLib/HpetGenerator.c | 246 ++++++
>> .../Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf | 32 +
>> .../Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c | 295 +++++++
>> .../Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf | 30 +
>> .../Library/Acpi/AcpiWsmtLib/WsmtGenerator.c | 243 ++++++
>> .../X64/AcpiMadtLibX64/AcpiMadtLibX64.inf | 27 +
>> .../Acpi/X64/AcpiMadtLibX64/MadtGenerator.c | 375 +++++++++
>> 19 files changed, 2477 insertions(+), 2 deletions(-)
>> create mode 100644 DynamicTablesPkg/Include/ArchNameSpaceObjects.h
>> create mode 100644 DynamicTablesPkg/Include/X64NameSpaceObjects.h
>> create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf
>> create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiFadtLib/Arm/FadtUpdate.c
>> 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/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf
>> create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c
>> create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
>> create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c
>> create mode 100644 DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/AcpiMadtLibX64.inf
>> create mode 100644 DynamicTablesPkg/Library/Acpi/X64/AcpiMadtLibX64/MadtGenerator.c
>>
>
>
> IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118855): https://edk2.groups.io/g/devel/message/118855
Mute This Topic: https://groups.io/mt/105796049/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-05-13  4:08 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-29  6:03 [edk2-devel] [RESEND PATCH v4 0/5] DynamicTablesPkg: Adds FADT, HPET, WSMT and MADT Table generators Abdul Lateef Attar via groups.io
2024-04-29  6:03 ` [edk2-devel] [RESEND PATCH v4 1/5] DynamicTablesPkg: Adds ACPI FADT Table generator Abdul Lateef Attar via groups.io
2024-04-29  6:03 ` [edk2-devel] [RESEND PATCH v4 2/5] DynamicTablesPkg: Adds ACPI HPET " Abdul Lateef Attar via groups.io
2024-05-02 16:36   ` PierreGondois
2024-04-29  6:03 ` [edk2-devel] [RESEND PATCH v4 3/5] DynamicTablesPkg: Adds ACPI WSMT " Abdul Lateef Attar via groups.io
2024-05-02 16:36   ` PierreGondois
2024-04-29  6:03 ` [edk2-devel] [RESEND PATCH v4 4/5] DynamicTablesPkg: Adds ACPI SSDT HPET " Abdul Lateef Attar via groups.io
2024-05-02 16:37   ` PierreGondois
2024-04-29  6:03 ` [edk2-devel] [RESEND PATCH v4 5/5] DynamicTablesPkg: Adds X64 arch MADT " Abdul Lateef Attar via groups.io
2024-05-02 16:37   ` PierreGondois
2024-05-02  7:21 ` [edk2-devel] [RESEND PATCH v4 0/5] DynamicTablesPkg: Adds FADT, HPET, WSMT and MADT Table generators Abdul Lateef Attar via groups.io
2024-05-02 16:35 ` PierreGondois
2024-05-03  7:41   ` Sami Mujawar
2024-05-13  4:08     ` Abdul Lateef Attar via groups.io

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox