From: Wasim Khan <wasim.k...@nxp.com> PCIe Layerscape controller can be enabled for ECAM style configuration access using CFG SHIFT Feature.
Check for PcdPciCfgShiftEnable to decide the configuration access scheme to be used with PCIe LS controller. Signed-off-by: Wasim Khan <wasim.k...@nxp.com> --- Notes: V2: - Addressed review comment to use (Bus > 0) instead of (Bus) Silicon/NXP/Library/PciSegmentLib/PciSegmentLib.inf | 3 +++ Silicon/NXP/Library/PciSegmentLib/PciSegmentLib.c | 20 ++++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Silicon/NXP/Library/PciSegmentLib/PciSegmentLib.inf b/Silicon/NXP/Library/PciSegmentLib/PciSegmentLib.inf index a36e79239b33..936213dc8a9d 100755 --- a/Silicon/NXP/Library/PciSegmentLib/PciSegmentLib.inf +++ b/Silicon/NXP/Library/PciSegmentLib/PciSegmentLib.inf @@ -30,3 +30,6 @@ [LibraryClasses] [FixedPcd] gNxpQoriqLsTokenSpaceGuid.PcdPciExp1BaseAddr + +[Pcd] + gNxpQoriqLsTokenSpaceGuid.PcdPciCfgShiftEnable diff --git a/Silicon/NXP/Library/PciSegmentLib/PciSegmentLib.c b/Silicon/NXP/Library/PciSegmentLib/PciSegmentLib.c index d0bacca3d0d7..e5251ecf0dd8 100755 --- a/Silicon/NXP/Library/PciSegmentLib/PciSegmentLib.c +++ b/Silicon/NXP/Library/PciSegmentLib/PciSegmentLib.c @@ -34,6 +34,8 @@ typedef enum { #define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A,M) \ ASSERT (((A) & (0xffff0000f0000000ULL | (M))) == 0) +static BOOLEAN CfgShiftEnable; + STATIC UINT64 PciLsCfgTarget ( @@ -88,11 +90,20 @@ PciLsGetConfigBase ( { UINT32 CfgAddr; - CfgAddr = (UINT16)Offset; - if (Bus > 0) { - return PciLsCfgTarget (PCI_SEG0_DBI_BASE + PCI_DBI_SIZE_DIFF * Segment, Address, Segment, Bus, Offset); + if (CfgShiftEnable) { + CfgAddr = (UINT32)Address; + if (Bus > 0) { + return PCI_SEG0_MMIO_MEMBASE + PCI_BASE_DIFF * Segment + CfgAddr; + } else { + return PCI_SEG0_DBI_BASE + PCI_DBI_SIZE_DIFF * Segment + CfgAddr; + } } else { - return PCI_SEG0_DBI_BASE + PCI_DBI_SIZE_DIFF * Segment + CfgAddr; + CfgAddr = (UINT16)Offset; + if (Bus > 0) { + return PciLsCfgTarget (PCI_SEG0_DBI_BASE + PCI_DBI_SIZE_DIFF * Segment, Address, Segment, Bus, Offset); + } else { + return PCI_SEG0_DBI_BASE + PCI_DBI_SIZE_DIFF * Segment + CfgAddr; + } } } @@ -608,5 +619,6 @@ PciSegLibInit ( IN EFI_SYSTEM_TABLE *SystemTable ) { + CfgShiftEnable = CFG_SHIFT_ENABLE; return EFI_SUCCESS; } -- 2.7.4 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#60247): https://edk2.groups.io/g/devel/message/60247 Mute This Topic: https://groups.io/mt/74474404/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-