* [PATCH edk2-platforms v2 1/7] Silicon/NXP: LX2160A: Define PCIe related PCDs
2020-06-29 6:44 [PATCH edk2-platforms v2 0/7] NXP: Add PCIe Support for LX2160aRdbPkg Wasim Khan
@ 2020-06-29 6:45 ` Wasim Khan
2020-06-29 6:45 ` [PATCH edk2-platforms v2 2/7] Platform/NXP: LX2160aRdbPkg: Add PCIe space in VirtualMemoryMap Wasim Khan
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Wasim Khan @ 2020-06-29 6:45 UTC (permalink / raw)
To: devel, meenakshi.aggarwal, V.Sethi, ard.biesheuvel, leif; +Cc: Wasim Khan
From: Wasim Khan <wasim.khan@nxp.com>
Define PCIe related PCDs for LX2160A.
Signed-off-by: Wasim Khan <wasim.khan@nxp.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
---
Silicon/NXP/LX2160A/LX2160A.dsc.inc | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Silicon/NXP/LX2160A/LX2160A.dsc.inc b/Silicon/NXP/LX2160A/LX2160A.dsc.inc
index fe8ed402fc4e..43e361464c8e 100644
--- a/Silicon/NXP/LX2160A/LX2160A.dsc.inc
+++ b/Silicon/NXP/LX2160A/LX2160A.dsc.inc
@@ -38,6 +38,11 @@ [PcdsFixedAtBuild.common]
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultReceiveFifoDepth|0
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x21C0000
+ gNxpQoriqLsTokenSpaceGuid.PcdPciExp1BaseAddr|0x8000000000
+ gNxpQoriqLsTokenSpaceGuid.PcdNumPciController|6
+ gNxpQoriqLsTokenSpaceGuid.PcdPcieLutBase|0x80000
+ gNxpQoriqLsTokenSpaceGuid.PcdPcieLutDbg|0x407FC
+
[PcdsFeatureFlag]
gNxpQoriqLsTokenSpaceGuid.PcdI2cErratumA009203|TRUE
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH edk2-platforms v2 2/7] Platform/NXP: LX2160aRdbPkg: Add PCIe space in VirtualMemoryMap
2020-06-29 6:44 [PATCH edk2-platforms v2 0/7] NXP: Add PCIe Support for LX2160aRdbPkg Wasim Khan
2020-06-29 6:45 ` [PATCH edk2-platforms v2 1/7] Silicon/NXP: LX2160A: Define PCIe related PCDs Wasim Khan
@ 2020-06-29 6:45 ` Wasim Khan
2020-06-29 6:45 ` [PATCH edk2-platforms v2 3/7] Platform/NXP: LX2160aRdbPkg: Add PlatformDxe driver Wasim Khan
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Wasim Khan @ 2020-06-29 6:45 UTC (permalink / raw)
To: devel, meenakshi.aggarwal, V.Sethi, ard.biesheuvel, leif; +Cc: Wasim Khan
From: Wasim Khan <wasim.khan@nxp.com>
LX2160A SoC has 6 PCIe controllers with 32GB space available
for each controller. A platform may have different PCIe controllers
enabled based on the RCW used to boot platform.
Add space for all PCIe controllers in VirtualMemoryMap.
Signed-off-by: Wasim Khan <wasim.khan@nxp.com>
---
Platform/NXP/LX2160aRdbPkg/Library/ArmPlatformLib/ArmPlatformLib.inf | 2 ++
Silicon/NXP/LX2160A/Include/Soc.h | 3 +++
Platform/NXP/LX2160aRdbPkg/Library/ArmPlatformLib/ArmPlatformLibMem.c | 11 ++++++++++-
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/Platform/NXP/LX2160aRdbPkg/Library/ArmPlatformLib/ArmPlatformLib.inf b/Platform/NXP/LX2160aRdbPkg/Library/ArmPlatformLib/ArmPlatformLib.inf
index e1ab682c1976..d98a2539410f 100644
--- a/Platform/NXP/LX2160aRdbPkg/Library/ArmPlatformLib/ArmPlatformLib.inf
+++ b/Platform/NXP/LX2160aRdbPkg/Library/ArmPlatformLib/ArmPlatformLib.inf
@@ -37,6 +37,8 @@ [Sources.AArch64]
[FixedPcd]
gArmTokenSpaceGuid.PcdArmPrimaryCore
gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
+ gNxpQoriqLsTokenSpaceGuid.PcdNumPciController
+ gNxpQoriqLsTokenSpaceGuid.PcdPciExp1BaseAddr
[Ppis]
gArmMpCoreInfoPpiGuid
diff --git a/Silicon/NXP/LX2160A/Include/Soc.h b/Silicon/NXP/LX2160A/Include/Soc.h
index 6c745d580a6d..d62b8adcdbe7 100644
--- a/Silicon/NXP/LX2160A/Include/Soc.h
+++ b/Silicon/NXP/LX2160A/Include/Soc.h
@@ -26,6 +26,9 @@
#define LX2160A_FSPI0_PHYS_ADDRESS (BASE_512MB)
#define LX2160A_FSPI0_SIZE (SIZE_256MB)
+#define LX2160A_PCI1_PHYS_ADDRESS FixedPcdGet64 (PcdPciExp1BaseAddr)
+#define LX2160A_PCI_SIZE SIZE_32GB
+
#define LX2160A_DCFG_ADDRESS NXP_LAYERSCAPE_CHASSIS3V2_DCFG_ADDRESS
// SVR
diff --git a/Platform/NXP/LX2160aRdbPkg/Library/ArmPlatformLib/ArmPlatformLibMem.c b/Platform/NXP/LX2160aRdbPkg/Library/ArmPlatformLib/ArmPlatformLibMem.c
index 391dab265ad7..98a6b2fc4ed4 100644
--- a/Platform/NXP/LX2160aRdbPkg/Library/ArmPlatformLib/ArmPlatformLibMem.c
+++ b/Platform/NXP/LX2160aRdbPkg/Library/ArmPlatformLib/ArmPlatformLibMem.c
@@ -12,7 +12,7 @@
#include <Library/MemoryAllocationLib.h>
#include <Soc.h>
-#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 6
+#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS (6 + FixedPcdGet32 (PcdNumPciController))
/**
Return the Virtual Memory Map of your platform
@@ -30,6 +30,7 @@ ArmPlatformGetVirtualMemoryMap (
)
{
UINTN Index;
+ UINT32 I;
ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable;
Index = 0;
@@ -71,6 +72,14 @@ ArmPlatformGetVirtualMemoryMap (
VirtualMemoryTable[Index].Length = LX2160A_FSPI0_SIZE;
VirtualMemoryTable[Index++].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+ // PCIe Space
+ for (I = 0; I < FixedPcdGet32 (PcdNumPciController); I++) {
+ VirtualMemoryTable[Index].PhysicalBase = LX2160A_PCI1_PHYS_ADDRESS + I * LX2160A_PCI_SIZE;
+ VirtualMemoryTable[Index].VirtualBase = LX2160A_PCI1_PHYS_ADDRESS + I * LX2160A_PCI_SIZE;
+ VirtualMemoryTable[Index].Length = LX2160A_PCI_SIZE;
+ VirtualMemoryTable[Index++].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+ }
+
// End of Table
ZeroMem (&VirtualMemoryTable[Index], sizeof (ARM_MEMORY_REGION_DESCRIPTOR));
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH edk2-platforms v2 3/7] Platform/NXP: LX2160aRdbPkg: Add PlatformDxe driver
2020-06-29 6:44 [PATCH edk2-platforms v2 0/7] NXP: Add PCIe Support for LX2160aRdbPkg Wasim Khan
2020-06-29 6:45 ` [PATCH edk2-platforms v2 1/7] Silicon/NXP: LX2160A: Define PCIe related PCDs Wasim Khan
2020-06-29 6:45 ` [PATCH edk2-platforms v2 2/7] Platform/NXP: LX2160aRdbPkg: Add PCIe space in VirtualMemoryMap Wasim Khan
@ 2020-06-29 6:45 ` Wasim Khan
2020-06-29 6:45 ` [PATCH edk2-platforms v2 4/7] Platform/NXP: LX2160aRdbPkg: Enable " Wasim Khan
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Wasim Khan @ 2020-06-29 6:45 UTC (permalink / raw)
To: devel, meenakshi.aggarwal, V.Sethi, ard.biesheuvel, leif; +Cc: Wasim Khan
From: Wasim Khan <wasim.khan@nxp.com>
Add PlatformDxe to do platform specific work.
At present it sets PCDs for PCIe controller based on
SoC version, which are used later during initialization
of PCIe controller.
Signed-off-by: Wasim Khan <wasim.khan@nxp.com>
---
Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.inf | 35 ++++++++
Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.c | 90 ++++++++++++++++++++
2 files changed, 125 insertions(+)
diff --git a/Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.inf b/Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.inf
new file mode 100644
index 000000000000..2514adf1d69d
--- /dev/null
+++ b/Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.inf
@@ -0,0 +1,35 @@
+## @file
+#
+# Copyright 2020 NXP
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010019
+ BASE_NAME = PlatformDxe
+ FILE_GUID = C4063EBA-7729-11EA-BC55-0232AC130003
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = PlatformDxeEntryPoint
+
+[Sources]
+ PlatformDxe.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ Silicon/NXP/Chassis3V2/Chassis3V2.dec
+ Silicon/NXP/LX2160A/LX2160A.dec
+ Silicon/NXP/NxpQoriqLs.dec
+
+[LibraryClasses]
+ PcdLib
+ UefiDriverEntryPoint
+
+[Pcd]
+ gNxpQoriqLsTokenSpaceGuid.PcdPciCfgShiftEnable
+ gNxpQoriqLsTokenSpaceGuid.PcdPciLsGen4Ctrl
+
+[Depex]
+ TRUE
diff --git a/Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.c b/Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.c
new file mode 100644
index 000000000000..0caabb448ec0
--- /dev/null
+++ b/Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -0,0 +1,90 @@
+/** @file
+*
+* Copyright 2020 NXP
+*
+* SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+#include <Library/DebugLib.h>
+#include <Library/PcdLib.h>
+#include <Library/SocLib.h>
+#include <Soc.h>
+
+/**
+ Set PCDs for PCIe controller based on SoC version.
+ LX2160-Rev1 and LX2160-Rev2 has different PCIe controller. This function
+ check the SoC version and set PCDs for PCIe controller which will be
+ used by PciHostBridgeLib and PciSegmentLib for controller initialization.
+
+ @return EFI_SUCCESS PCDs were set successfully
+ @return EFI_INVALID_PARAMETER Invalid major version number
+**/
+EFI_STATUS
+SetPciControllerPcdOptions (
+ VOID
+ )
+{
+ UINT32 Svr;
+
+ Svr = SocGetSvr ();
+ if (SVR_SOC_VER(Svr) == SVR_LX2160A) {
+ switch (SVR_MAJOR(Svr)) {
+ case 0x1:
+ //
+ // LX2160-Rev1 and LX2160-Rev2 has different PCIe controllers.
+ // Set PcdPciLsGen4Ctrl to TRUE for LX2160-Rev1, which will be used
+ // by PciHostBridgeLib and PciSegmentLib to differentiate both controllers
+ // and perform controller specific initialization.
+ //
+ PcdSetBoolS (PcdPciLsGen4Ctrl, TRUE);
+ break;
+ case 0x2:
+ //
+ // PCIe controller in LX2160-Rev2 supports two methods for config
+ // transactions.
+ // 1 - Default (Non ECAM compliant): PCIe controller
+ // requires target BDF to be written to bit[31:16] of type0/type1
+ // outbound window.
+ // 2 - CFG SHIFT: PCIe controller shifts BDF from bits[27:12] to
+ // bits[31:16] and supports Enhanced Configuration Address Mapping (ECAM)
+ // mechanism.
+ //
+ // Set PcdPciCfgShiftEnable to TRUE for LX2160-Rev2, which will be used by
+ // PciHostBridgeLib and PciSegmentLib to enable CFG SHIFT feature on
+ // PCIe controller and program the iATU windows accordingly.
+ //
+ PcdSetBoolS (PcdPciCfgShiftEnable, TRUE);
+ break;
+ default:
+ DEBUG ((DEBUG_ERROR, "%a: Invalid SoC Version 0x%x \n", __FUNCTION__,
+ SVR_MAJOR(Svr)));
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ The entry point for PlatformDxe driver. This driver
+ intends to perform platform specific initialization.
+
+ @param[in] ImageHandle The image handle of the driver.
+ @param[in] SystemTable The system table.
+
+ @retval EFI_SUCCESS Driver initialization success.
+
+**/
+EFI_STATUS
+EFIAPI
+PlatformDxeEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ // Set PCDs for PCIe controller
+ Status = SetPciControllerPcdOptions ();
+
+ return Status;
+}
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH edk2-platforms v2 4/7] Platform/NXP: LX2160aRdbPkg: Enable PlatformDxe driver
2020-06-29 6:44 [PATCH edk2-platforms v2 0/7] NXP: Add PCIe Support for LX2160aRdbPkg Wasim Khan
` (2 preceding siblings ...)
2020-06-29 6:45 ` [PATCH edk2-platforms v2 3/7] Platform/NXP: LX2160aRdbPkg: Add PlatformDxe driver Wasim Khan
@ 2020-06-29 6:45 ` Wasim Khan
2020-06-29 6:45 ` [PATCH edk2-platforms v2 5/7] Platform/NXP: LX2160aRdbPkg: Hide Root Port for LX2160A-Rev2 Wasim Khan
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Wasim Khan @ 2020-06-29 6:45 UTC (permalink / raw)
To: devel, meenakshi.aggarwal, V.Sethi, ard.biesheuvel, leif; +Cc: Wasim Khan
From: Wasim Khan <wasim.khan@nxp.com>
Enable PlatformDxe driver for LX2160aRdbPkg
Signed-off-by: Wasim Khan <wasim.khan@nxp.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
---
Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc | 2 ++
Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf | 3 +++
2 files changed, 5 insertions(+)
diff --git a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc
index 9b3e0386c13e..d0ec7b5a8906 100644
--- a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc
+++ b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc
@@ -43,4 +43,6 @@ [Components.common]
gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE
}
+ Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.inf
+
##
diff --git a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf
index eec1c0774a86..41b8f1ececa4 100644
--- a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf
+++ b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf
@@ -89,6 +89,9 @@ [FV.FvMain]
#
INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
+ # Platform DXE Driver
+ INF Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.inf
+
INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH edk2-platforms v2 5/7] Platform/NXP: LX2160aRdbPkg: Hide Root Port for LX2160A-Rev2
2020-06-29 6:44 [PATCH edk2-platforms v2 0/7] NXP: Add PCIe Support for LX2160aRdbPkg Wasim Khan
` (3 preceding siblings ...)
2020-06-29 6:45 ` [PATCH edk2-platforms v2 4/7] Platform/NXP: LX2160aRdbPkg: Enable " Wasim Khan
@ 2020-06-29 6:45 ` Wasim Khan
2020-06-29 6:45 ` [PATCH edk2-platforms v2 6/7] Platform/NXP: LX2160aRdbPkg: Enable NetworkPkg Wasim Khan
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Wasim Khan @ 2020-06-29 6:45 UTC (permalink / raw)
To: devel, meenakshi.aggarwal, V.Sethi, ard.biesheuvel, leif; +Cc: Wasim Khan
From: Wasim Khan <wasim.khan@nxp.com>
PCIe Layerscape controller in LX2160A-Rev2 is not completely
ECAM-compliant. It is non-ECAM only for the root bus (bus 0)
and for any other bus underneath the root bus it does support
ECAM access.
One approach can be to setup the controller in firmware and
expose bus[0x1-0xff] to OS via MCFG and DSDT table.
Introduce PcdPciHideRootPort PCD and set it for LX2160A-Rev2 for this.
Limit the size of CFG0 iATU window (for type0 config transactions)
to 32KB to avoid enumuration of unwanted devices in OS.
Signed-off-by: Wasim Khan <wasim.khan@nxp.com>
---
Silicon/NXP/NxpQoriqLs.dec | 1 +
Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.inf | 1 +
Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.inf | 1 +
Silicon/NXP/Include/Pcie.h | 1 +
Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.c | 7 +++++++
Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.c | 6 +++++-
6 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/Silicon/NXP/NxpQoriqLs.dec b/Silicon/NXP/NxpQoriqLs.dec
index d09a1ae194be..188a9fe1f382 100644
--- a/Silicon/NXP/NxpQoriqLs.dec
+++ b/Silicon/NXP/NxpQoriqLs.dec
@@ -40,3 +40,4 @@ [PcdsFixedAtBuild.common]
[PcdsDynamic.common]
gNxpQoriqLsTokenSpaceGuid.PcdPciCfgShiftEnable|FALSE|BOOLEAN|0x00000600
gNxpQoriqLsTokenSpaceGuid.PcdPciLsGen4Ctrl|FALSE|BOOLEAN|0x00000601
+ gNxpQoriqLsTokenSpaceGuid.PcdPciHideRootPort|FALSE|BOOLEAN|0x00000602
diff --git a/Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.inf b/Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.inf
index 2514adf1d69d..674ba3b298f3 100644
--- a/Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.inf
+++ b/Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.inf
@@ -30,6 +30,7 @@ [LibraryClasses]
[Pcd]
gNxpQoriqLsTokenSpaceGuid.PcdPciCfgShiftEnable
gNxpQoriqLsTokenSpaceGuid.PcdPciLsGen4Ctrl
+ gNxpQoriqLsTokenSpaceGuid.PcdPciHideRootPort
[Depex]
TRUE
diff --git a/Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.inf b/Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.inf
index 6003da708698..3726ec15317f 100644
--- a/Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.inf
+++ b/Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.inf
@@ -42,3 +42,4 @@ [FixedPcd]
[Pcd]
gNxpQoriqLsTokenSpaceGuid.PcdPciCfgShiftEnable
gNxpQoriqLsTokenSpaceGuid.PcdPciLsGen4Ctrl
+ gNxpQoriqLsTokenSpaceGuid.PcdPciHideRootPort
diff --git a/Silicon/NXP/Include/Pcie.h b/Silicon/NXP/Include/Pcie.h
index b5bf0ff5d1d4..4bc99bb53025 100755
--- a/Silicon/NXP/Include/Pcie.h
+++ b/Silicon/NXP/Include/Pcie.h
@@ -31,6 +31,7 @@
#define PCI_SEG_PORTIO_MIN 0x0
#define PCI_SEG_PORTIO_MAX 0xffff
#define SEG_CFG_SIZE 0x00001000
+#define ECAM_DEVICE_SIZE SIZE_32KB
#define ECAM_BUS_SIZE SIZE_1MB
#define ECAM_CFG_REGION_SIZE SIZE_256MB
#define SEG_MEM_BASE 0x40000000
diff --git a/Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.c b/Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.c
index 0caabb448ec0..0c013dd01009 100644
--- a/Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -53,6 +53,13 @@ SetPciControllerPcdOptions (
// PCIe controller and program the iATU windows accordingly.
//
PcdSetBoolS (PcdPciCfgShiftEnable, TRUE);
+
+ //
+ // PCIe controller in LX2160-Rev2 is not ECAM-compliant for bus0.
+ // Set PcdPciHideRootPort for LX2160-Rev2, which will be used by
+ // PciHostBridgeLib and PciSegmentLib to program iATU windows accordingly.
+ //
+ PcdSetBoolS (PcdPciHideRootPort, TRUE);
break;
default:
DEBUG ((DEBUG_ERROR, "%a: Invalid SoC Version 0x%x \n", __FUNCTION__,
diff --git a/Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.c b/Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.c
index 8bbbaaa6e24d..7f11d7a60256 100644
--- a/Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.c
+++ b/Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.c
@@ -432,7 +432,11 @@ PcieLsSetupAtu (
Cfg0BusAddress = SIZE_1MB;
Cfg1BusAddress = SIZE_2MB;
// Region for type0 CFG transactions (only for bus1)
- Cfg0Size = ECAM_BUS_SIZE;
+ if (PcdGetBool (PcdPciHideRootPort)) {
+ Cfg0Size = ECAM_DEVICE_SIZE;
+ } else {
+ Cfg0Size = ECAM_BUS_SIZE;
+ }
// Region for type1 CFG transactions (for bus > 1)
Cfg1Size = (ECAM_CFG_REGION_SIZE - ECAM_BUS_SIZE); // 255MB
} else {
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH edk2-platforms v2 6/7] Platform/NXP: LX2160aRdbPkg: Enable NetworkPkg
2020-06-29 6:44 [PATCH edk2-platforms v2 0/7] NXP: Add PCIe Support for LX2160aRdbPkg Wasim Khan
` (4 preceding siblings ...)
2020-06-29 6:45 ` [PATCH edk2-platforms v2 5/7] Platform/NXP: LX2160aRdbPkg: Hide Root Port for LX2160A-Rev2 Wasim Khan
@ 2020-06-29 6:45 ` Wasim Khan
2020-06-29 6:45 ` [PATCH edk2-platforms v2 7/7] Platform/NXP: LX2160aRdbPkg: Enable PCIE support Wasim Khan
2020-07-03 14:44 ` [PATCH edk2-platforms v2 0/7] NXP: Add PCIe Support for LX2160aRdbPkg Leif Lindholm
7 siblings, 0 replies; 9+ messages in thread
From: Wasim Khan @ 2020-06-29 6:45 UTC (permalink / raw)
To: devel, meenakshi.aggarwal, V.Sethi, ard.biesheuvel, leif; +Cc: Wasim Khan
From: Wasim Khan <wasim.khan@nxp.com>
Enable NetworkPkg for LX2160aRdbPkg Platform to
enable networking stack and test PCIe ethernet NIC.
Signed-off-by: Wasim Khan <wasim.khan@nxp.com>
---
Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc | 11 +++++++++++
Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf | 5 +++++
2 files changed, 16 insertions(+)
diff --git a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc
index d0ec7b5a8906..c73f9fd4d393 100644
--- a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc
+++ b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc
@@ -22,6 +22,13 @@ [Defines]
OUTPUT_DIRECTORY = Build/LX2160aRdbPkg
FLASH_DEFINITION = Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf
+ #
+ # Network definition
+ #
+ DEFINE NETWORK_TLS_ENABLE = FALSE
+ DEFINE NETWORK_HTTP_BOOT_ENABLE = FALSE
+ DEFINE NETWORK_ISCSI_ENABLE = FALSE
+
!include Silicon/NXP/NxpQoriqLs.dsc.inc
!include Silicon/NXP/LX2160A/LX2160A.dsc.inc
@@ -45,4 +52,8 @@ [Components.common]
Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.inf
+ #
+ # Networking stack
+ #
+!include NetworkPkg/Network.dsc.inc
##
diff --git a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf
index 41b8f1ececa4..4c9cab5d0938 100644
--- a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf
+++ b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf
@@ -116,6 +116,11 @@ [FV.FvMain]
INF ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf
#
+ # Networking stack
+ #
+!include NetworkPkg/Network.fdf.inc
+
+ #
# FAT filesystem + GPT/MBR partitioning
#
INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH edk2-platforms v2 7/7] Platform/NXP: LX2160aRdbPkg: Enable PCIE support
2020-06-29 6:44 [PATCH edk2-platforms v2 0/7] NXP: Add PCIe Support for LX2160aRdbPkg Wasim Khan
` (5 preceding siblings ...)
2020-06-29 6:45 ` [PATCH edk2-platforms v2 6/7] Platform/NXP: LX2160aRdbPkg: Enable NetworkPkg Wasim Khan
@ 2020-06-29 6:45 ` Wasim Khan
2020-07-03 14:44 ` [PATCH edk2-platforms v2 0/7] NXP: Add PCIe Support for LX2160aRdbPkg Leif Lindholm
7 siblings, 0 replies; 9+ messages in thread
From: Wasim Khan @ 2020-06-29 6:45 UTC (permalink / raw)
To: devel, meenakshi.aggarwal, V.Sethi, ard.biesheuvel, leif; +Cc: Wasim Khan
From: Wasim Khan <wasim.khan@nxp.com>
Enable generic PCIe drivers and Wire up PciHostBridgeLib,
PciSegmentLib and PciCpuIo2Dxe.
Signed-off-by: Wasim Khan <wasim.khan@nxp.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
---
Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc | 9 +++++++++
Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf | 7 +++++++
2 files changed, 16 insertions(+)
diff --git a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc
index c73f9fd4d393..579a72d363a4 100644
--- a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc
+++ b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc
@@ -35,6 +35,8 @@ [Defines]
[LibraryClasses.common]
ArmPlatformLib|Platform/NXP/LX2160aRdbPkg/Library/ArmPlatformLib/ArmPlatformLib.inf
RealTimeClockLib|EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf
+ PciSegmentLib|Silicon/NXP/Library/PciSegmentLib/PciSegmentLib.inf
+ PciHostBridgeLib|Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.inf
################################################################################
#
@@ -53,6 +55,13 @@ [Components.common]
Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.inf
#
+ # PCI
+ #
+ Silicon/NXP/Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.inf
+ MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
+ MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
+
+ #
# Networking stack
#
!include NetworkPkg/Network.dsc.inc
diff --git a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf
index 4c9cab5d0938..b803da124844 100644
--- a/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf
+++ b/Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf
@@ -121,6 +121,13 @@ [FV.FvMain]
!include NetworkPkg/Network.fdf.inc
#
+ # PCI
+ #
+ INF Silicon/NXP/Drivers/PciCpuIo2Dxe/PciCpuIo2Dxe.inf
+ INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
+ INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
+
+ #
# FAT filesystem + GPT/MBR partitioning
#
INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH edk2-platforms v2 0/7] NXP: Add PCIe Support for LX2160aRdbPkg
2020-06-29 6:44 [PATCH edk2-platforms v2 0/7] NXP: Add PCIe Support for LX2160aRdbPkg Wasim Khan
` (6 preceding siblings ...)
2020-06-29 6:45 ` [PATCH edk2-platforms v2 7/7] Platform/NXP: LX2160aRdbPkg: Enable PCIE support Wasim Khan
@ 2020-07-03 14:44 ` Leif Lindholm
7 siblings, 0 replies; 9+ messages in thread
From: Leif Lindholm @ 2020-07-03 14:44 UTC (permalink / raw)
To: Wasim Khan; +Cc: devel, meenakshi.aggarwal, V.Sethi, ard.biesheuvel, Wasim Khan
On Mon, Jun 29, 2020 at 12:14:59 +0530, Wasim Khan wrote:
> From: Wasim Khan <wasim.khan@nxp.com>
>
> LX2160-Rev1 and LX2160-Rev2 has different PCIe controller.
> This patch series adds PCIe support for LX2160aRdbPkg which includes
> - Add PCIe space in VirtualMemoryMap
> - Platform driver to check SoC version and sets PCDs for PCIe controller, which
> are used by PciHostBridgeLib and PciSegmentLib.
> PciHostBridgeLib and PciSegmentLib already has support for both PCIe controllers.
> - Enable NetworkPkg for LX2160aRdbPkg Platform.
>
>
> Changes in V2:
> - Addressed review comments on V1
Thanks!
For the series:
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
Pushed as b716f363e752..b9fba411178f.
> V1 series can be referred here:
> https://edk2.groups.io/g/devel/message/61062
>
> Wasim Khan (7):
> Silicon/NXP: LX2160A: Define PCIe related PCDs
> Platform/NXP: LX2160aRdbPkg: Add PCIe space in VirtualMemoryMap
> Platform/NXP: LX2160aRdbPkg: Add PlatformDxe driver
> Platform/NXP: LX2160aRdbPkg: Enable PlatformDxe driver
> Platform/NXP: LX2160aRdbPkg: Hide Root Port for LX2160A-Rev2
> Platform/NXP: LX2160aRdbPkg: Enable NetworkPkg
> Platform/NXP: LX2160aRdbPkg: Enable PCIE support
>
> Silicon/NXP/NxpQoriqLs.dec | 1 +
> Silicon/NXP/LX2160A/LX2160A.dsc.inc | 5 +
> Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.dsc | 22 +++++
> Platform/NXP/LX2160aRdbPkg/LX2160aRdbPkg.fdf | 15 +++
> Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.inf | 36 ++++++++
> Platform/NXP/LX2160aRdbPkg/Library/ArmPlatformLib/ArmPlatformLib.inf | 2 +
> Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.inf | 1 +
> Silicon/NXP/Include/Pcie.h | 1 +
> Silicon/NXP/LX2160A/Include/Soc.h | 3 +
> Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.c | 97 ++++++++++++++++++++
> Platform/NXP/LX2160aRdbPkg/Library/ArmPlatformLib/ArmPlatformLibMem.c | 11 ++-
> Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.c | 6 +-
> 12 files changed, 198 insertions(+), 2 deletions(-)
> create mode 100644 Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.inf
> create mode 100644 Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.c
>
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 9+ messages in thread