* [PATCH V0 1/4] Platform/NXP: Add generic log in CM to print SoC version
2021-06-01 13:50 [PATCH V0 0/4] Enable Dynamic ACPI for LS1046AFRWY Vikas Singh
@ 2021-06-01 13:50 ` Vikas Singh
2021-06-01 13:50 ` [PATCH V0 2/4] Silicon/NXP: Add support of SVR handling for LS1046FRWY Vikas Singh
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Vikas Singh @ 2021-06-01 13:50 UTC (permalink / raw)
To: devel
Cc: sami.mujawar, leif, meenakshi.aggarwal, samer.el-haj-mahmoud,
v.sethi, arokia.samy, kuldip.dwivedi, ard.biesheuvel, vikas.singh,
Sunny.Wang
Summary -
1.Configuration Manager(CM) is a common implementation
and should not evaluate the SoC version using macro's
However CM must directly consume SoC ver string from
platfrom who is extending CM services for ACPI table
generation.
2.Platforms who extends CM services for themselves must
notify their SoC details to CM.
3.This patch will update the lx2160ardb platform header
also with PLAT_SOC_NAME, this will be consumed by CM.
Signed-off-by: Vikas Singh <vikas.singh@puresoftware.com>
---
.../ConfigurationManagerDxe/ConfigurationManager.c | 10 +++-------
Platform/NXP/LX2160aRdbPkg/Include/Platform.h | 5 ++---
2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/Platform/NXP/ConfigurationManagerPkg/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/NXP/ConfigurationManagerPkg/ConfigurationManagerDxe/ConfigurationManager.c
index 80ce8412c4..dc1a7f5f85 100644
--- a/Platform/NXP/ConfigurationManagerPkg/ConfigurationManagerDxe/ConfigurationManager.c
+++ b/Platform/NXP/ConfigurationManagerPkg/ConfigurationManagerDxe/ConfigurationManager.c
@@ -2,7 +2,7 @@
Configuration Manager Dxe
Copyright 2020 NXP
- Copyright 2020 Puresoftware Ltd
+ Copyright 2020-2021 Puresoftware Ltd
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -170,12 +170,8 @@ InitializePlatformRepository (
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));
- }
+ PlatformRepo->FslBoardRevision = SVR_MAJOR(Svr);
+ DEBUG ((DEBUG_INFO, "Fsl : SoC = %s Rev = 0x%x\n", PLAT_SOC_NAME, PlatformRepo->FslBoardRevision));
return EFI_SUCCESS;
}
diff --git a/Platform/NXP/LX2160aRdbPkg/Include/Platform.h b/Platform/NXP/LX2160aRdbPkg/Include/Platform.h
index 76a41d4369..c18faf28cd 100644
--- a/Platform/NXP/LX2160aRdbPkg/Include/Platform.h
+++ b/Platform/NXP/LX2160aRdbPkg/Include/Platform.h
@@ -2,7 +2,7 @@
* Platform headers
*
* Copyright 2020 NXP
- * Copyright 2020 Puresoftware Ltd
+ * Copyright 2020-2021 Puresoftware Ltd
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*
@@ -15,12 +15,11 @@
#define EFI_ACPI_ARM_OEM_REVISION 0x00000000
// Soc defines
+#define PLAT_SOC_NAME "LX2160ARDB"
#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
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH V0 2/4] Silicon/NXP: Add support of SVR handling for LS1046FRWY
2021-06-01 13:50 [PATCH V0 0/4] Enable Dynamic ACPI for LS1046AFRWY Vikas Singh
2021-06-01 13:50 ` [PATCH V0 1/4] Platform/NXP: Add generic log in CM to print SoC version Vikas Singh
@ 2021-06-01 13:50 ` Vikas Singh
2021-06-01 13:50 ` [PATCH V0 3/4] Platform/NXP/LS1046aFrwyPkg: Extend Dynamic ACPI support Vikas Singh
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Vikas Singh @ 2021-06-01 13:50 UTC (permalink / raw)
To: devel
Cc: sami.mujawar, leif, meenakshi.aggarwal, samer.el-haj-mahmoud,
v.sethi, arokia.samy, kuldip.dwivedi, ard.biesheuvel, vikas.singh,
Sunny.Wang
This change set intend to add a generic method to get
access to SoC's Silicon Version Register (SVR) and its
handling for LS1046aFrwy platform.
Signed-off-by: Vikas Singh <vikas.singh@puresoftware.com>
---
Silicon/NXP/LS1046A/Library/SocLib/SocLib.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/Silicon/NXP/LS1046A/Library/SocLib/SocLib.c b/Silicon/NXP/LS1046A/Library/SocLib/SocLib.c
index 8fa6a7dd00..003f5bd82f 100644
--- a/Silicon/NXP/LS1046A/Library/SocLib/SocLib.c
+++ b/Silicon/NXP/LS1046A/Library/SocLib/SocLib.c
@@ -2,6 +2,7 @@
SoC specific Library containg functions to initialize various SoC components
Copyright 2017-2020 NXP
+ Copyright 2021 Puresoftware Ltd
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -64,6 +65,21 @@ SocGetClock (
return ReturnValue;
}
+/**
+ Function to get SoC's System Version Register(SVR)
+ **/
+UINT32
+SocGetSvr (
+ VOID
+ )
+{
+ LS1046A_DEVICE_CONFIG *Dcfg;
+
+ Dcfg = (LS1046A_DEVICE_CONFIG *)LS1046A_DCFG_ADDRESS;
+
+ return DcfgRead32 ((UINTN)&Dcfg->Svr);
+}
+
/**
Function to select pins depending upon pcd using supplemental
configuration unit(SCFG) extended RCW controlled pinmux control
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH V0 3/4] Platform/NXP/LS1046aFrwyPkg: Extend Dynamic ACPI support
2021-06-01 13:50 [PATCH V0 0/4] Enable Dynamic ACPI for LS1046AFRWY Vikas Singh
2021-06-01 13:50 ` [PATCH V0 1/4] Platform/NXP: Add generic log in CM to print SoC version Vikas Singh
2021-06-01 13:50 ` [PATCH V0 2/4] Silicon/NXP: Add support of SVR handling for LS1046FRWY Vikas Singh
@ 2021-06-01 13:50 ` Vikas Singh
2021-06-01 13:50 ` [PATCH V0 4/4] Platform/NXP/LS1046aFrwyPkg: Add OEM specific DSDT generator Vikas Singh
2021-06-08 11:11 ` [PATCH V0 0/4] Enable Dynamic ACPI for LS1046AFRWY Leif Lindholm
4 siblings, 0 replies; 6+ messages in thread
From: Vikas Singh @ 2021-06-01 13:50 UTC (permalink / raw)
To: devel
Cc: sami.mujawar, leif, meenakshi.aggarwal, samer.el-haj-mahmoud,
v.sethi, arokia.samy, kuldip.dwivedi, ard.biesheuvel, vikas.singh,
Sunny.Wang
This patch set extends Configuration Manager (CM) and
its services to leverage the Dynamic ACPI support for
NXP's LS1046aFrwy platform.
Refer-https://edk2.groups.io/g/devel/message/71710
Signed-off-by: Vikas Singh <vikas.singh@puresoftware.com>
---
.../NXP/LS1046aFrwyPkg/Include/Platform.h | 155 ++++++++++++++++++
.../NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.dsc | 28 ++++
.../NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.fdf | 13 ++
Silicon/NXP/LS1046A/LS1046A.dsc.inc | 10 ++
4 files changed, 206 insertions(+)
create mode 100644 Platform/NXP/LS1046aFrwyPkg/Include/Platform.h
diff --git a/Platform/NXP/LS1046aFrwyPkg/Include/Platform.h b/Platform/NXP/LS1046aFrwyPkg/Include/Platform.h
new file mode 100644
index 0000000000..19e879ec6d
--- /dev/null
+++ b/Platform/NXP/LS1046aFrwyPkg/Include/Platform.h
@@ -0,0 +1,155 @@
+/** @file
+ * Platform headers
+ *
+ * Copyright 2021 NXP
+ * Copyright 2021 Puresoftware Ltd
+ *
+ * SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+**/
+
+
+#ifndef LS1046AFRWY_PLATFORM_H
+#define LS1046AFRWY_PLATFORM_H
+
+#define EFI_ACPI_ARM_OEM_REVISION 0x00000000
+
+// Soc defines
+#define PLAT_SOC_NAME "LS1046AFRWY"
+#define SVR_SOC_VER(svr) (((svr) >> 8) & 0xFFFFFE)
+#define SVR_MAJOR(svr) (((svr) >> 4) & 0xf)
+#define SVR_MINOR(svr) (((svr) >> 0) & 0xf)
+
+// Gic
+#define GIC_VERSION 2
+#define GICD_BASE 0x1410000
+#define GICC_BASE 0x142f000
+#define GICH_BASE 0x1440000
+#define GICV_BASE 0x1460000
+
+// UART
+#define UART0_BASE 0x21C0500
+#define UART0_IT 86
+#define UART0_LENGTH 0x100
+#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_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
+
+// Mcfg
+#define LS1046A_PCI_SEG0_CONFIG_BASE 0x4000000000
+#define LS1046A_PCI_SEG0 0x0
+#define LS1046A_PCI_SEG_BUSNUM_MIN 0x0
+#define LS1046A_PCI_SEG_BUSNUM_MAX 0xff
+#define LS1046A_PCI_SEG1_CONFIG_BASE 0x4800000000
+#define LS1046A_PCI_SEG2_CONFIG_BASE 0x5000000000
+#define LS1046A_PCI_SEG1 0x1
+#define LS1046A_PCI_SEG2 0x2
+
+// Platform specific info needed by Configuration Manager
+
+#define CFG_MGR_TABLE_ID SIGNATURE_64 ('L','S','1','0','4','6',' ',' ')
+
+// Specify the OEM defined tables
+#define OEM_ACPI_TABLES 0
+
+#define PLAT_PCI_SEG0 LS1046A_PCI_SEG0
+#define PLAT_PCI_SEG1_CONFIG_BASE LS1046A_PCI_SEG1_CONFIG_BASE
+#define PLAT_PCI_SEG1 LS1046A_PCI_SEG1
+#define PLAT_PCI_SEG_BUSNUM_MIN LS1046A_PCI_SEG_BUSNUM_MIN
+#define PLAT_PCI_SEG_BUSNUM_MAX LS1046A_PCI_SEG_BUSNUM_MAX
+#define PLAT_PCI_SEG2_CONFIG_BASE LS1046A_PCI_SEG2_CONFIG_BASE
+#define PLAT_PCI_SEG2 LS1046A_PCI_SEG2
+
+#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 4
+#define PLAT_GTBLOCK_COUNT 0
+#define PLAT_GTFRAME_COUNT 0
+#define PLAT_PCI_CONFG_COUNT 2
+
+#define PLAT_WATCHDOG_COUNT 0
+#define PLAT_GIC_REDISTRIBUTOR_COUNT 0
+#define PLAT_GIC_ITS_COUNT 0
+
+/* GIC CPU Interface information
+ GIC_ENTRY (CPUInterfaceNumber, Mpidr, PmuIrq, VGicIrq, EnergyEfficiency)
+ */
+#define PLAT_GIC_CPU_INTERFACE { \
+ GICC_ENTRY (0, GET_MPID (0, 0), 138, 0x19, 0), \
+ GICC_ENTRY (1, GET_MPID (0, 1), 139, 0x19, 0), \
+ GICC_ENTRY (2, GET_MPID (0, 2), 127, 0x19, 0), \
+ GICC_ENTRY (3, GET_MPID (0, 3), 129, 0x19, 0), \
+}
+
+#define PLAT_WATCHDOG_INFO \
+ { \
+ } \
+
+#define PLAT_TIMER_BLOCK_INFO \
+ { \
+ } \
+
+#define PLAT_TIMER_FRAME_INFO \
+ { \
+ } \
+
+#define PLAT_GIC_DISTRIBUTOR_INFO \
+ { \
+ PLAT_GICD_BASE, /* UINT64 PhysicalBaseAddress */ \
+ 0, /* UINT32 SystemVectorBase */ \
+ PLAT_GIC_VERSION /* UINT8 GicVersion */ \
+ } \
+
+#define PLAT_GIC_REDISTRIBUTOR_INFO \
+ { \
+ } \
+
+#define PLAT_GIC_ITS_INFO \
+ { \
+ } \
+
+#define PLAT_MCFG_INFO \
+ { \
+ { \
+ PLAT_PCI_SEG1_CONFIG_BASE, \
+ PLAT_PCI_SEG1, \
+ PLAT_PCI_SEG_BUSNUM_MIN, \
+ PLAT_PCI_SEG_BUSNUM_MAX, \
+ }, \
+ { \
+ PLAT_PCI_SEG2_CONFIG_BASE, \
+ PLAT_PCI_SEG2, \
+ 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_16550 \
+ } \
+
+#endif // LS1046AFRWY_PLATFORM_H
diff --git a/Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.dsc b/Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.dsc
index 67cf15cbe4..20111e6037 100755
--- a/Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.dsc
+++ b/Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.dsc
@@ -3,6 +3,7 @@
# LS1046AFRWY Board package.
#
# Copyright 2019-2020 NXP
+# Copyright 2021 Puresoftware Ltd
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -22,10 +23,18 @@
OUTPUT_DIRECTORY = Build/LS1046aFrwyPkg
FLASH_DEFINITION = Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.fdf
+ # This flag controls the dynamic acpi generation
+ #
+ DEFINE DYNAMIC_ACPI_ENABLE = TRUE
+
!include Silicon/NXP/NxpQoriqLs.dsc.inc
!include MdePkg/MdeLibs.dsc.inc
!include Silicon/NXP/LS1046A/LS1046A.dsc.inc
+!if $(DYNAMIC_ACPI_ENABLE) == TRUE
+ !include DynamicTablesPkg/DynamicTables.dsc.inc
+!endif
+
[LibraryClasses.common]
ArmPlatformLib|Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatformLib.inf
RealTimeClockLib|EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf
@@ -46,4 +55,23 @@
Silicon/NXP/Drivers/UsbHcdInitDxe/UsbHcd.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
+ }
+ !endif
+
+ #
+ # Acpi Support
+ #
+ MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
+ MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+
##
diff --git a/Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.fdf b/Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.fdf
index 34c4e5a025..f3cac033bc 100755
--- a/Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.fdf
+++ b/Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.fdf
@@ -3,6 +3,7 @@
# FLASH layout file for LS1046a board.
#
# Copyright 2019-2020 NXP
+# Copyright 2021 Puresoftware Ltd
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -99,6 +100,18 @@ READ_LOCK_STATUS = TRUE
INF MdeModulePkg/Universal/Metronome/Metronome.inf
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/ConfigurationManagerPkg/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
+ !include DynamicTablesPkg/DynamicTables.fdf.inc
+ !endif
+
#
# Multiple Console IO support
#
diff --git a/Silicon/NXP/LS1046A/LS1046A.dsc.inc b/Silicon/NXP/LS1046A/LS1046A.dsc.inc
index 7004533ed5..98f999edfd 100644
--- a/Silicon/NXP/LS1046A/LS1046A.dsc.inc
+++ b/Silicon/NXP/LS1046A/LS1046A.dsc.inc
@@ -2,6 +2,7 @@
# LS1046A Soc package.
#
# Copyright 2017-2020 NXP
+# Copyright 2021 Puresoftware Ltd
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -48,4 +49,13 @@
[Components.common]
MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
+#
+# Configuration Manager
+!if $(DYNAMIC_ACPI_ENABLE) == TRUE
+ Platform/NXP/ConfigurationManagerPkg/ConfigurationManagerDxe/ConfigurationManagerDxe.inf {
+ <BuildOptions>
+ *_*_*_PLATFORM_FLAGS = -I$(WORKSPACE)/Platform/NXP/LS1046aFrwyPkg/Include
+ }
+!endif
+
##
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH V0 4/4] Platform/NXP/LS1046aFrwyPkg: Add OEM specific DSDT generator
2021-06-01 13:50 [PATCH V0 0/4] Enable Dynamic ACPI for LS1046AFRWY Vikas Singh
` (2 preceding siblings ...)
2021-06-01 13:50 ` [PATCH V0 3/4] Platform/NXP/LS1046aFrwyPkg: Extend Dynamic ACPI support Vikas Singh
@ 2021-06-01 13:50 ` Vikas Singh
2021-06-08 11:11 ` [PATCH V0 0/4] Enable Dynamic ACPI for LS1046AFRWY Leif Lindholm
4 siblings, 0 replies; 6+ messages in thread
From: Vikas Singh @ 2021-06-01 13:50 UTC (permalink / raw)
To: devel
Cc: sami.mujawar, leif, meenakshi.aggarwal, samer.el-haj-mahmoud,
v.sethi, arokia.samy, kuldip.dwivedi, ard.biesheuvel, vikas.singh,
Sunny.Wang
This patch adds platform specific DSDT generator
and Clk dsdt properties for LS1046AFRWY platform.
Signed-off-by: Vikas Singh <vikas.singh@puresoftware.com>
---
.../AcpiTablesInclude/Dsdt/Clk.asl | 60 ++++++++
.../AcpiTablesInclude/Dsdt/Dsdt.asl | 15 ++
.../AcpiTablesInclude/PlatformAcpiDsdtLib.inf | 39 +++++
.../PlatformAcpiDsdtLib/RawDsdtGenerator.c | 138 ++++++++++++++++++
.../AcpiTablesInclude/PlatformAcpiLib.h | 23 +++
.../NXP/LS1046aFrwyPkg/Include/Platform.h | 6 +-
.../NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.dsc | 1 +
7 files changed, 281 insertions(+), 1 deletion(-)
create mode 100644 Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/Dsdt/Clk.asl
create mode 100644 Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/Dsdt/Dsdt.asl
create mode 100644 Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
create mode 100644 Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c
create mode 100644 Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiLib.h
diff --git a/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/Dsdt/Clk.asl b/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/Dsdt/Clk.asl
new file mode 100644
index 0000000000..58541c3019
--- /dev/null
+++ b/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/Dsdt/Clk.asl
@@ -0,0 +1,60 @@
+/** @file
+* DSDT : Dynamic Clock ACPI Information
+*
+* Copyright 2021 NXP
+* Copyright 2021 Puresoftware Ltd.
+*
+* SPDX-License-Identifier: BSD-2-Clause-Patent
+*
+**/
+
+Scope(_SB)
+{
+ Device(PCLK) {
+ Name(_HID, "NXP0017")
+ Name(CLK, 0) // Maximum Platform Clock (Hz)
+ Name(CCLK, 0) // Maximum CPU Core Clock (MHz)
+ Name(AVBL, 0)
+ OperationRegion(RCWS, SystemMemory, DCFG_BASE, DCFG_LEN)
+ Method(_REG,2) {
+ if (Arg0 == "RCWS") {
+ Store(Arg1, AVBL)
+ }
+ }
+ Field (RCWS, ByteAcc, NoLock, Preserve) {
+ /* The below table provides the func of diff bits in 512 bits RCW data:
+ SYS_PLL_CFG : 0-1 bits
+ SYS_PLL_RAT : 2-6 bits
+ SYSCLK_FREQ : 472-481 bits etc.
+ Refer LS1046ARM for more info.
+ For LS1046 RCWSRs are read as RCW[0:31] .
+ */
+ offset(0x100),
+ RESV, 1,
+ PRAT, 5,
+ PCFG, 2,
+ offset(0x103),
+ CPRT, 6, // Cluster Group PLL Multiplier ratio
+ offset(0x13B),
+ HFRQ, 8, // Higher 8 bits of SYSCLK_FREQ
+ RESX, 6,
+ LFRQ, 2 // Lower bits of SYSCLK_FREQ
+ }
+
+ Method(_INI, 0, NotSerialized) {
+ /* Calculating Platform Clock */
+ Local0 = (HFRQ<<2 | LFRQ) // Concatinating LFRQ at end of HFRQ
+ Multiply(Local0, 500000, Local0)
+ Multiply(Local0, PRAT, Local0)
+ Divide(Local0, 3, , Local0)
+ Store(Local0, CLK)
+
+ /* Calculating Maximum Core Clock */
+ Local0 = (HFRQ<<2 | LFRQ) // Concatinating LFRQ at end of HFRQ
+ Multiply(Local0, 500000, Local0)
+ Divide(Local0, 3, , Local0)
+ Divide(Local0, 1000000, , Local0) //Just the MHz part of SYSCLK.
+ Multiply(Local0, CPRT, CCLK) // PLL_Ratio * SYSCLK, Max freq of cluster
+ }
+ } // end of device PCLK
+}
diff --git a/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/Dsdt/Dsdt.asl b/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/Dsdt/Dsdt.asl
new file mode 100644
index 0000000000..19f3f1c0e8
--- /dev/null
+++ b/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/Dsdt/Dsdt.asl
@@ -0,0 +1,15 @@
+/** @file
+ Differentiated System Description Table Fields (DSDT)
+
+ Copyright 2021 NXP
+ Copyright 2021 Puresoftware Ltd.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "Platform.h"
+
+DefinitionBlock("DsdtTable.aml", "DSDT", 2, "NXP ", "LS1046 ", EFI_ACPI_ARM_OEM_REVISION) {
+ include ("Clk.asl")
+}
diff --git a/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf b/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
new file mode 100644
index 0000000000..ed5f9dd442
--- /dev/null
+++ b/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
@@ -0,0 +1,39 @@
+## @file
+# Raw Table Generator
+#
+# Copyright 2021 NXP
+# Copyright 2021 Puresoftware Ltd
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+ INF_VERSION = 0x00010019
+ BASE_NAME = PlatformAcpiDsdtLib
+ FILE_GUID = A97F70AC-3BB4-4596-B4D2-9F948EC12D17
+ 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]
+ DynamicTablesPkg/DynamicTablesPkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.dec
+ Platform/NXP/ConfigurationManagerPkg/ConfigurationManagerPkg.dec
+
+[LibraryClasses]
+ BaseLib
+
+[Pcd]
+
+[Protocols]
+
+[Guids]
diff --git a/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c b/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c
new file mode 100644
index 0000000000..7d886396ca
--- /dev/null
+++ b/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c
@@ -0,0 +1,138 @@
+/** @file
+ Raw DSDT Table Generator
+
+ Copyright 2021 NXP
+ Copyright 2021 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.
+ *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 (PlatAcpiTableIdDsdt),
+ // 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/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiLib.h b/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiLib.h
new file mode 100644
index 0000000000..e5f907a7d4
--- /dev/null
+++ b/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiLib.h
@@ -0,0 +1,23 @@
+/** @file
+ * Acpi lib headers
+ *
+ * Copyright 2021 NXP
+ * Copyright 2021 Puresoftware Ltd
+ *
+ * SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+**/
+
+
+#ifndef LS1046AFRWY_PLATFORM_ACPI_LIB_H
+#define LS1046AFRWY_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/LS1046aFrwyPkg/Include/Platform.h b/Platform/NXP/LS1046aFrwyPkg/Include/Platform.h
index 19e879ec6d..b21e875f20 100644
--- a/Platform/NXP/LS1046aFrwyPkg/Include/Platform.h
+++ b/Platform/NXP/LS1046aFrwyPkg/Include/Platform.h
@@ -20,6 +20,10 @@
#define SVR_MAJOR(svr) (((svr) >> 4) & 0xf)
#define SVR_MINOR(svr) (((svr) >> 0) & 0xf)
+// PCLK : Dynamic Clock
+#define DCFG_BASE 0x1EE0000 /* Device configuration data Base Address */
+#define DCFG_LEN 0xFFF /* Device configuration data length */
+
// Gic
#define GIC_VERSION 2
#define GICD_BASE 0x1410000
@@ -62,7 +66,7 @@
#define CFG_MGR_TABLE_ID SIGNATURE_64 ('L','S','1','0','4','6',' ',' ')
// Specify the OEM defined tables
-#define OEM_ACPI_TABLES 0
+#define OEM_ACPI_TABLES 1 // Added DSDT
#define PLAT_PCI_SEG0 LS1046A_PCI_SEG0
#define PLAT_PCI_SEG1_CONFIG_BASE LS1046A_PCI_SEG1_CONFIG_BASE
diff --git a/Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.dsc b/Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.dsc
index 20111e6037..7041d15da5 100755
--- a/Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.dsc
+++ b/Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.dsc
@@ -65,6 +65,7 @@
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/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
}
!endif
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH V0 0/4] Enable Dynamic ACPI for LS1046AFRWY
2021-06-01 13:50 [PATCH V0 0/4] Enable Dynamic ACPI for LS1046AFRWY Vikas Singh
` (3 preceding siblings ...)
2021-06-01 13:50 ` [PATCH V0 4/4] Platform/NXP/LS1046aFrwyPkg: Add OEM specific DSDT generator Vikas Singh
@ 2021-06-08 11:11 ` Leif Lindholm
4 siblings, 0 replies; 6+ messages in thread
From: Leif Lindholm @ 2021-06-08 11:11 UTC (permalink / raw)
To: Vikas Singh
Cc: devel, sami.mujawar, meenakshi.aggarwal, samer.el-haj-mahmoud,
v.sethi, arokia.samy, kuldip.dwivedi, ard.biesheuvel, vikas.singh,
Sunny.Wang
Hi Vikas,
Please resubmit this set, following the instructions set out by
https://github.com/tianocore/tianocore.github.io/wiki/Laszlo%27s-unkempt-git-guide-for-edk2-contributors-and-maintainers
as I requested for your previous set.
Best Regards,
Leif
On Tue, Jun 01, 2021 at 19:20:30 +0530, Vikas Singh wrote:
> This patch series basically aims to extend the Dynamic ACPI
> framework towards NXP's LS1046AFRWY platform.
>
> Refer- https://edk2.groups.io/g/devel/message/71709
>
> The change set in the series is in below order -
>
> (1)Introducing a new platform specific macro "PLAT_SOC_NAME"
> This macro will be consumed by Configuration Manager(CM).
> Platforms who extends CM services for themselves must notify
> their SoC details to CM. Additionally also update the lx2160ardb
> platform header with PLAT_SOC_NAME, this will be consumed by CM.
>
> (2)Introduced a function to get SoC's System Version Register(SVR)
> This function will fetch SVR for LS1046A SoC based platforms.
> In current patch series, this function will be used by LS1046aFrwy.
>
> (3)Extending Configuration Manager (CM) and its services to leverage
> the Dynamic ACPI support for NXP's LS1046aFrwy platform.
>
> (4)Introduced an OEM specific firmware acpi table generator
> Also add Dsdt.asl as a place holder having only platform's clock
> related dsdt properties for now and can accommodate other IP specific
> dsdt tables(acpi properties) for LS1046AFRWY in future patch series.
>
> Vikas Singh (4):
> Platform/NXP: Add generic log in CM to print SoC version
> Silicon/NXP: Add support of SVR handling for LS1046FRWY
> Platform/NXP/LS1046aFrwyPkg: Extend Dynamic ACPI support
> Platform/NXP/LS1046aFrwyPkg: Add OEM specific DSDT generator
>
> .../ConfigurationManager.c | 10 +-
> .../AcpiTablesInclude/Dsdt/Clk.asl | 60 +++++++
> .../AcpiTablesInclude/Dsdt/Dsdt.asl | 15 ++
> .../AcpiTablesInclude/PlatformAcpiDsdtLib.inf | 39 +++++
> .../PlatformAcpiDsdtLib/RawDsdtGenerator.c | 138 +++++++++++++++
> .../AcpiTablesInclude/PlatformAcpiLib.h | 23 +++
> .../NXP/LS1046aFrwyPkg/Include/Platform.h | 159 ++++++++++++++++++
> .../NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.dsc | 29 ++++
> .../NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.fdf | 13 ++
> Platform/NXP/LX2160aRdbPkg/Include/Platform.h | 5 +-
> Silicon/NXP/LS1046A/LS1046A.dsc.inc | 10 ++
> Silicon/NXP/LS1046A/Library/SocLib/SocLib.c | 16 ++
> 12 files changed, 507 insertions(+), 10 deletions(-)
> create mode 100644 Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/Dsdt/Clk.asl
> create mode 100644 Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/Dsdt/Dsdt.asl
> create mode 100644 Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf
> create mode 100644 Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtGenerator.c
> create mode 100644 Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiLib.h
> create mode 100644 Platform/NXP/LS1046aFrwyPkg/Include/Platform.h
>
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread