public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v0] Dynamic ACPI framework for fsl layerscape platforms
@ 2020-12-29  7:25 Vikas Singh
  2020-12-29  7:25 ` [PATCH v0] Platform/NXP: Add Dynamic Acpi for " Vikas Singh
  2021-01-10  2:30 ` [PATCH v0] Dynamic ACPI framework for fsl " Leif Lindholm
  0 siblings, 2 replies; 12+ messages in thread
From: Vikas Singh @ 2020-12-29  7:25 UTC (permalink / raw)
  To: devel
  Cc: sami.mujawar, leif, meenakshi.aggarwal, paul.yang,
	augustine.philips, samer.el-haj-mahmoud, v.sethi, arokia.samy,
	kuldip.dwivedi, ard.biesheuvel, vikas.singh

This patch series sets the foundation of Dynamic ACPI framework
for fsl layerscape platforms.
In order to achieve :
 - Configurable firmware builds.
 - Unify firmware build for similar platforms.
 - Minimize/eliminate human induced errors.
 - Ability to validate, and generate firmware that complies with
   relevant specifications
this change set introduced following changes in below defined order
under edk2-platforms/NXP for LX2160ARDB.

(1) Introduced edk2-platforms/NXP/ConfigurationManager
    It creates the platform repositories dynamically during build time and
    initializes with platform specific information and serves all requestes
    from OEM/standard firmware table generators.
    This Configuration Manager will be common for all fsl platforms.

(2) Introduced edk2-platforms/NXP/LX2160ARDB/Include/Platform.h
    It has all the declarations & definitions specified for the platforms.
    These macros will be consumed by Configuration Manager.
    Additionally the placement of this header under "Include" dir will make
    these macro's availale to other translation units of the platform built.

(3) Introduced edk2-platforms/NXP/LX2160ARDB/AcpiTablesInclude
    This is a placeholder for - OEM specific firmware acpi table generators.
    This also holds IP specific - DSDT/SSDT generators for the OEM's platform.
    Currently Dsdt.asl is a place holder having only platform's clock related
    dsdt properties for LX2160ARDB but it is intended to extend this Dsdt.asl
    to hold other table as well in next patch series.

(4) Introduced a new "DYNAMIC_ACPI_ENABLE" flag to control DACPI framework for
    LX2160ARDB platform.
    By default it is enabled and can extend to other fsl platforms in future.
    Changes can be referred under :
      - LX2160ARDb.dsc
      - LX2160ARDB.fdf

(5) Introduced a "build.sh" script under edk2-platforms/NXP/ to automate the
    fsl platforms build system. And also mandatorily need to support Dynamic
    ACPI framework for fsl platforms. It exports build environment variables
    and also invokes "Env.cshrc".

Vikas Singh (1):
  Platform/NXP: Add Dynamic Acpi for layerscape platforms

 .../ConfigurationManager/ConfigurationManager.dec  |  24 +
 .../ConfigurationManager.dsc.inc                   |  21 +
 .../ConfigurationManagerDxe/ConfigurationManager.c | 709 +++++++++++++++++++++
 .../ConfigurationManagerDxe/ConfigurationManager.h | 229 +++++++
 .../ConfigurationManagerDxe.inf                    |  52 ++
 .../Include/PlatformAcpiTableGenerator.h           |  20 +
 Platform/NXP/Env.cshrc                             |  73 +++
 .../LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl   |  40 ++
 .../LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl  |  15 +
 .../AcpiTablesInclude/PlatformAcpiDsdtLib.inf      |  39 ++
 .../PlatformAcpiDsdtLib/RawDsdtGenerator.c         | 146 +++++
 .../AcpiTablesInclude/PlatformAcpiLib.h            |  24 +
 Platform/NXP/LX2160aRdbPkg/Include/Platform.h      | 244 +++++++
 Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec       |   6 +-
 Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc       |  30 +
 Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf       |  12 +
 Platform/NXP/build.sh                              | 121 ++++
 17 files changed, 1804 insertions(+), 1 deletion(-)
 create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManager.dec
 create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManager.dsc.inc
 create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
 create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
 create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
 create mode 100644 Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h
 create mode 100755 Platform/NXP/Env.cshrc
 create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl
 create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl
 create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
 create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c
 create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiLib.h
 create mode 100644 Platform/NXP/LX2160aRdbPkg/Include/Platform.h
 create mode 100755 Platform/NXP/build.sh

-- 
2.7.4


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

* [PATCH v0] Platform/NXP: Add Dynamic Acpi for layerscape platforms
  2020-12-29  7:25 [PATCH v0] Dynamic ACPI framework for fsl layerscape platforms Vikas Singh
@ 2020-12-29  7:25 ` Vikas Singh
  2021-01-10  3:26   ` Leif Lindholm
  2021-01-10  2:30 ` [PATCH v0] Dynamic ACPI framework for fsl " Leif Lindholm
  1 sibling, 1 reply; 12+ messages in thread
From: Vikas Singh @ 2020-12-29  7:25 UTC (permalink / raw)
  To: devel
  Cc: sami.mujawar, leif, meenakshi.aggarwal, paul.yang,
	augustine.philips, samer.el-haj-mahmoud, v.sethi, arokia.samy,
	kuldip.dwivedi, ard.biesheuvel, vikas.singh

These changes intend to add
- Common Configuration Manager (CM) for all fsl platforms.
- Platform headers consumed by CM for LX2160ARDB.
- Clk dsdt properties for LX2160ARDB.

Signed-off-by: Vikas Singh <vikas.singh@puresoftware.com>
---
 .../ConfigurationManager/ConfigurationManager.dec  |  24 +
 .../ConfigurationManager.dsc.inc                   |  21 +
 .../ConfigurationManagerDxe/ConfigurationManager.c | 709 +++++++++++++++++++++
 .../ConfigurationManagerDxe/ConfigurationManager.h | 229 +++++++
 .../ConfigurationManagerDxe.inf                    |  52 ++
 .../Include/PlatformAcpiTableGenerator.h           |  20 +
 Platform/NXP/Env.cshrc                             |  73 +++
 .../LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl   |  40 ++
 .../LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl  |  15 +
 .../AcpiTablesInclude/PlatformAcpiDsdtLib.inf      |  39 ++
 .../PlatformAcpiDsdtLib/RawDsdtGenerator.c         | 146 +++++
 .../AcpiTablesInclude/PlatformAcpiLib.h            |  24 +
 Platform/NXP/LX2160aRdbPkg/Include/Platform.h      | 244 +++++++
 Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec       |   6 +-
 Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc       |  30 +
 Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf       |  12 +
 Platform/NXP/build.sh                              | 121 ++++
 17 files changed, 1804 insertions(+), 1 deletion(-)
 create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManager.dec
 create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManager.dsc.inc
 create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
 create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
 create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
 create mode 100644 Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h
 create mode 100755 Platform/NXP/Env.cshrc
 create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl
 create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl
 create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
 create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c
 create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiLib.h
 create mode 100644 Platform/NXP/LX2160aRdbPkg/Include/Platform.h
 create mode 100755 Platform/NXP/build.sh

diff --git a/Platform/NXP/ConfigurationManager/ConfigurationManager.dec b/Platform/NXP/ConfigurationManager/ConfigurationManager.dec
new file mode 100644
index 0000000..8de2d7f
--- /dev/null
+++ b/Platform/NXP/ConfigurationManager/ConfigurationManager.dec
@@ -0,0 +1,24 @@
+#  ConfigurationManager.dec
+#
+#  Copyright 2020 NXP
+#  Copyright 2020 Puresoftware Ltd
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+[Defines]
+  PACKAGE_NAME                   = ConfigurationManager
+  PACKAGE_GUID                   = 0222b1b1-247f-404e-bdc3-baab65f2ddd3
+
+################################################################################
+#
+# Include Section - list of Include Paths that are provided by this package.
+#                   Comments are used for Keywords and Module Types.
+#
+# Supported Module Types:
+#  BASE SEC PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION
+#
+################################################################################
+[Includes]
+  .
+  Include
diff --git a/Platform/NXP/ConfigurationManager/ConfigurationManager.dsc.inc b/Platform/NXP/ConfigurationManager/ConfigurationManager.dsc.inc
new file mode 100644
index 0000000..8e6aed0
--- /dev/null
+++ b/Platform/NXP/ConfigurationManager/ConfigurationManager.dsc.inc
@@ -0,0 +1,21 @@
+## @file
+#  dsc include file for Configuration Manager
+#
+#  Copyright 2020 NXP
+#  Copyright 2020 Puresoftware Ltd
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+
+[BuildOptions]
+
+[LibraryClasses.common]
+
+[Components.common]
+  # Configuration Manager
+  Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf {
+    <BuildOptions>
+    *_*_*_PLATFORM_FLAGS = -I$(PACKAGES_PATH)/Platform/NXP/$(DYNAMIC_ACPI_PLATFORM)/Include
+  }
diff --git a/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
new file mode 100644
index 0000000..6e8a4c4
--- /dev/null
+++ b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
@@ -0,0 +1,709 @@
+/** @file
+  Configuration Manager Dxe
+
+  Copyright 2020 NXP
+  Copyright 2020 Puresoftware Ltd
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Glossary:
+    - Cm or CM   - Configuration Manager
+    - Obj or OBJ - Object
+**/
+
+#include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>
+#include <IndustryStandard/SerialPortConsoleRedirectionTable.h>
+#include <Library/ArmLib.h>
+#include <Library/DebugLib.h>
+#include <Library/IoLib.h>
+#include <Library/PcdLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Protocol/AcpiTable.h>
+#include <Protocol/ConfigurationManagerProtocol.h>
+
+/** The platform specific headers
+*/
+#include "ConfigurationManager.h"
+#include <Library/SocLib.h>
+
+/** The platform configuration repository information.
+*/
+STATIC
+EDKII_PLATFORM_REPOSITORY_INFO FslPlatformRepositoryInfo = {
+  /// Configuration Manager information
+  { CONFIGURATION_MANAGER_REVISION, CFG_MGR_OEM_ID },
+
+  // ACPI Table List
+  {
+    // FADT Table
+    {
+      EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
+      EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
+      CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt),
+      NULL,
+      CFG_MGR_TABLE_ID
+    },
+
+    // GTDT Table
+    {
+      EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE,
+      EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION,
+      CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdGtdt),
+      NULL,
+      CFG_MGR_TABLE_ID
+    },
+
+    // MADT Table
+    {
+      EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
+      EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION,
+      CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMadt),
+      NULL,
+      CFG_MGR_TABLE_ID
+    },
+
+    // PCI MCFG Table
+    {
+      EFI_ACPI_6_2_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE,
+      EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION,
+      CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMcfg),
+      NULL,
+      CFG_MGR_TABLE_ID
+    },
+
+    // SPCR Table
+    {
+      EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE,
+      EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_REVISION,
+      CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSpcr),
+      NULL,
+      CFG_MGR_TABLE_ID
+    },
+
+    // DSDT (OEM) Table
+    {
+      EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
+      0,
+      CREATE_OEM_ACPI_TABLE_GEN_ID (EPlatAcpiTableIdDsdt),
+      NULL,
+      CFG_MGR_TABLE_ID
+    }
+
+  },
+
+  // Boot architecture information
+  { EFI_ACPI_6_2_ARM_PSCI_COMPLIANT },        // BootArchFlags
+
+  // Power management profile information
+  { EFI_ACPI_6_2_PM_PROFILE_ENTERPRISE_SERVER }, // PowerManagement Profile
+
+  // Generic Timer Info
+  {
+    // The physical base address for the counter control frame
+    TIMER_BASE_ADDRESS,
+    // The physical base address for the counter read frame
+    TIMER_READ_BASE_ADDRESS,
+    // The secure PL1 timer interrupt
+    TIMER_SEC_IT,
+    // The secure PL1 timer flags
+    GTDT_GTIMER_FLAGS,
+    // The non-secure PL1 timer interrupt
+    TIMER_NON_SEC_IT,
+    // The non-secure PL1 timer flags
+    GTDT_GTIMER_FLAGS,
+    // The virtual timer interrupt
+    TIMER_VIRT_IT,
+    // The virtual timer flags
+    GTDT_GTIMER_FLAGS,
+    // The non-secure PL2 timer interrupt
+    TIMER_HYP_IT,
+    // The non-secure PL2 timer flags
+    GTDT_GTIMER_FLAGS
+  },
+
+  // Generic Timer Block Information
+  PLAT_TIMER_BLOCK_INFO,
+
+  // GTDT Frames
+  PLAT_TIMER_FRAME_INFO,
+
+  // Watchdog info
+  PLAT_WATCHDOG_INFO,
+
+  // GIC CPU Interface information
+  PLAT_GIC_CPU_INTERFACE,
+
+  // GIC Distributor Info
+  PLAT_GIC_DISTRIBUTOR_INFO,
+
+  // GIC Redistributor
+  PLAT_GIC_REDISTRIBUTOR_INFO,
+
+  // GIC ITS
+  PLAT_GIC_ITS_INFO,
+
+  // MCFG Info
+  PLAT_MCFG_INFO,
+
+  // SPCR Info
+  PLAT_SPCR_INFO,
+
+  2.0                                         // fsl board revision
+};
+
+/** Initialize the platform configuration repository.
+
+  @param [in]  This     Pointer to the Configuration Manager Protocol.
+
+  @retval EFI_SUCCESS   Success
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+InitializePlatformRepository (
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This
+  )
+{
+  EDKII_PLATFORM_REPOSITORY_INFO  * PlatformRepo;
+  UINT32 Svr;
+
+  PlatformRepo = This->PlatRepoInfo;
+
+  Svr = SocGetSvr ();
+  if (SVR_SOC_VER(Svr) == SVR_LX2160A) {
+    PlatformRepo->FslBoardRevision = SVR_MAJOR(Svr);
+    DEBUG ((DEBUG_INFO, "Fsl : SoC LX2160A Rev = 0x%x\n", PlatformRepo->FslBoardRevision));
+  } else {
+    DEBUG ((DEBUG_INFO, "Fsl : SoC Unknown Rev = 0x%x\n", PlatformRepo->FslBoardRevision));
+  }
+
+  return EFI_SUCCESS;
+}
+
+/** Return PCI Configuration Info.
+  @param [in]      This           Pointer to the Configuration Manager Protocol.
+  @param [in]      CmObjectId     The Object ID of the CM object requested
+  @param [in]      Token          A unique token for identifying the requested
+                                  CM_ARM_PCI_INFO object.
+  @param [in, out] CmObject       Pointer to the Configuration Manager Object
+                                  descriptor describing the requested Object.
+  @retval EFI_SUCCESS             Success.
+  @retval EFI_INVALID_PARAMETER   A parameter is invalid.
+  @retval EFI_NOT_FOUND           The required object information is
+  not found.
+ **/
+EFI_STATUS
+EFIAPI
+GetPciConfigInfo (
+    IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
+    IN  CONST CM_OBJECT_ID                                  CmObjectId,
+    IN  CONST CM_OBJECT_TOKEN                               Token,
+    IN  OUT   CM_OBJ_DESCRIPTOR                     * CONST CmObject
+    )
+{
+  EDKII_PLATFORM_REPOSITORY_INFO  * PlatformRepo;
+  UINT32                            TotalObjCount;
+  UINT32                            ObjIndex;
+
+  if ((This == NULL) || (CmObject == NULL)) {
+    ASSERT (This != NULL);
+    ASSERT (CmObject != NULL);
+    return EFI_INVALID_PARAMETER;
+  }
+
+  PlatformRepo = This->PlatRepoInfo;
+
+  TotalObjCount = ARRAY_SIZE (PlatformRepo->PciConfigInfo);
+
+  for (ObjIndex = 0; ObjIndex < TotalObjCount; ObjIndex++) {
+    if (Token == (CM_OBJECT_TOKEN)&PlatformRepo->PciConfigInfo[ObjIndex])
+    {
+      CmObject->ObjectId = CmObjectId;
+      CmObject->Size = sizeof (PlatformRepo->PciConfigInfo[ObjIndex]);
+      CmObject->Data = (VOID*)&PlatformRepo->PciConfigInfo[ObjIndex];
+      CmObject->Count = 1;
+      return EFI_SUCCESS;
+    }
+  }
+
+  return EFI_NOT_FOUND;
+}
+
+/** Return GIC CPU Interface Info.
+  @param [in]      This           Pointer to the Configuration Manager Protocol.
+  @param [in]      CmObjectId     The Object ID of the CM object requested
+  @param [in]      Token          A unique token for identifying the requested
+                                  CM_ARM_GICC_INFO object.
+  @param [in, out] CmObject       Pointer to the Configuration Manager Object
+                                  descriptor describing the requested Object.
+  @retval EFI_SUCCESS             Success.
+  @retval EFI_INVALID_PARAMETER   A parameter is invalid.
+  @retval EFI_NOT_FOUND           The required object information is
+  not found.
+ **/
+EFI_STATUS
+EFIAPI
+GetGicCInfo (
+    IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
+    IN  CONST CM_OBJECT_ID                                  CmObjectId,
+    IN  CONST CM_OBJECT_TOKEN                               Token,
+    IN  OUT   CM_OBJ_DESCRIPTOR                     * CONST CmObject
+    )
+{
+  EDKII_PLATFORM_REPOSITORY_INFO  * PlatformRepo;
+
+  if ((This == NULL) || (CmObject == NULL)) {
+    ASSERT (This != NULL);
+    ASSERT (CmObject != NULL);
+    return EFI_INVALID_PARAMETER;
+  }
+
+  PlatformRepo = This->PlatRepoInfo;
+
+  if (Token != (CM_OBJECT_TOKEN)&PlatformRepo->GicCInfo) {
+    return EFI_NOT_FOUND;
+  }
+
+  CmObject->ObjectId = CmObjectId;
+  CmObject->Size = sizeof (PlatformRepo->GicCInfo);
+  CmObject->Data = (VOID*)&PlatformRepo->GicCInfo;
+  CmObject->Count = sizeof (PlatformRepo->GicCInfo) /
+                      sizeof (PlatformRepo->GicCInfo[0]);
+  return EFI_SUCCESS;
+}
+
+/** Return a GT Block timer frame info list.
+  @param [in]      This         Pointer to the Configuration Manager Protocol.
+  @param [in]      CmObjectId   The Configuration Manager Object ID.
+  @param [in]      Token        A token for identifying the object
+  @param [in, out] CmObject     Pointer to the Configuration Manager Object
+                                descriptor describing the requested Object.
+  @retval EFI_SUCCESS           Success.
+  @retval EFI_INVALID_PARAMETER A parameter is invalid.
+  @retval EFI_NOT_FOUND         The required object information is not found.
+ **/
+EFI_STATUS
+  EFIAPI
+GetGTBlockTimerFrameInfo (
+    IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
+    IN  CONST CM_OBJECT_ID                                  CmObjectId,
+    IN  CONST CM_OBJECT_TOKEN                               Token,
+    IN  OUT   CM_OBJ_DESCRIPTOR                     * CONST CmObject
+    )
+{
+  EDKII_PLATFORM_REPOSITORY_INFO  * PlatformRepo;
+
+  if ((This == NULL) || (CmObject == NULL)) {
+    ASSERT (This != NULL);
+    ASSERT (CmObject != NULL);
+    return EFI_INVALID_PARAMETER;
+  }
+
+  PlatformRepo = This->PlatRepoInfo;
+
+  if (Token != (CM_OBJECT_TOKEN)&PlatformRepo->GTBlock0TimerInfo) {
+    return EFI_NOT_FOUND;
+  }
+
+  CmObject->ObjectId = CmObjectId;
+  CmObject->Size = sizeof (PlatformRepo->GTBlock0TimerInfo);
+  CmObject->Data = (VOID*)&PlatformRepo->GTBlock0TimerInfo;
+  CmObject->Count = sizeof (PlatformRepo->GTBlock0TimerInfo) /
+                      sizeof (PlatformRepo->GTBlock0TimerInfo[0]);
+  return EFI_SUCCESS;
+}
+
+/** Return a standard namespace object.
+
+  @param [in]      This        Pointer to the Configuration Manager Protocol.
+  @param [in]      CmObjectId  The Configuration Manager Object ID.
+  @param [in]      Token       An optional token identifying the object. If
+                               unused this must be CM_NULL_TOKEN.
+  @param [in, out] CmObject    Pointer to the Configuration Manager Object
+                               descriptor describing the requested Object.
+
+  @retval EFI_SUCCESS           Success.
+  @retval EFI_INVALID_PARAMETER A parameter is invalid.
+  @retval EFI_NOT_FOUND         The required object information is not found.
+**/
+EFI_STATUS
+EFIAPI
+GetStandardNameSpaceObject (
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
+  IN  CONST CM_OBJECT_ID                                  CmObjectId,
+  IN  CONST CM_OBJECT_TOKEN                               Token OPTIONAL,
+  IN  OUT   CM_OBJ_DESCRIPTOR                     * CONST CmObject
+  )
+{
+  EFI_STATUS                        Status;
+  EDKII_PLATFORM_REPOSITORY_INFO  * PlatformRepo;
+  UINT32                            TableCount;
+
+  Status = EFI_SUCCESS;
+  if ((This == NULL) || (CmObject == NULL)) {
+    ASSERT (This != NULL);
+    ASSERT (CmObject != NULL);
+    return EFI_INVALID_PARAMETER;
+  }
+  PlatformRepo = This->PlatRepoInfo;
+
+  switch (GET_CM_OBJECT_ID (CmObjectId)) {
+    HANDLE_CM_OBJECT (
+      EStdObjCfgMgrInfo,
+      CmObjectId,
+      PlatformRepo->CmInfo,
+      1
+      );
+
+    case EStdObjAcpiTableList:
+      CmObject->ObjectId = CmObjectId;
+      TableCount = sizeof (PlatformRepo->CmAcpiTableList) /
+                     sizeof (PlatformRepo->CmAcpiTableList[0]);
+      CmObject->Data = (VOID*)&PlatformRepo->CmAcpiTableList;
+      CmObject->Size = sizeof (PlatformRepo->CmAcpiTableList);
+      CmObject->Count = TableCount;
+      DEBUG ((
+        DEBUG_INFO,
+        "EStdObjAcpiTableList: Ptr = 0x%p. Size = %d, Count = %d\n",
+        CmObject->Data,
+        CmObject->Size,
+        CmObject->Count
+        ));
+      break;
+
+    default: {
+      Status = EFI_NOT_FOUND;
+      DEBUG ((
+        DEBUG_ERROR,
+        "ERROR: Object 0x%x. Status = %r\n",
+        CmObjectId,
+        Status
+        ));
+      break;
+    }
+  }
+
+  return Status;
+}
+
+/** Return an ARM namespace object.
+
+  @param [in]      This        Pointer to the Configuration Manager Protocol.
+  @param [in]      CmObjectId  The Configuration Manager Object ID.
+  @param [in]      Token       An optional token identifying the object. If
+                               unused this must be CM_NULL_TOKEN.
+  @param [in, out] CmObject    Pointer to the Configuration Manager Object
+                               descriptor describing the requested Object.
+
+  @retval EFI_SUCCESS           Success.
+  @retval EFI_INVALID_PARAMETER A parameter is invalid.
+  @retval EFI_NOT_FOUND         The required object information is not found.
+**/
+EFI_STATUS
+EFIAPI
+GetArmNameSpaceObject (
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
+  IN  CONST CM_OBJECT_ID                                  CmObjectId,
+  IN  CONST CM_OBJECT_TOKEN                               Token OPTIONAL,
+  IN  OUT   CM_OBJ_DESCRIPTOR                     * CONST CmObject
+  )
+{
+  EFI_STATUS                        Status;
+  EDKII_PLATFORM_REPOSITORY_INFO  * PlatformRepo;
+
+  Status = EFI_SUCCESS;
+  if ((This == NULL) || (CmObject == NULL)) {
+    ASSERT (This != NULL);
+    ASSERT (CmObject != NULL);
+    return EFI_INVALID_PARAMETER;
+  }
+  PlatformRepo = This->PlatRepoInfo;
+
+  switch (GET_CM_OBJECT_ID (CmObjectId)) {
+    HANDLE_CM_OBJECT (
+      EArmObjBootArchInfo,
+      CmObjectId,
+      PlatformRepo->BootArchInfo,
+      1
+      );
+    HANDLE_CM_OBJECT (
+      EArmObjPowerManagementProfileInfo,
+      CmObjectId,
+      PlatformRepo->PmProfileInfo,
+      1
+      );
+    HANDLE_CM_OBJECT (
+        EArmObjGenericTimerInfo,
+        CmObjectId,
+        PlatformRepo->GenericTimerInfo,
+        1
+        );
+    HANDLE_CM_OBJECT (
+        EArmObjPlatformGenericWatchdogInfo,
+        CmObjectId,
+        PlatformRepo->Watchdog,
+        PLAT_WATCHDOG_COUNT
+        );
+    HANDLE_CM_OBJECT (
+        EArmObjPlatformGTBlockInfo,
+        CmObjectId,
+        PlatformRepo->GTBlockInfo,
+        (sizeof (PlatformRepo->GTBlockInfo) /
+         sizeof (PlatformRepo->GTBlockInfo[0]))
+        );
+    HANDLE_CM_OBJECT_REF_BY_TOKEN (
+        EArmObjGTBlockTimerFrameInfo,
+        CmObjectId,
+        PlatformRepo->GTBlock0TimerInfo,
+        (sizeof (PlatformRepo->GTBlock0TimerInfo) /
+         sizeof (PlatformRepo->GTBlock0TimerInfo[0])),
+        Token,
+        GetGTBlockTimerFrameInfo
+        );
+    HANDLE_CM_OBJECT_REF_BY_TOKEN (
+        EArmObjGicCInfo,
+        CmObjectId,
+        PlatformRepo->GicCInfo,
+        ARRAY_SIZE (PlatformRepo->GicCInfo),
+        Token,
+        GetGicCInfo
+        );
+    HANDLE_CM_OBJECT (
+        EArmObjGicDInfo,
+        CmObjectId,
+        PlatformRepo->GicDInfo,
+        1
+        );
+    HANDLE_CM_OBJECT (
+        EArmObjGicRedistributorInfo,
+        CmObjectId,
+        PlatformRepo->GicRedistInfo,
+        PLAT_GIC_REDISTRIBUTOR_COUNT
+        );
+    HANDLE_CM_OBJECT (
+        EArmObjGicItsInfo,
+        CmObjectId,
+        PlatformRepo->GicItsInfo,
+        PLAT_GIC_ITS_COUNT
+        );
+    HANDLE_CM_OBJECT_REF_BY_TOKEN (
+        EArmObjPciConfigSpaceInfo,
+        CmObjectId,
+        PlatformRepo->PciConfigInfo,
+        (sizeof (PlatformRepo->PciConfigInfo) /
+         sizeof (PlatformRepo->PciConfigInfo[0])),
+        Token,
+        GetPciConfigInfo
+        );
+    HANDLE_CM_OBJECT (
+        EArmObjSerialConsolePortInfo,
+        CmObjectId,
+        PlatformRepo->SpcrSerialPort,
+        1
+        );
+    default: {
+      Status = EFI_NOT_FOUND;
+      DEBUG ((
+        DEBUG_INFO,
+        "INFO: Object 0x%x. Status = %r\n",
+        CmObjectId,
+        Status
+        ));
+      break;
+    }
+  }//switch
+
+  return Status;
+}
+
+/** Return an OEM namespace object.
+
+  @param [in]      This        Pointer to the Configuration Manager Protocol.
+  @param [in]      CmObjectId  The Configuration Manager Object ID.
+  @param [in]      Token       An optional token identifying the object. If
+                               unused this must be CM_NULL_TOKEN.
+  @param [in, out] CmObject    Pointer to the Configuration Manager Object
+                               descriptor describing the requested Object.
+
+  @retval EFI_SUCCESS           Success.
+  @retval EFI_INVALID_PARAMETER A parameter is invalid.
+  @retval EFI_NOT_FOUND         The required object information is not found.
+**/
+EFI_STATUS
+EFIAPI
+GetOemNameSpaceObject (
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
+  IN  CONST CM_OBJECT_ID                                  CmObjectId,
+  IN  CONST CM_OBJECT_TOKEN                               Token OPTIONAL,
+  IN  OUT   CM_OBJ_DESCRIPTOR                     * CONST CmObject
+  )
+{
+  EFI_STATUS  Status;
+
+  Status = EFI_SUCCESS;
+  if ((This == NULL) || (CmObject == NULL)) {
+    ASSERT (This != NULL);
+    ASSERT (CmObject != NULL);
+    return EFI_INVALID_PARAMETER;
+  }
+
+  switch (GET_CM_OBJECT_ID (CmObjectId)) {
+    default: {
+      Status = EFI_NOT_FOUND;
+      DEBUG ((
+        DEBUG_ERROR,
+        "ERROR: Object 0x%x. Status = %r\n",
+        CmObjectId,
+        Status
+        ));
+      break;
+    }
+  }
+
+  return Status;
+}
+
+/** The GetObject function defines the interface implemented by the
+    Configuration Manager Protocol for returning the Configuration
+    Manager Objects.
+
+  @param [in]      This        Pointer to the Configuration Manager Protocol.
+  @param [in]      CmObjectId  The Configuration Manager Object ID.
+  @param [in]      Token       An optional token identifying the object. If
+                               unused this must be CM_NULL_TOKEN.
+  @param [in, out] CmObject    Pointer to the Configuration Manager Object
+                               descriptor describing the requested Object.
+
+  @retval EFI_SUCCESS           Success.
+  @retval EFI_INVALID_PARAMETER A parameter is invalid.
+  @retval EFI_NOT_FOUND         The required object information is not found.
+**/
+EFI_STATUS
+EFIAPI
+FslPlatformGetObject (
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
+  IN  CONST CM_OBJECT_ID                                  CmObjectId,
+  IN  CONST CM_OBJECT_TOKEN                               Token OPTIONAL,
+  IN  OUT   CM_OBJ_DESCRIPTOR                     * CONST CmObject
+  )
+{
+  EFI_STATUS  Status;
+
+  if ((This == NULL) || (CmObject == NULL)) {
+    ASSERT (This != NULL);
+    ASSERT (CmObject != NULL);
+    return EFI_INVALID_PARAMETER;
+  }
+
+  switch (GET_CM_NAMESPACE_ID (CmObjectId)) {
+    case EObjNameSpaceStandard:
+      Status = GetStandardNameSpaceObject (This, CmObjectId, Token, CmObject);
+      break;
+    case EObjNameSpaceArm:
+      Status = GetArmNameSpaceObject (This, CmObjectId, Token, CmObject);
+      break;
+    case EObjNameSpaceOem:
+      Status = GetOemNameSpaceObject (This, CmObjectId, Token, CmObject);
+      break;
+    default: {
+      Status = EFI_INVALID_PARAMETER;
+      DEBUG ((
+        DEBUG_ERROR,
+        "ERROR: Unknown Namespace Object = 0x%x. Status = %r\n",
+        CmObjectId,
+        Status
+        ));
+      break;
+    }
+  }
+
+  return Status;
+}
+
+/** The SetObject function defines the interface implemented by the
+    Configuration Manager Protocol for updating the Configuration
+    Manager Objects.
+
+  @param [in]      This        Pointer to the Configuration Manager Protocol.
+  @param [in]      CmObjectId  The Configuration Manager Object ID.
+  @param [in]      Token       An optional token identifying the object. If
+                               unused this must be CM_NULL_TOKEN.
+  @param [in]      CmObject    Pointer to the Configuration Manager Object
+                               descriptor describing the Object.
+
+  @retval EFI_UNSUPPORTED  This operation is not supported.
+**/
+EFI_STATUS
+EFIAPI
+FslPlatformSetObject (
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
+  IN  CONST CM_OBJECT_ID                                  CmObjectId,
+  IN  CONST CM_OBJECT_TOKEN                               Token OPTIONAL,
+  IN        CM_OBJ_DESCRIPTOR                     * CONST CmObject
+  )
+{
+  return EFI_UNSUPPORTED;
+}
+
+/** A structure describing the configuration manager protocol interface.
+*/
+STATIC
+CONST
+EDKII_CONFIGURATION_MANAGER_PROTOCOL FslConfigManagerProtocol = {
+  CREATE_REVISION (1, 0),
+  FslPlatformGetObject,
+  FslPlatformSetObject,
+  &FslPlatformRepositoryInfo
+};
+
+/**
+  Entrypoint of Configuration Manager Dxe.
+
+  @param  ImageHandle
+  @param  SystemTable
+
+  @return EFI_SUCCESS
+  @return EFI_LOAD_ERROR
+  @return EFI_OUT_OF_RESOURCES
+
+**/
+EFI_STATUS
+EFIAPI
+ConfigurationManagerDxeInitialize (
+  IN EFI_HANDLE          ImageHandle,
+  IN EFI_SYSTEM_TABLE  * SystemTable
+  )
+{
+  EFI_STATUS  Status;
+
+  Status = gBS->InstallProtocolInterface (
+                  &ImageHandle,
+                  &gEdkiiConfigurationManagerProtocolGuid,
+                  EFI_NATIVE_INTERFACE,
+                  (VOID*)&FslConfigManagerProtocol
+                  );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "ERROR: Failed to get Install Configuration Manager Protocol." \
+      " Status = %r\n",
+      Status
+      ));
+    goto error_handler;
+  }
+
+  Status = InitializePlatformRepository (
+    &FslConfigManagerProtocol
+    );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "ERROR: Failed to initialize the Platform Configuration Repository." \
+      " Status = %r\n",
+      Status
+      ));
+  }
+
+error_handler:
+  return Status;
+}
diff --git a/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
new file mode 100644
index 0000000..cf09ef9
--- /dev/null
+++ b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
@@ -0,0 +1,229 @@
+/** @file
+  Configuration Manager headers
+
+  Copyright 2020 NXP
+  Copyright 2020 Puresoftware Ltd
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Glossary:
+    - Cm or CM   - Configuration Manager
+    - Obj or OBJ - Object
+**/
+
+#ifndef CONFIGURATION_MANAGER_H__
+#define CONFIGURATION_MANAGER_H__
+
+#include <Platform.h>
+#include <PlatformAcpiTableGenerator.h>
+
+/** The configuration manager version
+*/
+#define CONFIGURATION_MANAGER_REVISION CREATE_REVISION (0, 0)
+
+/** The OEM ID
+*/
+#define CFG_MGR_OEM_ID    { 'N', 'X', 'P', ' ', ' ', ' ' }
+
+/** A helper macro for populating the GIC CPU information
+ */
+#define GICC_ENTRY(                                                   \
+    CPUInterfaceNumber,                                               \
+    Mpidr,                                                            \
+    PmuIrq,                                                           \
+    VGicIrq,                                                          \
+    EnergyEfficiency                                                  \
+    ) {                                                               \
+  CPUInterfaceNumber,       /* UINT32  CPUInterfaceNumber         */  \
+  CPUInterfaceNumber,       /* UINT32  AcpiProcessorUid           */  \
+  EFI_ACPI_6_2_GIC_ENABLED, /* UINT32  Flags                      */  \
+  0,                        /* UINT32  ParkingProtocolVersion     */  \
+  PmuIrq,                   /* UINT32  PerformanceInterruptGsiv   */  \
+  0,                        /* UINT64  ParkedAddress              */  \
+  GICC_BASE,                /* UINT64  PhysicalBaseAddress        */  \
+  GICV_BASE,                /* UINT64  GICV                       */  \
+  GICH_BASE,                /* UINT64  GICH                       */  \
+  VGicIrq,                  /* UINT32  VGICMaintenanceInterrupt   */  \
+  0,                        /* UINT64  GICRBaseAddress            */  \
+  Mpidr,                    /* UINT64  MPIDR                      */  \
+  EnergyEfficiency          /* UINT8   ProcessorPowerEfficiency   */  \
+}
+
+/** A helper macro for returning configuration manager objects
+*/
+#define HANDLE_CM_OBJECT(ObjId, CmObjectId, Object, ObjectCount)      \
+  case ObjId: {                                                       \
+    CmObject->ObjectId = CmObjectId;                                  \
+    CmObject->Size = sizeof (Object);                                 \
+    CmObject->Data = (VOID*)&Object;                                  \
+    CmObject->Count = ObjectCount;                                    \
+    DEBUG ((                                                          \
+      DEBUG_INFO,                                                     \
+      #CmObjectId ": Ptr = 0x%p, Size = %d, Count = %d\n",            \
+      CmObject->Data,                                                 \
+      CmObject->Size,                                                 \
+      CmObject->Count                                                 \
+      ));                                                             \
+    break;                                                            \
+  }
+
+/** A helper macro for returning configuration manager objects
+    referenced by token
+*/
+#define HANDLE_CM_OBJECT_REF_BY_TOKEN(                                      \
+          ObjId,                                                            \
+          CmObjectId,                                                       \
+          Object,                                                           \
+          ObjectCount,                                                      \
+          Token,                                                            \
+          HandlerProc                                                       \
+          )                                                                 \
+  case ObjId: {                                                             \
+    CmObject->ObjectId = CmObjectId;                                        \
+    if (Token == CM_NULL_TOKEN) {                                           \
+      CmObject->Size = sizeof (Object);                                     \
+      CmObject->Data = (VOID*)&Object;                                      \
+      CmObject->Count = ObjectCount;                                        \
+      DEBUG ((                                                              \
+        DEBUG_INFO,                                                         \
+        #CmObjectId ": Ptr = 0x%p, Size = %d, Count = %d\n",                \
+        CmObject->Data,                                                     \
+        CmObject->Size,                                                     \
+        CmObject->Count                                                     \
+        ));                                                                 \
+    } else {                                                                \
+      Status = HandlerProc (This, CmObjectId, Token, CmObject);             \
+      DEBUG ((                                                              \
+        DEBUG_INFO,                                                         \
+        #CmObjectId ": Token = 0x%p, Ptr = 0x%p, Size = %d, Count = %d\n",  \
+        (VOID*)Token,                                                       \
+        CmObject->Data,                                                     \
+        CmObject->Size,                                                     \
+        CmObject->Count                                                     \
+        ));                                                                 \
+    }                                                                       \
+    break;                                                                  \
+  }
+
+/** A helper macro for returning configuration manager objects referenced
+    by token when the entire platform repository is in scope and the
+    CM_NULL_TOKEN value is not allowed.
+*/
+#define HANDLE_CM_OBJECT_SEARCH_PLAT_REPO(                                  \
+          ObjId,                                                            \
+          CmObjectId,                                                       \
+          Token,                                                            \
+          HandlerProc                                                       \
+          )                                                                 \
+  case ObjId: {                                                             \
+    CmObject->ObjectId = CmObjectId;                                        \
+    if (Token == CM_NULL_TOKEN) {                                           \
+      Status = EFI_INVALID_PARAMETER;                                       \
+      DEBUG ((                                                              \
+        DEBUG_ERROR,                                                        \
+        #ObjId ": CM_NULL_TOKEN value is not allowed when searching"        \
+        " the entire platform repository.\n"                                \
+        ));                                                                 \
+    } else {                                                                \
+      Status = HandlerProc (This, CmObjectId, Token, CmObject);             \
+      DEBUG ((                                                              \
+        DEBUG_INFO,                                                         \
+        #ObjId ": Token = 0x%p, Ptr = 0x%p, Size = %d, Count = %d\n",       \
+        (VOID*)Token,                                                       \
+        CmObject->Data,                                                     \
+        CmObject->Size,                                                     \
+        CmObject->Count                                                     \
+        ));                                                                 \
+    }                                                                       \
+    break;                                                                  \
+  }
+
+/** The number of ACPI tables to install
+*/
+#define PLAT_ACPI_TABLE_COUNT   6
+
+/** A structure describing the platform configuration
+    manager repository information
+*/
+typedef struct PlatformRepositoryInfo {
+  /// Configuration Manager Information
+  CM_STD_OBJ_CONFIGURATION_MANAGER_INFO     CmInfo;
+
+  /// List of ACPI tables
+  CM_STD_OBJ_ACPI_TABLE_INFO                CmAcpiTableList[PLAT_ACPI_TABLE_COUNT];
+
+  /// Boot architecture information
+  CM_ARM_BOOT_ARCH_INFO                     BootArchInfo;
+
+  /// Power management profile information
+  CM_ARM_POWER_MANAGEMENT_PROFILE_INFO      PmProfileInfo;
+
+  /// Generic timer information
+  CM_ARM_GENERIC_TIMER_INFO                 GenericTimerInfo;
+
+  /// Generic timer block information
+  CM_ARM_GTBLOCK_INFO                       GTBlockInfo[PLAT_GTBLOCK_COUNT];
+
+  /// Generic timer frame information
+  CM_ARM_GTBLOCK_TIMER_FRAME_INFO           GTBlock0TimerInfo[PLAT_GTFRAME_COUNT];
+
+  /// Watchdog information
+  CM_ARM_GENERIC_WATCHDOG_INFO              Watchdog;
+
+  /// GIC CPU interface information
+  CM_ARM_GICC_INFO                          GicCInfo[PLAT_CPU_COUNT];
+
+  /// GIC distributor information
+  CM_ARM_GICD_INFO                          GicDInfo;
+
+  /// GIC Redistributor information
+  CM_ARM_GIC_REDIST_INFO                    GicRedistInfo;
+
+  /// GIC ITS information
+  CM_ARM_GIC_ITS_INFO                       GicItsInfo;
+
+  /// PCI configuration space information
+  CM_ARM_PCI_CONFIG_SPACE_INFO              PciConfigInfo[PLAT_PCI_CONFG_COUNT];
+
+  /// Serial port information for serial port console redirection port
+  CM_ARM_SERIAL_PORT_INFO                   SpcrSerialPort;
+
+  /// Fsl Board Revision
+  UINT32                                    FslBoardRevision;
+} EDKII_PLATFORM_REPOSITORY_INFO;
+
+/*
+ * GTDT_GTIMER_FLAGS
+ * IT trigger (Level/Edge- Bit 0) and Polarity (Low/High) Bit 1
+ * Set bit-0 is 0 (Level trigger), Bit 1 1 (Active low)
+ */
+#define GTDT_GTIMER_FLAGS           (EFI_ACPI_6_1_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY)
+
+/*
+ * Timer Frame IT High Level triggered
+ * IT trigger (Level/Edge- Bit 0) and Polarity (Low/High) Bit 1
+ * Set  bit-0 is 0 (Level trigger), Bit 1 0 (Active High)
+ */
+#define GTDT_FRAME_FLAGS 0
+
+/*
+ * Timer frame status
+ * Access - Secure or non secure <-- Bit 0
+ * State - Save (meaning always on) or Lose Context  <-- Bit 1
+ * Set Bit 0 1 as Secure and Bit 1 zero as lose context
+*/
+#define GTDT_FRAME_COMMON_FLAGS EFI_ACPI_6_1_GTDT_GT_BLOCK_COMMON_FLAG_SECURE_TIMER
+
+/*
+ * Watchdog flags
+ * IT trigger (Level/Edge- Bit 0), Polarity (Low/High) Bit 1, Secured Bit 2
+ * Set Level trigger (Bit 0 as 0)
+ * Active High (Bit 1 as 0)
+ * Non secure (Bit 2 as 0)
+ */
+#define SBSA_WATCHDOG_FLAGS 0
+#define SBSA_SEC_WATCHDOG_FLAGS EFI_ACPI_6_1_GTDT_GT_BLOCK_COMMON_FLAG_SECURE_TIMER
+
+#define GT_BLOCK_FRAME_RES_BASE  MAX_UINT64
+
+#endif // CONFIGURATION_MANAGER_H__
diff --git a/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
new file mode 100644
index 0000000..03fe104
--- /dev/null
+++ b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
@@ -0,0 +1,52 @@
+## @file
+#  Configuration Manager Dxe
+#
+#  Copyright 2020 NXP
+#  Copyright 2020 Puresoftware Ltd
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+  INF_VERSION                    = 0x0001001B
+  BASE_NAME                      = ConfigurationManagerDxe
+  FILE_GUID                      = A97F70AC-3BB4-4596-B4D2-9F948EC12D17
+  MODULE_TYPE                    = DXE_DRIVER
+  VERSION_STRING                 = 1.0
+  ENTRY_POINT                    = ConfigurationManagerDxeInitialize
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+#  VALID_ARCHITECTURES           = ARM AARCH64
+#
+
+[Sources]
+  ConfigurationManager.c
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  ArmPlatformPkg/ArmPlatformPkg.dec
+  DynamicTablesPkg/DynamicTablesPkg.dec
+  EmbeddedPkg/EmbeddedPkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+  Platform/NXP/ConfigurationManager/ConfigurationManager.dec
+  Silicon/NXP/NxpQoriqLs.dec
+
+[LibraryClasses]
+  ArmPlatformLib
+  PrintLib
+  UefiBootServicesTableLib
+  UefiDriverEntryPoint
+  UefiRuntimeServicesTableLib
+
+[Protocols]
+  gEdkiiConfigurationManagerProtocolGuid
+
+[FixedPcd]
+
+[Pcd]
+
+[Depex]
+  TRUE
diff --git a/Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h b/Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h
new file mode 100644
index 0000000..da3c571
--- /dev/null
+++ b/Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h
@@ -0,0 +1,20 @@
+/** @file
+  Acpi Table generator headers
+
+  Copyright 2020 NXP
+  Copyright 2020 Puresoftware Ltd
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef PLATFORM_ACPI_TABLE_GENERATOR_H_
+#define PLATFORM_ACPI_TABLE_GENERATOR_H_
+
+typedef enum PlatAcpiTableId {
+  EPlatAcpiTableIdReserved = 0x0000,             ///< Reserved
+  EPlatAcpiTableIdDsdt,
+  EPlatAcpiTableIdMax
+} EPLAT_ACPI_TABLE_ID;
+
+#endif
diff --git a/Platform/NXP/Env.cshrc b/Platform/NXP/Env.cshrc
new file mode 100755
index 0000000..a0f151b
--- /dev/null
+++ b/Platform/NXP/Env.cshrc
@@ -0,0 +1,73 @@
+#  @file.
+#
+#  Copyright 2020 NXP
+#  Copyright 2020 Puresoftware Ltd
+#
+#  This program and the accompanying materials are licensed and made available under
+#  the terms and conditions of the BSD License which accompanies this distribution.
+#  The full text of the license may be found at
+#  http://opensource.org/licenses/bsd-license.php
+#
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+
+unset GCC_UTILITY GCC_VERSION MajorVersion MinorVersion
+
+if [ X"$CROSS_COMPILE_64" != X"" ]; then
+  ARM64_PREFIX="$CROSS_COMPILE_64"
+elif [ X"$CROSS_COMPILE" != X"" ]; then
+  ARM64_PREFIX="$CROSS_COMPILE"
+else
+  ARM64_PREFIX="aarch64-linux-gnu-"
+fi
+
+GCC_UTILITY="${ARM64_PREFIX}gcc"
+CheckGcc=`which $GCC_UTILITY >/dev/null 2>&1`
+if [ "$?" -eq 0 ];then
+  GCC_VERSION=`$GCC_UTILITY -v 2>&1 | tail -n 1 | awk '{print $3}'`
+  MajorVersion=`echo $GCC_VERSION | cut -d . -f 1`
+  MinorVersion=`echo $GCC_VERSION | cut -d . -f 2`
+  GCC_ARCH_PREFIX=
+
+  case $MajorVersion in
+    4)
+      case $MinorVersion in
+        9)
+          GCC_ARCH_PREFIX="GCC49_AARCH64_PREFIX"
+        ;;
+        *)
+          NOTSUPPORTED=1
+        ;;
+      esac
+    ;;
+    5)
+      case $MinorVersion in
+      4)
+        GCC_ARCH_PREFIX="GCC5_AARCH64_PREFIX"
+      ;;
+      *)
+        GCC_ARCH_PREFIX="GCC5_AARCH64_PREFIX"
+        echo "Warning: ${GCC_UTILITY} version ($MajorVersion.$MinorVersion) has not been tested, please use at own risk."
+      ;;
+      esac
+    ;;
+    *)
+      GCC_ARCH_PREFIX="GCC5_AARCH64_PREFIX"
+      echo "Warning: ${GCC_UTILITY} version ($MajorVersion.$MinorVersion) has not been tested, please use at own risk."
+    ;;
+  esac
+
+  [ -n "$GCC_ARCH_PREFIX" ] && {
+    export GCC_ARCH_PREFIX="$GCC_ARCH_PREFIX"
+    export "$GCC_ARCH_PREFIX=$ARM64_PREFIX"
+  }
+
+  unset ARCH
+else
+    echo "Error: ${GCC_UTILITY} not found. Please check PATH variable."
+    unset GCC_UTILITY GCC_VERSION MajorVersion MinorVersion
+fi
+
+# Export edk2-platforms path
+export PACKAGES_PATH=`dirname \`dirname "$PWD"\``
diff --git a/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl
new file mode 100644
index 0000000..1008476
--- /dev/null
+++ b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl
@@ -0,0 +1,40 @@
+/** @file
+  Differentiated System Description Table Fields (DSDT)
+
+  Copyright 2020 NXP
+  Copyright 2020 Puresoftware Ltd
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+Scope(_SB)
+{
+  Device(PCLK) {
+    Name(_HID, "NXP0017")
+    Name(CLK, 0)
+    Name(AVBL, 0)
+    OperationRegion(RCWS, SystemMemory, DCFG_BASE, DCFG_LEN)
+    Method(_REG,2) {
+      if (Arg0 == "RCWS") {
+        Store(Arg1, AVBL)
+      }
+    }
+    Field (RCWS, ByteAcc, NoLock, Preserve) {
+      offset(0x100),
+      PCFG, 2,
+      PRAT, 6,
+      offset(0x124),
+      RESV, 4,
+      SFRQ, 10
+    }
+
+    Method(_INI, 0, NotSerialized) {
+      Store(SFRQ, Local0)
+      Multiply(Local0, 500000, Local0)
+      Multiply(Local0, PRAT, Local0)
+      Divide(Local0, 6, , Local0)
+      Store(Local0, CLK)
+    }
+  }
+} // end of device PCLK
diff --git a/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl
new file mode 100644
index 0000000..e4f04ce
--- /dev/null
+++ b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl
@@ -0,0 +1,15 @@
+/** @file
+  Differentiated System Description Table Fields (DSDT)
+
+  Copyright 2020 NXP
+  Copyright 2020 Puresoftware Ltd.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "Platform.h"
+
+DefinitionBlock("DsdtTable.aml", "DSDT", 2, "NXP  ", "LX2160  ", EFI_ACPI_ARM_OEM_REVISION) {
+  include ("Clk.asl")
+}
diff --git a/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
new file mode 100644
index 0000000..f2d8ea5
--- /dev/null
+++ b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
@@ -0,0 +1,39 @@
+## @file
+#  Raw Table Generator
+#
+#  Copyright 2020 NXP
+#  Copyright 2020 Puresoftware Ltd
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+  INF_VERSION    = 0x00010019
+  BASE_NAME      = PlatformAcpiDsdtLib
+  FILE_GUID      = 0b1768cf-13fa-4ecf-b640-338a636d1abb
+  VERSION_STRING = 1.0
+  MODULE_TYPE    = DXE_DRIVER
+  LIBRARY_CLASS  = NULL|DXE_DRIVER
+  CONSTRUCTOR    = AcpiDsdtLibConstructor
+  DESTRUCTOR     = AcpiDsdtLibDestructor
+
+[Sources]
+  PlatformAcpiDsdtLib/RawDsdtGenerator.c
+  Dsdt/Dsdt.asl
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  EmbeddedPkg/EmbeddedPkg.dec
+  DynamicTablesPkg/DynamicTablesPkg.dec
+  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec
+
+[LibraryClasses]
+  BaseLib
+
+[Pcd]
+
+[Protocols]
+
+[Guids]
+
diff --git a/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c
new file mode 100644
index 0000000..75ea2b7
--- /dev/null
+++ b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c
@@ -0,0 +1,146 @@
+/** @file
+  Raw DSDT Table Generator
+
+  Copyright 2020 NXP
+  Copyright 2020 Puresoftware Ltd.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Library/AcpiLib.h>
+#include <Library/DebugLib.h>
+#include <Protocol/AcpiTable.h>
+
+// Module specific include files.
+#include <AcpiTableGenerator.h>
+#include <ConfigurationManagerObject.h>
+#include <ConfigurationManagerHelper.h>
+#include <Library/TableHelperLib.h>
+#include <Protocol/ConfigurationManagerProtocol.h>
+
+#include "PlatformAcpiLib.h"
+
+/** Construct the ACPI table using the ACPI table data provided.
+
+  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.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+BuildRawDsdtTable (
+  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
+  )
+{
+  ASSERT (This != NULL);
+  ASSERT (AcpiTableInfo != NULL);
+  ASSERT (CfgMgrProtocol != NULL);
+  ASSERT (Table != NULL);
+  ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
+
+  if (AcpiTableInfo->AcpiTableData == NULL) {
+    // Add the dsdt aml code here, Currently NULL place holder.
+    *Table = (EFI_ACPI_DESCRIPTION_HEADER *)&dsdt_aml_code;
+  }
+
+  return EFI_SUCCESS;
+}
+
+/** This macro defines the Raw Generator revision.
+*/
+#define DSDT_GENERATOR_REVISION CREATE_REVISION (1, 0)
+
+/** The interface for the Raw Table Generator.
+*/
+STATIC
+CONST
+ACPI_TABLE_GENERATOR RawDsdtGenerator = {
+  // Generator ID
+  CREATE_OEM_ACPI_TABLE_GEN_ID (EPlatAcpiTableIdDsdt),
+  // Generator Description
+  L"ACPI.OEM.RAW.DSDT.GENERATOR",
+  // ACPI Table Signature - Unused
+  0,
+  // ACPI Table Revision - Unused
+  0,
+  // Minimum ACPI Table Revision - Unused
+  0,
+  // Creator ID
+  TABLE_GENERATOR_CREATOR_ID_ARM,
+  // Creator Revision
+  DSDT_GENERATOR_REVISION,
+  // Build Table function
+  BuildRawDsdtTable,
+  // 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
+AcpiDsdtLibConstructor (
+  IN CONST EFI_HANDLE                ImageHandle,
+  IN       EFI_SYSTEM_TABLE  * CONST SystemTable
+  )
+{
+  EFI_STATUS  Status;
+  Status = RegisterAcpiTableGenerator (&RawDsdtGenerator);
+  DEBUG ((DEBUG_INFO, "OEM: Register DSDT 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
+AcpiDsdtLibDestructor (
+  IN CONST EFI_HANDLE                ImageHandle,
+  IN       EFI_SYSTEM_TABLE  * CONST SystemTable
+  )
+{
+  EFI_STATUS  Status;
+  Status = DeregisterAcpiTableGenerator (&RawDsdtGenerator);
+  DEBUG ((DEBUG_INFO, "OEM: Deregister DSDT Generator. Status = %r\n", Status));
+  ASSERT_EFI_ERROR (Status);
+  return Status;
+}
diff --git a/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiLib.h b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiLib.h
new file mode 100644
index 0000000..1747245
--- /dev/null
+++ b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiLib.h
@@ -0,0 +1,24 @@
+/** @file
+ *  Acpi lib headers
+ *
+ *  Copyright 2020 NXP
+ *  Copyright 2020 Puresoftware Ltd
+ *
+ *  SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+**/
+
+
+#ifndef _LX2160ARDB_PLATFORM_ACPI_LIB_H_
+#define _LX2160ARDB_PLATFORM_ACPI_LIB_H_
+
+#include <PlatformAcpiTableGenerator.h>
+
+/** C array containing the compiled AML template.
+    These symbols are defined in the auto generated C file
+    containing the AML bytecode array.
+*/
+extern CHAR8  dsdt_aml_code[];
+
+#endif
+
diff --git a/Platform/NXP/LX2160aRdbPkg/Include/Platform.h b/Platform/NXP/LX2160aRdbPkg/Include/Platform.h
new file mode 100644
index 0000000..e2a6faa
--- /dev/null
+++ b/Platform/NXP/LX2160aRdbPkg/Include/Platform.h
@@ -0,0 +1,244 @@
+/** @file
+ *  Platform headers
+ *
+ *  Copyright 2020 NXP
+ *  Copyright 2020 Puresoftware Ltd
+ *
+ *  SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+**/
+
+
+#ifndef _LX2160ARDB_PLATFORM_H_
+#define _LX2160ARDB_PLATFORM_H_
+
+#define EFI_ACPI_ARM_OEM_REVISION       0x00000000
+
+// Soc defines
+#define SVR_SOC_VER(svr)        (((svr) >> 8) & 0xFFFFFE)
+#define SVR_MAJOR(svr)          (((svr) >> 4) & 0xf)
+#define SVR_MINOR(svr)          (((svr) >> 0) & 0xf)
+
+#define SVR_LX2160A             0x873600
+
+// PCLK
+#define DCFG_BASE   0x1E00000
+#define DCFG_LEN    0x1FFFF
+
+// Gic
+#define GIC_VERSION 3
+#define GICD_BASE   0x6000000
+#define GICI_BASE   0x6020000
+#define GICR_BASE   0x06200000
+#define GICR_LEN    0x200000
+#define GICC_BASE   0x0c0c0000
+#define GICH_BASE   0x0c0d0000
+#define GICV_BASE   0x0c0e0000
+
+// UART
+#define UART0_BASE               0x21C0000
+#define UART1_BASE               0x21D0000
+#define UART2_BASE               0x21E0000
+#define UART3_BASE               0x21F0000
+#define UART0_IT                 64
+#define UART1_IT                 65
+#define UART2_IT                 104
+#define UART3_IT                 105
+#define UART_LEN                 0x10000
+#define SPCR_FLOW_CONTROL_NONE   0
+
+// Timer
+#define TIMER_BLOCK_COUNT            1
+#define TIMER_FRAME_COUNT            4
+#define TIMER_WATCHDOG_COUNT         1
+#define TIMER_BASE_ADDRESS           0x23E0000 // a.k.a CNTControlBase
+#define TIMER_READ_BASE_ADDRESS      0x23F0000 // a.k.a CNTReadBase
+#define TIMER_GT_BLOCK_0_ADDRESS     0x2890000 // a.k.a CNTCTLBase (Secure)
+#define TIMER_GT_BASE_0_ADDRESS      0x28A0000  // a.k.a CNTBase0
+#define TIMER_GT_BASE_1_ADDRESS      0x28B0000  // a.k.a CNTBase1
+#define TIMER_GT_BASE_2_ADDRESS      0x28C0000  // a.k.a CNTBase2
+#define TIMER_GT_BASE_3_ADDRESS      0x28D0000  // a.k.a CNTBase3
+#define TIMER_GT_BASE_0_EL0_ADDRESS  0x28E0000  // a.k.a CNTBase0EL0
+#define TIMER_GT_BASE_2_EL0_ADDRESS  0x28F0000  // a.k.a CNTBase2EL0
+#define TIMER_WDT0_REFRESH_BASE      0x2390000
+#define TIMER_WDT0_CONTROL_BASE      0x23A0000
+#define TIMER_SEC_IT                 29
+#define TIMER_NON_SEC_IT             30
+#define TIMER_VIRT_IT                27
+#define TIMER_HYP_IT                 26
+#define TIMER_FRAME0_IT              78
+#define TIMER_FRAME1_IT              79
+#define TIMER_FRAME2_IT              92
+#define TIMER_FRAME3_IT              93
+#define TIMER_WDT0_IT                91
+
+#define DEFAULT_PLAT_FREQ            700000000
+
+// Mcfg
+#define LX2160A_PCI_SEG0_CONFIG_BASE 0x9000000000
+#define LX2160A_PCI_SEG0             0x2
+#define LX2160A_PCI_SEG_BUSNUM_MIN   0x0
+#define LX2160A_PCI_SEG_BUSNUM_MAX   0xff
+#define LX2160A_PCI_SEG1_CONFIG_BASE 0xA000000000
+#define LX2160A_PCI_SEG1             0x4
+
+// Platform specific info needed by Configuration Manager
+
+#define CFG_MGR_TABLE_ID  SIGNATURE_64 ('L','X','2','1','6','0',' ',' ')
+
+#define PLAT_PCI_SEG0_CONFIG_BASE   LX2160A_PCI_SEG0_CONFIG_BASE
+#define PLAT_PCI_SEG0               LX2160A_PCI_SEG0
+#define PLAT_PCI_SEG_BUSNUM_MIN     LX2160A_PCI_SEG_BUSNUM_MIN
+#define PLAT_PCI_SEG_BUSNUM_MAX     LX2160A_PCI_SEG_BUSNUM_MAX
+#define PLAT_PCI_SEG1_CONFIG_BASE   LX2160A_PCI_SEG1_CONFIG_BASE
+#define PLAT_PCI_SEG1               LX2160A_PCI_SEG1
+
+#define PLAT_GIC_VERSION            GIC_VERSION
+#define PLAT_GICD_BASE              GICD_BASE
+#define PLAT_GICI_BASE              GICI_BASE
+#define PLAT_GICR_BASE              GICR_BASE
+#define PLAT_GICR_LEN               GICR_LEN
+#define PLAT_GICC_BASE              GICC_BASE
+#define PLAT_GICH_BASE              GICH_BASE
+#define PLAT_GICV_BASE              GICV_BASE
+
+#define PLAT_CPU_COUNT          16
+#define PLAT_GTBLOCK_COUNT      1
+#define PLAT_GTFRAME_COUNT      4
+#define PLAT_PCI_CONFG_COUNT    2
+
+#define PLAT_WATCHDOG_COUNT           1
+#define PLAT_GIC_REDISTRIBUTOR_COUNT  1
+#define PLAT_GIC_ITS_COUNT            1
+
+/* GIC CPU Interface information
+   GIC_ENTRY (CPUInterfaceNumber, Mpidr, PmuIrq, VGicIrq, EnergyEfficiency)
+ */
+#define PLAT_GIC_CPU_INTERFACE    {                         \
+             GICC_ENTRY (0,  GET_MPID (0, 0), 23, 0x19, 0), \
+             GICC_ENTRY (1,  GET_MPID (0, 1), 23, 0x19, 0), \
+             GICC_ENTRY (2,  GET_MPID (1, 0), 23, 0x19, 0), \
+             GICC_ENTRY (3,  GET_MPID (1, 1), 23, 0x19, 0), \
+             GICC_ENTRY (4,  GET_MPID (2, 0), 23, 0x19, 0), \
+             GICC_ENTRY (5,  GET_MPID (2, 1), 23, 0x19, 0), \
+             GICC_ENTRY (6,  GET_MPID (3, 0), 23, 0x19, 0), \
+             GICC_ENTRY (7,  GET_MPID (3, 1), 23, 0x19, 0), \
+             GICC_ENTRY (8,  GET_MPID (4, 0), 23, 0x19, 0), \
+             GICC_ENTRY (9,  GET_MPID (4, 1), 23, 0x19, 0), \
+             GICC_ENTRY (10, GET_MPID (5, 0), 23, 0x19, 0), \
+             GICC_ENTRY (11, GET_MPID (5, 1), 23, 0x19, 0), \
+             GICC_ENTRY (12, GET_MPID (6, 0), 23, 0x19, 0), \
+             GICC_ENTRY (13, GET_MPID (6, 1), 23, 0x19, 0), \
+             GICC_ENTRY (14, GET_MPID (7, 0), 23, 0x19, 0), \
+             GICC_ENTRY (15, GET_MPID (7, 1), 23, 0x19, 0)  \
+}
+
+// watchdogs
+#define PLAT_WATCHDOG_INFO                    \
+  {                                           \
+      TIMER_WDT0_CONTROL_BASE,                \
+      TIMER_WDT0_REFRESH_BASE,                \
+      TIMER_WDT0_IT,                          \
+      SBSA_WATCHDOG_FLAGS                     \
+  }                                           \
+
+#define PLAT_TIMER_BLOCK_INFO                                           \
+  {                                                                     \
+    {                                                                   \
+      TIMER_GT_BLOCK_0_ADDRESS,                                         \
+      PLAT_GTFRAME_COUNT,                                               \
+      (CM_OBJECT_TOKEN)((UINT8*)&FslPlatformRepositoryInfo +            \
+        OFFSET_OF (EDKII_PLATFORM_REPOSITORY_INFO, GTBlock0TimerInfo))  \
+    }                                                                   \
+  }                                                                     \
+
+#define PLAT_TIMER_FRAME_INFO                                            \
+  {                                                                      \
+    {                                                                    \
+      0,                             /* UINT8 GTFrameNumber */           \
+      TIMER_GT_BASE_0_ADDRESS,       /* UINT64 CntBaseX */               \
+      TIMER_GT_BASE_0_EL0_ADDRESS,   /* UINT64 CntEL0BaseX */            \
+      TIMER_FRAME0_IT,               /* UINT32 GTxPhysicalTimerGSIV */   \
+      GTDT_FRAME_FLAGS,              /* UINT32 GTxPhysicalTimerFlags */  \
+      TIMER_FRAME0_IT,               /* UINT32 GTxVirtualTimerGSIV */    \
+      GTDT_FRAME_FLAGS,              /* UINT32 GTxVirtualTimerFlags */   \
+      0                              /* UINT32 GTxCommonFlags */         \
+    }, /* Gtdt.Frames[0] */                                              \
+    {                                                                    \
+      1,                             /* UINT8 GTFrameNumber */           \
+      TIMER_GT_BASE_1_ADDRESS,       /* UINT64 CntBaseX */               \
+      GT_BLOCK_FRAME_RES_BASE,       /* UINT64 CntEL0BaseX */            \
+      TIMER_FRAME1_IT,               /* UINT32 GTxPhysicalTimerGSIV */   \
+      GTDT_FRAME_FLAGS,              /* UINT32 GTxPhysicalTimerFlags */  \
+      0,                             /* UINT32 GTxVirtualTimerGSIV */    \
+      0,                             /* UINT32 GTxVirtualTimerFlags */   \
+      GTDT_FRAME_COMMON_FLAGS        /* UINT32 GTxCommonFlags */         \
+    }, /* Gtdt.Frames[1] */                                              \
+    {                                                                    \
+      2,                              /* UINT8 GTFrameNumber */          \
+      TIMER_GT_BASE_2_ADDRESS,        /* UINT64 CntBaseX */              \
+      TIMER_GT_BASE_2_EL0_ADDRESS,    /* UINT64 CntEL0BaseX */           \
+      TIMER_FRAME2_IT,                /* UINT32 GTxPhysicalTimerGSIV */  \
+      GTDT_FRAME_FLAGS,               /* UINT32 GTxPhysicalTimerFlags */ \
+      0,                              /* UINT32 GTxVirtualTimerGSIV */   \
+      0,                              /* UINT32 GTxVirtualTimerFlags */  \
+      GTDT_FRAME_COMMON_FLAGS         /* UINT32 GTxCommonFlags */        \
+    },/* Gtdt.Frames[2] */                                               \
+    {                                                                   \
+      3,                             /* UINT8 GTFrameNumber */          \
+      TIMER_GT_BASE_3_ADDRESS,       /* UINT64 CntBaseX */              \
+      GT_BLOCK_FRAME_RES_BASE,       /* UINT64 CntEL0BaseX */           \
+      TIMER_FRAME3_IT,               /* UINT32 GTxPhysicalTimerGSIV */  \
+      GTDT_FRAME_FLAGS,              /* UINT32 GTxPhysicalTimerFlags */ \
+      0,                             /* UINT32 GTxVirtualTimerGSIV */   \
+      0,                             /* UINT32 GTxVirtualTimerFlags */  \
+      GTDT_FRAME_COMMON_FLAGS        /* UINT32 GTxCommonFlags */        \
+    }, /* Gtdt.Frames[3] */                                             \
+  }                                                                     \
+
+#define PLAT_GIC_DISTRIBUTOR_INFO                                      \
+  {                                                                    \
+    PLAT_GICD_BASE,                  /* UINT64  PhysicalBaseAddress */ \
+    0,                               /* UINT32  SystemVectorBase */    \
+    PLAT_GIC_VERSION                 /* UINT8   GicVersion */          \
+  }                                                                    \
+
+#define PLAT_GIC_REDISTRIBUTOR_INFO                                    \
+  {                                                                    \
+    PLAT_GICR_BASE,      /* UINT64 DiscoveryRangeBaseAddress */        \
+    PLAT_GICR_LEN        /* UINT32 DiscoveryRangeLength */             \
+  }                                                                    \
+
+#define PLAT_GIC_ITS_INFO                                                    \
+  {                                                                          \
+    0,                   /* UINT32 GIC ITS ID */                             \
+    PLAT_GICI_BASE,      /* UINT64 The 64-bit physical address for ITS */    \
+    0                    /* UINT32 Populate the GIC ITS affinity in SRAT. */ \
+  }                                                                          \
+
+#define PLAT_MCFG_INFO                \
+  {                                   \
+    {                                 \
+      PLAT_PCI_SEG0_CONFIG_BASE,      \
+      PLAT_PCI_SEG0,                  \
+      PLAT_PCI_SEG_BUSNUM_MIN,        \
+      PLAT_PCI_SEG_BUSNUM_MAX,        \
+    },                                \
+    {                                 \
+      PLAT_PCI_SEG1_CONFIG_BASE,      \
+      PLAT_PCI_SEG1,                  \
+      PLAT_PCI_SEG_BUSNUM_MIN,        \
+      PLAT_PCI_SEG_BUSNUM_MAX,        \
+    }                                 \
+  }                                   \
+
+#define PLAT_SPCR_INFO                                                            \
+  {                                                                               \
+    UART0_BASE,                                                                   \
+    UART0_IT,                                                                     \
+    115200,                                                                       \
+    0,                                                                            \
+    EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERFACE_TYPE_ARM_PL011_UART  \
+  }                                                                               \
+
+#endif
diff --git a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec
index 03996b0..3d5385c 100644
--- a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec
+++ b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec
@@ -2,6 +2,7 @@
 #  LX2160a board package.
 #
 #  Copyright 2018, 2020 NXP
+#  Copyright 2020 Puresoftware Ltd
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -20,4 +21,7 @@
 #
 ################################################################################
 [Includes.common]
-  Include                        # Root include for the package
+  .                       # Root include for the package
+  Include
+  AcpiTablesInclude
+  Platform/NXP/ConfigurationManager/Include
diff --git a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc
index 7132b3e..a8d7787 100644
--- a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc
+++ b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc
@@ -3,6 +3,7 @@
 #  LX2160ARDB Board package.
 #
 #  Copyright 2018-2020 NXP
+#  Copyright 2020 Puresoftware Ltd
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -29,9 +30,18 @@
   DEFINE NETWORK_HTTP_BOOT_ENABLE       = FALSE
   DEFINE NETWORK_ISCSI_ENABLE           = FALSE
 
+  # This flag controls the dynamic acpi generation
+  #
+  DEFINE DYNAMIC_ACPI_ENABLE            = TRUE
+
 !include Silicon/NXP/NxpQoriqLs.dsc.inc
 !include Silicon/NXP/LX2160A/LX2160A.dsc.inc
 
+!if $(DYNAMIC_ACPI_ENABLE) == TRUE
+  !include DynamicTablesPkg/DynamicTables.dsc.inc
+  !include Platform/NXP/ConfigurationManager/ConfigurationManager.dsc.inc
+!endif
+
 [LibraryClasses.common]
   ArmPlatformLib|Platform/NXP/LX2160aRdbPkg/Library/ArmPlatformLib/ArmPlatformLib.inf
   RealTimeClockLib|EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf
@@ -64,6 +74,26 @@
   MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
 
   #
+  # Dynamic Table Factory
+  !if $(DYNAMIC_ACPI_ENABLE) == TRUE
+    DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf {
+      <LibraryClasses>
+        NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/AcpiFadtLibArm.inf
+        NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/AcpiGtdtLibArm.inf
+        NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/AcpiMadtLibArm.inf
+        NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/AcpiMcfgLibArm.inf
+        NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/AcpiSpcrLibArm.inf
+        NULL|Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
+    }
+  !endif
+
+  #
+  # Acpi Support
+  #
+  MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
+  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+
+  #
   # Networking stack
   #
 !include NetworkPkg/Network.dsc.inc
diff --git a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf
index 111c845..6622360 100644
--- a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf
+++ b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf
@@ -3,6 +3,7 @@
 #  FLASH layout file for LX2160a board.
 #
 #  Copyright 2018-2020 NXP
+#  Copyright 2020 Puresoftware Ltd
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -103,6 +104,17 @@ READ_LOCK_STATUS   = TRUE
   INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
 
   #
+  # Acpi Support
+  #
+  INF MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
+  INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+
+  !if $(DYNAMIC_ACPI_ENABLE) == TRUE
+    INF Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
+    !include DynamicTablesPkg/DynamicTables.fdf.inc
+  !endif
+
+  #
   # Multiple Console IO support
   #
   INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
diff --git a/Platform/NXP/build.sh b/Platform/NXP/build.sh
new file mode 100755
index 0000000..676c7fd
--- /dev/null
+++ b/Platform/NXP/build.sh
@@ -0,0 +1,121 @@
+#!/bin/bash
+# UEFI build script for NXP Layer Scape SoCs
+#
+# Copyright 2020 NXP
+# Copyright 2020 Puresoftware Ltd
+#
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+
+# source environment file
+source Env.cshrc
+
+# Global Defaults
+ARCH=AARCH64
+TARGET_TOOLS=`echo $GCC_ARCH_PREFIX | cut -d _ -f 1`
+BASE_DIR=../../..
+
+[ -z "$TARGET_TOOLS" ] && {
+  echo "TARGET_TOOLS not found. Please run \"source Env.cshrc\" ."
+  exit 1
+}
+
+print_usage_banner()
+{
+    echo ""
+    echo "This shell script expects:"
+    echo "    Arg 1 (mandatory): SoC Type (can be LS1043 / LS1046 / LS2088 / LX2160 / LS1028)."
+    echo "    Arg 2 (mandatory): Board Type (can be RDB / QDS /FRWY)."
+    echo "    Arg 3 (mandatory): Build candidate (can be RELEASE or DEBUG). By
+              default we build the RELEASE candidate."
+    echo "    Arg 4 (optional): clean - To do a 'make clean' operation."
+}
+
+# Check for total num of input arguments
+if [[ "$#" -gt 4 ]]; then
+  echo "Illegal number of parameters"
+  print_usage_banner
+  exit
+fi
+
+# Check for third parameter to be clean only
+if [[ "$4" && $4 != "clean" ]]; then
+  echo "Error ! Either clean or emplty"
+  print_usage_banner
+  exit
+fi
+
+# Check for input arguments
+if [[ $1 == "" || $2 == "" || $3 == "" ]]; then
+  echo "Error !"
+  print_usage_banner
+  exit
+fi
+
+# Check for input arguments
+if [[ $1 != "LS1043" && $1 != "LS1046" && $1 != "LS2088" && $1 != "LX2160" && $1 != "LS1028" ]]; then
+  echo "Error ! Incorrect Soc Type specified."
+  print_usage_banner
+  exit
+fi
+
+# Check for input arguments
+if [[ $2 != "RDB" && $2 != "QDS" && $2 != "FRWY" ]]; then
+  echo "Error ! Incorrect Board Type specified."
+  print_usage_banner
+  exit
+fi
+
+# Check for input arguments
+if [[ $3 != "RELEASE" ]]; then
+  if [[ $3 != "DEBUG" ]]; then
+    echo "Error ! Incorrect build target specified."
+    print_usage_banner
+    exit
+  fi
+fi
+
+# Set Package drirectory
+if [[ $2 == "RDB" ]]; then
+  PKG="aRdbPkg"
+  if [[ $2 == "QDS" ]]; then
+    PKG="aQdsPkg"
+  fi
+elif [[ $2 == "FRWY" ]]; then
+    PKG="aFrwyPkg"
+fi
+
+echo ".........................................."
+echo "Welcome to $1$PKG UEFI Build environment"
+echo ".........................................."
+
+if [[ $4 == "clean" ]]; then
+  echo "Cleaning up the build directory '$BASE_DIR/Build/$1$PKG/'.."
+  rm -rf $BASE_DIR/Build/$1$PKG/*
+  exit
+fi
+
+# Clean-up
+set -e
+shopt -s nocasematch
+
+#
+# Setup workspace now
+#
+echo Initializing workspace
+cd $BASE_DIR
+
+# Use the BaseTools in edk2
+export EDK_TOOLS_PATH=`pwd`/BaseTools
+source edksetup.sh BaseTools
+
+export DYNAMIC_ACPI_PLATFORM=$1$PKG
+export DYNAMIC_ACPI_INC="$1A"
+
+build -p "$PACKAGES_PATH/Platform/NXP/$1$PKG/$1$PKG.dsc" -a $ARCH -t $TARGET_TOOLS -b $3
-- 
2.7.4


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

* Re: [PATCH v0] Dynamic ACPI framework for fsl layerscape platforms
  2020-12-29  7:25 [PATCH v0] Dynamic ACPI framework for fsl layerscape platforms Vikas Singh
  2020-12-29  7:25 ` [PATCH v0] Platform/NXP: Add Dynamic Acpi for " Vikas Singh
@ 2021-01-10  2:30 ` Leif Lindholm
  2021-01-16  4:08   ` Vikas Singh
  1 sibling, 1 reply; 12+ messages in thread
From: Leif Lindholm @ 2021-01-10  2:30 UTC (permalink / raw)
  To: Vikas Singh
  Cc: devel, sami.mujawar, meenakshi.aggarwal, paul.yang,
	augustine.philips, samer.el-haj-mahmoud, v.sethi, arokia.samy,
	kuldip.dwivedi, ard.biesheuvel, vikas.singh

We usually start from v1 :)

However, there is something weird with this set (like the missing 0/1,
1/1 in the subject lines)- please make sure you follow the
instructions from
https://github.com/tianocore/tianocore.github.io/wiki/Laszlo%27s-unkempt-git-guide-for-edk2-contributors-and-maintainers
when generating patches.

/
    Leif

On Tue, Dec 29, 2020 at 12:55:57 +0530, Vikas Singh wrote:
> This patch series sets the foundation of Dynamic ACPI framework
> for fsl layerscape platforms.
> In order to achieve :
>  - Configurable firmware builds.
>  - Unify firmware build for similar platforms.
>  - Minimize/eliminate human induced errors.
>  - Ability to validate, and generate firmware that complies with
>    relevant specifications
> this change set introduced following changes in below defined order
> under edk2-platforms/NXP for LX2160ARDB.
> 
> (1) Introduced edk2-platforms/NXP/ConfigurationManager
>     It creates the platform repositories dynamically during build time and
>     initializes with platform specific information and serves all requestes
>     from OEM/standard firmware table generators.
>     This Configuration Manager will be common for all fsl platforms.
> 
> (2) Introduced edk2-platforms/NXP/LX2160ARDB/Include/Platform.h
>     It has all the declarations & definitions specified for the platforms.
>     These macros will be consumed by Configuration Manager.
>     Additionally the placement of this header under "Include" dir will make
>     these macro's availale to other translation units of the platform built.
> 
> (3) Introduced edk2-platforms/NXP/LX2160ARDB/AcpiTablesInclude
>     This is a placeholder for - OEM specific firmware acpi table generators.
>     This also holds IP specific - DSDT/SSDT generators for the OEM's platform.
>     Currently Dsdt.asl is a place holder having only platform's clock related
>     dsdt properties for LX2160ARDB but it is intended to extend this Dsdt.asl
>     to hold other table as well in next patch series.
> 
> (4) Introduced a new "DYNAMIC_ACPI_ENABLE" flag to control DACPI framework for
>     LX2160ARDB platform.
>     By default it is enabled and can extend to other fsl platforms in future.
>     Changes can be referred under :
>       - LX2160ARDb.dsc
>       - LX2160ARDB.fdf
> 
> (5) Introduced a "build.sh" script under edk2-platforms/NXP/ to automate the
>     fsl platforms build system. And also mandatorily need to support Dynamic
>     ACPI framework for fsl platforms. It exports build environment variables
>     and also invokes "Env.cshrc".
> 
> Vikas Singh (1):
>   Platform/NXP: Add Dynamic Acpi for layerscape platforms
> 
>  .../ConfigurationManager/ConfigurationManager.dec  |  24 +
>  .../ConfigurationManager.dsc.inc                   |  21 +
>  .../ConfigurationManagerDxe/ConfigurationManager.c | 709 +++++++++++++++++++++
>  .../ConfigurationManagerDxe/ConfigurationManager.h | 229 +++++++
>  .../ConfigurationManagerDxe.inf                    |  52 ++
>  .../Include/PlatformAcpiTableGenerator.h           |  20 +
>  Platform/NXP/Env.cshrc                             |  73 +++
>  .../LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl   |  40 ++
>  .../LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl  |  15 +
>  .../AcpiTablesInclude/PlatformAcpiDsdtLib.inf      |  39 ++
>  .../PlatformAcpiDsdtLib/RawDsdtGenerator.c         | 146 +++++
>  .../AcpiTablesInclude/PlatformAcpiLib.h            |  24 +
>  Platform/NXP/LX2160aRdbPkg/Include/Platform.h      | 244 +++++++
>  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec       |   6 +-
>  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc       |  30 +
>  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf       |  12 +
>  Platform/NXP/build.sh                              | 121 ++++
>  17 files changed, 1804 insertions(+), 1 deletion(-)
>  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManager.dec
>  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManager.dsc.inc
>  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
>  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
>  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
>  create mode 100644 Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h
>  create mode 100755 Platform/NXP/Env.cshrc
>  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl
>  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl
>  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
>  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c
>  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiLib.h
>  create mode 100644 Platform/NXP/LX2160aRdbPkg/Include/Platform.h
>  create mode 100755 Platform/NXP/build.sh
> 
> -- 
> 2.7.4
> 

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

* Re: [PATCH v0] Platform/NXP: Add Dynamic Acpi for layerscape platforms
  2020-12-29  7:25 ` [PATCH v0] Platform/NXP: Add Dynamic Acpi for " Vikas Singh
@ 2021-01-10  3:26   ` Leif Lindholm
  2021-01-16  4:45     ` Vikas Singh
  0 siblings, 1 reply; 12+ messages in thread
From: Leif Lindholm @ 2021-01-10  3:26 UTC (permalink / raw)
  To: Vikas Singh
  Cc: devel, sami.mujawar, meenakshi.aggarwal, paul.yang,
	augustine.philips, samer.el-haj-mahmoud, v.sethi, arokia.samy,
	kuldip.dwivedi, ard.biesheuvel, vikas.singh

On Tue, Dec 29, 2020 at 12:55:58 +0530, Vikas Singh wrote:
> These changes intend to add

Hopefully they actually do.

> - Common Configuration Manager (CM) for all fsl platforms.
> - Platform headers consumed by CM for LX2160ARDB.
> - Clk dsdt properties for LX2160ARDB.

This sounds like (at least) three patches.

> 
> Signed-off-by: Vikas Singh <vikas.singh@puresoftware.com>
> ---
>  .../ConfigurationManager/ConfigurationManager.dec  |  24 +
>  .../ConfigurationManager.dsc.inc                   |  21 +
>  .../ConfigurationManagerDxe/ConfigurationManager.c | 709 +++++++++++++++++++++
>  .../ConfigurationManagerDxe/ConfigurationManager.h | 229 +++++++
>  .../ConfigurationManagerDxe.inf                    |  52 ++
>  .../Include/PlatformAcpiTableGenerator.h           |  20 +
>  Platform/NXP/Env.cshrc                             |  73 +++
>  .../LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl   |  40 ++
>  .../LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl  |  15 +
>  .../AcpiTablesInclude/PlatformAcpiDsdtLib.inf      |  39 ++
>  .../PlatformAcpiDsdtLib/RawDsdtGenerator.c         | 146 +++++
>  .../AcpiTablesInclude/PlatformAcpiLib.h            |  24 +
>  Platform/NXP/LX2160aRdbPkg/Include/Platform.h      | 244 +++++++
>  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec       |   6 +-
>  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc       |  30 +
>  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf       |  12 +
>  Platform/NXP/build.sh                              | 121 ++++
>  17 files changed, 1804 insertions(+), 1 deletion(-)
>  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManager.dec
>  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManager.dsc.inc
>  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
>  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
>  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
>  create mode 100644 Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h
>  create mode 100755 Platform/NXP/Env.cshrc
>  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl
>  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl
>  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
>  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c
>  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiLib.h
>  create mode 100644 Platform/NXP/LX2160aRdbPkg/Include/Platform.h
>  create mode 100755 Platform/NXP/build.sh
> 
> diff --git a/Platform/NXP/ConfigurationManager/ConfigurationManager.dec b/Platform/NXP/ConfigurationManager/ConfigurationManager.dec
> new file mode 100644
> index 0000000..8de2d7f
> --- /dev/null
> +++ b/Platform/NXP/ConfigurationManager/ConfigurationManager.dec
> @@ -0,0 +1,24 @@
> +#  ConfigurationManager.dec
> +#
> +#  Copyright 2020 NXP
> +#  Copyright 2020 Puresoftware Ltd
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +
> +[Defines]
> +  PACKAGE_NAME                   = ConfigurationManager

If it has a .dec, should it be ConfigurationManagerPkg?

> +  PACKAGE_GUID                   = 0222b1b1-247f-404e-bdc3-baab65f2ddd3
> +
> +################################################################################
> +#
> +# Include Section - list of Include Paths that are provided by this package.
> +#                   Comments are used for Keywords and Module Types.
> +#
> +# Supported Module Types:
> +#  BASE SEC PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION
> +#
> +################################################################################
> +[Includes]
> +  .

No.
Why should I need to depend on ConfigurationManagerPkg to include a
header file in the same location as my source file?
Why would this be needed anyway?

> +  Include
> diff --git a/Platform/NXP/ConfigurationManager/ConfigurationManager.dsc.inc b/Platform/NXP/ConfigurationManager/ConfigurationManager.dsc.inc
> new file mode 100644
> index 0000000..8e6aed0
> --- /dev/null
> +++ b/Platform/NXP/ConfigurationManager/ConfigurationManager.dsc.inc
> @@ -0,0 +1,21 @@
> +## @file
> +#  dsc include file for Configuration Manager
> +#
> +#  Copyright 2020 NXP
> +#  Copyright 2020 Puresoftware Ltd
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +##
> +
> +[Defines]
> +
> +[BuildOptions]
> +
> +[LibraryClasses.common]
> +
> +[Components.common]
> +  # Configuration Manager
> +  Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf {
> +    <BuildOptions>
> +    *_*_*_PLATFORM_FLAGS = -I$(PACKAGES_PATH)/Platform/NXP/$(DYNAMIC_ACPI_PLATFORM)/Include

This is not how PACKAGES_PATH works. It is a path, containing multiple
':'-separated directories. From looking at other platforms,
$(WORKSPACE) might do what you want.

But still, this is a .dsc.inc - it is always included from somewhere
else. Does that platform not set up its own include paths?

> +  }
> diff --git a/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
> new file mode 100644
> index 0000000..6e8a4c4
> --- /dev/null
> +++ b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
> @@ -0,0 +1,709 @@
> +/** @file
> +  Configuration Manager Dxe
> +
> +  Copyright 2020 NXP
> +  Copyright 2020 Puresoftware Ltd
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +  @par Glossary:
> +    - Cm or CM   - Configuration Manager
> +    - Obj or OBJ - Object
> +**/
> +
> +#include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>
> +#include <IndustryStandard/SerialPortConsoleRedirectionTable.h>
> +#include <Library/ArmLib.h>
> +#include <Library/DebugLib.h>
> +#include <Library/IoLib.h>
> +#include <Library/PcdLib.h>
> +#include <Library/UefiBootServicesTableLib.h>
> +#include <Protocol/AcpiTable.h>
> +#include <Protocol/ConfigurationManagerProtocol.h>
> +
> +/** The platform specific headers
> +*/
> +#include "ConfigurationManager.h"
> +#include <Library/SocLib.h>
> +
> +/** The platform configuration repository information.
> +*/
> +STATIC
> +EDKII_PLATFORM_REPOSITORY_INFO FslPlatformRepositoryInfo = {
> +  /// Configuration Manager information
> +  { CONFIGURATION_MANAGER_REVISION, CFG_MGR_OEM_ID },
> +
> +  // ACPI Table List
> +  {
> +    // FADT Table
> +    {
> +      EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
> +      EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
> +      CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt),
> +      NULL,
> +      CFG_MGR_TABLE_ID
> +    },
> +
> +    // GTDT Table
> +    {
> +      EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE,
> +      EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION,
> +      CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdGtdt),
> +      NULL,
> +      CFG_MGR_TABLE_ID
> +    },
> +
> +    // MADT Table
> +    {
> +      EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
> +      EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION,
> +      CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMadt),
> +      NULL,
> +      CFG_MGR_TABLE_ID
> +    },
> +
> +    // PCI MCFG Table
> +    {
> +      EFI_ACPI_6_2_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE,
> +      EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION,
> +      CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMcfg),
> +      NULL,
> +      CFG_MGR_TABLE_ID
> +    },
> +
> +    // SPCR Table
> +    {
> +      EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE,
> +      EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_REVISION,
> +      CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSpcr),
> +      NULL,
> +      CFG_MGR_TABLE_ID
> +    },
> +
> +    // DSDT (OEM) Table
> +    {
> +      EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
> +      0,
> +      CREATE_OEM_ACPI_TABLE_GEN_ID (EPlatAcpiTableIdDsdt),
> +      NULL,
> +      CFG_MGR_TABLE_ID
> +    }
> +
> +  },
> +
> +  // Boot architecture information
> +  { EFI_ACPI_6_2_ARM_PSCI_COMPLIANT },        // BootArchFlags
> +
> +  // Power management profile information
> +  { EFI_ACPI_6_2_PM_PROFILE_ENTERPRISE_SERVER }, // PowerManagement Profile
> +
> +  // Generic Timer Info
> +  {
> +    // The physical base address for the counter control frame
> +    TIMER_BASE_ADDRESS,
> +    // The physical base address for the counter read frame
> +    TIMER_READ_BASE_ADDRESS,
> +    // The secure PL1 timer interrupt
> +    TIMER_SEC_IT,
> +    // The secure PL1 timer flags
> +    GTDT_GTIMER_FLAGS,
> +    // The non-secure PL1 timer interrupt
> +    TIMER_NON_SEC_IT,
> +    // The non-secure PL1 timer flags
> +    GTDT_GTIMER_FLAGS,
> +    // The virtual timer interrupt
> +    TIMER_VIRT_IT,
> +    // The virtual timer flags
> +    GTDT_GTIMER_FLAGS,
> +    // The non-secure PL2 timer interrupt
> +    TIMER_HYP_IT,
> +    // The non-secure PL2 timer flags
> +    GTDT_GTIMER_FLAGS
> +  },
> +
> +  // Generic Timer Block Information
> +  PLAT_TIMER_BLOCK_INFO,
> +
> +  // GTDT Frames
> +  PLAT_TIMER_FRAME_INFO,
> +
> +  // Watchdog info
> +  PLAT_WATCHDOG_INFO,
> +
> +  // GIC CPU Interface information
> +  PLAT_GIC_CPU_INTERFACE,
> +
> +  // GIC Distributor Info
> +  PLAT_GIC_DISTRIBUTOR_INFO,
> +
> +  // GIC Redistributor
> +  PLAT_GIC_REDISTRIBUTOR_INFO,
> +
> +  // GIC ITS
> +  PLAT_GIC_ITS_INFO,
> +
> +  // MCFG Info
> +  PLAT_MCFG_INFO,
> +
> +  // SPCR Info
> +  PLAT_SPCR_INFO,
> +
> +  2.0                                         // fsl board revision
> +};
> +
> +/** Initialize the platform configuration repository.
> +
> +  @param [in]  This     Pointer to the Configuration Manager Protocol.
> +
> +  @retval EFI_SUCCESS   Success
> +**/
> +STATIC
> +EFI_STATUS
> +EFIAPI
> +InitializePlatformRepository (
> +  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This
> +  )
> +{
> +  EDKII_PLATFORM_REPOSITORY_INFO  * PlatformRepo;
> +  UINT32 Svr;
> +
> +  PlatformRepo = This->PlatRepoInfo;
> +
> +  Svr = SocGetSvr ();
> +  if (SVR_SOC_VER(Svr) == SVR_LX2160A) {
> +    PlatformRepo->FslBoardRevision = SVR_MAJOR(Svr);
> +    DEBUG ((DEBUG_INFO, "Fsl : SoC LX2160A Rev = 0x%x\n", PlatformRepo->FslBoardRevision));
> +  } else {
> +    DEBUG ((DEBUG_INFO, "Fsl : SoC Unknown Rev = 0x%x\n", PlatformRepo->FslBoardRevision));
> +  }
> +
> +  return EFI_SUCCESS;
> +}
> +
> +/** Return PCI Configuration Info.
> +  @param [in]      This           Pointer to the Configuration Manager Protocol.
> +  @param [in]      CmObjectId     The Object ID of the CM object requested
> +  @param [in]      Token          A unique token for identifying the requested
> +                                  CM_ARM_PCI_INFO object.
> +  @param [in, out] CmObject       Pointer to the Configuration Manager Object
> +                                  descriptor describing the requested Object.
> +  @retval EFI_SUCCESS             Success.
> +  @retval EFI_INVALID_PARAMETER   A parameter is invalid.
> +  @retval EFI_NOT_FOUND           The required object information is
> +  not found.
> + **/
> +EFI_STATUS
> +EFIAPI
> +GetPciConfigInfo (
> +    IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
> +    IN  CONST CM_OBJECT_ID                                  CmObjectId,
> +    IN  CONST CM_OBJECT_TOKEN                               Token,
> +    IN  OUT   CM_OBJ_DESCRIPTOR                     * CONST CmObject
> +    )
> +{
> +  EDKII_PLATFORM_REPOSITORY_INFO  * PlatformRepo;
> +  UINT32                            TotalObjCount;
> +  UINT32                            ObjIndex;
> +
> +  if ((This == NULL) || (CmObject == NULL)) {
> +    ASSERT (This != NULL);
> +    ASSERT (CmObject != NULL);
> +    return EFI_INVALID_PARAMETER;
> +  }
> +
> +  PlatformRepo = This->PlatRepoInfo;
> +
> +  TotalObjCount = ARRAY_SIZE (PlatformRepo->PciConfigInfo);
> +
> +  for (ObjIndex = 0; ObjIndex < TotalObjCount; ObjIndex++) {
> +    if (Token == (CM_OBJECT_TOKEN)&PlatformRepo->PciConfigInfo[ObjIndex])
> +    {
> +      CmObject->ObjectId = CmObjectId;
> +      CmObject->Size = sizeof (PlatformRepo->PciConfigInfo[ObjIndex]);
> +      CmObject->Data = (VOID*)&PlatformRepo->PciConfigInfo[ObjIndex];
> +      CmObject->Count = 1;
> +      return EFI_SUCCESS;
> +    }
> +  }
> +
> +  return EFI_NOT_FOUND;
> +}
> +
> +/** Return GIC CPU Interface Info.
> +  @param [in]      This           Pointer to the Configuration Manager Protocol.
> +  @param [in]      CmObjectId     The Object ID of the CM object requested
> +  @param [in]      Token          A unique token for identifying the requested
> +                                  CM_ARM_GICC_INFO object.
> +  @param [in, out] CmObject       Pointer to the Configuration Manager Object
> +                                  descriptor describing the requested Object.
> +  @retval EFI_SUCCESS             Success.
> +  @retval EFI_INVALID_PARAMETER   A parameter is invalid.
> +  @retval EFI_NOT_FOUND           The required object information is
> +  not found.
> + **/
> +EFI_STATUS
> +EFIAPI
> +GetGicCInfo (
> +    IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
> +    IN  CONST CM_OBJECT_ID                                  CmObjectId,
> +    IN  CONST CM_OBJECT_TOKEN                               Token,
> +    IN  OUT   CM_OBJ_DESCRIPTOR                     * CONST CmObject
> +    )
> +{
> +  EDKII_PLATFORM_REPOSITORY_INFO  * PlatformRepo;
> +
> +  if ((This == NULL) || (CmObject == NULL)) {
> +    ASSERT (This != NULL);
> +    ASSERT (CmObject != NULL);
> +    return EFI_INVALID_PARAMETER;
> +  }
> +
> +  PlatformRepo = This->PlatRepoInfo;
> +
> +  if (Token != (CM_OBJECT_TOKEN)&PlatformRepo->GicCInfo) {
> +    return EFI_NOT_FOUND;
> +  }
> +
> +  CmObject->ObjectId = CmObjectId;
> +  CmObject->Size = sizeof (PlatformRepo->GicCInfo);
> +  CmObject->Data = (VOID*)&PlatformRepo->GicCInfo;
> +  CmObject->Count = sizeof (PlatformRepo->GicCInfo) /
> +                      sizeof (PlatformRepo->GicCInfo[0]);

Use ARRAY_SIZE macro.

> +  return EFI_SUCCESS;
> +}
> +
> +/** Return a GT Block timer frame info list.
> +  @param [in]      This         Pointer to the Configuration Manager Protocol.
> +  @param [in]      CmObjectId   The Configuration Manager Object ID.
> +  @param [in]      Token        A token for identifying the object
> +  @param [in, out] CmObject     Pointer to the Configuration Manager Object
> +                                descriptor describing the requested Object.
> +  @retval EFI_SUCCESS           Success.
> +  @retval EFI_INVALID_PARAMETER A parameter is invalid.
> +  @retval EFI_NOT_FOUND         The required object information is not found.
> + **/
> +EFI_STATUS
> +  EFIAPI
> +GetGTBlockTimerFrameInfo (
> +    IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
> +    IN  CONST CM_OBJECT_ID                                  CmObjectId,
> +    IN  CONST CM_OBJECT_TOKEN                               Token,
> +    IN  OUT   CM_OBJ_DESCRIPTOR                     * CONST CmObject
> +    )
> +{
> +  EDKII_PLATFORM_REPOSITORY_INFO  * PlatformRepo;
> +
> +  if ((This == NULL) || (CmObject == NULL)) {
> +    ASSERT (This != NULL);
> +    ASSERT (CmObject != NULL);
> +    return EFI_INVALID_PARAMETER;
> +  }
> +
> +  PlatformRepo = This->PlatRepoInfo;
> +
> +  if (Token != (CM_OBJECT_TOKEN)&PlatformRepo->GTBlock0TimerInfo) {
> +    return EFI_NOT_FOUND;
> +  }
> +
> +  CmObject->ObjectId = CmObjectId;
> +  CmObject->Size = sizeof (PlatformRepo->GTBlock0TimerInfo);
> +  CmObject->Data = (VOID*)&PlatformRepo->GTBlock0TimerInfo;
> +  CmObject->Count = sizeof (PlatformRepo->GTBlock0TimerInfo) /
> +                      sizeof (PlatformRepo->GTBlock0TimerInfo[0]);

Use ARRAY_SIZE macro.

> +  return EFI_SUCCESS;
> +}
> +
> +/** Return a standard namespace object.
> +
> +  @param [in]      This        Pointer to the Configuration Manager Protocol.
> +  @param [in]      CmObjectId  The Configuration Manager Object ID.
> +  @param [in]      Token       An optional token identifying the object. If
> +                               unused this must be CM_NULL_TOKEN.
> +  @param [in, out] CmObject    Pointer to the Configuration Manager Object
> +                               descriptor describing the requested Object.
> +
> +  @retval EFI_SUCCESS           Success.
> +  @retval EFI_INVALID_PARAMETER A parameter is invalid.
> +  @retval EFI_NOT_FOUND         The required object information is not found.
> +**/
> +EFI_STATUS
> +EFIAPI
> +GetStandardNameSpaceObject (
> +  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
> +  IN  CONST CM_OBJECT_ID                                  CmObjectId,
> +  IN  CONST CM_OBJECT_TOKEN                               Token OPTIONAL,
> +  IN  OUT   CM_OBJ_DESCRIPTOR                     * CONST CmObject
> +  )
> +{
> +  EFI_STATUS                        Status;
> +  EDKII_PLATFORM_REPOSITORY_INFO  * PlatformRepo;
> +  UINT32                            TableCount;
> +
> +  Status = EFI_SUCCESS;
> +  if ((This == NULL) || (CmObject == NULL)) {
> +    ASSERT (This != NULL);
> +    ASSERT (CmObject != NULL);
> +    return EFI_INVALID_PARAMETER;
> +  }
> +  PlatformRepo = This->PlatRepoInfo;
> +
> +  switch (GET_CM_OBJECT_ID (CmObjectId)) {
> +    HANDLE_CM_OBJECT (
> +      EStdObjCfgMgrInfo,
> +      CmObjectId,
> +      PlatformRepo->CmInfo,
> +      1
> +      );
> +
> +    case EStdObjAcpiTableList:
> +      CmObject->ObjectId = CmObjectId;
> +      TableCount = sizeof (PlatformRepo->CmAcpiTableList) /
> +                     sizeof (PlatformRepo->CmAcpiTableList[0]);

Use ARRAY_SIZE macro.

> +      CmObject->Data = (VOID*)&PlatformRepo->CmAcpiTableList;
> +      CmObject->Size = sizeof (PlatformRepo->CmAcpiTableList);
> +      CmObject->Count = TableCount;
> +      DEBUG ((
> +        DEBUG_INFO,
> +        "EStdObjAcpiTableList: Ptr = 0x%p. Size = %d, Count = %d\n",
> +        CmObject->Data,
> +        CmObject->Size,
> +        CmObject->Count
> +        ));
> +      break;
> +
> +    default: {
> +      Status = EFI_NOT_FOUND;
> +      DEBUG ((
> +        DEBUG_ERROR,
> +        "ERROR: Object 0x%x. Status = %r\n",
> +        CmObjectId,
> +        Status
> +        ));
> +      break;
> +    }
> +  }
> +
> +  return Status;
> +}
> +
> +/** Return an ARM namespace object.
> +
> +  @param [in]      This        Pointer to the Configuration Manager Protocol.
> +  @param [in]      CmObjectId  The Configuration Manager Object ID.
> +  @param [in]      Token       An optional token identifying the object. If
> +                               unused this must be CM_NULL_TOKEN.
> +  @param [in, out] CmObject    Pointer to the Configuration Manager Object
> +                               descriptor describing the requested Object.
> +
> +  @retval EFI_SUCCESS           Success.
> +  @retval EFI_INVALID_PARAMETER A parameter is invalid.
> +  @retval EFI_NOT_FOUND         The required object information is not found.
> +**/
> +EFI_STATUS
> +EFIAPI
> +GetArmNameSpaceObject (
> +  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
> +  IN  CONST CM_OBJECT_ID                                  CmObjectId,
> +  IN  CONST CM_OBJECT_TOKEN                               Token OPTIONAL,
> +  IN  OUT   CM_OBJ_DESCRIPTOR                     * CONST CmObject
> +  )
> +{
> +  EFI_STATUS                        Status;
> +  EDKII_PLATFORM_REPOSITORY_INFO  * PlatformRepo;
> +
> +  Status = EFI_SUCCESS;
> +  if ((This == NULL) || (CmObject == NULL)) {
> +    ASSERT (This != NULL);
> +    ASSERT (CmObject != NULL);
> +    return EFI_INVALID_PARAMETER;
> +  }
> +  PlatformRepo = This->PlatRepoInfo;
> +
> +  switch (GET_CM_OBJECT_ID (CmObjectId)) {
> +    HANDLE_CM_OBJECT (
> +      EArmObjBootArchInfo,
> +      CmObjectId,
> +      PlatformRepo->BootArchInfo,
> +      1
> +      );
> +    HANDLE_CM_OBJECT (
> +      EArmObjPowerManagementProfileInfo,
> +      CmObjectId,
> +      PlatformRepo->PmProfileInfo,
> +      1
> +      );
> +    HANDLE_CM_OBJECT (
> +        EArmObjGenericTimerInfo,
> +        CmObjectId,
> +        PlatformRepo->GenericTimerInfo,
> +        1
> +        );
> +    HANDLE_CM_OBJECT (
> +        EArmObjPlatformGenericWatchdogInfo,
> +        CmObjectId,
> +        PlatformRepo->Watchdog,
> +        PLAT_WATCHDOG_COUNT
> +        );
> +    HANDLE_CM_OBJECT (
> +        EArmObjPlatformGTBlockInfo,
> +        CmObjectId,
> +        PlatformRepo->GTBlockInfo,
> +        (sizeof (PlatformRepo->GTBlockInfo) /
> +         sizeof (PlatformRepo->GTBlockInfo[0]))

Use ARRAY_SIZE macro.

> +        );
> +    HANDLE_CM_OBJECT_REF_BY_TOKEN (
> +        EArmObjGTBlockTimerFrameInfo,
> +        CmObjectId,
> +        PlatformRepo->GTBlock0TimerInfo,
> +        (sizeof (PlatformRepo->GTBlock0TimerInfo) /
> +         sizeof (PlatformRepo->GTBlock0TimerInfo[0])),

Use ARRAY_SIZE macro.

> +        Token,
> +        GetGTBlockTimerFrameInfo
> +        );
> +    HANDLE_CM_OBJECT_REF_BY_TOKEN (
> +        EArmObjGicCInfo,
> +        CmObjectId,
> +        PlatformRepo->GicCInfo,
> +        ARRAY_SIZE (PlatformRepo->GicCInfo),
> +        Token,
> +        GetGicCInfo
> +        );
> +    HANDLE_CM_OBJECT (
> +        EArmObjGicDInfo,
> +        CmObjectId,
> +        PlatformRepo->GicDInfo,
> +        1
> +        );
> +    HANDLE_CM_OBJECT (
> +        EArmObjGicRedistributorInfo,
> +        CmObjectId,
> +        PlatformRepo->GicRedistInfo,
> +        PLAT_GIC_REDISTRIBUTOR_COUNT
> +        );
> +    HANDLE_CM_OBJECT (
> +        EArmObjGicItsInfo,
> +        CmObjectId,
> +        PlatformRepo->GicItsInfo,
> +        PLAT_GIC_ITS_COUNT
> +        );
> +    HANDLE_CM_OBJECT_REF_BY_TOKEN (
> +        EArmObjPciConfigSpaceInfo,
> +        CmObjectId,
> +        PlatformRepo->PciConfigInfo,
> +        (sizeof (PlatformRepo->PciConfigInfo) /
> +         sizeof (PlatformRepo->PciConfigInfo[0])),

Use ARRAY_SIZE macro.

> +        Token,
> +        GetPciConfigInfo
> +        );
> +    HANDLE_CM_OBJECT (
> +        EArmObjSerialConsolePortInfo,
> +        CmObjectId,
> +        PlatformRepo->SpcrSerialPort,
> +        1
> +        );
> +    default: {
> +      Status = EFI_NOT_FOUND;
> +      DEBUG ((
> +        DEBUG_INFO,
> +        "INFO: Object 0x%x. Status = %r\n",
> +        CmObjectId,
> +        Status
> +        ));
> +      break;
> +    }
> +  }//switch
> +
> +  return Status;
> +}
> +
> +/** Return an OEM namespace object.
> +
> +  @param [in]      This        Pointer to the Configuration Manager Protocol.
> +  @param [in]      CmObjectId  The Configuration Manager Object ID.
> +  @param [in]      Token       An optional token identifying the object. If
> +                               unused this must be CM_NULL_TOKEN.
> +  @param [in, out] CmObject    Pointer to the Configuration Manager Object
> +                               descriptor describing the requested Object.
> +
> +  @retval EFI_SUCCESS           Success.
> +  @retval EFI_INVALID_PARAMETER A parameter is invalid.
> +  @retval EFI_NOT_FOUND         The required object information is not found.
> +**/
> +EFI_STATUS
> +EFIAPI
> +GetOemNameSpaceObject (
> +  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
> +  IN  CONST CM_OBJECT_ID                                  CmObjectId,
> +  IN  CONST CM_OBJECT_TOKEN                               Token OPTIONAL,
> +  IN  OUT   CM_OBJ_DESCRIPTOR                     * CONST CmObject
> +  )
> +{
> +  EFI_STATUS  Status;
> +
> +  Status = EFI_SUCCESS;
> +  if ((This == NULL) || (CmObject == NULL)) {
> +    ASSERT (This != NULL);
> +    ASSERT (CmObject != NULL);
> +    return EFI_INVALID_PARAMETER;
> +  }
> +
> +  switch (GET_CM_OBJECT_ID (CmObjectId)) {
> +    default: {
> +      Status = EFI_NOT_FOUND;
> +      DEBUG ((
> +        DEBUG_ERROR,
> +        "ERROR: Object 0x%x. Status = %r\n",
> +        CmObjectId,
> +        Status
> +        ));
> +      break;
> +    }
> +  }
> +
> +  return Status;
> +}
> +
> +/** The GetObject function defines the interface implemented by the
> +    Configuration Manager Protocol for returning the Configuration
> +    Manager Objects.
> +
> +  @param [in]      This        Pointer to the Configuration Manager Protocol.
> +  @param [in]      CmObjectId  The Configuration Manager Object ID.
> +  @param [in]      Token       An optional token identifying the object. If
> +                               unused this must be CM_NULL_TOKEN.
> +  @param [in, out] CmObject    Pointer to the Configuration Manager Object
> +                               descriptor describing the requested Object.
> +
> +  @retval EFI_SUCCESS           Success.
> +  @retval EFI_INVALID_PARAMETER A parameter is invalid.
> +  @retval EFI_NOT_FOUND         The required object information is not found.
> +**/
> +EFI_STATUS
> +EFIAPI
> +FslPlatformGetObject (
> +  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
> +  IN  CONST CM_OBJECT_ID                                  CmObjectId,
> +  IN  CONST CM_OBJECT_TOKEN                               Token OPTIONAL,
> +  IN  OUT   CM_OBJ_DESCRIPTOR                     * CONST CmObject
> +  )
> +{
> +  EFI_STATUS  Status;
> +
> +  if ((This == NULL) || (CmObject == NULL)) {
> +    ASSERT (This != NULL);
> +    ASSERT (CmObject != NULL);
> +    return EFI_INVALID_PARAMETER;
> +  }
> +
> +  switch (GET_CM_NAMESPACE_ID (CmObjectId)) {
> +    case EObjNameSpaceStandard:
> +      Status = GetStandardNameSpaceObject (This, CmObjectId, Token, CmObject);
> +      break;
> +    case EObjNameSpaceArm:
> +      Status = GetArmNameSpaceObject (This, CmObjectId, Token, CmObject);
> +      break;
> +    case EObjNameSpaceOem:
> +      Status = GetOemNameSpaceObject (This, CmObjectId, Token, CmObject);
> +      break;
> +    default: {
> +      Status = EFI_INVALID_PARAMETER;
> +      DEBUG ((
> +        DEBUG_ERROR,
> +        "ERROR: Unknown Namespace Object = 0x%x. Status = %r\n",
> +        CmObjectId,
> +        Status
> +        ));
> +      break;
> +    }
> +  }
> +
> +  return Status;
> +}
> +
> +/** The SetObject function defines the interface implemented by the
> +    Configuration Manager Protocol for updating the Configuration
> +    Manager Objects.
> +
> +  @param [in]      This        Pointer to the Configuration Manager Protocol.
> +  @param [in]      CmObjectId  The Configuration Manager Object ID.
> +  @param [in]      Token       An optional token identifying the object. If
> +                               unused this must be CM_NULL_TOKEN.
> +  @param [in]      CmObject    Pointer to the Configuration Manager Object
> +                               descriptor describing the Object.
> +
> +  @retval EFI_UNSUPPORTED  This operation is not supported.
> +**/
> +EFI_STATUS
> +EFIAPI
> +FslPlatformSetObject (
> +  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
> +  IN  CONST CM_OBJECT_ID                                  CmObjectId,
> +  IN  CONST CM_OBJECT_TOKEN                               Token OPTIONAL,
> +  IN        CM_OBJ_DESCRIPTOR                     * CONST CmObject
> +  )
> +{
> +  return EFI_UNSUPPORTED;
> +}
> +
> +/** A structure describing the configuration manager protocol interface.
> +*/
> +STATIC
> +CONST
> +EDKII_CONFIGURATION_MANAGER_PROTOCOL FslConfigManagerProtocol = {
> +  CREATE_REVISION (1, 0),
> +  FslPlatformGetObject,
> +  FslPlatformSetObject,
> +  &FslPlatformRepositoryInfo
> +};
> +
> +/**
> +  Entrypoint of Configuration Manager Dxe.
> +
> +  @param  ImageHandle
> +  @param  SystemTable
> +
> +  @return EFI_SUCCESS
> +  @return EFI_LOAD_ERROR
> +  @return EFI_OUT_OF_RESOURCES
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +ConfigurationManagerDxeInitialize (
> +  IN EFI_HANDLE          ImageHandle,
> +  IN EFI_SYSTEM_TABLE  * SystemTable
> +  )
> +{
> +  EFI_STATUS  Status;
> +
> +  Status = gBS->InstallProtocolInterface (
> +                  &ImageHandle,
> +                  &gEdkiiConfigurationManagerProtocolGuid,
> +                  EFI_NATIVE_INTERFACE,
> +                  (VOID*)&FslConfigManagerProtocol
> +                  );
> +  if (EFI_ERROR (Status)) {
> +    DEBUG ((
> +      DEBUG_ERROR,
> +      "ERROR: Failed to get Install Configuration Manager Protocol." \
> +      " Status = %r\n",
> +      Status
> +      ));
> +    goto error_handler;
> +  }
> +
> +  Status = InitializePlatformRepository (
> +    &FslConfigManagerProtocol
> +    );
> +  if (EFI_ERROR (Status)) {
> +    DEBUG ((
> +      DEBUG_ERROR,
> +      "ERROR: Failed to initialize the Platform Configuration Repository." \
> +      " Status = %r\n",
> +      Status
> +      ));
> +  }
> +
> +error_handler:
> +  return Status;
> +}
> diff --git a/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
> new file mode 100644
> index 0000000..cf09ef9
> --- /dev/null
> +++ b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
> @@ -0,0 +1,229 @@
> +/** @file
> +  Configuration Manager headers
> +
> +  Copyright 2020 NXP
> +  Copyright 2020 Puresoftware Ltd
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +  @par Glossary:
> +    - Cm or CM   - Configuration Manager
> +    - Obj or OBJ - Object
> +**/
> +
> +#ifndef CONFIGURATION_MANAGER_H__
> +#define CONFIGURATION_MANAGER_H__
> +
> +#include <Platform.h>
> +#include <PlatformAcpiTableGenerator.h>
> +
> +/** The configuration manager version
> +*/
> +#define CONFIGURATION_MANAGER_REVISION CREATE_REVISION (0, 0)
> +
> +/** The OEM ID
> +*/
> +#define CFG_MGR_OEM_ID    { 'N', 'X', 'P', ' ', ' ', ' ' }
> +
> +/** A helper macro for populating the GIC CPU information
> + */
> +#define GICC_ENTRY(                                                   \
> +    CPUInterfaceNumber,                                               \
> +    Mpidr,                                                            \
> +    PmuIrq,                                                           \
> +    VGicIrq,                                                          \
> +    EnergyEfficiency                                                  \
> +    ) {                                                               \
> +  CPUInterfaceNumber,       /* UINT32  CPUInterfaceNumber         */  \
> +  CPUInterfaceNumber,       /* UINT32  AcpiProcessorUid           */  \
> +  EFI_ACPI_6_2_GIC_ENABLED, /* UINT32  Flags                      */  \
> +  0,                        /* UINT32  ParkingProtocolVersion     */  \
> +  PmuIrq,                   /* UINT32  PerformanceInterruptGsiv   */  \
> +  0,                        /* UINT64  ParkedAddress              */  \
> +  GICC_BASE,                /* UINT64  PhysicalBaseAddress        */  \
> +  GICV_BASE,                /* UINT64  GICV                       */  \
> +  GICH_BASE,                /* UINT64  GICH                       */  \
> +  VGicIrq,                  /* UINT32  VGICMaintenanceInterrupt   */  \
> +  0,                        /* UINT64  GICRBaseAddress            */  \
> +  Mpidr,                    /* UINT64  MPIDR                      */  \
> +  EnergyEfficiency          /* UINT8   ProcessorPowerEfficiency   */  \
> +}
> +
> +/** A helper macro for returning configuration manager objects
> +*/
> +#define HANDLE_CM_OBJECT(ObjId, CmObjectId, Object, ObjectCount)      \
> +  case ObjId: {                                                       \
> +    CmObject->ObjectId = CmObjectId;                                  \
> +    CmObject->Size = sizeof (Object);                                 \
> +    CmObject->Data = (VOID*)&Object;                                  \
> +    CmObject->Count = ObjectCount;                                    \
> +    DEBUG ((                                                          \
> +      DEBUG_INFO,                                                     \
> +      #CmObjectId ": Ptr = 0x%p, Size = %d, Count = %d\n",            \
> +      CmObject->Data,                                                 \
> +      CmObject->Size,                                                 \
> +      CmObject->Count                                                 \
> +      ));                                                             \
> +    break;                                                            \
> +  }

This is code obfuscation. Please don't invent your own programming
languages. In C, the case, the start bracket, the break and the end
bracket always go inline.
The rest would be better as a static helper function than a macro.

> +
> +/** A helper macro for returning configuration manager objects
> +    referenced by token
> +*/
> +#define HANDLE_CM_OBJECT_REF_BY_TOKEN(                                      \

See comment above.

> +          ObjId,                                                            \
> +          CmObjectId,                                                       \
> +          Object,                                                           \
> +          ObjectCount,                                                      \
> +          Token,                                                            \
> +          HandlerProc                                                       \
> +          )                                                                 \
> +  case ObjId: {                                                             \
> +    CmObject->ObjectId = CmObjectId;                                        \
> +    if (Token == CM_NULL_TOKEN) {                                           \
> +      CmObject->Size = sizeof (Object);                                     \
> +      CmObject->Data = (VOID*)&Object;                                      \
> +      CmObject->Count = ObjectCount;                                        \
> +      DEBUG ((                                                              \
> +        DEBUG_INFO,                                                         \
> +        #CmObjectId ": Ptr = 0x%p, Size = %d, Count = %d\n",                \
> +        CmObject->Data,                                                     \
> +        CmObject->Size,                                                     \
> +        CmObject->Count                                                     \
> +        ));                                                                 \
> +    } else {                                                                \
> +      Status = HandlerProc (This, CmObjectId, Token, CmObject);             \
> +      DEBUG ((                                                              \
> +        DEBUG_INFO,                                                         \
> +        #CmObjectId ": Token = 0x%p, Ptr = 0x%p, Size = %d, Count = %d\n",  \
> +        (VOID*)Token,                                                       \
> +        CmObject->Data,                                                     \
> +        CmObject->Size,                                                     \
> +        CmObject->Count                                                     \
> +        ));                                                                 \
> +    }                                                                       \
> +    break;                                                                  \
> +  }
> +
> +/** A helper macro for returning configuration manager objects referenced
> +    by token when the entire platform repository is in scope and the
> +    CM_NULL_TOKEN value is not allowed.
> +*/
> +#define HANDLE_CM_OBJECT_SEARCH_PLAT_REPO(                                  \

See comment above.

> +          ObjId,                                                            \
> +          CmObjectId,                                                       \
> +          Token,                                                            \
> +          HandlerProc                                                       \
> +          )                                                                 \
> +  case ObjId: {                                                             \
> +    CmObject->ObjectId = CmObjectId;                                        \
> +    if (Token == CM_NULL_TOKEN) {                                           \
> +      Status = EFI_INVALID_PARAMETER;                                       \
> +      DEBUG ((                                                              \
> +        DEBUG_ERROR,                                                        \
> +        #ObjId ": CM_NULL_TOKEN value is not allowed when searching"        \
> +        " the entire platform repository.\n"                                \
> +        ));                                                                 \
> +    } else {                                                                \
> +      Status = HandlerProc (This, CmObjectId, Token, CmObject);             \
> +      DEBUG ((                                                              \
> +        DEBUG_INFO,                                                         \
> +        #ObjId ": Token = 0x%p, Ptr = 0x%p, Size = %d, Count = %d\n",       \
> +        (VOID*)Token,                                                       \
> +        CmObject->Data,                                                     \
> +        CmObject->Size,                                                     \
> +        CmObject->Count                                                     \
> +        ));                                                                 \
> +    }                                                                       \
> +    break;                                                                  \
> +  }
> +
> +/** The number of ACPI tables to install
> +*/
> +#define PLAT_ACPI_TABLE_COUNT   6

This feels suboptimal.
Could this be calculated at run- or compile time?

> +
> +/** A structure describing the platform configuration
> +    manager repository information
> +*/
> +typedef struct PlatformRepositoryInfo {
> +  /// Configuration Manager Information
> +  CM_STD_OBJ_CONFIGURATION_MANAGER_INFO     CmInfo;
> +
> +  /// List of ACPI tables
> +  CM_STD_OBJ_ACPI_TABLE_INFO                CmAcpiTableList[PLAT_ACPI_TABLE_COUNT];
> +
> +  /// Boot architecture information
> +  CM_ARM_BOOT_ARCH_INFO                     BootArchInfo;
> +
> +  /// Power management profile information
> +  CM_ARM_POWER_MANAGEMENT_PROFILE_INFO      PmProfileInfo;
> +
> +  /// Generic timer information
> +  CM_ARM_GENERIC_TIMER_INFO                 GenericTimerInfo;
> +
> +  /// Generic timer block information
> +  CM_ARM_GTBLOCK_INFO                       GTBlockInfo[PLAT_GTBLOCK_COUNT];
> +
> +  /// Generic timer frame information
> +  CM_ARM_GTBLOCK_TIMER_FRAME_INFO           GTBlock0TimerInfo[PLAT_GTFRAME_COUNT];
> +
> +  /// Watchdog information
> +  CM_ARM_GENERIC_WATCHDOG_INFO              Watchdog;
> +
> +  /// GIC CPU interface information
> +  CM_ARM_GICC_INFO                          GicCInfo[PLAT_CPU_COUNT];
> +
> +  /// GIC distributor information
> +  CM_ARM_GICD_INFO                          GicDInfo;
> +
> +  /// GIC Redistributor information
> +  CM_ARM_GIC_REDIST_INFO                    GicRedistInfo;
> +
> +  /// GIC ITS information
> +  CM_ARM_GIC_ITS_INFO                       GicItsInfo;
> +
> +  /// PCI configuration space information
> +  CM_ARM_PCI_CONFIG_SPACE_INFO              PciConfigInfo[PLAT_PCI_CONFG_COUNT];
> +
> +  /// Serial port information for serial port console redirection port
> +  CM_ARM_SERIAL_PORT_INFO                   SpcrSerialPort;
> +
> +  /// Fsl Board Revision
> +  UINT32                                    FslBoardRevision;
> +} EDKII_PLATFORM_REPOSITORY_INFO;

Please don't use EDKII prefix for platform-scpecific code.

> +
> +/*
> + * GTDT_GTIMER_FLAGS
> + * IT trigger (Level/Edge- Bit 0) and Polarity (Low/High) Bit 1
> + * Set bit-0 is 0 (Level trigger), Bit 1 1 (Active low)
> + */
> +#define GTDT_GTIMER_FLAGS           (EFI_ACPI_6_1_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY)
> +
> +/*
> + * Timer Frame IT High Level triggered
> + * IT trigger (Level/Edge- Bit 0) and Polarity (Low/High) Bit 1
> + * Set  bit-0 is 0 (Level trigger), Bit 1 0 (Active High)
> + */
> +#define GTDT_FRAME_FLAGS 0
> +
> +/*
> + * Timer frame status
> + * Access - Secure or non secure <-- Bit 0
> + * State - Save (meaning always on) or Lose Context  <-- Bit 1
> + * Set Bit 0 1 as Secure and Bit 1 zero as lose context
> +*/
> +#define GTDT_FRAME_COMMON_FLAGS EFI_ACPI_6_1_GTDT_GT_BLOCK_COMMON_FLAG_SECURE_TIMER
> +
> +/*
> + * Watchdog flags
> + * IT trigger (Level/Edge- Bit 0), Polarity (Low/High) Bit 1, Secured Bit 2
> + * Set Level trigger (Bit 0 as 0)
> + * Active High (Bit 1 as 0)
> + * Non secure (Bit 2 as 0)
> + */
> +#define SBSA_WATCHDOG_FLAGS 0
> +#define SBSA_SEC_WATCHDOG_FLAGS EFI_ACPI_6_1_GTDT_GT_BLOCK_COMMON_FLAG_SECURE_TIMER
> +
> +#define GT_BLOCK_FRAME_RES_BASE  MAX_UINT64
> +
> +#endif // CONFIGURATION_MANAGER_H__
> diff --git a/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
> new file mode 100644
> index 0000000..03fe104
> --- /dev/null
> +++ b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
> @@ -0,0 +1,52 @@
> +## @file
> +#  Configuration Manager Dxe
> +#
> +#  Copyright 2020 NXP
> +#  Copyright 2020 Puresoftware Ltd
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +##
> +
> +[Defines]
> +  INF_VERSION                    = 0x0001001B
> +  BASE_NAME                      = ConfigurationManagerDxe
> +  FILE_GUID                      = A97F70AC-3BB4-4596-B4D2-9F948EC12D17
> +  MODULE_TYPE                    = DXE_DRIVER
> +  VERSION_STRING                 = 1.0
> +  ENTRY_POINT                    = ConfigurationManagerDxeInitialize
> +
> +#
> +# The following information is for reference only and not required by the build tools.
> +#
> +#  VALID_ARCHITECTURES           = ARM AARCH64
> +#
> +
> +[Sources]
> +  ConfigurationManager.c
> +
> +[Packages]
> +  ArmPkg/ArmPkg.dec
> +  ArmPlatformPkg/ArmPlatformPkg.dec
> +  DynamicTablesPkg/DynamicTablesPkg.dec
> +  EmbeddedPkg/EmbeddedPkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  MdePkg/MdePkg.dec
> +  Platform/NXP/ConfigurationManager/ConfigurationManager.dec
> +  Silicon/NXP/NxpQoriqLs.dec
> +
> +[LibraryClasses]
> +  ArmPlatformLib
> +  PrintLib
> +  UefiBootServicesTableLib
> +  UefiDriverEntryPoint
> +  UefiRuntimeServicesTableLib
> +
> +[Protocols]
> +  gEdkiiConfigurationManagerProtocolGuid
> +
> +[FixedPcd]
> +
> +[Pcd]
> +
> +[Depex]
> +  TRUE
> diff --git a/Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h b/Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h
> new file mode 100644
> index 0000000..da3c571
> --- /dev/null
> +++ b/Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h
> @@ -0,0 +1,20 @@
> +/** @file
> +  Acpi Table generator headers
> +
> +  Copyright 2020 NXP
> +  Copyright 2020 Puresoftware Ltd
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef PLATFORM_ACPI_TABLE_GENERATOR_H_
> +#define PLATFORM_ACPI_TABLE_GENERATOR_H_
> +
> +typedef enum PlatAcpiTableId {
> +  EPlatAcpiTableIdReserved = 0x0000,             ///< Reserved
> +  EPlatAcpiTableIdDsdt,
> +  EPlatAcpiTableIdMax
> +} EPLAT_ACPI_TABLE_ID;

Where does the EPlat prefix come from? What does it stand for?

> +
> +#endif
> diff --git a/Platform/NXP/Env.cshrc b/Platform/NXP/Env.cshrc
> new file mode 100755
> index 0000000..a0f151b
> --- /dev/null
> +++ b/Platform/NXP/Env.cshrc

I am nearly 100% convinced the below would only execute correctly in a
bash shell, which is where it is called from - why does it claim to be
for csh?

> @@ -0,0 +1,73 @@
> +#  @file.
> +#
> +#  Copyright 2020 NXP
> +#  Copyright 2020 Puresoftware Ltd
> +#
> +#  This program and the accompanying materials are licensed and made available under
> +#  the terms and conditions of the BSD License which accompanies this distribution.
> +#  The full text of the license may be found at
> +#  http://opensource.org/licenses/bsd-license.php
> +#
> +#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
> +#

Please use SPDX tag here as well.

> +
> +unset GCC_UTILITY GCC_VERSION MajorVersion MinorVersion
> +
> +if [ X"$CROSS_COMPILE_64" != X"" ]; then
> +  ARM64_PREFIX="$CROSS_COMPILE_64"
> +elif [ X"$CROSS_COMPILE" != X"" ]; then
> +  ARM64_PREFIX="$CROSS_COMPILE"
> +else
> +  ARM64_PREFIX="aarch64-linux-gnu-"
> +fi
> +
> +GCC_UTILITY="${ARM64_PREFIX}gcc"
> +CheckGcc=`which $GCC_UTILITY >/dev/null 2>&1`
> +if [ "$?" -eq 0 ];then
> +  GCC_VERSION=`$GCC_UTILITY -v 2>&1 | tail -n 1 | awk '{print $3}'`
> +  MajorVersion=`echo $GCC_VERSION | cut -d . -f 1`
> +  MinorVersion=`echo $GCC_VERSION | cut -d . -f 2`
> +  GCC_ARCH_PREFIX=
> +
> +  case $MajorVersion in
> +    4)
> +      case $MinorVersion in
> +        9)
> +          GCC_ARCH_PREFIX="GCC49_AARCH64_PREFIX"
> +        ;;
> +        *)
> +          NOTSUPPORTED=1
> +        ;;
> +      esac
> +    ;;
> +    5)
> +      case $MinorVersion in
> +      4)
> +        GCC_ARCH_PREFIX="GCC5_AARCH64_PREFIX"
> +      ;;
> +      *)
> +        GCC_ARCH_PREFIX="GCC5_AARCH64_PREFIX"
> +        echo "Warning: ${GCC_UTILITY} version ($MajorVersion.$MinorVersion) has not been tested, please use at own risk."
> +      ;;
> +      esac
> +    ;;
> +    *)
> +      GCC_ARCH_PREFIX="GCC5_AARCH64_PREFIX"
> +      echo "Warning: ${GCC_UTILITY} version ($MajorVersion.$MinorVersion) has not been tested, please use at own risk."
> +    ;;
> +  esac
> +
> +  [ -n "$GCC_ARCH_PREFIX" ] && {
> +    export GCC_ARCH_PREFIX="$GCC_ARCH_PREFIX"
> +    export "$GCC_ARCH_PREFIX=$ARM64_PREFIX"
> +  }
> +
> +  unset ARCH
> +else
> +    echo "Error: ${GCC_UTILITY} not found. Please check PATH variable."
> +    unset GCC_UTILITY GCC_VERSION MajorVersion MinorVersion
> +fi
> +
> +# Export edk2-platforms path
> +export PACKAGES_PATH=`dirname \`dirname "$PWD"\``
> diff --git a/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl
> new file mode 100644
> index 0000000..1008476
> --- /dev/null
> +++ b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl
> @@ -0,0 +1,40 @@
> +/** @file
> +  Differentiated System Description Table Fields (DSDT)
> +
> +  Copyright 2020 NXP
> +  Copyright 2020 Puresoftware Ltd
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +Scope(_SB)
> +{
> +  Device(PCLK) {
> +    Name(_HID, "NXP0017")
> +    Name(CLK, 0)
> +    Name(AVBL, 0)
> +    OperationRegion(RCWS, SystemMemory, DCFG_BASE, DCFG_LEN)
> +    Method(_REG,2) {
> +      if (Arg0 == "RCWS") {
> +        Store(Arg1, AVBL)
> +      }
> +    }
> +    Field (RCWS, ByteAcc, NoLock, Preserve) {
> +      offset(0x100),
> +      PCFG, 2,
> +      PRAT, 6,
> +      offset(0x124),
> +      RESV, 4,
> +      SFRQ, 10
> +    }
> +
> +    Method(_INI, 0, NotSerialized) {
> +      Store(SFRQ, Local0)
> +      Multiply(Local0, 500000, Local0)
> +      Multiply(Local0, PRAT, Local0)
> +      Divide(Local0, 6, , Local0)
> +      Store(Local0, CLK)
> +    }
> +  }
> +} // end of device PCLK
> diff --git a/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl
> new file mode 100644
> index 0000000..e4f04ce
> --- /dev/null
> +++ b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl
> @@ -0,0 +1,15 @@
> +/** @file
> +  Differentiated System Description Table Fields (DSDT)
> +
> +  Copyright 2020 NXP
> +  Copyright 2020 Puresoftware Ltd.
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include "Platform.h"
> +
> +DefinitionBlock("DsdtTable.aml", "DSDT", 2, "NXP  ", "LX2160  ", EFI_ACPI_ARM_OEM_REVISION) {
> +  include ("Clk.asl")
> +}
> diff --git a/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
> new file mode 100644
> index 0000000..f2d8ea5
> --- /dev/null
> +++ b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
> @@ -0,0 +1,39 @@
> +## @file
> +#  Raw Table Generator
> +#
> +#  Copyright 2020 NXP
> +#  Copyright 2020 Puresoftware Ltd
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +##
> +
> +[Defines]
> +  INF_VERSION    = 0x00010019
> +  BASE_NAME      = PlatformAcpiDsdtLib
> +  FILE_GUID      = 0b1768cf-13fa-4ecf-b640-338a636d1abb
> +  VERSION_STRING = 1.0
> +  MODULE_TYPE    = DXE_DRIVER
> +  LIBRARY_CLASS  = NULL|DXE_DRIVER
> +  CONSTRUCTOR    = AcpiDsdtLibConstructor
> +  DESTRUCTOR     = AcpiDsdtLibDestructor
> +
> +[Sources]
> +  PlatformAcpiDsdtLib/RawDsdtGenerator.c
> +  Dsdt/Dsdt.asl
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  EmbeddedPkg/EmbeddedPkg.dec
> +  DynamicTablesPkg/DynamicTablesPkg.dec
> +  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec

Please sort alphabetically.

> +
> +[LibraryClasses]
> +  BaseLib
> +
> +[Pcd]
> +
> +[Protocols]
> +
> +[Guids]
> +
> diff --git a/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c
> new file mode 100644
> index 0000000..75ea2b7
> --- /dev/null
> +++ b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c
> @@ -0,0 +1,146 @@
> +/** @file
> +  Raw DSDT Table Generator
> +
> +  Copyright 2020 NXP
> +  Copyright 2020 Puresoftware Ltd.
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <Library/AcpiLib.h>
> +#include <Library/DebugLib.h>
> +#include <Protocol/AcpiTable.h>
> +
> +// Module specific include files.
> +#include <AcpiTableGenerator.h>
> +#include <ConfigurationManagerObject.h>
> +#include <ConfigurationManagerHelper.h>
> +#include <Library/TableHelperLib.h>
> +#include <Protocol/ConfigurationManagerProtocol.h>
> +
> +#include "PlatformAcpiLib.h"
> +
> +/** Construct the ACPI table using the ACPI table data provided.
> +
> +  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.
> +**/
> +STATIC
> +EFI_STATUS
> +EFIAPI
> +BuildRawDsdtTable (
> +  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
> +  )
> +{
> +  ASSERT (This != NULL);
> +  ASSERT (AcpiTableInfo != NULL);
> +  ASSERT (CfgMgrProtocol != NULL);
> +  ASSERT (Table != NULL);
> +  ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
> +
> +  if (AcpiTableInfo->AcpiTableData == NULL) {
> +    // Add the dsdt aml code here, Currently NULL place holder.
> +    *Table = (EFI_ACPI_DESCRIPTION_HEADER *)&dsdt_aml_code;
> +  }
> +
> +  return EFI_SUCCESS;
> +}
> +
> +/** This macro defines the Raw Generator revision.
> +*/
> +#define DSDT_GENERATOR_REVISION CREATE_REVISION (1, 0)
> +
> +/** The interface for the Raw Table Generator.
> +*/
> +STATIC
> +CONST
> +ACPI_TABLE_GENERATOR RawDsdtGenerator = {
> +  // Generator ID
> +  CREATE_OEM_ACPI_TABLE_GEN_ID (EPlatAcpiTableIdDsdt),
> +  // Generator Description
> +  L"ACPI.OEM.RAW.DSDT.GENERATOR",
> +  // ACPI Table Signature - Unused
> +  0,
> +  // ACPI Table Revision - Unused
> +  0,
> +  // Minimum ACPI Table Revision - Unused
> +  0,
> +  // Creator ID
> +  TABLE_GENERATOR_CREATOR_ID_ARM,
> +  // Creator Revision
> +  DSDT_GENERATOR_REVISION,
> +  // Build Table function
> +  BuildRawDsdtTable,
> +  // 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
> +AcpiDsdtLibConstructor (
> +  IN CONST EFI_HANDLE                ImageHandle,
> +  IN       EFI_SYSTEM_TABLE  * CONST SystemTable
> +  )
> +{
> +  EFI_STATUS  Status;
> +  Status = RegisterAcpiTableGenerator (&RawDsdtGenerator);
> +  DEBUG ((DEBUG_INFO, "OEM: Register DSDT 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
> +AcpiDsdtLibDestructor (
> +  IN CONST EFI_HANDLE                ImageHandle,
> +  IN       EFI_SYSTEM_TABLE  * CONST SystemTable
> +  )
> +{
> +  EFI_STATUS  Status;
> +  Status = DeregisterAcpiTableGenerator (&RawDsdtGenerator);
> +  DEBUG ((DEBUG_INFO, "OEM: Deregister DSDT Generator. Status = %r\n", Status));
> +  ASSERT_EFI_ERROR (Status);
> +  return Status;
> +}
> diff --git a/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiLib.h b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiLib.h
> new file mode 100644
> index 0000000..1747245
> --- /dev/null
> +++ b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiLib.h
> @@ -0,0 +1,24 @@
> +/** @file
> + *  Acpi lib headers
> + *
> + *  Copyright 2020 NXP
> + *  Copyright 2020 Puresoftware Ltd
> + *
> + *  SPDX-License-Identifier: BSD-2-Clause-Patent
> + *
> +**/
> +
> +
> +#ifndef _LX2160ARDB_PLATFORM_ACPI_LIB_H_
> +#define _LX2160ARDB_PLATFORM_ACPI_LIB_H_

Please don't use leading _ in macros.

> +
> +#include <PlatformAcpiTableGenerator.h>

This header does not appear needed by this file.

> +
> +/** C array containing the compiled AML template.
> +    These symbols are defined in the auto generated C file
> +    containing the AML bytecode array.
> +*/
> +extern CHAR8  dsdt_aml_code[];
> +
> +#endif
> +
> diff --git a/Platform/NXP/LX2160aRdbPkg/Include/Platform.h b/Platform/NXP/LX2160aRdbPkg/Include/Platform.h
> new file mode 100644
> index 0000000..e2a6faa
> --- /dev/null
> +++ b/Platform/NXP/LX2160aRdbPkg/Include/Platform.h
> @@ -0,0 +1,244 @@
> +/** @file
> + *  Platform headers
> + *
> + *  Copyright 2020 NXP
> + *  Copyright 2020 Puresoftware Ltd
> + *
> + *  SPDX-License-Identifier: BSD-2-Clause-Patent
> + *
> +**/
> +
> +
> +#ifndef _LX2160ARDB_PLATFORM_H_
> +#define _LX2160ARDB_PLATFORM_H_

Please don't use leading _ in macros.

> +
> +#define EFI_ACPI_ARM_OEM_REVISION       0x00000000
> +
> +// Soc defines
> +#define SVR_SOC_VER(svr)        (((svr) >> 8) & 0xFFFFFE)
> +#define SVR_MAJOR(svr)          (((svr) >> 4) & 0xf)
> +#define SVR_MINOR(svr)          (((svr) >> 0) & 0xf)
> +
> +#define SVR_LX2160A             0x873600
> +
> +// PCLK
> +#define DCFG_BASE   0x1E00000
> +#define DCFG_LEN    0x1FFFF
> +
> +// Gic
> +#define GIC_VERSION 3
> +#define GICD_BASE   0x6000000
> +#define GICI_BASE   0x6020000
> +#define GICR_BASE   0x06200000
> +#define GICR_LEN    0x200000
> +#define GICC_BASE   0x0c0c0000
> +#define GICH_BASE   0x0c0d0000
> +#define GICV_BASE   0x0c0e0000
> +
> +// UART
> +#define UART0_BASE               0x21C0000
> +#define UART1_BASE               0x21D0000
> +#define UART2_BASE               0x21E0000
> +#define UART3_BASE               0x21F0000
> +#define UART0_IT                 64
> +#define UART1_IT                 65
> +#define UART2_IT                 104
> +#define UART3_IT                 105
> +#define UART_LEN                 0x10000
> +#define SPCR_FLOW_CONTROL_NONE   0
> +
> +// Timer
> +#define TIMER_BLOCK_COUNT            1
> +#define TIMER_FRAME_COUNT            4
> +#define TIMER_WATCHDOG_COUNT         1
> +#define TIMER_BASE_ADDRESS           0x23E0000 // a.k.a CNTControlBase
> +#define TIMER_READ_BASE_ADDRESS      0x23F0000 // a.k.a CNTReadBase
> +#define TIMER_GT_BLOCK_0_ADDRESS     0x2890000 // a.k.a CNTCTLBase (Secure)
> +#define TIMER_GT_BASE_0_ADDRESS      0x28A0000  // a.k.a CNTBase0
> +#define TIMER_GT_BASE_1_ADDRESS      0x28B0000  // a.k.a CNTBase1
> +#define TIMER_GT_BASE_2_ADDRESS      0x28C0000  // a.k.a CNTBase2
> +#define TIMER_GT_BASE_3_ADDRESS      0x28D0000  // a.k.a CNTBase3
> +#define TIMER_GT_BASE_0_EL0_ADDRESS  0x28E0000  // a.k.a CNTBase0EL0
> +#define TIMER_GT_BASE_2_EL0_ADDRESS  0x28F0000  // a.k.a CNTBase2EL0
> +#define TIMER_WDT0_REFRESH_BASE      0x2390000
> +#define TIMER_WDT0_CONTROL_BASE      0x23A0000
> +#define TIMER_SEC_IT                 29
> +#define TIMER_NON_SEC_IT             30
> +#define TIMER_VIRT_IT                27
> +#define TIMER_HYP_IT                 26
> +#define TIMER_FRAME0_IT              78
> +#define TIMER_FRAME1_IT              79
> +#define TIMER_FRAME2_IT              92
> +#define TIMER_FRAME3_IT              93
> +#define TIMER_WDT0_IT                91
> +
> +#define DEFAULT_PLAT_FREQ            700000000
> +
> +// Mcfg
> +#define LX2160A_PCI_SEG0_CONFIG_BASE 0x9000000000
> +#define LX2160A_PCI_SEG0             0x2
> +#define LX2160A_PCI_SEG_BUSNUM_MIN   0x0
> +#define LX2160A_PCI_SEG_BUSNUM_MAX   0xff
> +#define LX2160A_PCI_SEG1_CONFIG_BASE 0xA000000000
> +#define LX2160A_PCI_SEG1             0x4
> +
> +// Platform specific info needed by Configuration Manager
> +
> +#define CFG_MGR_TABLE_ID  SIGNATURE_64 ('L','X','2','1','6','0',' ',' ')
> +
> +#define PLAT_PCI_SEG0_CONFIG_BASE   LX2160A_PCI_SEG0_CONFIG_BASE
> +#define PLAT_PCI_SEG0               LX2160A_PCI_SEG0
> +#define PLAT_PCI_SEG_BUSNUM_MIN     LX2160A_PCI_SEG_BUSNUM_MIN
> +#define PLAT_PCI_SEG_BUSNUM_MAX     LX2160A_PCI_SEG_BUSNUM_MAX
> +#define PLAT_PCI_SEG1_CONFIG_BASE   LX2160A_PCI_SEG1_CONFIG_BASE
> +#define PLAT_PCI_SEG1               LX2160A_PCI_SEG1
> +
> +#define PLAT_GIC_VERSION            GIC_VERSION
> +#define PLAT_GICD_BASE              GICD_BASE
> +#define PLAT_GICI_BASE              GICI_BASE
> +#define PLAT_GICR_BASE              GICR_BASE
> +#define PLAT_GICR_LEN               GICR_LEN
> +#define PLAT_GICC_BASE              GICC_BASE
> +#define PLAT_GICH_BASE              GICH_BASE
> +#define PLAT_GICV_BASE              GICV_BASE
> +
> +#define PLAT_CPU_COUNT          16
> +#define PLAT_GTBLOCK_COUNT      1
> +#define PLAT_GTFRAME_COUNT      4
> +#define PLAT_PCI_CONFG_COUNT    2
> +
> +#define PLAT_WATCHDOG_COUNT           1
> +#define PLAT_GIC_REDISTRIBUTOR_COUNT  1
> +#define PLAT_GIC_ITS_COUNT            1
> +
> +/* GIC CPU Interface information
> +   GIC_ENTRY (CPUInterfaceNumber, Mpidr, PmuIrq, VGicIrq, EnergyEfficiency)
> + */
> +#define PLAT_GIC_CPU_INTERFACE    {                         \
> +             GICC_ENTRY (0,  GET_MPID (0, 0), 23, 0x19, 0), \
> +             GICC_ENTRY (1,  GET_MPID (0, 1), 23, 0x19, 0), \
> +             GICC_ENTRY (2,  GET_MPID (1, 0), 23, 0x19, 0), \
> +             GICC_ENTRY (3,  GET_MPID (1, 1), 23, 0x19, 0), \
> +             GICC_ENTRY (4,  GET_MPID (2, 0), 23, 0x19, 0), \
> +             GICC_ENTRY (5,  GET_MPID (2, 1), 23, 0x19, 0), \
> +             GICC_ENTRY (6,  GET_MPID (3, 0), 23, 0x19, 0), \
> +             GICC_ENTRY (7,  GET_MPID (3, 1), 23, 0x19, 0), \
> +             GICC_ENTRY (8,  GET_MPID (4, 0), 23, 0x19, 0), \
> +             GICC_ENTRY (9,  GET_MPID (4, 1), 23, 0x19, 0), \
> +             GICC_ENTRY (10, GET_MPID (5, 0), 23, 0x19, 0), \
> +             GICC_ENTRY (11, GET_MPID (5, 1), 23, 0x19, 0), \
> +             GICC_ENTRY (12, GET_MPID (6, 0), 23, 0x19, 0), \
> +             GICC_ENTRY (13, GET_MPID (6, 1), 23, 0x19, 0), \
> +             GICC_ENTRY (14, GET_MPID (7, 0), 23, 0x19, 0), \
> +             GICC_ENTRY (15, GET_MPID (7, 1), 23, 0x19, 0)  \
> +}
> +
> +// watchdogs
> +#define PLAT_WATCHDOG_INFO                    \
> +  {                                           \
> +      TIMER_WDT0_CONTROL_BASE,                \
> +      TIMER_WDT0_REFRESH_BASE,                \
> +      TIMER_WDT0_IT,                          \
> +      SBSA_WATCHDOG_FLAGS                     \
> +  }                                           \
> +
> +#define PLAT_TIMER_BLOCK_INFO                                           \
> +  {                                                                     \
> +    {                                                                   \
> +      TIMER_GT_BLOCK_0_ADDRESS,                                         \
> +      PLAT_GTFRAME_COUNT,                                               \
> +      (CM_OBJECT_TOKEN)((UINT8*)&FslPlatformRepositoryInfo +            \
> +        OFFSET_OF (EDKII_PLATFORM_REPOSITORY_INFO, GTBlock0TimerInfo))  \
> +    }                                                                   \
> +  }                                                                     \
> +
> +#define PLAT_TIMER_FRAME_INFO                                            \
> +  {                                                                      \
> +    {                                                                    \
> +      0,                             /* UINT8 GTFrameNumber */           \
> +      TIMER_GT_BASE_0_ADDRESS,       /* UINT64 CntBaseX */               \
> +      TIMER_GT_BASE_0_EL0_ADDRESS,   /* UINT64 CntEL0BaseX */            \
> +      TIMER_FRAME0_IT,               /* UINT32 GTxPhysicalTimerGSIV */   \
> +      GTDT_FRAME_FLAGS,              /* UINT32 GTxPhysicalTimerFlags */  \
> +      TIMER_FRAME0_IT,               /* UINT32 GTxVirtualTimerGSIV */    \
> +      GTDT_FRAME_FLAGS,              /* UINT32 GTxVirtualTimerFlags */   \
> +      0                              /* UINT32 GTxCommonFlags */         \
> +    }, /* Gtdt.Frames[0] */                                              \
> +    {                                                                    \
> +      1,                             /* UINT8 GTFrameNumber */           \
> +      TIMER_GT_BASE_1_ADDRESS,       /* UINT64 CntBaseX */               \
> +      GT_BLOCK_FRAME_RES_BASE,       /* UINT64 CntEL0BaseX */            \
> +      TIMER_FRAME1_IT,               /* UINT32 GTxPhysicalTimerGSIV */   \
> +      GTDT_FRAME_FLAGS,              /* UINT32 GTxPhysicalTimerFlags */  \
> +      0,                             /* UINT32 GTxVirtualTimerGSIV */    \
> +      0,                             /* UINT32 GTxVirtualTimerFlags */   \
> +      GTDT_FRAME_COMMON_FLAGS        /* UINT32 GTxCommonFlags */         \
> +    }, /* Gtdt.Frames[1] */                                              \
> +    {                                                                    \
> +      2,                              /* UINT8 GTFrameNumber */          \
> +      TIMER_GT_BASE_2_ADDRESS,        /* UINT64 CntBaseX */              \
> +      TIMER_GT_BASE_2_EL0_ADDRESS,    /* UINT64 CntEL0BaseX */           \
> +      TIMER_FRAME2_IT,                /* UINT32 GTxPhysicalTimerGSIV */  \
> +      GTDT_FRAME_FLAGS,               /* UINT32 GTxPhysicalTimerFlags */ \
> +      0,                              /* UINT32 GTxVirtualTimerGSIV */   \
> +      0,                              /* UINT32 GTxVirtualTimerFlags */  \
> +      GTDT_FRAME_COMMON_FLAGS         /* UINT32 GTxCommonFlags */        \
> +    },/* Gtdt.Frames[2] */                                               \
> +    {                                                                   \
> +      3,                             /* UINT8 GTFrameNumber */          \
> +      TIMER_GT_BASE_3_ADDRESS,       /* UINT64 CntBaseX */              \
> +      GT_BLOCK_FRAME_RES_BASE,       /* UINT64 CntEL0BaseX */           \
> +      TIMER_FRAME3_IT,               /* UINT32 GTxPhysicalTimerGSIV */  \
> +      GTDT_FRAME_FLAGS,              /* UINT32 GTxPhysicalTimerFlags */ \
> +      0,                             /* UINT32 GTxVirtualTimerGSIV */   \
> +      0,                             /* UINT32 GTxVirtualTimerFlags */  \
> +      GTDT_FRAME_COMMON_FLAGS        /* UINT32 GTxCommonFlags */        \
> +    }, /* Gtdt.Frames[3] */                                             \
> +  }                                                                     \
> +
> +#define PLAT_GIC_DISTRIBUTOR_INFO                                      \
> +  {                                                                    \
> +    PLAT_GICD_BASE,                  /* UINT64  PhysicalBaseAddress */ \
> +    0,                               /* UINT32  SystemVectorBase */    \
> +    PLAT_GIC_VERSION                 /* UINT8   GicVersion */          \
> +  }                                                                    \
> +
> +#define PLAT_GIC_REDISTRIBUTOR_INFO                                    \
> +  {                                                                    \
> +    PLAT_GICR_BASE,      /* UINT64 DiscoveryRangeBaseAddress */        \
> +    PLAT_GICR_LEN        /* UINT32 DiscoveryRangeLength */             \
> +  }                                                                    \
> +
> +#define PLAT_GIC_ITS_INFO                                                    \
> +  {                                                                          \
> +    0,                   /* UINT32 GIC ITS ID */                             \
> +    PLAT_GICI_BASE,      /* UINT64 The 64-bit physical address for ITS */    \
> +    0                    /* UINT32 Populate the GIC ITS affinity in SRAT. */ \
> +  }                                                                          \
> +
> +#define PLAT_MCFG_INFO                \
> +  {                                   \
> +    {                                 \
> +      PLAT_PCI_SEG0_CONFIG_BASE,      \
> +      PLAT_PCI_SEG0,                  \
> +      PLAT_PCI_SEG_BUSNUM_MIN,        \
> +      PLAT_PCI_SEG_BUSNUM_MAX,        \
> +    },                                \
> +    {                                 \
> +      PLAT_PCI_SEG1_CONFIG_BASE,      \
> +      PLAT_PCI_SEG1,                  \
> +      PLAT_PCI_SEG_BUSNUM_MIN,        \
> +      PLAT_PCI_SEG_BUSNUM_MAX,        \
> +    }                                 \
> +  }                                   \
> +
> +#define PLAT_SPCR_INFO                                                            \
> +  {                                                                               \
> +    UART0_BASE,                                                                   \
> +    UART0_IT,                                                                     \
> +    115200,                                                                       \
> +    0,                                                                            \
> +    EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERFACE_TYPE_ARM_PL011_UART  \
> +  }                                                                               \
> +
> +#endif
> diff --git a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec
> index 03996b0..3d5385c 100644
> --- a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec
> +++ b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec
> @@ -2,6 +2,7 @@
>  #  LX2160a board package.
>  #
>  #  Copyright 2018, 2020 NXP
> +#  Copyright 2020 Puresoftware Ltd
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -20,4 +21,7 @@
>  #
>  ################################################################################
>  [Includes.common]
> -  Include                        # Root include for the package

Don't delete this...

> +  .                       # Root include for the package

No. Find another way, if this indeed has any effect at all.

> +  Include

...only to add it again.

> +  AcpiTablesInclude
> +  Platform/NXP/ConfigurationManager/Include
> diff --git a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc
> index 7132b3e..a8d7787 100644
> --- a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc
> +++ b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc
> @@ -3,6 +3,7 @@
>  #  LX2160ARDB Board package.
>  #
>  #  Copyright 2018-2020 NXP
> +#  Copyright 2020 Puresoftware Ltd
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -29,9 +30,18 @@
>    DEFINE NETWORK_HTTP_BOOT_ENABLE       = FALSE
>    DEFINE NETWORK_ISCSI_ENABLE           = FALSE
>  
> +  # This flag controls the dynamic acpi generation
> +  #
> +  DEFINE DYNAMIC_ACPI_ENABLE            = TRUE
> +
>  !include Silicon/NXP/NxpQoriqLs.dsc.inc
>  !include Silicon/NXP/LX2160A/LX2160A.dsc.inc
>  
> +!if $(DYNAMIC_ACPI_ENABLE) == TRUE
> +  !include DynamicTablesPkg/DynamicTables.dsc.inc
> +  !include Platform/NXP/ConfigurationManager/ConfigurationManager.dsc.inc
> +!endif
> +
>  [LibraryClasses.common]
>    ArmPlatformLib|Platform/NXP/LX2160aRdbPkg/Library/ArmPlatformLib/ArmPlatformLib.inf
>    RealTimeClockLib|EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf
> @@ -64,6 +74,26 @@
>    MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
>  
>    #
> +  # Dynamic Table Factory
> +  !if $(DYNAMIC_ACPI_ENABLE) == TRUE
> +    DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf {
> +      <LibraryClasses>
> +        NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/AcpiFadtLibArm.inf
> +        NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/AcpiGtdtLibArm.inf
> +        NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/AcpiMadtLibArm.inf
> +        NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/AcpiMcfgLibArm.inf
> +        NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/AcpiSpcrLibArm.inf
> +        NULL|Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
> +    }
> +  !endif
> +
> +  #
> +  # Acpi Support
> +  #
> +  MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
> +  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
> +
> +  #
>    # Networking stack
>    #
>  !include NetworkPkg/Network.dsc.inc
> diff --git a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf
> index 111c845..6622360 100644
> --- a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf
> +++ b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf
> @@ -3,6 +3,7 @@
>  #  FLASH layout file for LX2160a board.
>  #
>  #  Copyright 2018-2020 NXP
> +#  Copyright 2020 Puresoftware Ltd
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -103,6 +104,17 @@ READ_LOCK_STATUS   = TRUE
>    INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
>  
>    #
> +  # Acpi Support
> +  #
> +  INF MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
> +  INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
> +
> +  !if $(DYNAMIC_ACPI_ENABLE) == TRUE
> +    INF Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
> +    !include DynamicTablesPkg/DynamicTables.fdf.inc
> +  !endif
> +
> +  #
>    # Multiple Console IO support
>    #
>    INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
> diff --git a/Platform/NXP/build.sh b/Platform/NXP/build.sh
> new file mode 100755
> index 0000000..676c7fd
> --- /dev/null
> +++ b/Platform/NXP/build.sh
> @@ -0,0 +1,121 @@
> +#!/bin/bash
> +# UEFI build script for NXP Layer Scape SoCs
> +#
> +# Copyright 2020 NXP
> +# Copyright 2020 Puresoftware Ltd
> +#
> +# This program and the accompanying materials
> +# are licensed and made available under the terms and conditions of the BSD License
> +# which accompanies this distribution.  The full text of the license may be found at
> +# http://opensource.org/licenses/bsd-license.php
> +#
> +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

Please use SPDX tag instead.

On the whole, I'm not a fan of custom build scripts, since they
inevitably (like this one) start making unreliable assumptions about
directory layout etc.

There are build instructions in the top-level Readme.md. All that this
script does should be possible to describe as an addition in
Platform/NXP/Readme.md.

/
    Leif

> +#
> +
> +# source environment file
> +source Env.cshrc
> +
> +# Global Defaults
> +ARCH=AARCH64
> +TARGET_TOOLS=`echo $GCC_ARCH_PREFIX | cut -d _ -f 1`
> +BASE_DIR=../../..
> +
> +[ -z "$TARGET_TOOLS" ] && {
> +  echo "TARGET_TOOLS not found. Please run \"source Env.cshrc\" ."
> +  exit 1
> +}
> +
> +print_usage_banner()
> +{
> +    echo ""
> +    echo "This shell script expects:"
> +    echo "    Arg 1 (mandatory): SoC Type (can be LS1043 / LS1046 / LS2088 / LX2160 / LS1028)."
> +    echo "    Arg 2 (mandatory): Board Type (can be RDB / QDS /FRWY)."
> +    echo "    Arg 3 (mandatory): Build candidate (can be RELEASE or DEBUG). By
> +              default we build the RELEASE candidate."
> +    echo "    Arg 4 (optional): clean - To do a 'make clean' operation."
> +}
> +
> +# Check for total num of input arguments
> +if [[ "$#" -gt 4 ]]; then
> +  echo "Illegal number of parameters"
> +  print_usage_banner
> +  exit
> +fi
> +
> +# Check for third parameter to be clean only
> +if [[ "$4" && $4 != "clean" ]]; then
> +  echo "Error ! Either clean or emplty"
> +  print_usage_banner
> +  exit
> +fi
> +
> +# Check for input arguments
> +if [[ $1 == "" || $2 == "" || $3 == "" ]]; then
> +  echo "Error !"
> +  print_usage_banner
> +  exit
> +fi
> +
> +# Check for input arguments
> +if [[ $1 != "LS1043" && $1 != "LS1046" && $1 != "LS2088" && $1 != "LX2160" && $1 != "LS1028" ]]; then
> +  echo "Error ! Incorrect Soc Type specified."
> +  print_usage_banner
> +  exit
> +fi
> +
> +# Check for input arguments
> +if [[ $2 != "RDB" && $2 != "QDS" && $2 != "FRWY" ]]; then
> +  echo "Error ! Incorrect Board Type specified."
> +  print_usage_banner
> +  exit
> +fi
> +
> +# Check for input arguments
> +if [[ $3 != "RELEASE" ]]; then
> +  if [[ $3 != "DEBUG" ]]; then
> +    echo "Error ! Incorrect build target specified."
> +    print_usage_banner
> +    exit
> +  fi
> +fi
> +
> +# Set Package drirectory
> +if [[ $2 == "RDB" ]]; then
> +  PKG="aRdbPkg"
> +  if [[ $2 == "QDS" ]]; then
> +    PKG="aQdsPkg"
> +  fi
> +elif [[ $2 == "FRWY" ]]; then
> +    PKG="aFrwyPkg"
> +fi
> +
> +echo ".........................................."
> +echo "Welcome to $1$PKG UEFI Build environment"
> +echo ".........................................."
> +
> +if [[ $4 == "clean" ]]; then
> +  echo "Cleaning up the build directory '$BASE_DIR/Build/$1$PKG/'.."
> +  rm -rf $BASE_DIR/Build/$1$PKG/*
> +  exit
> +fi
> +
> +# Clean-up
> +set -e
> +shopt -s nocasematch
> +
> +#
> +# Setup workspace now
> +#
> +echo Initializing workspace
> +cd $BASE_DIR
> +
> +# Use the BaseTools in edk2
> +export EDK_TOOLS_PATH=`pwd`/BaseTools
> +source edksetup.sh BaseTools
> +
> +export DYNAMIC_ACPI_PLATFORM=$1$PKG
> +export DYNAMIC_ACPI_INC="$1A"
> +
> +build -p "$PACKAGES_PATH/Platform/NXP/$1$PKG/$1$PKG.dsc" -a $ARCH -t $TARGET_TOOLS -b $3
> -- 
> 2.7.4
> 

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

* Re: [PATCH v0] Dynamic ACPI framework for fsl layerscape platforms
  2021-01-10  2:30 ` [PATCH v0] Dynamic ACPI framework for fsl " Leif Lindholm
@ 2021-01-16  4:08   ` Vikas Singh
  0 siblings, 0 replies; 12+ messages in thread
From: Vikas Singh @ 2021-01-16  4:08 UTC (permalink / raw)
  To: Leif Lindholm
  Cc: devel, Sami Mujawar, meenakshi.aggarwal, Paul Yang,
	Augustine Philips, samer.el-haj-mahmoud, Varun Sethi, Arokia Samy,
	Kuldip Dwivedi, ard.biesheuvel, Vikas Singh

On Sun, Jan 10, 2021 at 8:00 AM Leif Lindholm <leif@nuviainc.com> wrote:
>
> We usually start from v1 :)
>
> However, there is something weird with this set (like the missing 0/1,
> 1/1 in the subject lines)- please make sure you follow the
> instructions from
> https://github.com/tianocore/tianocore.github.io/wiki/Laszlo%27s-unkempt-git-guide-for-edk2-contributors-and-maintainers
> when generating patches.
Sure leif, I will send a new patch series starting with v1 early next
week sometime.
>
> /
>     Leif
>
> On Tue, Dec 29, 2020 at 12:55:57 +0530, Vikas Singh wrote:
> > This patch series sets the foundation of Dynamic ACPI framework
> > for fsl layerscape platforms.
> > In order to achieve :
> >  - Configurable firmware builds.
> >  - Unify firmware build for similar platforms.
> >  - Minimize/eliminate human induced errors.
> >  - Ability to validate, and generate firmware that complies with
> >    relevant specifications
> > this change set introduced following changes in below defined order
> > under edk2-platforms/NXP for LX2160ARDB.
> >
> > (1) Introduced edk2-platforms/NXP/ConfigurationManager
> >     It creates the platform repositories dynamically during build time and
> >     initializes with platform specific information and serves all requestes
> >     from OEM/standard firmware table generators.
> >     This Configuration Manager will be common for all fsl platforms.
> >
> > (2) Introduced edk2-platforms/NXP/LX2160ARDB/Include/Platform.h
> >     It has all the declarations & definitions specified for the platforms.
> >     These macros will be consumed by Configuration Manager.
> >     Additionally the placement of this header under "Include" dir will make
> >     these macro's availale to other translation units of the platform built.
> >
> > (3) Introduced edk2-platforms/NXP/LX2160ARDB/AcpiTablesInclude
> >     This is a placeholder for - OEM specific firmware acpi table generators.
> >     This also holds IP specific - DSDT/SSDT generators for the OEM's platform.
> >     Currently Dsdt.asl is a place holder having only platform's clock related
> >     dsdt properties for LX2160ARDB but it is intended to extend this Dsdt.asl
> >     to hold other table as well in next patch series.
> >
> > (4) Introduced a new "DYNAMIC_ACPI_ENABLE" flag to control DACPI framework for
> >     LX2160ARDB platform.
> >     By default it is enabled and can extend to other fsl platforms in future.
> >     Changes can be referred under :
> >       - LX2160ARDb.dsc
> >       - LX2160ARDB.fdf
> >
> > (5) Introduced a "build.sh" script under edk2-platforms/NXP/ to automate the
> >     fsl platforms build system. And also mandatorily need to support Dynamic
> >     ACPI framework for fsl platforms. It exports build environment variables
> >     and also invokes "Env.cshrc".
> >
> > Vikas Singh (1):
> >   Platform/NXP: Add Dynamic Acpi for layerscape platforms
> >
> >  .../ConfigurationManager/ConfigurationManager.dec  |  24 +
> >  .../ConfigurationManager.dsc.inc                   |  21 +
> >  .../ConfigurationManagerDxe/ConfigurationManager.c | 709 +++++++++++++++++++++
> >  .../ConfigurationManagerDxe/ConfigurationManager.h | 229 +++++++
> >  .../ConfigurationManagerDxe.inf                    |  52 ++
> >  .../Include/PlatformAcpiTableGenerator.h           |  20 +
> >  Platform/NXP/Env.cshrc                             |  73 +++
> >  .../LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl   |  40 ++
> >  .../LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl  |  15 +
> >  .../AcpiTablesInclude/PlatformAcpiDsdtLib.inf      |  39 ++
> >  .../PlatformAcpiDsdtLib/RawDsdtGenerator.c         | 146 +++++
> >  .../AcpiTablesInclude/PlatformAcpiLib.h            |  24 +
> >  Platform/NXP/LX2160aRdbPkg/Include/Platform.h      | 244 +++++++
> >  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec       |   6 +-
> >  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc       |  30 +
> >  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf       |  12 +
> >  Platform/NXP/build.sh                              | 121 ++++
> >  17 files changed, 1804 insertions(+), 1 deletion(-)
> >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManager.dec
> >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManager.dsc.inc
> >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
> >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
> >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
> >  create mode 100644 Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h
> >  create mode 100755 Platform/NXP/Env.cshrc
> >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl
> >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl
> >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
> >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c
> >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiLib.h
> >  create mode 100644 Platform/NXP/LX2160aRdbPkg/Include/Platform.h
> >  create mode 100755 Platform/NXP/build.sh
> >
> > --
> > 2.7.4
> >

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

* Re: [PATCH v0] Platform/NXP: Add Dynamic Acpi for layerscape platforms
  2021-01-10  3:26   ` Leif Lindholm
@ 2021-01-16  4:45     ` Vikas Singh
  2021-01-18 16:55       ` Leif Lindholm
  0 siblings, 1 reply; 12+ messages in thread
From: Vikas Singh @ 2021-01-16  4:45 UTC (permalink / raw)
  To: Leif Lindholm
  Cc: devel, Sami Mujawar, meenakshi.aggarwal, Paul Yang,
	Augustine Philips, samer.el-haj-mahmoud, Varun Sethi, Arokia Samy,
	Kuldip Dwivedi, ard.biesheuvel, Vikas Singh

On Sun, Jan 10, 2021 at 8:56 AM Leif Lindholm <leif@nuviainc.com> wrote:
>
> On Tue, Dec 29, 2020 at 12:55:58 +0530, Vikas Singh wrote:
> > These changes intend to add
>
> Hopefully they actually do.
>
> > - Common Configuration Manager (CM) for all fsl platforms.
> > - Platform headers consumed by CM for LX2160ARDB.
> > - Clk dsdt properties for LX2160ARDB.
>
> This sounds like (at least) three patches.
>
Leif, I plan to disintegrate the complete changes into 2 patch set's
and will be sharing this series early next week.
set1: Add Common Configuration Manager (CM) for all fsl platforms and
headers consumed by CM for LX2160ARDB.
set2: Add platform specific DSDT generator and Clk dsdt properties for
LX2160ARDB.

> >
> > Signed-off-by: Vikas Singh <vikas.singh@puresoftware.com>
> > ---
> >  .../ConfigurationManager/ConfigurationManager.dec  |  24 +
> >  .../ConfigurationManager.dsc.inc                   |  21 +
> >  .../ConfigurationManagerDxe/ConfigurationManager.c | 709 +++++++++++++++++++++
> >  .../ConfigurationManagerDxe/ConfigurationManager.h | 229 +++++++
> >  .../ConfigurationManagerDxe.inf                    |  52 ++
> >  .../Include/PlatformAcpiTableGenerator.h           |  20 +
> >  Platform/NXP/Env.cshrc                             |  73 +++
> >  .../LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl   |  40 ++
> >  .../LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl  |  15 +
> >  .../AcpiTablesInclude/PlatformAcpiDsdtLib.inf      |  39 ++
> >  .../PlatformAcpiDsdtLib/RawDsdtGenerator.c         | 146 +++++
> >  .../AcpiTablesInclude/PlatformAcpiLib.h            |  24 +
> >  Platform/NXP/LX2160aRdbPkg/Include/Platform.h      | 244 +++++++
> >  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec       |   6 +-
> >  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc       |  30 +
> >  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf       |  12 +
> >  Platform/NXP/build.sh                              | 121 ++++
> >  17 files changed, 1804 insertions(+), 1 deletion(-)
> >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManager.dec
> >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManager.dsc.inc
> >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
> >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
> >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
> >  create mode 100644 Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h
> >  create mode 100755 Platform/NXP/Env.cshrc
> >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl
> >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl
> >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
> >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c
> >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiLib.h
> >  create mode 100644 Platform/NXP/LX2160aRdbPkg/Include/Platform.h
> >  create mode 100755 Platform/NXP/build.sh
> >
> > diff --git a/Platform/NXP/ConfigurationManager/ConfigurationManager.dec b/Platform/NXP/ConfigurationManager/ConfigurationManager.dec
> > new file mode 100644
> > index 0000000..8de2d7f
> > --- /dev/null
> > +++ b/Platform/NXP/ConfigurationManager/ConfigurationManager.dec
> > @@ -0,0 +1,24 @@
> > +#  ConfigurationManager.dec
> > +#
> > +#  Copyright 2020 NXP
> > +#  Copyright 2020 Puresoftware Ltd
> > +#
> > +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +#
> > +
> > +[Defines]
> > +  PACKAGE_NAME                   = ConfigurationManager
>
> If it has a .dec, should it be ConfigurationManagerPkg?
>
Yes, I will update this.

> > +  PACKAGE_GUID                   = 0222b1b1-247f-404e-bdc3-baab65f2ddd3
> > +
> > +################################################################################
> > +#
> > +# Include Section - list of Include Paths that are provided by this package.
> > +#                   Comments are used for Keywords and Module Types.
> > +#
> > +# Supported Module Types:
> > +#  BASE SEC PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION
> > +#
> > +################################################################################
> > +[Includes]
> > +  .
>
> No.
> Why should I need to depend on ConfigurationManagerPkg to include a
> header file in the same location as my source file?
> Why would this be needed anyway?
>
Yes, agreed. Will correct this in next series.

> > +  Include
> > diff --git a/Platform/NXP/ConfigurationManager/ConfigurationManager.dsc.inc b/Platform/NXP/ConfigurationManager/ConfigurationManager.dsc.inc
> > new file mode 100644
> > index 0000000..8e6aed0
> > --- /dev/null
> > +++ b/Platform/NXP/ConfigurationManager/ConfigurationManager.dsc.inc
> > @@ -0,0 +1,21 @@
> > +## @file
> > +#  dsc include file for Configuration Manager
> > +#
> > +#  Copyright 2020 NXP
> > +#  Copyright 2020 Puresoftware Ltd
> > +#
> > +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +##
> > +
> > +[Defines]
> > +
> > +[BuildOptions]
> > +
> > +[LibraryClasses.common]
> > +
> > +[Components.common]
> > +  # Configuration Manager
> > +  Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf {
> > +    <BuildOptions>
> > +    *_*_*_PLATFORM_FLAGS = -I$(PACKAGES_PATH)/Platform/NXP/$(DYNAMIC_ACPI_PLATFORM)/Include
>
> This is not how PACKAGES_PATH works. It is a path, containing multiple
> ':'-separated directories. From looking at other platforms,
> $(WORKSPACE) might do what you want.
>
> But still, this is a .dsc.inc - it is always included from somewhere
> else. Does that platform not set up its own include paths?
>
Agreed. Will correct this.

> > +  }
> > diff --git a/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
> > new file mode 100644
> > index 0000000..6e8a4c4
> > --- /dev/null
> > +++ b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
> > @@ -0,0 +1,709 @@
> > +/** @file
> > +  Configuration Manager Dxe
> > +
> > +  Copyright 2020 NXP
> > +  Copyright 2020 Puresoftware Ltd
> > +
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +
> > +  @par Glossary:
> > +    - Cm or CM   - Configuration Manager
> > +    - Obj or OBJ - Object
> > +**/
> > +
> > +#include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>
> > +#include <IndustryStandard/SerialPortConsoleRedirectionTable.h>
> > +#include <Library/ArmLib.h>
> > +#include <Library/DebugLib.h>
> > +#include <Library/IoLib.h>
> > +#include <Library/PcdLib.h>
> > +#include <Library/UefiBootServicesTableLib.h>
> > +#include <Protocol/AcpiTable.h>
> > +#include <Protocol/ConfigurationManagerProtocol.h>
> > +
> > +/** The platform specific headers
> > +*/
> > +#include "ConfigurationManager.h"
> > +#include <Library/SocLib.h>
> > +
> > +/** The platform configuration repository information.
> > +*/
> > +STATIC
> > +EDKII_PLATFORM_REPOSITORY_INFO FslPlatformRepositoryInfo = {
> > +  /// Configuration Manager information
> > +  { CONFIGURATION_MANAGER_REVISION, CFG_MGR_OEM_ID },
> > +
> > +  // ACPI Table List
> > +  {
> > +    // FADT Table
> > +    {
> > +      EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
> > +      EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
> > +      CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt),
> > +      NULL,
> > +      CFG_MGR_TABLE_ID
> > +    },
> > +
> > +    // GTDT Table
> > +    {
> > +      EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE,
> > +      EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION,
> > +      CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdGtdt),
> > +      NULL,
> > +      CFG_MGR_TABLE_ID
> > +    },
> > +
> > +    // MADT Table
> > +    {
> > +      EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
> > +      EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION,
> > +      CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMadt),
> > +      NULL,
> > +      CFG_MGR_TABLE_ID
> > +    },
> > +
> > +    // PCI MCFG Table
> > +    {
> > +      EFI_ACPI_6_2_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE,
> > +      EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION,
> > +      CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMcfg),
> > +      NULL,
> > +      CFG_MGR_TABLE_ID
> > +    },
> > +
> > +    // SPCR Table
> > +    {
> > +      EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE,
> > +      EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_REVISION,
> > +      CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSpcr),
> > +      NULL,
> > +      CFG_MGR_TABLE_ID
> > +    },
> > +
> > +    // DSDT (OEM) Table
> > +    {
> > +      EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
> > +      0,
> > +      CREATE_OEM_ACPI_TABLE_GEN_ID (EPlatAcpiTableIdDsdt),
> > +      NULL,
> > +      CFG_MGR_TABLE_ID
> > +    }
> > +
> > +  },
> > +
> > +  // Boot architecture information
> > +  { EFI_ACPI_6_2_ARM_PSCI_COMPLIANT },        // BootArchFlags
> > +
> > +  // Power management profile information
> > +  { EFI_ACPI_6_2_PM_PROFILE_ENTERPRISE_SERVER }, // PowerManagement Profile
> > +
> > +  // Generic Timer Info
> > +  {
> > +    // The physical base address for the counter control frame
> > +    TIMER_BASE_ADDRESS,
> > +    // The physical base address for the counter read frame
> > +    TIMER_READ_BASE_ADDRESS,
> > +    // The secure PL1 timer interrupt
> > +    TIMER_SEC_IT,
> > +    // The secure PL1 timer flags
> > +    GTDT_GTIMER_FLAGS,
> > +    // The non-secure PL1 timer interrupt
> > +    TIMER_NON_SEC_IT,
> > +    // The non-secure PL1 timer flags
> > +    GTDT_GTIMER_FLAGS,
> > +    // The virtual timer interrupt
> > +    TIMER_VIRT_IT,
> > +    // The virtual timer flags
> > +    GTDT_GTIMER_FLAGS,
> > +    // The non-secure PL2 timer interrupt
> > +    TIMER_HYP_IT,
> > +    // The non-secure PL2 timer flags
> > +    GTDT_GTIMER_FLAGS
> > +  },
> > +
> > +  // Generic Timer Block Information
> > +  PLAT_TIMER_BLOCK_INFO,
> > +
> > +  // GTDT Frames
> > +  PLAT_TIMER_FRAME_INFO,
> > +
> > +  // Watchdog info
> > +  PLAT_WATCHDOG_INFO,
> > +
> > +  // GIC CPU Interface information
> > +  PLAT_GIC_CPU_INTERFACE,
> > +
> > +  // GIC Distributor Info
> > +  PLAT_GIC_DISTRIBUTOR_INFO,
> > +
> > +  // GIC Redistributor
> > +  PLAT_GIC_REDISTRIBUTOR_INFO,
> > +
> > +  // GIC ITS
> > +  PLAT_GIC_ITS_INFO,
> > +
> > +  // MCFG Info
> > +  PLAT_MCFG_INFO,
> > +
> > +  // SPCR Info
> > +  PLAT_SPCR_INFO,
> > +
> > +  2.0                                         // fsl board revision
> > +};
> > +
> > +/** Initialize the platform configuration repository.
> > +
> > +  @param [in]  This     Pointer to the Configuration Manager Protocol.
> > +
> > +  @retval EFI_SUCCESS   Success
> > +**/
> > +STATIC
> > +EFI_STATUS
> > +EFIAPI
> > +InitializePlatformRepository (
> > +  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This
> > +  )
> > +{
> > +  EDKII_PLATFORM_REPOSITORY_INFO  * PlatformRepo;
> > +  UINT32 Svr;
> > +
> > +  PlatformRepo = This->PlatRepoInfo;
> > +
> > +  Svr = SocGetSvr ();
> > +  if (SVR_SOC_VER(Svr) == SVR_LX2160A) {
> > +    PlatformRepo->FslBoardRevision = SVR_MAJOR(Svr);
> > +    DEBUG ((DEBUG_INFO, "Fsl : SoC LX2160A Rev = 0x%x\n", PlatformRepo->FslBoardRevision));
> > +  } else {
> > +    DEBUG ((DEBUG_INFO, "Fsl : SoC Unknown Rev = 0x%x\n", PlatformRepo->FslBoardRevision));
> > +  }
> > +
> > +  return EFI_SUCCESS;
> > +}
> > +
> > +/** Return PCI Configuration Info.
> > +  @param [in]      This           Pointer to the Configuration Manager Protocol.
> > +  @param [in]      CmObjectId     The Object ID of the CM object requested
> > +  @param [in]      Token          A unique token for identifying the requested
> > +                                  CM_ARM_PCI_INFO object.
> > +  @param [in, out] CmObject       Pointer to the Configuration Manager Object
> > +                                  descriptor describing the requested Object.
> > +  @retval EFI_SUCCESS             Success.
> > +  @retval EFI_INVALID_PARAMETER   A parameter is invalid.
> > +  @retval EFI_NOT_FOUND           The required object information is
> > +  not found.
> > + **/
> > +EFI_STATUS
> > +EFIAPI
> > +GetPciConfigInfo (
> > +    IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
> > +    IN  CONST CM_OBJECT_ID                                  CmObjectId,
> > +    IN  CONST CM_OBJECT_TOKEN                               Token,
> > +    IN  OUT   CM_OBJ_DESCRIPTOR                     * CONST CmObject
> > +    )
> > +{
> > +  EDKII_PLATFORM_REPOSITORY_INFO  * PlatformRepo;
> > +  UINT32                            TotalObjCount;
> > +  UINT32                            ObjIndex;
> > +
> > +  if ((This == NULL) || (CmObject == NULL)) {
> > +    ASSERT (This != NULL);
> > +    ASSERT (CmObject != NULL);
> > +    return EFI_INVALID_PARAMETER;
> > +  }
> > +
> > +  PlatformRepo = This->PlatRepoInfo;
> > +
> > +  TotalObjCount = ARRAY_SIZE (PlatformRepo->PciConfigInfo);
> > +
> > +  for (ObjIndex = 0; ObjIndex < TotalObjCount; ObjIndex++) {
> > +    if (Token == (CM_OBJECT_TOKEN)&PlatformRepo->PciConfigInfo[ObjIndex])
> > +    {
> > +      CmObject->ObjectId = CmObjectId;
> > +      CmObject->Size = sizeof (PlatformRepo->PciConfigInfo[ObjIndex]);
> > +      CmObject->Data = (VOID*)&PlatformRepo->PciConfigInfo[ObjIndex];
> > +      CmObject->Count = 1;
> > +      return EFI_SUCCESS;
> > +    }
> > +  }
> > +
> > +  return EFI_NOT_FOUND;
> > +}
> > +
> > +/** Return GIC CPU Interface Info.
> > +  @param [in]      This           Pointer to the Configuration Manager Protocol.
> > +  @param [in]      CmObjectId     The Object ID of the CM object requested
> > +  @param [in]      Token          A unique token for identifying the requested
> > +                                  CM_ARM_GICC_INFO object.
> > +  @param [in, out] CmObject       Pointer to the Configuration Manager Object
> > +                                  descriptor describing the requested Object.
> > +  @retval EFI_SUCCESS             Success.
> > +  @retval EFI_INVALID_PARAMETER   A parameter is invalid.
> > +  @retval EFI_NOT_FOUND           The required object information is
> > +  not found.
> > + **/
> > +EFI_STATUS
> > +EFIAPI
> > +GetGicCInfo (
> > +    IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
> > +    IN  CONST CM_OBJECT_ID                                  CmObjectId,
> > +    IN  CONST CM_OBJECT_TOKEN                               Token,
> > +    IN  OUT   CM_OBJ_DESCRIPTOR                     * CONST CmObject
> > +    )
> > +{
> > +  EDKII_PLATFORM_REPOSITORY_INFO  * PlatformRepo;
> > +
> > +  if ((This == NULL) || (CmObject == NULL)) {
> > +    ASSERT (This != NULL);
> > +    ASSERT (CmObject != NULL);
> > +    return EFI_INVALID_PARAMETER;
> > +  }
> > +
> > +  PlatformRepo = This->PlatRepoInfo;
> > +
> > +  if (Token != (CM_OBJECT_TOKEN)&PlatformRepo->GicCInfo) {
> > +    return EFI_NOT_FOUND;
> > +  }
> > +
> > +  CmObject->ObjectId = CmObjectId;
> > +  CmObject->Size = sizeof (PlatformRepo->GicCInfo);
> > +  CmObject->Data = (VOID*)&PlatformRepo->GicCInfo;
> > +  CmObject->Count = sizeof (PlatformRepo->GicCInfo) /
> > +                      sizeof (PlatformRepo->GicCInfo[0]);
>
> Use ARRAY_SIZE macro.
>
Yes, will update.

> > +  return EFI_SUCCESS;
> > +}
> > +
> > +/** Return a GT Block timer frame info list.
> > +  @param [in]      This         Pointer to the Configuration Manager Protocol.
> > +  @param [in]      CmObjectId   The Configuration Manager Object ID.
> > +  @param [in]      Token        A token for identifying the object
> > +  @param [in, out] CmObject     Pointer to the Configuration Manager Object
> > +                                descriptor describing the requested Object.
> > +  @retval EFI_SUCCESS           Success.
> > +  @retval EFI_INVALID_PARAMETER A parameter is invalid.
> > +  @retval EFI_NOT_FOUND         The required object information is not found.
> > + **/
> > +EFI_STATUS
> > +  EFIAPI
> > +GetGTBlockTimerFrameInfo (
> > +    IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
> > +    IN  CONST CM_OBJECT_ID                                  CmObjectId,
> > +    IN  CONST CM_OBJECT_TOKEN                               Token,
> > +    IN  OUT   CM_OBJ_DESCRIPTOR                     * CONST CmObject
> > +    )
> > +{
> > +  EDKII_PLATFORM_REPOSITORY_INFO  * PlatformRepo;
> > +
> > +  if ((This == NULL) || (CmObject == NULL)) {
> > +    ASSERT (This != NULL);
> > +    ASSERT (CmObject != NULL);
> > +    return EFI_INVALID_PARAMETER;
> > +  }
> > +
> > +  PlatformRepo = This->PlatRepoInfo;
> > +
> > +  if (Token != (CM_OBJECT_TOKEN)&PlatformRepo->GTBlock0TimerInfo) {
> > +    return EFI_NOT_FOUND;
> > +  }
> > +
> > +  CmObject->ObjectId = CmObjectId;
> > +  CmObject->Size = sizeof (PlatformRepo->GTBlock0TimerInfo);
> > +  CmObject->Data = (VOID*)&PlatformRepo->GTBlock0TimerInfo;
> > +  CmObject->Count = sizeof (PlatformRepo->GTBlock0TimerInfo) /
> > +                      sizeof (PlatformRepo->GTBlock0TimerInfo[0]);
>
> Use ARRAY_SIZE macro.
>
Yes, will update.

> > +  return EFI_SUCCESS;
> > +}
> > +
> > +/** Return a standard namespace object.
> > +
> > +  @param [in]      This        Pointer to the Configuration Manager Protocol.
> > +  @param [in]      CmObjectId  The Configuration Manager Object ID.
> > +  @param [in]      Token       An optional token identifying the object. If
> > +                               unused this must be CM_NULL_TOKEN.
> > +  @param [in, out] CmObject    Pointer to the Configuration Manager Object
> > +                               descriptor describing the requested Object.
> > +
> > +  @retval EFI_SUCCESS           Success.
> > +  @retval EFI_INVALID_PARAMETER A parameter is invalid.
> > +  @retval EFI_NOT_FOUND         The required object information is not found.
> > +**/
> > +EFI_STATUS
> > +EFIAPI
> > +GetStandardNameSpaceObject (
> > +  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
> > +  IN  CONST CM_OBJECT_ID                                  CmObjectId,
> > +  IN  CONST CM_OBJECT_TOKEN                               Token OPTIONAL,
> > +  IN  OUT   CM_OBJ_DESCRIPTOR                     * CONST CmObject
> > +  )
> > +{
> > +  EFI_STATUS                        Status;
> > +  EDKII_PLATFORM_REPOSITORY_INFO  * PlatformRepo;
> > +  UINT32                            TableCount;
> > +
> > +  Status = EFI_SUCCESS;
> > +  if ((This == NULL) || (CmObject == NULL)) {
> > +    ASSERT (This != NULL);
> > +    ASSERT (CmObject != NULL);
> > +    return EFI_INVALID_PARAMETER;
> > +  }
> > +  PlatformRepo = This->PlatRepoInfo;
> > +
> > +  switch (GET_CM_OBJECT_ID (CmObjectId)) {
> > +    HANDLE_CM_OBJECT (
> > +      EStdObjCfgMgrInfo,
> > +      CmObjectId,
> > +      PlatformRepo->CmInfo,
> > +      1
> > +      );
> > +
> > +    case EStdObjAcpiTableList:
> > +      CmObject->ObjectId = CmObjectId;
> > +      TableCount = sizeof (PlatformRepo->CmAcpiTableList) /
> > +                     sizeof (PlatformRepo->CmAcpiTableList[0]);
>
> Use ARRAY_SIZE macro.
>
Yes, will update.

> > +      CmObject->Data = (VOID*)&PlatformRepo->CmAcpiTableList;
> > +      CmObject->Size = sizeof (PlatformRepo->CmAcpiTableList);
> > +      CmObject->Count = TableCount;
> > +      DEBUG ((
> > +        DEBUG_INFO,
> > +        "EStdObjAcpiTableList: Ptr = 0x%p. Size = %d, Count = %d\n",
> > +        CmObject->Data,
> > +        CmObject->Size,
> > +        CmObject->Count
> > +        ));
> > +      break;
> > +
> > +    default: {
> > +      Status = EFI_NOT_FOUND;
> > +      DEBUG ((
> > +        DEBUG_ERROR,
> > +        "ERROR: Object 0x%x. Status = %r\n",
> > +        CmObjectId,
> > +        Status
> > +        ));
> > +      break;
> > +    }
> > +  }
> > +
> > +  return Status;
> > +}
> > +
> > +/** Return an ARM namespace object.
> > +
> > +  @param [in]      This        Pointer to the Configuration Manager Protocol.
> > +  @param [in]      CmObjectId  The Configuration Manager Object ID.
> > +  @param [in]      Token       An optional token identifying the object. If
> > +                               unused this must be CM_NULL_TOKEN.
> > +  @param [in, out] CmObject    Pointer to the Configuration Manager Object
> > +                               descriptor describing the requested Object.
> > +
> > +  @retval EFI_SUCCESS           Success.
> > +  @retval EFI_INVALID_PARAMETER A parameter is invalid.
> > +  @retval EFI_NOT_FOUND         The required object information is not found.
> > +**/
> > +EFI_STATUS
> > +EFIAPI
> > +GetArmNameSpaceObject (
> > +  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
> > +  IN  CONST CM_OBJECT_ID                                  CmObjectId,
> > +  IN  CONST CM_OBJECT_TOKEN                               Token OPTIONAL,
> > +  IN  OUT   CM_OBJ_DESCRIPTOR                     * CONST CmObject
> > +  )
> > +{
> > +  EFI_STATUS                        Status;
> > +  EDKII_PLATFORM_REPOSITORY_INFO  * PlatformRepo;
> > +
> > +  Status = EFI_SUCCESS;
> > +  if ((This == NULL) || (CmObject == NULL)) {
> > +    ASSERT (This != NULL);
> > +    ASSERT (CmObject != NULL);
> > +    return EFI_INVALID_PARAMETER;
> > +  }
> > +  PlatformRepo = This->PlatRepoInfo;
> > +
> > +  switch (GET_CM_OBJECT_ID (CmObjectId)) {
> > +    HANDLE_CM_OBJECT (
> > +      EArmObjBootArchInfo,
> > +      CmObjectId,
> > +      PlatformRepo->BootArchInfo,
> > +      1
> > +      );
> > +    HANDLE_CM_OBJECT (
> > +      EArmObjPowerManagementProfileInfo,
> > +      CmObjectId,
> > +      PlatformRepo->PmProfileInfo,
> > +      1
> > +      );
> > +    HANDLE_CM_OBJECT (
> > +        EArmObjGenericTimerInfo,
> > +        CmObjectId,
> > +        PlatformRepo->GenericTimerInfo,
> > +        1
> > +        );
> > +    HANDLE_CM_OBJECT (
> > +        EArmObjPlatformGenericWatchdogInfo,
> > +        CmObjectId,
> > +        PlatformRepo->Watchdog,
> > +        PLAT_WATCHDOG_COUNT
> > +        );
> > +    HANDLE_CM_OBJECT (
> > +        EArmObjPlatformGTBlockInfo,
> > +        CmObjectId,
> > +        PlatformRepo->GTBlockInfo,
> > +        (sizeof (PlatformRepo->GTBlockInfo) /
> > +         sizeof (PlatformRepo->GTBlockInfo[0]))
>
> Use ARRAY_SIZE macro.
>
Yes, will update.

> > +        );
> > +    HANDLE_CM_OBJECT_REF_BY_TOKEN (
> > +        EArmObjGTBlockTimerFrameInfo,
> > +        CmObjectId,
> > +        PlatformRepo->GTBlock0TimerInfo,
> > +        (sizeof (PlatformRepo->GTBlock0TimerInfo) /
> > +         sizeof (PlatformRepo->GTBlock0TimerInfo[0])),
>
> Use ARRAY_SIZE macro.
>
Yes, will update.

> > +        Token,
> > +        GetGTBlockTimerFrameInfo
> > +        );
> > +    HANDLE_CM_OBJECT_REF_BY_TOKEN (
> > +        EArmObjGicCInfo,
> > +        CmObjectId,
> > +        PlatformRepo->GicCInfo,
> > +        ARRAY_SIZE (PlatformRepo->GicCInfo),
> > +        Token,
> > +        GetGicCInfo
> > +        );
> > +    HANDLE_CM_OBJECT (
> > +        EArmObjGicDInfo,
> > +        CmObjectId,
> > +        PlatformRepo->GicDInfo,
> > +        1
> > +        );
> > +    HANDLE_CM_OBJECT (
> > +        EArmObjGicRedistributorInfo,
> > +        CmObjectId,
> > +        PlatformRepo->GicRedistInfo,
> > +        PLAT_GIC_REDISTRIBUTOR_COUNT
> > +        );
> > +    HANDLE_CM_OBJECT (
> > +        EArmObjGicItsInfo,
> > +        CmObjectId,
> > +        PlatformRepo->GicItsInfo,
> > +        PLAT_GIC_ITS_COUNT
> > +        );
> > +    HANDLE_CM_OBJECT_REF_BY_TOKEN (
> > +        EArmObjPciConfigSpaceInfo,
> > +        CmObjectId,
> > +        PlatformRepo->PciConfigInfo,
> > +        (sizeof (PlatformRepo->PciConfigInfo) /
> > +         sizeof (PlatformRepo->PciConfigInfo[0])),
>
> Use ARRAY_SIZE macro.
>
Yes, will update.

> > +        Token,
> > +        GetPciConfigInfo
> > +        );
> > +    HANDLE_CM_OBJECT (
> > +        EArmObjSerialConsolePortInfo,
> > +        CmObjectId,
> > +        PlatformRepo->SpcrSerialPort,
> > +        1
> > +        );
> > +    default: {
> > +      Status = EFI_NOT_FOUND;
> > +      DEBUG ((
> > +        DEBUG_INFO,
> > +        "INFO: Object 0x%x. Status = %r\n",
> > +        CmObjectId,
> > +        Status
> > +        ));
> > +      break;
> > +    }
> > +  }//switch
> > +
> > +  return Status;
> > +}
> > +
> > +/** Return an OEM namespace object.
> > +
> > +  @param [in]      This        Pointer to the Configuration Manager Protocol.
> > +  @param [in]      CmObjectId  The Configuration Manager Object ID.
> > +  @param [in]      Token       An optional token identifying the object. If
> > +                               unused this must be CM_NULL_TOKEN.
> > +  @param [in, out] CmObject    Pointer to the Configuration Manager Object
> > +                               descriptor describing the requested Object.
> > +
> > +  @retval EFI_SUCCESS           Success.
> > +  @retval EFI_INVALID_PARAMETER A parameter is invalid.
> > +  @retval EFI_NOT_FOUND         The required object information is not found.
> > +**/
> > +EFI_STATUS
> > +EFIAPI
> > +GetOemNameSpaceObject (
> > +  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
> > +  IN  CONST CM_OBJECT_ID                                  CmObjectId,
> > +  IN  CONST CM_OBJECT_TOKEN                               Token OPTIONAL,
> > +  IN  OUT   CM_OBJ_DESCRIPTOR                     * CONST CmObject
> > +  )
> > +{
> > +  EFI_STATUS  Status;
> > +
> > +  Status = EFI_SUCCESS;
> > +  if ((This == NULL) || (CmObject == NULL)) {
> > +    ASSERT (This != NULL);
> > +    ASSERT (CmObject != NULL);
> > +    return EFI_INVALID_PARAMETER;
> > +  }
> > +
> > +  switch (GET_CM_OBJECT_ID (CmObjectId)) {
> > +    default: {
> > +      Status = EFI_NOT_FOUND;
> > +      DEBUG ((
> > +        DEBUG_ERROR,
> > +        "ERROR: Object 0x%x. Status = %r\n",
> > +        CmObjectId,
> > +        Status
> > +        ));
> > +      break;
> > +    }
> > +  }
> > +
> > +  return Status;
> > +}
> > +
> > +/** The GetObject function defines the interface implemented by the
> > +    Configuration Manager Protocol for returning the Configuration
> > +    Manager Objects.
> > +
> > +  @param [in]      This        Pointer to the Configuration Manager Protocol.
> > +  @param [in]      CmObjectId  The Configuration Manager Object ID.
> > +  @param [in]      Token       An optional token identifying the object. If
> > +                               unused this must be CM_NULL_TOKEN.
> > +  @param [in, out] CmObject    Pointer to the Configuration Manager Object
> > +                               descriptor describing the requested Object.
> > +
> > +  @retval EFI_SUCCESS           Success.
> > +  @retval EFI_INVALID_PARAMETER A parameter is invalid.
> > +  @retval EFI_NOT_FOUND         The required object information is not found.
> > +**/
> > +EFI_STATUS
> > +EFIAPI
> > +FslPlatformGetObject (
> > +  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
> > +  IN  CONST CM_OBJECT_ID                                  CmObjectId,
> > +  IN  CONST CM_OBJECT_TOKEN                               Token OPTIONAL,
> > +  IN  OUT   CM_OBJ_DESCRIPTOR                     * CONST CmObject
> > +  )
> > +{
> > +  EFI_STATUS  Status;
> > +
> > +  if ((This == NULL) || (CmObject == NULL)) {
> > +    ASSERT (This != NULL);
> > +    ASSERT (CmObject != NULL);
> > +    return EFI_INVALID_PARAMETER;
> > +  }
> > +
> > +  switch (GET_CM_NAMESPACE_ID (CmObjectId)) {
> > +    case EObjNameSpaceStandard:
> > +      Status = GetStandardNameSpaceObject (This, CmObjectId, Token, CmObject);
> > +      break;
> > +    case EObjNameSpaceArm:
> > +      Status = GetArmNameSpaceObject (This, CmObjectId, Token, CmObject);
> > +      break;
> > +    case EObjNameSpaceOem:
> > +      Status = GetOemNameSpaceObject (This, CmObjectId, Token, CmObject);
> > +      break;
> > +    default: {
> > +      Status = EFI_INVALID_PARAMETER;
> > +      DEBUG ((
> > +        DEBUG_ERROR,
> > +        "ERROR: Unknown Namespace Object = 0x%x. Status = %r\n",
> > +        CmObjectId,
> > +        Status
> > +        ));
> > +      break;
> > +    }
> > +  }
> > +
> > +  return Status;
> > +}
> > +
> > +/** The SetObject function defines the interface implemented by the
> > +    Configuration Manager Protocol for updating the Configuration
> > +    Manager Objects.
> > +
> > +  @param [in]      This        Pointer to the Configuration Manager Protocol.
> > +  @param [in]      CmObjectId  The Configuration Manager Object ID.
> > +  @param [in]      Token       An optional token identifying the object. If
> > +                               unused this must be CM_NULL_TOKEN.
> > +  @param [in]      CmObject    Pointer to the Configuration Manager Object
> > +                               descriptor describing the Object.
> > +
> > +  @retval EFI_UNSUPPORTED  This operation is not supported.
> > +**/
> > +EFI_STATUS
> > +EFIAPI
> > +FslPlatformSetObject (
> > +  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
> > +  IN  CONST CM_OBJECT_ID                                  CmObjectId,
> > +  IN  CONST CM_OBJECT_TOKEN                               Token OPTIONAL,
> > +  IN        CM_OBJ_DESCRIPTOR                     * CONST CmObject
> > +  )
> > +{
> > +  return EFI_UNSUPPORTED;
> > +}
> > +
> > +/** A structure describing the configuration manager protocol interface.
> > +*/
> > +STATIC
> > +CONST
> > +EDKII_CONFIGURATION_MANAGER_PROTOCOL FslConfigManagerProtocol = {
> > +  CREATE_REVISION (1, 0),
> > +  FslPlatformGetObject,
> > +  FslPlatformSetObject,
> > +  &FslPlatformRepositoryInfo
> > +};
> > +
> > +/**
> > +  Entrypoint of Configuration Manager Dxe.
> > +
> > +  @param  ImageHandle
> > +  @param  SystemTable
> > +
> > +  @return EFI_SUCCESS
> > +  @return EFI_LOAD_ERROR
> > +  @return EFI_OUT_OF_RESOURCES
> > +
> > +**/
> > +EFI_STATUS
> > +EFIAPI
> > +ConfigurationManagerDxeInitialize (
> > +  IN EFI_HANDLE          ImageHandle,
> > +  IN EFI_SYSTEM_TABLE  * SystemTable
> > +  )
> > +{
> > +  EFI_STATUS  Status;
> > +
> > +  Status = gBS->InstallProtocolInterface (
> > +                  &ImageHandle,
> > +                  &gEdkiiConfigurationManagerProtocolGuid,
> > +                  EFI_NATIVE_INTERFACE,
> > +                  (VOID*)&FslConfigManagerProtocol
> > +                  );
> > +  if (EFI_ERROR (Status)) {
> > +    DEBUG ((
> > +      DEBUG_ERROR,
> > +      "ERROR: Failed to get Install Configuration Manager Protocol." \
> > +      " Status = %r\n",
> > +      Status
> > +      ));
> > +    goto error_handler;
> > +  }
> > +
> > +  Status = InitializePlatformRepository (
> > +    &FslConfigManagerProtocol
> > +    );
> > +  if (EFI_ERROR (Status)) {
> > +    DEBUG ((
> > +      DEBUG_ERROR,
> > +      "ERROR: Failed to initialize the Platform Configuration Repository." \
> > +      " Status = %r\n",
> > +      Status
> > +      ));
> > +  }
> > +
> > +error_handler:
> > +  return Status;
> > +}
> > diff --git a/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
> > new file mode 100644
> > index 0000000..cf09ef9
> > --- /dev/null
> > +++ b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
> > @@ -0,0 +1,229 @@
> > +/** @file
> > +  Configuration Manager headers
> > +
> > +  Copyright 2020 NXP
> > +  Copyright 2020 Puresoftware Ltd
> > +
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +
> > +  @par Glossary:
> > +    - Cm or CM   - Configuration Manager
> > +    - Obj or OBJ - Object
> > +**/
> > +
> > +#ifndef CONFIGURATION_MANAGER_H__
> > +#define CONFIGURATION_MANAGER_H__
> > +
> > +#include <Platform.h>
> > +#include <PlatformAcpiTableGenerator.h>
> > +
> > +/** The configuration manager version
> > +*/
> > +#define CONFIGURATION_MANAGER_REVISION CREATE_REVISION (0, 0)
> > +
> > +/** The OEM ID
> > +*/
> > +#define CFG_MGR_OEM_ID    { 'N', 'X', 'P', ' ', ' ', ' ' }
> > +
> > +/** A helper macro for populating the GIC CPU information
> > + */
> > +#define GICC_ENTRY(                                                   \
> > +    CPUInterfaceNumber,                                               \
> > +    Mpidr,                                                            \
> > +    PmuIrq,                                                           \
> > +    VGicIrq,                                                          \
> > +    EnergyEfficiency                                                  \
> > +    ) {                                                               \
> > +  CPUInterfaceNumber,       /* UINT32  CPUInterfaceNumber         */  \
> > +  CPUInterfaceNumber,       /* UINT32  AcpiProcessorUid           */  \
> > +  EFI_ACPI_6_2_GIC_ENABLED, /* UINT32  Flags                      */  \
> > +  0,                        /* UINT32  ParkingProtocolVersion     */  \
> > +  PmuIrq,                   /* UINT32  PerformanceInterruptGsiv   */  \
> > +  0,                        /* UINT64  ParkedAddress              */  \
> > +  GICC_BASE,                /* UINT64  PhysicalBaseAddress        */  \
> > +  GICV_BASE,                /* UINT64  GICV                       */  \
> > +  GICH_BASE,                /* UINT64  GICH                       */  \
> > +  VGicIrq,                  /* UINT32  VGICMaintenanceInterrupt   */  \
> > +  0,                        /* UINT64  GICRBaseAddress            */  \
> > +  Mpidr,                    /* UINT64  MPIDR                      */  \
> > +  EnergyEfficiency          /* UINT8   ProcessorPowerEfficiency   */  \
> > +}
> > +
> > +/** A helper macro for returning configuration manager objects
> > +*/
> > +#define HANDLE_CM_OBJECT(ObjId, CmObjectId, Object, ObjectCount)      \
> > +  case ObjId: {                                                       \
> > +    CmObject->ObjectId = CmObjectId;                                  \
> > +    CmObject->Size = sizeof (Object);                                 \
> > +    CmObject->Data = (VOID*)&Object;                                  \
> > +    CmObject->Count = ObjectCount;                                    \
> > +    DEBUG ((                                                          \
> > +      DEBUG_INFO,                                                     \
> > +      #CmObjectId ": Ptr = 0x%p, Size = %d, Count = %d\n",            \
> > +      CmObject->Data,                                                 \
> > +      CmObject->Size,                                                 \
> > +      CmObject->Count                                                 \
> > +      ));                                                             \
> > +    break;                                                            \
> > +  }
>
> This is code obfuscation. Please don't invent your own programming
> languages. In C, the case, the start bracket, the break and the end
> bracket always go inline.
> The rest would be better as a static helper function than a macro.
>
Leif, changes are in accordance with :
https://raw.githubusercontent.com/tianocore-docs/Docs/master/Specifications/CCS_2_1_Draft.pdf
and in reference to :
https://github.com/tianocore/edk2-platforms/blob/master/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h#L94
These macros are in simpleset form. However i will try to move some of
the logic to a static function, but this will again lead to duplicacy.

> > +
> > +/** A helper macro for returning configuration manager objects
> > +    referenced by token
> > +*/
> > +#define HANDLE_CM_OBJECT_REF_BY_TOKEN(                                      \
>
> See comment above.
>
> > +          ObjId,                                                            \
> > +          CmObjectId,                                                       \
> > +          Object,                                                           \
> > +          ObjectCount,                                                      \
> > +          Token,                                                            \
> > +          HandlerProc                                                       \
> > +          )                                                                 \
> > +  case ObjId: {                                                             \
> > +    CmObject->ObjectId = CmObjectId;                                        \
> > +    if (Token == CM_NULL_TOKEN) {                                           \
> > +      CmObject->Size = sizeof (Object);                                     \
> > +      CmObject->Data = (VOID*)&Object;                                      \
> > +      CmObject->Count = ObjectCount;                                        \
> > +      DEBUG ((                                                              \
> > +        DEBUG_INFO,                                                         \
> > +        #CmObjectId ": Ptr = 0x%p, Size = %d, Count = %d\n",                \
> > +        CmObject->Data,                                                     \
> > +        CmObject->Size,                                                     \
> > +        CmObject->Count                                                     \
> > +        ));                                                                 \
> > +    } else {                                                                \
> > +      Status = HandlerProc (This, CmObjectId, Token, CmObject);             \
> > +      DEBUG ((                                                              \
> > +        DEBUG_INFO,                                                         \
> > +        #CmObjectId ": Token = 0x%p, Ptr = 0x%p, Size = %d, Count = %d\n",  \
> > +        (VOID*)Token,                                                       \
> > +        CmObject->Data,                                                     \
> > +        CmObject->Size,                                                     \
> > +        CmObject->Count                                                     \
> > +        ));                                                                 \
> > +    }                                                                       \
> > +    break;                                                                  \
> > +  }
> > +
> > +/** A helper macro for returning configuration manager objects referenced
> > +    by token when the entire platform repository is in scope and the
> > +    CM_NULL_TOKEN value is not allowed.
> > +*/
> > +#define HANDLE_CM_OBJECT_SEARCH_PLAT_REPO(                                  \
>
> See comment above.
>
> > +          ObjId,                                                            \
> > +          CmObjectId,                                                       \
> > +          Token,                                                            \
> > +          HandlerProc                                                       \
> > +          )                                                                 \
> > +  case ObjId: {                                                             \
> > +    CmObject->ObjectId = CmObjectId;                                        \
> > +    if (Token == CM_NULL_TOKEN) {                                           \
> > +      Status = EFI_INVALID_PARAMETER;                                       \
> > +      DEBUG ((                                                              \
> > +        DEBUG_ERROR,                                                        \
> > +        #ObjId ": CM_NULL_TOKEN value is not allowed when searching"        \
> > +        " the entire platform repository.\n"                                \
> > +        ));                                                                 \
> > +    } else {                                                                \
> > +      Status = HandlerProc (This, CmObjectId, Token, CmObject);             \
> > +      DEBUG ((                                                              \
> > +        DEBUG_INFO,                                                         \
> > +        #ObjId ": Token = 0x%p, Ptr = 0x%p, Size = %d, Count = %d\n",       \
> > +        (VOID*)Token,                                                       \
> > +        CmObject->Data,                                                     \
> > +        CmObject->Size,                                                     \
> > +        CmObject->Count                                                     \
> > +        ));                                                                 \
> > +    }                                                                       \
> > +    break;                                                                  \
> > +  }
> > +
> > +/** The number of ACPI tables to install
> > +*/
> > +#define PLAT_ACPI_TABLE_COUNT   6
>
> This feels suboptimal.
> Could this be calculated at run- or compile time?
>
Leif, I plan to chnage like this : PLAT_ACPI_TABLE_COUNT =
CM_MANDATORY_TBLS + OEM_ACPI_TBLS
Here CM_MANDATORY_TBLS must be known to CM upfront and is fixed as per
thr CM's implementation (min tables needed to boot any os).
OEM_ACPI_TBLS should be coming form platforms headers only.
Unfortunately this can not be done at runtime /compile time.

> > +
> > +/** A structure describing the platform configuration
> > +    manager repository information
> > +*/
> > +typedef struct PlatformRepositoryInfo {
> > +  /// Configuration Manager Information
> > +  CM_STD_OBJ_CONFIGURATION_MANAGER_INFO     CmInfo;
> > +
> > +  /// List of ACPI tables
> > +  CM_STD_OBJ_ACPI_TABLE_INFO                CmAcpiTableList[PLAT_ACPI_TABLE_COUNT];
> > +
> > +  /// Boot architecture information
> > +  CM_ARM_BOOT_ARCH_INFO                     BootArchInfo;
> > +
> > +  /// Power management profile information
> > +  CM_ARM_POWER_MANAGEMENT_PROFILE_INFO      PmProfileInfo;
> > +
> > +  /// Generic timer information
> > +  CM_ARM_GENERIC_TIMER_INFO                 GenericTimerInfo;
> > +
> > +  /// Generic timer block information
> > +  CM_ARM_GTBLOCK_INFO                       GTBlockInfo[PLAT_GTBLOCK_COUNT];
> > +
> > +  /// Generic timer frame information
> > +  CM_ARM_GTBLOCK_TIMER_FRAME_INFO           GTBlock0TimerInfo[PLAT_GTFRAME_COUNT];
> > +
> > +  /// Watchdog information
> > +  CM_ARM_GENERIC_WATCHDOG_INFO              Watchdog;
> > +
> > +  /// GIC CPU interface information
> > +  CM_ARM_GICC_INFO                          GicCInfo[PLAT_CPU_COUNT];
> > +
> > +  /// GIC distributor information
> > +  CM_ARM_GICD_INFO                          GicDInfo;
> > +
> > +  /// GIC Redistributor information
> > +  CM_ARM_GIC_REDIST_INFO                    GicRedistInfo;
> > +
> > +  /// GIC ITS information
> > +  CM_ARM_GIC_ITS_INFO                       GicItsInfo;
> > +
> > +  /// PCI configuration space information
> > +  CM_ARM_PCI_CONFIG_SPACE_INFO              PciConfigInfo[PLAT_PCI_CONFG_COUNT];
> > +
> > +  /// Serial port information for serial port console redirection port
> > +  CM_ARM_SERIAL_PORT_INFO                   SpcrSerialPort;
> > +
> > +  /// Fsl Board Revision
> > +  UINT32                                    FslBoardRevision;
> > +} EDKII_PLATFORM_REPOSITORY_INFO;
>
> Please don't use EDKII prefix for platform-scpecific code.
>
Yes, will update this.

> > +
> > +/*
> > + * GTDT_GTIMER_FLAGS
> > + * IT trigger (Level/Edge- Bit 0) and Polarity (Low/High) Bit 1
> > + * Set bit-0 is 0 (Level trigger), Bit 1 1 (Active low)
> > + */
> > +#define GTDT_GTIMER_FLAGS           (EFI_ACPI_6_1_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY)
> > +
> > +/*
> > + * Timer Frame IT High Level triggered
> > + * IT trigger (Level/Edge- Bit 0) and Polarity (Low/High) Bit 1
> > + * Set  bit-0 is 0 (Level trigger), Bit 1 0 (Active High)
> > + */
> > +#define GTDT_FRAME_FLAGS 0
> > +
> > +/*
> > + * Timer frame status
> > + * Access - Secure or non secure <-- Bit 0
> > + * State - Save (meaning always on) or Lose Context  <-- Bit 1
> > + * Set Bit 0 1 as Secure and Bit 1 zero as lose context
> > +*/
> > +#define GTDT_FRAME_COMMON_FLAGS EFI_ACPI_6_1_GTDT_GT_BLOCK_COMMON_FLAG_SECURE_TIMER
> > +
> > +/*
> > + * Watchdog flags
> > + * IT trigger (Level/Edge- Bit 0), Polarity (Low/High) Bit 1, Secured Bit 2
> > + * Set Level trigger (Bit 0 as 0)
> > + * Active High (Bit 1 as 0)
> > + * Non secure (Bit 2 as 0)
> > + */
> > +#define SBSA_WATCHDOG_FLAGS 0
> > +#define SBSA_SEC_WATCHDOG_FLAGS EFI_ACPI_6_1_GTDT_GT_BLOCK_COMMON_FLAG_SECURE_TIMER
> > +
> > +#define GT_BLOCK_FRAME_RES_BASE  MAX_UINT64
> > +
> > +#endif // CONFIGURATION_MANAGER_H__
> > diff --git a/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
> > new file mode 100644
> > index 0000000..03fe104
> > --- /dev/null
> > +++ b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
> > @@ -0,0 +1,52 @@
> > +## @file
> > +#  Configuration Manager Dxe
> > +#
> > +#  Copyright 2020 NXP
> > +#  Copyright 2020 Puresoftware Ltd
> > +#
> > +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +##
> > +
> > +[Defines]
> > +  INF_VERSION                    = 0x0001001B
> > +  BASE_NAME                      = ConfigurationManagerDxe
> > +  FILE_GUID                      = A97F70AC-3BB4-4596-B4D2-9F948EC12D17
> > +  MODULE_TYPE                    = DXE_DRIVER
> > +  VERSION_STRING                 = 1.0
> > +  ENTRY_POINT                    = ConfigurationManagerDxeInitialize
> > +
> > +#
> > +# The following information is for reference only and not required by the build tools.
> > +#
> > +#  VALID_ARCHITECTURES           = ARM AARCH64
> > +#
> > +
> > +[Sources]
> > +  ConfigurationManager.c
> > +
> > +[Packages]
> > +  ArmPkg/ArmPkg.dec
> > +  ArmPlatformPkg/ArmPlatformPkg.dec
> > +  DynamicTablesPkg/DynamicTablesPkg.dec
> > +  EmbeddedPkg/EmbeddedPkg.dec
> > +  MdeModulePkg/MdeModulePkg.dec
> > +  MdePkg/MdePkg.dec
> > +  Platform/NXP/ConfigurationManager/ConfigurationManager.dec
> > +  Silicon/NXP/NxpQoriqLs.dec
> > +
> > +[LibraryClasses]
> > +  ArmPlatformLib
> > +  PrintLib
> > +  UefiBootServicesTableLib
> > +  UefiDriverEntryPoint
> > +  UefiRuntimeServicesTableLib
> > +
> > +[Protocols]
> > +  gEdkiiConfigurationManagerProtocolGuid
> > +
> > +[FixedPcd]
> > +
> > +[Pcd]
> > +
> > +[Depex]
> > +  TRUE
> > diff --git a/Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h b/Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h
> > new file mode 100644
> > index 0000000..da3c571
> > --- /dev/null
> > +++ b/Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h
> > @@ -0,0 +1,20 @@
> > +/** @file
> > +  Acpi Table generator headers
> > +
> > +  Copyright 2020 NXP
> > +  Copyright 2020 Puresoftware Ltd
> > +
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +
> > +**/
> > +
> > +#ifndef PLATFORM_ACPI_TABLE_GENERATOR_H_
> > +#define PLATFORM_ACPI_TABLE_GENERATOR_H_
> > +
> > +typedef enum PlatAcpiTableId {
> > +  EPlatAcpiTableIdReserved = 0x0000,             ///< Reserved
> > +  EPlatAcpiTableIdDsdt,
> > +  EPlatAcpiTableIdMax
> > +} EPLAT_ACPI_TABLE_ID;
>
> Where does the EPlat prefix come from? What does it stand for?
>
Leif, this will be corrected.
e.g: EPlatAcpiTableIdReserved -> PlatAcpiTableIdReserved
These Id's will be used by OEM/platforms defined generators etc.

> > +
> > +#endif
> > diff --git a/Platform/NXP/Env.cshrc b/Platform/NXP/Env.cshrc
> > new file mode 100755
> > index 0000000..a0f151b
> > --- /dev/null
> > +++ b/Platform/NXP/Env.cshrc
>
> I am nearly 100% convinced the below would only execute correctly in a
> bash shell, which is where it is called from - why does it claim to be
> for csh?
>
Yes, i plan to modify this Env.cshrc --> Env.sh

> > @@ -0,0 +1,73 @@
> > +#  @file.
> > +#
> > +#  Copyright 2020 NXP
> > +#  Copyright 2020 Puresoftware Ltd
> > +#
> > +#  This program and the accompanying materials are licensed and made available under
> > +#  the terms and conditions of the BSD License which accompanies this distribution.
> > +#  The full text of the license may be found at
> > +#  http://opensource.org/licenses/bsd-license.php
> > +#
> > +#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> > +#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
> > +#
>
> Please use SPDX tag here as well.
>
Yes, I will correct this.

> > +
> > +unset GCC_UTILITY GCC_VERSION MajorVersion MinorVersion
> > +
> > +if [ X"$CROSS_COMPILE_64" != X"" ]; then
> > +  ARM64_PREFIX="$CROSS_COMPILE_64"
> > +elif [ X"$CROSS_COMPILE" != X"" ]; then
> > +  ARM64_PREFIX="$CROSS_COMPILE"
> > +else
> > +  ARM64_PREFIX="aarch64-linux-gnu-"
> > +fi
> > +
> > +GCC_UTILITY="${ARM64_PREFIX}gcc"
> > +CheckGcc=`which $GCC_UTILITY >/dev/null 2>&1`
> > +if [ "$?" -eq 0 ];then
> > +  GCC_VERSION=`$GCC_UTILITY -v 2>&1 | tail -n 1 | awk '{print $3}'`
> > +  MajorVersion=`echo $GCC_VERSION | cut -d . -f 1`
> > +  MinorVersion=`echo $GCC_VERSION | cut -d . -f 2`
> > +  GCC_ARCH_PREFIX=
> > +
> > +  case $MajorVersion in
> > +    4)
> > +      case $MinorVersion in
> > +        9)
> > +          GCC_ARCH_PREFIX="GCC49_AARCH64_PREFIX"
> > +        ;;
> > +        *)
> > +          NOTSUPPORTED=1
> > +        ;;
> > +      esac
> > +    ;;
> > +    5)
> > +      case $MinorVersion in
> > +      4)
> > +        GCC_ARCH_PREFIX="GCC5_AARCH64_PREFIX"
> > +      ;;
> > +      *)
> > +        GCC_ARCH_PREFIX="GCC5_AARCH64_PREFIX"
> > +        echo "Warning: ${GCC_UTILITY} version ($MajorVersion.$MinorVersion) has not been tested, please use at own risk."
> > +      ;;
> > +      esac
> > +    ;;
> > +    *)
> > +      GCC_ARCH_PREFIX="GCC5_AARCH64_PREFIX"
> > +      echo "Warning: ${GCC_UTILITY} version ($MajorVersion.$MinorVersion) has not been tested, please use at own risk."
> > +    ;;
> > +  esac
> > +
> > +  [ -n "$GCC_ARCH_PREFIX" ] && {
> > +    export GCC_ARCH_PREFIX="$GCC_ARCH_PREFIX"
> > +    export "$GCC_ARCH_PREFIX=$ARM64_PREFIX"
> > +  }
> > +
> > +  unset ARCH
> > +else
> > +    echo "Error: ${GCC_UTILITY} not found. Please check PATH variable."
> > +    unset GCC_UTILITY GCC_VERSION MajorVersion MinorVersion
> > +fi
> > +
> > +# Export edk2-platforms path
> > +export PACKAGES_PATH=`dirname \`dirname "$PWD"\``
> > diff --git a/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl
> > new file mode 100644
> > index 0000000..1008476
> > --- /dev/null
> > +++ b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl
> > @@ -0,0 +1,40 @@
> > +/** @file
> > +  Differentiated System Description Table Fields (DSDT)
> > +
> > +  Copyright 2020 NXP
> > +  Copyright 2020 Puresoftware Ltd
> > +
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +
> > +**/
> > +
> > +Scope(_SB)
> > +{
> > +  Device(PCLK) {
> > +    Name(_HID, "NXP0017")
> > +    Name(CLK, 0)
> > +    Name(AVBL, 0)
> > +    OperationRegion(RCWS, SystemMemory, DCFG_BASE, DCFG_LEN)
> > +    Method(_REG,2) {
> > +      if (Arg0 == "RCWS") {
> > +        Store(Arg1, AVBL)
> > +      }
> > +    }
> > +    Field (RCWS, ByteAcc, NoLock, Preserve) {
> > +      offset(0x100),
> > +      PCFG, 2,
> > +      PRAT, 6,
> > +      offset(0x124),
> > +      RESV, 4,
> > +      SFRQ, 10
> > +    }
> > +
> > +    Method(_INI, 0, NotSerialized) {
> > +      Store(SFRQ, Local0)
> > +      Multiply(Local0, 500000, Local0)
> > +      Multiply(Local0, PRAT, Local0)
> > +      Divide(Local0, 6, , Local0)
> > +      Store(Local0, CLK)
> > +    }
> > +  }
> > +} // end of device PCLK
> > diff --git a/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl
> > new file mode 100644
> > index 0000000..e4f04ce
> > --- /dev/null
> > +++ b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl
> > @@ -0,0 +1,15 @@
> > +/** @file
> > +  Differentiated System Description Table Fields (DSDT)
> > +
> > +  Copyright 2020 NXP
> > +  Copyright 2020 Puresoftware Ltd.
> > +
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +
> > +**/
> > +
> > +#include "Platform.h"
> > +
> > +DefinitionBlock("DsdtTable.aml", "DSDT", 2, "NXP  ", "LX2160  ", EFI_ACPI_ARM_OEM_REVISION) {
> > +  include ("Clk.asl")
> > +}
> > diff --git a/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
> > new file mode 100644
> > index 0000000..f2d8ea5
> > --- /dev/null
> > +++ b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
> > @@ -0,0 +1,39 @@
> > +## @file
> > +#  Raw Table Generator
> > +#
> > +#  Copyright 2020 NXP
> > +#  Copyright 2020 Puresoftware Ltd
> > +#
> > +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +##
> > +
> > +[Defines]
> > +  INF_VERSION    = 0x00010019
> > +  BASE_NAME      = PlatformAcpiDsdtLib
> > +  FILE_GUID      = 0b1768cf-13fa-4ecf-b640-338a636d1abb
> > +  VERSION_STRING = 1.0
> > +  MODULE_TYPE    = DXE_DRIVER
> > +  LIBRARY_CLASS  = NULL|DXE_DRIVER
> > +  CONSTRUCTOR    = AcpiDsdtLibConstructor
> > +  DESTRUCTOR     = AcpiDsdtLibDestructor
> > +
> > +[Sources]
> > +  PlatformAcpiDsdtLib/RawDsdtGenerator.c
> > +  Dsdt/Dsdt.asl
> > +
> > +[Packages]
> > +  MdePkg/MdePkg.dec
> > +  MdeModulePkg/MdeModulePkg.dec
> > +  EmbeddedPkg/EmbeddedPkg.dec
> > +  DynamicTablesPkg/DynamicTablesPkg.dec
> > +  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec
>
> Please sort alphabetically.
>
Yes, I will correct this.

> > +
> > +[LibraryClasses]
> > +  BaseLib
> > +
> > +[Pcd]
> > +
> > +[Protocols]
> > +
> > +[Guids]
> > +
> > diff --git a/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c
> > new file mode 100644
> > index 0000000..75ea2b7
> > --- /dev/null
> > +++ b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c
> > @@ -0,0 +1,146 @@
> > +/** @file
> > +  Raw DSDT Table Generator
> > +
> > +  Copyright 2020 NXP
> > +  Copyright 2020 Puresoftware Ltd.
> > +
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +
> > +**/
> > +
> > +#include <Library/AcpiLib.h>
> > +#include <Library/DebugLib.h>
> > +#include <Protocol/AcpiTable.h>
> > +
> > +// Module specific include files.
> > +#include <AcpiTableGenerator.h>
> > +#include <ConfigurationManagerObject.h>
> > +#include <ConfigurationManagerHelper.h>
> > +#include <Library/TableHelperLib.h>
> > +#include <Protocol/ConfigurationManagerProtocol.h>
> > +
> > +#include "PlatformAcpiLib.h"
> > +
> > +/** Construct the ACPI table using the ACPI table data provided.
> > +
> > +  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.
> > +**/
> > +STATIC
> > +EFI_STATUS
> > +EFIAPI
> > +BuildRawDsdtTable (
> > +  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
> > +  )
> > +{
> > +  ASSERT (This != NULL);
> > +  ASSERT (AcpiTableInfo != NULL);
> > +  ASSERT (CfgMgrProtocol != NULL);
> > +  ASSERT (Table != NULL);
> > +  ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
> > +
> > +  if (AcpiTableInfo->AcpiTableData == NULL) {
> > +    // Add the dsdt aml code here, Currently NULL place holder.
> > +    *Table = (EFI_ACPI_DESCRIPTION_HEADER *)&dsdt_aml_code;
> > +  }
> > +
> > +  return EFI_SUCCESS;
> > +}
> > +
> > +/** This macro defines the Raw Generator revision.
> > +*/
> > +#define DSDT_GENERATOR_REVISION CREATE_REVISION (1, 0)
> > +
> > +/** The interface for the Raw Table Generator.
> > +*/
> > +STATIC
> > +CONST
> > +ACPI_TABLE_GENERATOR RawDsdtGenerator = {
> > +  // Generator ID
> > +  CREATE_OEM_ACPI_TABLE_GEN_ID (EPlatAcpiTableIdDsdt),
> > +  // Generator Description
> > +  L"ACPI.OEM.RAW.DSDT.GENERATOR",
> > +  // ACPI Table Signature - Unused
> > +  0,
> > +  // ACPI Table Revision - Unused
> > +  0,
> > +  // Minimum ACPI Table Revision - Unused
> > +  0,
> > +  // Creator ID
> > +  TABLE_GENERATOR_CREATOR_ID_ARM,
> > +  // Creator Revision
> > +  DSDT_GENERATOR_REVISION,
> > +  // Build Table function
> > +  BuildRawDsdtTable,
> > +  // 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
> > +AcpiDsdtLibConstructor (
> > +  IN CONST EFI_HANDLE                ImageHandle,
> > +  IN       EFI_SYSTEM_TABLE  * CONST SystemTable
> > +  )
> > +{
> > +  EFI_STATUS  Status;
> > +  Status = RegisterAcpiTableGenerator (&RawDsdtGenerator);
> > +  DEBUG ((DEBUG_INFO, "OEM: Register DSDT 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
> > +AcpiDsdtLibDestructor (
> > +  IN CONST EFI_HANDLE                ImageHandle,
> > +  IN       EFI_SYSTEM_TABLE  * CONST SystemTable
> > +  )
> > +{
> > +  EFI_STATUS  Status;
> > +  Status = DeregisterAcpiTableGenerator (&RawDsdtGenerator);
> > +  DEBUG ((DEBUG_INFO, "OEM: Deregister DSDT Generator. Status = %r\n", Status));
> > +  ASSERT_EFI_ERROR (Status);
> > +  return Status;
> > +}
> > diff --git a/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiLib.h b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiLib.h
> > new file mode 100644
> > index 0000000..1747245
> > --- /dev/null
> > +++ b/Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiLib.h
> > @@ -0,0 +1,24 @@
> > +/** @file
> > + *  Acpi lib headers
> > + *
> > + *  Copyright 2020 NXP
> > + *  Copyright 2020 Puresoftware Ltd
> > + *
> > + *  SPDX-License-Identifier: BSD-2-Clause-Patent
> > + *
> > +**/
> > +
> > +
> > +#ifndef _LX2160ARDB_PLATFORM_ACPI_LIB_H_
> > +#define _LX2160ARDB_PLATFORM_ACPI_LIB_H_
>
> Please don't use leading _ in macros.
>
Yes, I will correct this. I intend to replace "_LX2160ARDB_PLATFORM_ACPI_LIB_H_"
with "LX2160ARDB_PLATFORM_ACPI_LIB_H" throughout by patch.

> > +
> > +#include <PlatformAcpiTableGenerator.h>
>
> This header does not appear needed by this file.
>
Will correct it.

> > +
> > +/** C array containing the compiled AML template.
> > +    These symbols are defined in the auto generated C file
> > +    containing the AML bytecode array.
> > +*/
> > +extern CHAR8  dsdt_aml_code[];
> > +
> > +#endif
> > +
> > diff --git a/Platform/NXP/LX2160aRdbPkg/Include/Platform.h b/Platform/NXP/LX2160aRdbPkg/Include/Platform.h
> > new file mode 100644
> > index 0000000..e2a6faa
> > --- /dev/null
> > +++ b/Platform/NXP/LX2160aRdbPkg/Include/Platform.h
> > @@ -0,0 +1,244 @@
> > +/** @file
> > + *  Platform headers
> > + *
> > + *  Copyright 2020 NXP
> > + *  Copyright 2020 Puresoftware Ltd
> > + *
> > + *  SPDX-License-Identifier: BSD-2-Clause-Patent
> > + *
> > +**/
> > +
> > +
> > +#ifndef _LX2160ARDB_PLATFORM_H_
> > +#define _LX2160ARDB_PLATFORM_H_
>
> Please don't use leading _ in macros.
>
> > +
> > +#define EFI_ACPI_ARM_OEM_REVISION       0x00000000
> > +
> > +// Soc defines
> > +#define SVR_SOC_VER(svr)        (((svr) >> 8) & 0xFFFFFE)
> > +#define SVR_MAJOR(svr)          (((svr) >> 4) & 0xf)
> > +#define SVR_MINOR(svr)          (((svr) >> 0) & 0xf)
> > +
> > +#define SVR_LX2160A             0x873600
> > +
> > +// PCLK
> > +#define DCFG_BASE   0x1E00000
> > +#define DCFG_LEN    0x1FFFF
> > +
> > +// Gic
> > +#define GIC_VERSION 3
> > +#define GICD_BASE   0x6000000
> > +#define GICI_BASE   0x6020000
> > +#define GICR_BASE   0x06200000
> > +#define GICR_LEN    0x200000
> > +#define GICC_BASE   0x0c0c0000
> > +#define GICH_BASE   0x0c0d0000
> > +#define GICV_BASE   0x0c0e0000
> > +
> > +// UART
> > +#define UART0_BASE               0x21C0000
> > +#define UART1_BASE               0x21D0000
> > +#define UART2_BASE               0x21E0000
> > +#define UART3_BASE               0x21F0000
> > +#define UART0_IT                 64
> > +#define UART1_IT                 65
> > +#define UART2_IT                 104
> > +#define UART3_IT                 105
> > +#define UART_LEN                 0x10000
> > +#define SPCR_FLOW_CONTROL_NONE   0
> > +
> > +// Timer
> > +#define TIMER_BLOCK_COUNT            1
> > +#define TIMER_FRAME_COUNT            4
> > +#define TIMER_WATCHDOG_COUNT         1
> > +#define TIMER_BASE_ADDRESS           0x23E0000 // a.k.a CNTControlBase
> > +#define TIMER_READ_BASE_ADDRESS      0x23F0000 // a.k.a CNTReadBase
> > +#define TIMER_GT_BLOCK_0_ADDRESS     0x2890000 // a.k.a CNTCTLBase (Secure)
> > +#define TIMER_GT_BASE_0_ADDRESS      0x28A0000  // a.k.a CNTBase0
> > +#define TIMER_GT_BASE_1_ADDRESS      0x28B0000  // a.k.a CNTBase1
> > +#define TIMER_GT_BASE_2_ADDRESS      0x28C0000  // a.k.a CNTBase2
> > +#define TIMER_GT_BASE_3_ADDRESS      0x28D0000  // a.k.a CNTBase3
> > +#define TIMER_GT_BASE_0_EL0_ADDRESS  0x28E0000  // a.k.a CNTBase0EL0
> > +#define TIMER_GT_BASE_2_EL0_ADDRESS  0x28F0000  // a.k.a CNTBase2EL0
> > +#define TIMER_WDT0_REFRESH_BASE      0x2390000
> > +#define TIMER_WDT0_CONTROL_BASE      0x23A0000
> > +#define TIMER_SEC_IT                 29
> > +#define TIMER_NON_SEC_IT             30
> > +#define TIMER_VIRT_IT                27
> > +#define TIMER_HYP_IT                 26
> > +#define TIMER_FRAME0_IT              78
> > +#define TIMER_FRAME1_IT              79
> > +#define TIMER_FRAME2_IT              92
> > +#define TIMER_FRAME3_IT              93
> > +#define TIMER_WDT0_IT                91
> > +
> > +#define DEFAULT_PLAT_FREQ            700000000
> > +
> > +// Mcfg
> > +#define LX2160A_PCI_SEG0_CONFIG_BASE 0x9000000000
> > +#define LX2160A_PCI_SEG0             0x2
> > +#define LX2160A_PCI_SEG_BUSNUM_MIN   0x0
> > +#define LX2160A_PCI_SEG_BUSNUM_MAX   0xff
> > +#define LX2160A_PCI_SEG1_CONFIG_BASE 0xA000000000
> > +#define LX2160A_PCI_SEG1             0x4
> > +
> > +// Platform specific info needed by Configuration Manager
> > +
> > +#define CFG_MGR_TABLE_ID  SIGNATURE_64 ('L','X','2','1','6','0',' ',' ')
> > +
> > +#define PLAT_PCI_SEG0_CONFIG_BASE   LX2160A_PCI_SEG0_CONFIG_BASE
> > +#define PLAT_PCI_SEG0               LX2160A_PCI_SEG0
> > +#define PLAT_PCI_SEG_BUSNUM_MIN     LX2160A_PCI_SEG_BUSNUM_MIN
> > +#define PLAT_PCI_SEG_BUSNUM_MAX     LX2160A_PCI_SEG_BUSNUM_MAX
> > +#define PLAT_PCI_SEG1_CONFIG_BASE   LX2160A_PCI_SEG1_CONFIG_BASE
> > +#define PLAT_PCI_SEG1               LX2160A_PCI_SEG1
> > +
> > +#define PLAT_GIC_VERSION            GIC_VERSION
> > +#define PLAT_GICD_BASE              GICD_BASE
> > +#define PLAT_GICI_BASE              GICI_BASE
> > +#define PLAT_GICR_BASE              GICR_BASE
> > +#define PLAT_GICR_LEN               GICR_LEN
> > +#define PLAT_GICC_BASE              GICC_BASE
> > +#define PLAT_GICH_BASE              GICH_BASE
> > +#define PLAT_GICV_BASE              GICV_BASE
> > +
> > +#define PLAT_CPU_COUNT          16
> > +#define PLAT_GTBLOCK_COUNT      1
> > +#define PLAT_GTFRAME_COUNT      4
> > +#define PLAT_PCI_CONFG_COUNT    2
> > +
> > +#define PLAT_WATCHDOG_COUNT           1
> > +#define PLAT_GIC_REDISTRIBUTOR_COUNT  1
> > +#define PLAT_GIC_ITS_COUNT            1
> > +
> > +/* GIC CPU Interface information
> > +   GIC_ENTRY (CPUInterfaceNumber, Mpidr, PmuIrq, VGicIrq, EnergyEfficiency)
> > + */
> > +#define PLAT_GIC_CPU_INTERFACE    {                         \
> > +             GICC_ENTRY (0,  GET_MPID (0, 0), 23, 0x19, 0), \
> > +             GICC_ENTRY (1,  GET_MPID (0, 1), 23, 0x19, 0), \
> > +             GICC_ENTRY (2,  GET_MPID (1, 0), 23, 0x19, 0), \
> > +             GICC_ENTRY (3,  GET_MPID (1, 1), 23, 0x19, 0), \
> > +             GICC_ENTRY (4,  GET_MPID (2, 0), 23, 0x19, 0), \
> > +             GICC_ENTRY (5,  GET_MPID (2, 1), 23, 0x19, 0), \
> > +             GICC_ENTRY (6,  GET_MPID (3, 0), 23, 0x19, 0), \
> > +             GICC_ENTRY (7,  GET_MPID (3, 1), 23, 0x19, 0), \
> > +             GICC_ENTRY (8,  GET_MPID (4, 0), 23, 0x19, 0), \
> > +             GICC_ENTRY (9,  GET_MPID (4, 1), 23, 0x19, 0), \
> > +             GICC_ENTRY (10, GET_MPID (5, 0), 23, 0x19, 0), \
> > +             GICC_ENTRY (11, GET_MPID (5, 1), 23, 0x19, 0), \
> > +             GICC_ENTRY (12, GET_MPID (6, 0), 23, 0x19, 0), \
> > +             GICC_ENTRY (13, GET_MPID (6, 1), 23, 0x19, 0), \
> > +             GICC_ENTRY (14, GET_MPID (7, 0), 23, 0x19, 0), \
> > +             GICC_ENTRY (15, GET_MPID (7, 1), 23, 0x19, 0)  \
> > +}
> > +
> > +// watchdogs
> > +#define PLAT_WATCHDOG_INFO                    \
> > +  {                                           \
> > +      TIMER_WDT0_CONTROL_BASE,                \
> > +      TIMER_WDT0_REFRESH_BASE,                \
> > +      TIMER_WDT0_IT,                          \
> > +      SBSA_WATCHDOG_FLAGS                     \
> > +  }                                           \
> > +
> > +#define PLAT_TIMER_BLOCK_INFO                                           \
> > +  {                                                                     \
> > +    {                                                                   \
> > +      TIMER_GT_BLOCK_0_ADDRESS,                                         \
> > +      PLAT_GTFRAME_COUNT,                                               \
> > +      (CM_OBJECT_TOKEN)((UINT8*)&FslPlatformRepositoryInfo +            \
> > +        OFFSET_OF (EDKII_PLATFORM_REPOSITORY_INFO, GTBlock0TimerInfo))  \
> > +    }                                                                   \
> > +  }                                                                     \
> > +
> > +#define PLAT_TIMER_FRAME_INFO                                            \
> > +  {                                                                      \
> > +    {                                                                    \
> > +      0,                             /* UINT8 GTFrameNumber */           \
> > +      TIMER_GT_BASE_0_ADDRESS,       /* UINT64 CntBaseX */               \
> > +      TIMER_GT_BASE_0_EL0_ADDRESS,   /* UINT64 CntEL0BaseX */            \
> > +      TIMER_FRAME0_IT,               /* UINT32 GTxPhysicalTimerGSIV */   \
> > +      GTDT_FRAME_FLAGS,              /* UINT32 GTxPhysicalTimerFlags */  \
> > +      TIMER_FRAME0_IT,               /* UINT32 GTxVirtualTimerGSIV */    \
> > +      GTDT_FRAME_FLAGS,              /* UINT32 GTxVirtualTimerFlags */   \
> > +      0                              /* UINT32 GTxCommonFlags */         \
> > +    }, /* Gtdt.Frames[0] */                                              \
> > +    {                                                                    \
> > +      1,                             /* UINT8 GTFrameNumber */           \
> > +      TIMER_GT_BASE_1_ADDRESS,       /* UINT64 CntBaseX */               \
> > +      GT_BLOCK_FRAME_RES_BASE,       /* UINT64 CntEL0BaseX */            \
> > +      TIMER_FRAME1_IT,               /* UINT32 GTxPhysicalTimerGSIV */   \
> > +      GTDT_FRAME_FLAGS,              /* UINT32 GTxPhysicalTimerFlags */  \
> > +      0,                             /* UINT32 GTxVirtualTimerGSIV */    \
> > +      0,                             /* UINT32 GTxVirtualTimerFlags */   \
> > +      GTDT_FRAME_COMMON_FLAGS        /* UINT32 GTxCommonFlags */         \
> > +    }, /* Gtdt.Frames[1] */                                              \
> > +    {                                                                    \
> > +      2,                              /* UINT8 GTFrameNumber */          \
> > +      TIMER_GT_BASE_2_ADDRESS,        /* UINT64 CntBaseX */              \
> > +      TIMER_GT_BASE_2_EL0_ADDRESS,    /* UINT64 CntEL0BaseX */           \
> > +      TIMER_FRAME2_IT,                /* UINT32 GTxPhysicalTimerGSIV */  \
> > +      GTDT_FRAME_FLAGS,               /* UINT32 GTxPhysicalTimerFlags */ \
> > +      0,                              /* UINT32 GTxVirtualTimerGSIV */   \
> > +      0,                              /* UINT32 GTxVirtualTimerFlags */  \
> > +      GTDT_FRAME_COMMON_FLAGS         /* UINT32 GTxCommonFlags */        \
> > +    },/* Gtdt.Frames[2] */                                               \
> > +    {                                                                   \
> > +      3,                             /* UINT8 GTFrameNumber */          \
> > +      TIMER_GT_BASE_3_ADDRESS,       /* UINT64 CntBaseX */              \
> > +      GT_BLOCK_FRAME_RES_BASE,       /* UINT64 CntEL0BaseX */           \
> > +      TIMER_FRAME3_IT,               /* UINT32 GTxPhysicalTimerGSIV */  \
> > +      GTDT_FRAME_FLAGS,              /* UINT32 GTxPhysicalTimerFlags */ \
> > +      0,                             /* UINT32 GTxVirtualTimerGSIV */   \
> > +      0,                             /* UINT32 GTxVirtualTimerFlags */  \
> > +      GTDT_FRAME_COMMON_FLAGS        /* UINT32 GTxCommonFlags */        \
> > +    }, /* Gtdt.Frames[3] */                                             \
> > +  }                                                                     \
> > +
> > +#define PLAT_GIC_DISTRIBUTOR_INFO                                      \
> > +  {                                                                    \
> > +    PLAT_GICD_BASE,                  /* UINT64  PhysicalBaseAddress */ \
> > +    0,                               /* UINT32  SystemVectorBase */    \
> > +    PLAT_GIC_VERSION                 /* UINT8   GicVersion */          \
> > +  }                                                                    \
> > +
> > +#define PLAT_GIC_REDISTRIBUTOR_INFO                                    \
> > +  {                                                                    \
> > +    PLAT_GICR_BASE,      /* UINT64 DiscoveryRangeBaseAddress */        \
> > +    PLAT_GICR_LEN        /* UINT32 DiscoveryRangeLength */             \
> > +  }                                                                    \
> > +
> > +#define PLAT_GIC_ITS_INFO                                                    \
> > +  {                                                                          \
> > +    0,                   /* UINT32 GIC ITS ID */                             \
> > +    PLAT_GICI_BASE,      /* UINT64 The 64-bit physical address for ITS */    \
> > +    0                    /* UINT32 Populate the GIC ITS affinity in SRAT. */ \
> > +  }                                                                          \
> > +
> > +#define PLAT_MCFG_INFO                \
> > +  {                                   \
> > +    {                                 \
> > +      PLAT_PCI_SEG0_CONFIG_BASE,      \
> > +      PLAT_PCI_SEG0,                  \
> > +      PLAT_PCI_SEG_BUSNUM_MIN,        \
> > +      PLAT_PCI_SEG_BUSNUM_MAX,        \
> > +    },                                \
> > +    {                                 \
> > +      PLAT_PCI_SEG1_CONFIG_BASE,      \
> > +      PLAT_PCI_SEG1,                  \
> > +      PLAT_PCI_SEG_BUSNUM_MIN,        \
> > +      PLAT_PCI_SEG_BUSNUM_MAX,        \
> > +    }                                 \
> > +  }                                   \
> > +
> > +#define PLAT_SPCR_INFO                                                            \
> > +  {                                                                               \
> > +    UART0_BASE,                                                                   \
> > +    UART0_IT,                                                                     \
> > +    115200,                                                                       \
> > +    0,                                                                            \
> > +    EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERFACE_TYPE_ARM_PL011_UART  \
> > +  }                                                                               \
> > +
> > +#endif
> > diff --git a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec
> > index 03996b0..3d5385c 100644
> > --- a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec
> > +++ b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec
> > @@ -2,6 +2,7 @@
> >  #  LX2160a board package.
> >  #
> >  #  Copyright 2018, 2020 NXP
> > +#  Copyright 2020 Puresoftware Ltd
> >  #
> >  #  SPDX-License-Identifier: BSD-2-Clause-Patent
> >  #
> > @@ -20,4 +21,7 @@
> >  #
> >  ################################################################################
> >  [Includes.common]
> > -  Include                        # Root include for the package
>
> Don't delete this...
>
Will correct it.

> > +  .                       # Root include for the package
>
> No. Find another way, if this indeed has any effect at all.
>
> > +  Include
>
> ...only to add it again.
>
> > +  AcpiTablesInclude
> > +  Platform/NXP/ConfigurationManager/Include
> > diff --git a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc
> > index 7132b3e..a8d7787 100644
> > --- a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc
> > +++ b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc
> > @@ -3,6 +3,7 @@
> >  #  LX2160ARDB Board package.
> >  #
> >  #  Copyright 2018-2020 NXP
> > +#  Copyright 2020 Puresoftware Ltd
> >  #
> >  #  SPDX-License-Identifier: BSD-2-Clause-Patent
> >  #
> > @@ -29,9 +30,18 @@
> >    DEFINE NETWORK_HTTP_BOOT_ENABLE       = FALSE
> >    DEFINE NETWORK_ISCSI_ENABLE           = FALSE
> >
> > +  # This flag controls the dynamic acpi generation
> > +  #
> > +  DEFINE DYNAMIC_ACPI_ENABLE            = TRUE
> > +
> >  !include Silicon/NXP/NxpQoriqLs.dsc.inc
> >  !include Silicon/NXP/LX2160A/LX2160A.dsc.inc
> >
> > +!if $(DYNAMIC_ACPI_ENABLE) == TRUE
> > +  !include DynamicTablesPkg/DynamicTables.dsc.inc
> > +  !include Platform/NXP/ConfigurationManager/ConfigurationManager.dsc.inc
> > +!endif
> > +
> >  [LibraryClasses.common]
> >    ArmPlatformLib|Platform/NXP/LX2160aRdbPkg/Library/ArmPlatformLib/ArmPlatformLib.inf
> >    RealTimeClockLib|EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf
> > @@ -64,6 +74,26 @@
> >    MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
> >
> >    #
> > +  # Dynamic Table Factory
> > +  !if $(DYNAMIC_ACPI_ENABLE) == TRUE
> > +    DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf {
> > +      <LibraryClasses>
> > +        NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/AcpiFadtLibArm.inf
> > +        NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/AcpiGtdtLibArm.inf
> > +        NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/AcpiMadtLibArm.inf
> > +        NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/AcpiMcfgLibArm.inf
> > +        NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/AcpiSpcrLibArm.inf
> > +        NULL|Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
> > +    }
> > +  !endif
> > +
> > +  #
> > +  # Acpi Support
> > +  #
> > +  MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
> > +  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
> > +
> > +  #
> >    # Networking stack
> >    #
> >  !include NetworkPkg/Network.dsc.inc
> > diff --git a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf
> > index 111c845..6622360 100644
> > --- a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf
> > +++ b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf
> > @@ -3,6 +3,7 @@
> >  #  FLASH layout file for LX2160a board.
> >  #
> >  #  Copyright 2018-2020 NXP
> > +#  Copyright 2020 Puresoftware Ltd
> >  #
> >  #  SPDX-License-Identifier: BSD-2-Clause-Patent
> >  #
> > @@ -103,6 +104,17 @@ READ_LOCK_STATUS   = TRUE
> >    INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
> >
> >    #
> > +  # Acpi Support
> > +  #
> > +  INF MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
> > +  INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
> > +
> > +  !if $(DYNAMIC_ACPI_ENABLE) == TRUE
> > +    INF Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
> > +    !include DynamicTablesPkg/DynamicTables.fdf.inc
> > +  !endif
> > +
> > +  #
> >    # Multiple Console IO support
> >    #
> >    INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
> > diff --git a/Platform/NXP/build.sh b/Platform/NXP/build.sh
> > new file mode 100755
> > index 0000000..676c7fd
> > --- /dev/null
> > +++ b/Platform/NXP/build.sh
> > @@ -0,0 +1,121 @@
> > +#!/bin/bash
> > +# UEFI build script for NXP Layer Scape SoCs
> > +#
> > +# Copyright 2020 NXP
> > +# Copyright 2020 Puresoftware Ltd
> > +#
> > +# This program and the accompanying materials
> > +# are licensed and made available under the terms and conditions of the BSD License
> > +# which accompanies this distribution.  The full text of the license may be found at
> > +# http://opensource.org/licenses/bsd-license.php
> > +#
> > +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> > +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
> Please use SPDX tag instead.
>
> On the whole, I'm not a fan of custom build scripts, since they
> inevitably (like this one) start making unreliable assumptions about
> directory layout etc.
>
> There are build instructions in the top-level Readme.md. All that this
> script does should be possible to describe as an addition in
> Platform/NXP/Readme.md.
>
Yes, will update the Platform/NXP/Readme.md

> /
>     Leif
>
> > +#
> > +
> > +# source environment file
> > +source Env.cshrc
> > +
> > +# Global Defaults
> > +ARCH=AARCH64
> > +TARGET_TOOLS=`echo $GCC_ARCH_PREFIX | cut -d _ -f 1`
> > +BASE_DIR=../../..
> > +
> > +[ -z "$TARGET_TOOLS" ] && {
> > +  echo "TARGET_TOOLS not found. Please run \"source Env.cshrc\" ."
> > +  exit 1
> > +}
> > +
> > +print_usage_banner()
> > +{
> > +    echo ""
> > +    echo "This shell script expects:"
> > +    echo "    Arg 1 (mandatory): SoC Type (can be LS1043 / LS1046 / LS2088 / LX2160 / LS1028)."
> > +    echo "    Arg 2 (mandatory): Board Type (can be RDB / QDS /FRWY)."
> > +    echo "    Arg 3 (mandatory): Build candidate (can be RELEASE or DEBUG). By
> > +              default we build the RELEASE candidate."
> > +    echo "    Arg 4 (optional): clean - To do a 'make clean' operation."
> > +}
> > +
> > +# Check for total num of input arguments
> > +if [[ "$#" -gt 4 ]]; then
> > +  echo "Illegal number of parameters"
> > +  print_usage_banner
> > +  exit
> > +fi
> > +
> > +# Check for third parameter to be clean only
> > +if [[ "$4" && $4 != "clean" ]]; then
> > +  echo "Error ! Either clean or emplty"
> > +  print_usage_banner
> > +  exit
> > +fi
> > +
> > +# Check for input arguments
> > +if [[ $1 == "" || $2 == "" || $3 == "" ]]; then
> > +  echo "Error !"
> > +  print_usage_banner
> > +  exit
> > +fi
> > +
> > +# Check for input arguments
> > +if [[ $1 != "LS1043" && $1 != "LS1046" && $1 != "LS2088" && $1 != "LX2160" && $1 != "LS1028" ]]; then
> > +  echo "Error ! Incorrect Soc Type specified."
> > +  print_usage_banner
> > +  exit
> > +fi
> > +
> > +# Check for input arguments
> > +if [[ $2 != "RDB" && $2 != "QDS" && $2 != "FRWY" ]]; then
> > +  echo "Error ! Incorrect Board Type specified."
> > +  print_usage_banner
> > +  exit
> > +fi
> > +
> > +# Check for input arguments
> > +if [[ $3 != "RELEASE" ]]; then
> > +  if [[ $3 != "DEBUG" ]]; then
> > +    echo "Error ! Incorrect build target specified."
> > +    print_usage_banner
> > +    exit
> > +  fi
> > +fi
> > +
> > +# Set Package drirectory
> > +if [[ $2 == "RDB" ]]; then
> > +  PKG="aRdbPkg"
> > +  if [[ $2 == "QDS" ]]; then
> > +    PKG="aQdsPkg"
> > +  fi
> > +elif [[ $2 == "FRWY" ]]; then
> > +    PKG="aFrwyPkg"
> > +fi
> > +
> > +echo ".........................................."
> > +echo "Welcome to $1$PKG UEFI Build environment"
> > +echo ".........................................."
> > +
> > +if [[ $4 == "clean" ]]; then
> > +  echo "Cleaning up the build directory '$BASE_DIR/Build/$1$PKG/'.."
> > +  rm -rf $BASE_DIR/Build/$1$PKG/*
> > +  exit
> > +fi
> > +
> > +# Clean-up
> > +set -e
> > +shopt -s nocasematch
> > +
> > +#
> > +# Setup workspace now
> > +#
> > +echo Initializing workspace
> > +cd $BASE_DIR
> > +
> > +# Use the BaseTools in edk2
> > +export EDK_TOOLS_PATH=`pwd`/BaseTools
> > +source edksetup.sh BaseTools
> > +
> > +export DYNAMIC_ACPI_PLATFORM=$1$PKG
> > +export DYNAMIC_ACPI_INC="$1A"
> > +
> > +build -p "$PACKAGES_PATH/Platform/NXP/$1$PKG/$1$PKG.dsc" -a $ARCH -t $TARGET_TOOLS -b $3
> > --
> > 2.7.4
> >

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

* Re: [PATCH v0] Platform/NXP: Add Dynamic Acpi for layerscape platforms
  2021-01-16  4:45     ` Vikas Singh
@ 2021-01-18 16:55       ` Leif Lindholm
  2021-01-19  4:41         ` Vikas Singh
  2021-01-19 14:37         ` [edk2-devel] " Sami Mujawar
  0 siblings, 2 replies; 12+ messages in thread
From: Leif Lindholm @ 2021-01-18 16:55 UTC (permalink / raw)
  To: Vikas Singh
  Cc: devel, Sami Mujawar, meenakshi.aggarwal, Paul Yang,
	Augustine Philips, samer.el-haj-mahmoud, Varun Sethi, Arokia Samy,
	Kuldip Dwivedi, ard.biesheuvel, Vikas Singh

+Sami,

On Sat, Jan 16, 2021 at 10:15:41 +0530, Vikas Singh wrote:
> On Sun, Jan 10, 2021 at 8:56 AM Leif Lindholm <leif@nuviainc.com> wrote:
> >
> > On Tue, Dec 29, 2020 at 12:55:58 +0530, Vikas Singh wrote:
> > > These changes intend to add
> >
> > Hopefully they actually do.
> >
> > > - Common Configuration Manager (CM) for all fsl platforms.
> > > - Platform headers consumed by CM for LX2160ARDB.
> > > - Clk dsdt properties for LX2160ARDB.
> >
> > This sounds like (at least) three patches.
> >
> Leif, I plan to disintegrate the complete changes into 2 patch set's
> and will be sharing this series early next week.
> set1: Add Common Configuration Manager (CM) for all fsl platforms and
> headers consumed by CM for LX2160ARDB.
> set2: Add platform specific DSDT generator and Clk dsdt properties for
> LX2160ARDB.

This sounds sensible.

> > >
> > > Signed-off-by: Vikas Singh <vikas.singh@puresoftware.com>
> > > ---
> > >  .../ConfigurationManager/ConfigurationManager.dec  |  24 +
> > >  .../ConfigurationManager.dsc.inc                   |  21 +
> > >  .../ConfigurationManagerDxe/ConfigurationManager.c | 709 +++++++++++++++++++++
> > >  .../ConfigurationManagerDxe/ConfigurationManager.h | 229 +++++++
> > >  .../ConfigurationManagerDxe.inf                    |  52 ++
> > >  .../Include/PlatformAcpiTableGenerator.h           |  20 +
> > >  Platform/NXP/Env.cshrc                             |  73 +++
> > >  .../LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl   |  40 ++
> > >  .../LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl  |  15 +
> > >  .../AcpiTablesInclude/PlatformAcpiDsdtLib.inf      |  39 ++
> > >  .../PlatformAcpiDsdtLib/RawDsdtGenerator.c         | 146 +++++
> > >  .../AcpiTablesInclude/PlatformAcpiLib.h            |  24 +
> > >  Platform/NXP/LX2160aRdbPkg/Include/Platform.h      | 244 +++++++
> > >  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec       |   6 +-
> > >  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc       |  30 +
> > >  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf       |  12 +
> > >  Platform/NXP/build.sh                              | 121 ++++
> > >  17 files changed, 1804 insertions(+), 1 deletion(-)
> > >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManager.dec
> > >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManager.dsc.inc
> > >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
> > >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
> > >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
> > >  create mode 100644 Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h
> > >  create mode 100755 Platform/NXP/Env.cshrc
> > >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl
> > >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl
> > >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
> > >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c
> > >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiLib.h
> > >  create mode 100644 Platform/NXP/LX2160aRdbPkg/Include/Platform.h
> > >  create mode 100755 Platform/NXP/build.sh
> > >

> > > diff --git a/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
> > > new file mode 100644
> > > index 0000000..cf09ef9
> > > --- /dev/null
> > > +++ b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
> > > @@ -0,0 +1,229 @@
> > > +/** @file
> > > +  Configuration Manager headers
> > > +
> > > +  Copyright 2020 NXP
> > > +  Copyright 2020 Puresoftware Ltd
> > > +
> > > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > > +
> > > +  @par Glossary:
> > > +    - Cm or CM   - Configuration Manager
> > > +    - Obj or OBJ - Object
> > > +**/
> > > +
> > > +#ifndef CONFIGURATION_MANAGER_H__
> > > +#define CONFIGURATION_MANAGER_H__
> > > +
> > > +#include <Platform.h>
> > > +#include <PlatformAcpiTableGenerator.h>
> > > +
> > > +/** The configuration manager version
> > > +*/
> > > +#define CONFIGURATION_MANAGER_REVISION CREATE_REVISION (0, 0)
> > > +
> > > +/** The OEM ID
> > > +*/
> > > +#define CFG_MGR_OEM_ID    { 'N', 'X', 'P', ' ', ' ', ' ' }
> > > +
> > > +/** A helper macro for populating the GIC CPU information
> > > + */
> > > +#define GICC_ENTRY(                                                   \
> > > +    CPUInterfaceNumber,                                               \
> > > +    Mpidr,                                                            \
> > > +    PmuIrq,                                                           \
> > > +    VGicIrq,                                                          \
> > > +    EnergyEfficiency                                                  \
> > > +    ) {                                                               \
> > > +  CPUInterfaceNumber,       /* UINT32  CPUInterfaceNumber         */  \
> > > +  CPUInterfaceNumber,       /* UINT32  AcpiProcessorUid           */  \
> > > +  EFI_ACPI_6_2_GIC_ENABLED, /* UINT32  Flags                      */  \
> > > +  0,                        /* UINT32  ParkingProtocolVersion     */  \
> > > +  PmuIrq,                   /* UINT32  PerformanceInterruptGsiv   */  \
> > > +  0,                        /* UINT64  ParkedAddress              */  \
> > > +  GICC_BASE,                /* UINT64  PhysicalBaseAddress        */  \
> > > +  GICV_BASE,                /* UINT64  GICV                       */  \
> > > +  GICH_BASE,                /* UINT64  GICH                       */  \
> > > +  VGicIrq,                  /* UINT32  VGICMaintenanceInterrupt   */  \
> > > +  0,                        /* UINT64  GICRBaseAddress            */  \
> > > +  Mpidr,                    /* UINT64  MPIDR                      */  \
> > > +  EnergyEfficiency          /* UINT8   ProcessorPowerEfficiency   */  \
> > > +}
> > > +
> > > +/** A helper macro for returning configuration manager objects
> > > +*/
> > > +#define HANDLE_CM_OBJECT(ObjId, CmObjectId, Object, ObjectCount)      \
> > > +  case ObjId: {                                                       \
> > > +    CmObject->ObjectId = CmObjectId;                                  \
> > > +    CmObject->Size = sizeof (Object);                                 \
> > > +    CmObject->Data = (VOID*)&Object;                                  \
> > > +    CmObject->Count = ObjectCount;                                    \
> > > +    DEBUG ((                                                          \
> > > +      DEBUG_INFO,                                                     \
> > > +      #CmObjectId ": Ptr = 0x%p, Size = %d, Count = %d\n",            \
> > > +      CmObject->Data,                                                 \
> > > +      CmObject->Size,                                                 \
> > > +      CmObject->Count                                                 \
> > > +      ));                                                             \
> > > +    break;                                                            \
> > > +  }
> >
> > This is code obfuscation. Please don't invent your own programming
> > languages. In C, the case, the start bracket, the break and the end
> > bracket always go inline.
> > The rest would be better as a static helper function than a macro.
> >
> Leif, changes are in accordance with :
> https://raw.githubusercontent.com/tianocore-docs/Docs/master/Specifications/CCS_2_1_Draft.pdf

Do you mean 5.5.2.1:
Functional macros are generally discouraged.
?

> and in reference to :
> https://github.com/tianocore/edk2-platforms/blob/master/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h#L94

Clearly I was asleep at the wheel when reviewing that set.

So let me state unambiguously:
Hiding *gotos* away in a header macro turns the language into
something other than C.

Sami: please rewrite the referenced code in a way that does not
obfuscate the program flow.

Vikas: please submit a v2 that does not obfuscate the program flow.

> > > +/** The number of ACPI tables to install
> > > +*/
> > > +#define PLAT_ACPI_TABLE_COUNT   6
> >
> > This feels suboptimal.
> > Could this be calculated at run- or compile time?
> >
> Leif, I plan to chnage like this : PLAT_ACPI_TABLE_COUNT =
> CM_MANDATORY_TBLS + OEM_ACPI_TBLS
> Here CM_MANDATORY_TBLS must be known to CM upfront and is fixed as per
> thr CM's implementation (min tables needed to boot any os).
> OEM_ACPI_TBLS should be coming form platforms headers only.
> Unfortunately this can not be done at runtime /compile time.

OK. This is still an improvement over direct hard-coding.

> > > diff --git a/Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h b/Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h
> > > new file mode 100644
> > > index 0000000..da3c571
> > > --- /dev/null
> > > +++ b/Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h
> > > @@ -0,0 +1,20 @@
> > > +/** @file
> > > +  Acpi Table generator headers
> > > +
> > > +  Copyright 2020 NXP
> > > +  Copyright 2020 Puresoftware Ltd
> > > +
> > > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > > +
> > > +**/
> > > +
> > > +#ifndef PLATFORM_ACPI_TABLE_GENERATOR_H_
> > > +#define PLATFORM_ACPI_TABLE_GENERATOR_H_
> > > +
> > > +typedef enum PlatAcpiTableId {
> > > +  EPlatAcpiTableIdReserved = 0x0000,             ///< Reserved
> > > +  EPlatAcpiTableIdDsdt,
> > > +  EPlatAcpiTableIdMax
> > > +} EPLAT_ACPI_TABLE_ID;
> >
> > Where does the EPlat prefix come from? What does it stand for?
> >
> Leif, this will be corrected.
> e.g: EPlatAcpiTableIdReserved -> PlatAcpiTableIdReserved
> These Id's will be used by OEM/platforms defined generators etc.

Makes sense.

> > > +
> > > +#endif

Best Regards,

Leif


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

* Re: [PATCH v0] Platform/NXP: Add Dynamic Acpi for layerscape platforms
  2021-01-18 16:55       ` Leif Lindholm
@ 2021-01-19  4:41         ` Vikas Singh
  2021-01-26 11:19           ` Leif Lindholm
  2021-01-19 14:37         ` [edk2-devel] " Sami Mujawar
  1 sibling, 1 reply; 12+ messages in thread
From: Vikas Singh @ 2021-01-19  4:41 UTC (permalink / raw)
  To: Leif Lindholm
  Cc: devel, Sami Mujawar, meenakshi.aggarwal, Paul Yang,
	Augustine Philips, samer.el-haj-mahmoud, Varun Sethi, Arokia Samy,
	Kuldip Dwivedi, ard.biesheuvel, Vikas Singh

On Mon, Jan 18, 2021 at 10:25 PM Leif Lindholm <leif@nuviainc.com> wrote:
>
> +Sami,
>
> On Sat, Jan 16, 2021 at 10:15:41 +0530, Vikas Singh wrote:
> > On Sun, Jan 10, 2021 at 8:56 AM Leif Lindholm <leif@nuviainc.com> wrote:
> > >
> > > On Tue, Dec 29, 2020 at 12:55:58 +0530, Vikas Singh wrote:
> > > > These changes intend to add
> > >
> > > Hopefully they actually do.
> > >
> > > > - Common Configuration Manager (CM) for all fsl platforms.
> > > > - Platform headers consumed by CM for LX2160ARDB.
> > > > - Clk dsdt properties for LX2160ARDB.
> > >
> > > This sounds like (at least) three patches.
> > >
> > Leif, I plan to disintegrate the complete changes into 2 patch set's
> > and will be sharing this series early next week.
> > set1: Add Common Configuration Manager (CM) for all fsl platforms and
> > headers consumed by CM for LX2160ARDB.
> > set2: Add platform specific DSDT generator and Clk dsdt properties for
> > LX2160ARDB.
>
> This sounds sensible.
>
> > > >
> > > > Signed-off-by: Vikas Singh <vikas.singh@puresoftware.com>
> > > > ---
> > > >  .../ConfigurationManager/ConfigurationManager.dec  |  24 +
> > > >  .../ConfigurationManager.dsc.inc                   |  21 +
> > > >  .../ConfigurationManagerDxe/ConfigurationManager.c | 709 +++++++++++++++++++++
> > > >  .../ConfigurationManagerDxe/ConfigurationManager.h | 229 +++++++
> > > >  .../ConfigurationManagerDxe.inf                    |  52 ++
> > > >  .../Include/PlatformAcpiTableGenerator.h           |  20 +
> > > >  Platform/NXP/Env.cshrc                             |  73 +++
> > > >  .../LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl   |  40 ++
> > > >  .../LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl  |  15 +
> > > >  .../AcpiTablesInclude/PlatformAcpiDsdtLib.inf      |  39 ++
> > > >  .../PlatformAcpiDsdtLib/RawDsdtGenerator.c         | 146 +++++
> > > >  .../AcpiTablesInclude/PlatformAcpiLib.h            |  24 +
> > > >  Platform/NXP/LX2160aRdbPkg/Include/Platform.h      | 244 +++++++
> > > >  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec       |   6 +-
> > > >  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc       |  30 +
> > > >  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf       |  12 +
> > > >  Platform/NXP/build.sh                              | 121 ++++
> > > >  17 files changed, 1804 insertions(+), 1 deletion(-)
> > > >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManager.dec
> > > >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManager.dsc.inc
> > > >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
> > > >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
> > > >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
> > > >  create mode 100644 Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h
> > > >  create mode 100755 Platform/NXP/Env.cshrc
> > > >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl
> > > >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl
> > > >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
> > > >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c
> > > >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiLib.h
> > > >  create mode 100644 Platform/NXP/LX2160aRdbPkg/Include/Platform.h
> > > >  create mode 100755 Platform/NXP/build.sh
> > > >
>
> > > > diff --git a/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
> > > > new file mode 100644
> > > > index 0000000..cf09ef9
> > > > --- /dev/null
> > > > +++ b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
> > > > @@ -0,0 +1,229 @@
> > > > +/** @file
> > > > +  Configuration Manager headers
> > > > +
> > > > +  Copyright 2020 NXP
> > > > +  Copyright 2020 Puresoftware Ltd
> > > > +
> > > > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > > > +
> > > > +  @par Glossary:
> > > > +    - Cm or CM   - Configuration Manager
> > > > +    - Obj or OBJ - Object
> > > > +**/
> > > > +
> > > > +#ifndef CONFIGURATION_MANAGER_H__
> > > > +#define CONFIGURATION_MANAGER_H__
> > > > +
> > > > +#include <Platform.h>
> > > > +#include <PlatformAcpiTableGenerator.h>
> > > > +
> > > > +/** The configuration manager version
> > > > +*/
> > > > +#define CONFIGURATION_MANAGER_REVISION CREATE_REVISION (0, 0)
> > > > +
> > > > +/** The OEM ID
> > > > +*/
> > > > +#define CFG_MGR_OEM_ID    { 'N', 'X', 'P', ' ', ' ', ' ' }
> > > > +
> > > > +/** A helper macro for populating the GIC CPU information
> > > > + */
> > > > +#define GICC_ENTRY(                                                   \
> > > > +    CPUInterfaceNumber,                                               \
> > > > +    Mpidr,                                                            \
> > > > +    PmuIrq,                                                           \
> > > > +    VGicIrq,                                                          \
> > > > +    EnergyEfficiency                                                  \
> > > > +    ) {                                                               \
> > > > +  CPUInterfaceNumber,       /* UINT32  CPUInterfaceNumber         */  \
> > > > +  CPUInterfaceNumber,       /* UINT32  AcpiProcessorUid           */  \
> > > > +  EFI_ACPI_6_2_GIC_ENABLED, /* UINT32  Flags                      */  \
> > > > +  0,                        /* UINT32  ParkingProtocolVersion     */  \
> > > > +  PmuIrq,                   /* UINT32  PerformanceInterruptGsiv   */  \
> > > > +  0,                        /* UINT64  ParkedAddress              */  \
> > > > +  GICC_BASE,                /* UINT64  PhysicalBaseAddress        */  \
> > > > +  GICV_BASE,                /* UINT64  GICV                       */  \
> > > > +  GICH_BASE,                /* UINT64  GICH                       */  \
> > > > +  VGicIrq,                  /* UINT32  VGICMaintenanceInterrupt   */  \
> > > > +  0,                        /* UINT64  GICRBaseAddress            */  \
> > > > +  Mpidr,                    /* UINT64  MPIDR                      */  \
> > > > +  EnergyEfficiency          /* UINT8   ProcessorPowerEfficiency   */  \
> > > > +}
> > > > +
> > > > +/** A helper macro for returning configuration manager objects
> > > > +*/
> > > > +#define HANDLE_CM_OBJECT(ObjId, CmObjectId, Object, ObjectCount)      \
> > > > +  case ObjId: {                                                       \
> > > > +    CmObject->ObjectId = CmObjectId;                                  \
> > > > +    CmObject->Size = sizeof (Object);                                 \
> > > > +    CmObject->Data = (VOID*)&Object;                                  \
> > > > +    CmObject->Count = ObjectCount;                                    \
> > > > +    DEBUG ((                                                          \
> > > > +      DEBUG_INFO,                                                     \
> > > > +      #CmObjectId ": Ptr = 0x%p, Size = %d, Count = %d\n",            \
> > > > +      CmObject->Data,                                                 \
> > > > +      CmObject->Size,                                                 \
> > > > +      CmObject->Count                                                 \
> > > > +      ));                                                             \
> > > > +    break;                                                            \
> > > > +  }
> > >
> > > This is code obfuscation. Please don't invent your own programming
> > > languages. In C, the case, the start bracket, the break and the end
> > > bracket always go inline.
> > > The rest would be better as a static helper function than a macro.
> > >
> > Leif, changes are in accordance with :
> > https://raw.githubusercontent.com/tianocore-docs/Docs/master/Specifications/CCS_2_1_Draft.pdf
>
> Do you mean 5.5.2.1:
> Functional macros are generally discouraged.
> ?

Leif + Sami, I was referring section 5.7.3.7, since you commented on
switch case & break statement.
However keeping section 5.5.2.1 in consideration, I have done few
changes and shared updated V1 series.
Could you please have a look on it and revert, if in case you have any concerns.

>
> > and in reference to :
> > https://github.com/tianocore/edk2-platforms/blob/master/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h#L94
>
> Clearly I was asleep at the wheel when reviewing that set.
>
> So let me state unambiguously:
> Hiding *gotos* away in a header macro turns the language into
> something other than C.
>
> Sami: please rewrite the referenced code in a way that does not
> obfuscate the program flow.
>
> Vikas: please submit a v2 that does not obfuscate the program flow.
>
> > > > +/** The number of ACPI tables to install
> > > > +*/
> > > > +#define PLAT_ACPI_TABLE_COUNT   6
> > >
> > > This feels suboptimal.
> > > Could this be calculated at run- or compile time?
> > >
> > Leif, I plan to chnage like this : PLAT_ACPI_TABLE_COUNT =
> > CM_MANDATORY_TBLS + OEM_ACPI_TBLS
> > Here CM_MANDATORY_TBLS must be known to CM upfront and is fixed as per
> > thr CM's implementation (min tables needed to boot any os).
> > OEM_ACPI_TBLS should be coming form platforms headers only.
> > Unfortunately this can not be done at runtime /compile time.
>
> OK. This is still an improvement over direct hard-coding.
>
> > > > diff --git a/Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h b/Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h
> > > > new file mode 100644
> > > > index 0000000..da3c571
> > > > --- /dev/null
> > > > +++ b/Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h
> > > > @@ -0,0 +1,20 @@
> > > > +/** @file
> > > > +  Acpi Table generator headers
> > > > +
> > > > +  Copyright 2020 NXP
> > > > +  Copyright 2020 Puresoftware Ltd
> > > > +
> > > > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > > > +
> > > > +**/
> > > > +
> > > > +#ifndef PLATFORM_ACPI_TABLE_GENERATOR_H_
> > > > +#define PLATFORM_ACPI_TABLE_GENERATOR_H_
> > > > +
> > > > +typedef enum PlatAcpiTableId {
> > > > +  EPlatAcpiTableIdReserved = 0x0000,             ///< Reserved
> > > > +  EPlatAcpiTableIdDsdt,
> > > > +  EPlatAcpiTableIdMax
> > > > +} EPLAT_ACPI_TABLE_ID;
> > >
> > > Where does the EPlat prefix come from? What does it stand for?
> > >
> > Leif, this will be corrected.
> > e.g: EPlatAcpiTableIdReserved -> PlatAcpiTableIdReserved
> > These Id's will be used by OEM/platforms defined generators etc.
>
> Makes sense.
>
> > > > +
> > > > +#endif
>
> Best Regards,
>
> Leif
>

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

* Re: [edk2-devel] [PATCH v0] Platform/NXP: Add Dynamic Acpi for layerscape platforms
  2021-01-18 16:55       ` Leif Lindholm
  2021-01-19  4:41         ` Vikas Singh
@ 2021-01-19 14:37         ` Sami Mujawar
  1 sibling, 0 replies; 12+ messages in thread
From: Sami Mujawar @ 2021-01-19 14:37 UTC (permalink / raw)
  To: devel@edk2.groups.io, leif@nuviainc.com, Vikas Singh
  Cc: Meenakshi Aggarwal (meenakshi.aggarwal@nxp.com), Paul Yang,
	Augustine Philips, Samer El-Haj-Mahmoud,
	V Sethi (v.sethi@nxp.com), arokia.samy, Kuldip Dwivedi,
	Ard Biesheuvel, Vikas Singh, nd

Hi Leif,

Please find my response inline marked [SAMI].

Regards,

Sami Mujawar

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Leif Lindholm via groups.io
Sent: 18 January 2021 04:56 PM
To: Vikas Singh <vikas.singh@puresoftware.com>
Cc: devel@edk2.groups.io; Sami Mujawar <Sami.Mujawar@arm.com>; Meenakshi Aggarwal (meenakshi.aggarwal@nxp.com) <meenakshi.aggarwal@nxp.com>; Paul Yang <Paul.Yang@arm.com>; Augustine Philips <Augustine.Philips@arm.com>; Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>; V Sethi (v.sethi@nxp.com) <v.sethi@nxp.com>; arokia.samy <arokia.samy@puresoftware.com>; Kuldip Dwivedi <kuldip.dwivedi@puresoftware.com>; Ard Biesheuvel <Ard.Biesheuvel@arm.com>; Vikas Singh <vikas.singh@nxp.com>
Subject: Re: [edk2-devel] [PATCH v0] Platform/NXP: Add Dynamic Acpi for layerscape platforms

+Sami,

On Sat, Jan 16, 2021 at 10:15:41 +0530, Vikas Singh wrote:
> On Sun, Jan 10, 2021 at 8:56 AM Leif Lindholm <leif@nuviainc.com> wrote:
> >
> > On Tue, Dec 29, 2020 at 12:55:58 +0530, Vikas Singh wrote:
> > > These changes intend to add
> >
> > Hopefully they actually do.
> >
> > > - Common Configuration Manager (CM) for all fsl platforms.
> > > - Platform headers consumed by CM for LX2160ARDB.
> > > - Clk dsdt properties for LX2160ARDB.
> >
> > This sounds like (at least) three patches.
> >
> Leif, I plan to disintegrate the complete changes into 2 patch set's
> and will be sharing this series early next week.
> set1: Add Common Configuration Manager (CM) for all fsl platforms and
> headers consumed by CM for LX2160ARDB.
> set2: Add platform specific DSDT generator and Clk dsdt properties for
> LX2160ARDB.

This sounds sensible.

> > >
> > > Signed-off-by: Vikas Singh <vikas.singh@puresoftware.com>
> > > ---
> > >  .../ConfigurationManager/ConfigurationManager.dec  |  24 +
> > >  .../ConfigurationManager.dsc.inc                   |  21 +
> > >  .../ConfigurationManagerDxe/ConfigurationManager.c | 709 +++++++++++++++++++++
> > >  .../ConfigurationManagerDxe/ConfigurationManager.h | 229 +++++++
> > >  .../ConfigurationManagerDxe.inf                    |  52 ++
> > >  .../Include/PlatformAcpiTableGenerator.h           |  20 +
> > >  Platform/NXP/Env.cshrc                             |  73 +++
> > >  .../LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl   |  40 ++
> > >  .../LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl  |  15 +
> > >  .../AcpiTablesInclude/PlatformAcpiDsdtLib.inf      |  39 ++
> > >  .../PlatformAcpiDsdtLib/RawDsdtGenerator.c         | 146 +++++
> > >  .../AcpiTablesInclude/PlatformAcpiLib.h            |  24 +
> > >  Platform/NXP/LX2160aRdbPkg/Include/Platform.h      | 244 +++++++
> > >  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dec       |   6 +-
> > >  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc       |  30 +
> > >  Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf       |  12 +
> > >  Platform/NXP/build.sh                              | 121 ++++
> > >  17 files changed, 1804 insertions(+), 1 deletion(-)
> > >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManager.dec
> > >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManager.dsc.inc
> > >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
> > >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
> > >  create mode 100644 Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
> > >  create mode 100644 Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h
> > >  create mode 100755 Platform/NXP/Env.cshrc
> > >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Clk.asl
> > >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/Dsdt/Dsdt.asl
> > >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
> > >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c
> > >  create mode 100644 Platform/NXP/LX2160aRdbPkg/AcpiTablesInclude/PlatformAcpiLib.h
> > >  create mode 100644 Platform/NXP/LX2160aRdbPkg/Include/Platform.h
> > >  create mode 100755 Platform/NXP/build.sh
> > >

> > > diff --git a/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
> > > new file mode 100644
> > > index 0000000..cf09ef9
> > > --- /dev/null
> > > +++ b/Platform/NXP/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
> > > @@ -0,0 +1,229 @@
> > > +/** @file
> > > +  Configuration Manager headers
> > > +
> > > +  Copyright 2020 NXP
> > > +  Copyright 2020 Puresoftware Ltd
> > > +
> > > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > > +
> > > +  @par Glossary:
> > > +    - Cm or CM   - Configuration Manager
> > > +    - Obj or OBJ - Object
> > > +**/
> > > +
> > > +#ifndef CONFIGURATION_MANAGER_H__
> > > +#define CONFIGURATION_MANAGER_H__
> > > +
> > > +#include <Platform.h>
> > > +#include <PlatformAcpiTableGenerator.h>
> > > +
> > > +/** The configuration manager version
> > > +*/
> > > +#define CONFIGURATION_MANAGER_REVISION CREATE_REVISION (0, 0)
> > > +
> > > +/** The OEM ID
> > > +*/
> > > +#define CFG_MGR_OEM_ID    { 'N', 'X', 'P', ' ', ' ', ' ' }
> > > +
> > > +/** A helper macro for populating the GIC CPU information
> > > + */
> > > +#define GICC_ENTRY(                                                   \
> > > +    CPUInterfaceNumber,                                               \
> > > +    Mpidr,                                                            \
> > > +    PmuIrq,                                                           \
> > > +    VGicIrq,                                                          \
> > > +    EnergyEfficiency                                                  \
> > > +    ) {                                                               \
> > > +  CPUInterfaceNumber,       /* UINT32  CPUInterfaceNumber         */  \
> > > +  CPUInterfaceNumber,       /* UINT32  AcpiProcessorUid           */  \
> > > +  EFI_ACPI_6_2_GIC_ENABLED, /* UINT32  Flags                      */  \
> > > +  0,                        /* UINT32  ParkingProtocolVersion     */  \
> > > +  PmuIrq,                   /* UINT32  PerformanceInterruptGsiv   */  \
> > > +  0,                        /* UINT64  ParkedAddress              */  \
> > > +  GICC_BASE,                /* UINT64  PhysicalBaseAddress        */  \
> > > +  GICV_BASE,                /* UINT64  GICV                       */  \
> > > +  GICH_BASE,                /* UINT64  GICH                       */  \
> > > +  VGicIrq,                  /* UINT32  VGICMaintenanceInterrupt   */  \
> > > +  0,                        /* UINT64  GICRBaseAddress            */  \
> > > +  Mpidr,                    /* UINT64  MPIDR                      */  \
> > > +  EnergyEfficiency          /* UINT8   ProcessorPowerEfficiency   */  \
> > > +}
> > > +
> > > +/** A helper macro for returning configuration manager objects
> > > +*/
> > > +#define HANDLE_CM_OBJECT(ObjId, CmObjectId, Object, ObjectCount)      \
> > > +  case ObjId: {                                                       \
> > > +    CmObject->ObjectId = CmObjectId;                                  \
> > > +    CmObject->Size = sizeof (Object);                                 \
> > > +    CmObject->Data = (VOID*)&Object;                                  \
> > > +    CmObject->Count = ObjectCount;                                    \
> > > +    DEBUG ((                                                          \
> > > +      DEBUG_INFO,                                                     \
> > > +      #CmObjectId ": Ptr = 0x%p, Size = %d, Count = %d\n",            \
> > > +      CmObject->Data,                                                 \
> > > +      CmObject->Size,                                                 \
> > > +      CmObject->Count                                                 \
> > > +      ));                                                             \
> > > +    break;                                                            \
> > > +  }
> >
> > This is code obfuscation. Please don't invent your own programming
> > languages. In C, the case, the start bracket, the break and the end
> > bracket always go inline.
> > The rest would be better as a static helper function than a macro.
> >
> Leif, changes are in accordance with :
> https://raw.githubusercontent.com/tianocore-docs/Docs/master/Specifications/CCS_2_1_Draft.pdf

Do you mean 5.5.2.1:
Functional macros are generally discouraged.
?

> and in reference to :
> https://github.com/tianocore/edk2-platforms/blob/master/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h#L94

Clearly I was asleep at the wheel when reviewing that set.

So let me state unambiguously:
Hiding *gotos* away in a header macro turns the language into
something other than C.

Sami: please rewrite the referenced code in a way that does not
obfuscate the program flow.
[SAMI] I will submit a patch that removes the macros and uses static functions. 
[/SAMI]

Vikas: please submit a v2 that does not obfuscate the program flow.

> > > +/** The number of ACPI tables to install
> > > +*/
> > > +#define PLAT_ACPI_TABLE_COUNT   6
> >
> > This feels suboptimal.
> > Could this be calculated at run- or compile time?
> >
> Leif, I plan to chnage like this : PLAT_ACPI_TABLE_COUNT =
> CM_MANDATORY_TBLS + OEM_ACPI_TBLS
> Here CM_MANDATORY_TBLS must be known to CM upfront and is fixed as per
> thr CM's implementation (min tables needed to boot any os).
> OEM_ACPI_TBLS should be coming form platforms headers only.
> Unfortunately this can not be done at runtime /compile time.

OK. This is still an improvement over direct hard-coding.

> > > diff --git a/Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h b/Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h
> > > new file mode 100644
> > > index 0000000..da3c571
> > > --- /dev/null
> > > +++ b/Platform/NXP/ConfigurationManager/Include/PlatformAcpiTableGenerator.h
> > > @@ -0,0 +1,20 @@
> > > +/** @file
> > > +  Acpi Table generator headers
> > > +
> > > +  Copyright 2020 NXP
> > > +  Copyright 2020 Puresoftware Ltd
> > > +
> > > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > > +
> > > +**/
> > > +
> > > +#ifndef PLATFORM_ACPI_TABLE_GENERATOR_H_
> > > +#define PLATFORM_ACPI_TABLE_GENERATOR_H_
> > > +
> > > +typedef enum PlatAcpiTableId {
> > > +  EPlatAcpiTableIdReserved = 0x0000,             ///< Reserved
> > > +  EPlatAcpiTableIdDsdt,
> > > +  EPlatAcpiTableIdMax
> > > +} EPLAT_ACPI_TABLE_ID;
> >
> > Where does the EPlat prefix come from? What does it stand for?
> >
> Leif, this will be corrected.
> e.g: EPlatAcpiTableIdReserved -> PlatAcpiTableIdReserved
> These Id's will be used by OEM/platforms defined generators etc.

Makes sense.

> > > +
> > > +#endif

Best Regards,

Leif







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

* Re: [PATCH v0] Platform/NXP: Add Dynamic Acpi for layerscape platforms
  2021-01-19  4:41         ` Vikas Singh
@ 2021-01-26 11:19           ` Leif Lindholm
  2021-01-27  6:51             ` Vikas Singh
  0 siblings, 1 reply; 12+ messages in thread
From: Leif Lindholm @ 2021-01-26 11:19 UTC (permalink / raw)
  To: Vikas Singh
  Cc: devel, Sami Mujawar, meenakshi.aggarwal, Paul Yang,
	Augustine Philips, samer.el-haj-mahmoud, Varun Sethi, Arokia Samy,
	Kuldip Dwivedi, ard.biesheuvel, Vikas Singh

Hi Vikas,

On Tue, Jan 19, 2021 at 10:11:43 +0530, Vikas Singh wrote:
> > > > > +/** A helper macro for returning configuration manager objects
> > > > > +*/
> > > > > +#define HANDLE_CM_OBJECT(ObjId, CmObjectId, Object, ObjectCount)      \
> > > > > +  case ObjId: {                                                       \
> > > > > +    CmObject->ObjectId = CmObjectId;                                  \
> > > > > +    CmObject->Size = sizeof (Object);                                 \
> > > > > +    CmObject->Data = (VOID*)&Object;                                  \
> > > > > +    CmObject->Count = ObjectCount;                                    \
> > > > > +    DEBUG ((                                                          \
> > > > > +      DEBUG_INFO,                                                     \
> > > > > +      #CmObjectId ": Ptr = 0x%p, Size = %d, Count = %d\n",            \
> > > > > +      CmObject->Data,                                                 \
> > > > > +      CmObject->Size,                                                 \
> > > > > +      CmObject->Count                                                 \
> > > > > +      ));                                                             \
> > > > > +    break;                                                            \
> > > > > +  }
> > > >
> > > > This is code obfuscation. Please don't invent your own programming
> > > > languages. In C, the case, the start bracket, the break and the end
> > > > bracket always go inline.
> > > > The rest would be better as a static helper function than a macro.
> > > >
> > > Leif, changes are in accordance with :
> > > https://raw.githubusercontent.com/tianocore-docs/Docs/master/Specifications/CCS_2_1_Draft.pdf
> >
> > Do you mean 5.5.2.1:
> > Functional macros are generally discouraged.
> > ?
> 
> Leif + Sami, I was referring section 5.7.3.7, since you commented on
> switch case & break statement.
> However keeping section 5.5.2.1 in consideration, I have done few
> changes and shared updated V1 series.
> Could you please have a look on it and revert, if in case you have any concerns.

I have not seen any update?

Please have a look at Sami's updates to the ARM platform code, which I
merged yeaterday.

Best Regards,

Leif


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

* Re: [PATCH v0] Platform/NXP: Add Dynamic Acpi for layerscape platforms
  2021-01-26 11:19           ` Leif Lindholm
@ 2021-01-27  6:51             ` Vikas Singh
  2021-02-10  7:12               ` Vikas Singh
  0 siblings, 1 reply; 12+ messages in thread
From: Vikas Singh @ 2021-01-27  6:51 UTC (permalink / raw)
  To: Leif Lindholm
  Cc: devel, Sami Mujawar, meenakshi.aggarwal, Paul Yang,
	Augustine Philips, samer.el-haj-mahmoud, Varun Sethi, Arokia Samy,
	Kuldip Dwivedi, ard.biesheuvel, Vikas Singh

On Tue, Jan 26, 2021 at 4:49 PM Leif Lindholm <leif@nuviainc.com> wrote:
>
> Hi Vikas,
>
> On Tue, Jan 19, 2021 at 10:11:43 +0530, Vikas Singh wrote:
> > > > > > +/** A helper macro for returning configuration manager objects
> > > > > > +*/
> > > > > > +#define HANDLE_CM_OBJECT(ObjId, CmObjectId, Object, ObjectCount)      \
> > > > > > +  case ObjId: {                                                       \
> > > > > > +    CmObject->ObjectId = CmObjectId;                                  \
> > > > > > +    CmObject->Size = sizeof (Object);                                 \
> > > > > > +    CmObject->Data = (VOID*)&Object;                                  \
> > > > > > +    CmObject->Count = ObjectCount;                                    \
> > > > > > +    DEBUG ((                                                          \
> > > > > > +      DEBUG_INFO,                                                     \
> > > > > > +      #CmObjectId ": Ptr = 0x%p, Size = %d, Count = %d\n",            \
> > > > > > +      CmObject->Data,                                                 \
> > > > > > +      CmObject->Size,                                                 \
> > > > > > +      CmObject->Count                                                 \
> > > > > > +      ));                                                             \
> > > > > > +    break;                                                            \
> > > > > > +  }
> > > > >
> > > > > This is code obfuscation. Please don't invent your own programming
> > > > > languages. In C, the case, the start bracket, the break and the end
> > > > > bracket always go inline.
> > > > > The rest would be better as a static helper function than a macro.
> > > > >
> > > > Leif, changes are in accordance with :
> > > > https://raw.githubusercontent.com/tianocore-docs/Docs/master/Specifications/CCS_2_1_Draft.pdf
> > >
> > > Do you mean 5.5.2.1:
> > > Functional macros are generally discouraged.
> > > ?
> >
> > Leif + Sami, I was referring section 5.7.3.7, since you commented on
> > switch case & break statement.
> > However keeping section 5.5.2.1 in consideration, I have done few
> > changes and shared updated V1 series.
> > Could you please have a look on it and revert, if in case you have any concerns.
>
> I have not seen any update?
>
> Please have a look at Sami's updates to the ARM platform code, which I
> merged yeaterday.
>
> Best Regards,
>
> Leif
>
Leif , I have sent an updated V2 patch series today. FYI.

Thnx.

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

* Re: [PATCH v0] Platform/NXP: Add Dynamic Acpi for layerscape platforms
  2021-01-27  6:51             ` Vikas Singh
@ 2021-02-10  7:12               ` Vikas Singh
  0 siblings, 0 replies; 12+ messages in thread
From: Vikas Singh @ 2021-02-10  7:12 UTC (permalink / raw)
  To: Leif Lindholm
  Cc: devel, Sami Mujawar, meenakshi.aggarwal, Paul Yang,
	Augustine Philips, samer.el-haj-mahmoud, Varun Sethi, Arokia Samy,
	Kuldip Dwivedi, ard.biesheuvel, Vikas Singh

On Wed, Jan 27, 2021 at 12:21 PM Vikas Singh
<vikas.singh@puresoftware.com> wrote:
>
> On Tue, Jan 26, 2021 at 4:49 PM Leif Lindholm <leif@nuviainc.com> wrote:
> >
> > Hi Vikas,
> >
> > On Tue, Jan 19, 2021 at 10:11:43 +0530, Vikas Singh wrote:
> > > > > > > +/** A helper macro for returning configuration manager objects
> > > > > > > +*/
> > > > > > > +#define HANDLE_CM_OBJECT(ObjId, CmObjectId, Object, ObjectCount)      \
> > > > > > > +  case ObjId: {                                                       \
> > > > > > > +    CmObject->ObjectId = CmObjectId;                                  \
> > > > > > > +    CmObject->Size = sizeof (Object);                                 \
> > > > > > > +    CmObject->Data = (VOID*)&Object;                                  \
> > > > > > > +    CmObject->Count = ObjectCount;                                    \
> > > > > > > +    DEBUG ((                                                          \
> > > > > > > +      DEBUG_INFO,                                                     \
> > > > > > > +      #CmObjectId ": Ptr = 0x%p, Size = %d, Count = %d\n",            \
> > > > > > > +      CmObject->Data,                                                 \
> > > > > > > +      CmObject->Size,                                                 \
> > > > > > > +      CmObject->Count                                                 \
> > > > > > > +      ));                                                             \
> > > > > > > +    break;                                                            \
> > > > > > > +  }
> > > > > >
> > > > > > This is code obfuscation. Please don't invent your own programming
> > > > > > languages. In C, the case, the start bracket, the break and the end
> > > > > > bracket always go inline.
> > > > > > The rest would be better as a static helper function than a macro.
> > > > > >
> > > > > Leif, changes are in accordance with :
> > > > > https://raw.githubusercontent.com/tianocore-docs/Docs/master/Specifications/CCS_2_1_Draft.pdf
> > > >
> > > > Do you mean 5.5.2.1:
> > > > Functional macros are generally discouraged.
> > > > ?
> > >
> > > Leif + Sami, I was referring section 5.7.3.7, since you commented on
> > > switch case & break statement.
> > > However keeping section 5.5.2.1 in consideration, I have done few
> > > changes and shared updated V1 series.
> > > Could you please have a look on it and revert, if in case you have any concerns.
> >
> > I have not seen any update?
> >
> > Please have a look at Sami's updates to the ARM platform code, which I
> > merged yeaterday.
> >
> > Best Regards,
> >
> > Leif
> >
> Leif , I have sent an updated V2 patch series today. FYI.
>
> Thnx.

Hi Leif,

Any Update on V2 patch series that I have shared to you at the end of Jan 2021.

I did not receive any comments (if any).

Thnx !!
Vikas Singh

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

end of thread, other threads:[~2021-02-10  7:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-29  7:25 [PATCH v0] Dynamic ACPI framework for fsl layerscape platforms Vikas Singh
2020-12-29  7:25 ` [PATCH v0] Platform/NXP: Add Dynamic Acpi for " Vikas Singh
2021-01-10  3:26   ` Leif Lindholm
2021-01-16  4:45     ` Vikas Singh
2021-01-18 16:55       ` Leif Lindholm
2021-01-19  4:41         ` Vikas Singh
2021-01-26 11:19           ` Leif Lindholm
2021-01-27  6:51             ` Vikas Singh
2021-02-10  7:12               ` Vikas Singh
2021-01-19 14:37         ` [edk2-devel] " Sami Mujawar
2021-01-10  2:30 ` [PATCH v0] Dynamic ACPI framework for fsl " Leif Lindholm
2021-01-16  4:08   ` Vikas Singh

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