From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR02-VE1-obe.outbound.protection.outlook.com (EUR02-VE1-obe.outbound.protection.outlook.com [40.107.2.69]) by mx.groups.io with SMTP id smtpd.web11.3407.1590102219167657148 for ; Thu, 21 May 2020 16:03:39 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@nxp1.onmicrosoft.com header.s=selector2-nxp1-onmicrosoft-com header.b=M+aVFBC1; spf=pass (domain: oss.nxp.com, ip: 40.107.2.69, mailfrom: wasim.khan@oss.nxp.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OibXbBNH2xHlP8uj9lIBHP3r8ZnwihBt0W7M1KlGXHlqBS4UGsrl/LXM4+EggMCYM2xSicQZvujGmcrk/gVy00NpbtYD4A9A9O4eCfWZSAbhPfa7uJ6Fd/0ux2r9uweWwFeyF862yOhPWzZh2V0kQOybZlTOXECzfV78lsmDDUMmnnWumhl3kOqce5YJ6ujfk2d6cFXvBLNORRpxv8arbrtg9299FDm5Olef1h9ZincVOpcR7wrv55pyQNqAVEDWsyGvxzOjJ+jcyUgXfybq/nxUUkkRpUE70Hg/0KWOonq6ikLV/w5VCynamS7+R1FsUyj/QCHI+otTGcXpmEyOyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R+Ihz58MiOWiKrGGEa+Wu9qjc3e28YNEGu+A/THxMQQ=; b=gdLndQAdk6Baqh7YeRXbaF7IecgOPP99VvR9LU3GnhGSpPbFYwS/QrgUteoB9olteVC0wZWokHkVNtX8QNz+2iQRsgvbPnE3w1aCfVbXGlbNxOdkO+niOa/PLDhOZ0YAr6n1/M8g/nXCdCz17tP4IDy+P9i3KcFnWeKH+HUcYQueDcrBCA1oS+9dLXt1nXCpikw8xQNdSBoxPcVE9YGMnCIbylRuA/oLywGEfFwFlf2AlVlMSUdRt99wZSgUMUtMHg/DoFddOK9CL+m2c5Vdr3P7v9uF2Ec/ZdY3zEZTFN+5wA3CnoW3AX9fWtTFx1d2s5kgIkzoHUndqthWZ1wF8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R+Ihz58MiOWiKrGGEa+Wu9qjc3e28YNEGu+A/THxMQQ=; b=M+aVFBC1zJrrc6Q6jF/bNMWiG6Hl+Zd+a2i/raxaP89E3PAWHP82e3vgkYXuC1jVxIxGNgzNvK9D5GIUNf7LWmm9pUbutrXj0fmVl964fiP51TBUcohstiU9oxqd3UgYVM3YLdiqZx79mO9dajDEYK+HhTflJTY9ED3r97akWe4= Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=oss.nxp.com; Received: from VE1PR04MB6702.eurprd04.prod.outlook.com (2603:10a6:803:123::13) by VE1PR04MB6381.eurprd04.prod.outlook.com (2603:10a6:803:119::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.27; Thu, 21 May 2020 23:03:36 +0000 Received: from VE1PR04MB6702.eurprd04.prod.outlook.com ([fe80::81c4:97a6:7592:f225]) by VE1PR04MB6702.eurprd04.prod.outlook.com ([fe80::81c4:97a6:7592:f225%7]) with mapi id 15.20.3021.020; Thu, 21 May 2020 23:03:36 +0000 From: Wasim Khan To: devel@edk2.groups.io, meenakshi.aggarwal@nxp.com, vabhav.sharma@nxp.com, V.Sethi@nxp.com, ard.biesheuvel@arm.com, leif@nuviainc.com, jon@solid-run.com CC: Wasim Khan Subject: [PATCH edk2-platforms 10/16] Silicon/NXP: PciSegmentLib: Add ECAM config support for PCIe LS Controller Date: Fri, 22 May 2020 04:32:13 +0530 Message-ID: <1590102139-16588-11-git-send-email-wasim.khan@oss.nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1590102139-16588-1-git-send-email-wasim.khan@oss.nxp.com> References: <1590102139-16588-1-git-send-email-wasim.khan@oss.nxp.com> X-ClientProxiedBy: PN1PR01CA0071.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:1::11) To VE1PR04MB6702.eurprd04.prod.outlook.com (2603:10a6:803:123::13) Return-Path: wasim.khan@oss.nxp.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wasimk-VirtualBox.nxp.com (157.47.200.219) by PN1PR01CA0071.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 23:03:34 +0000 X-Mailer: git-send-email 2.7.4 X-Originating-IP: [157.47.200.219] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 78fc4762-5f8b-475d-dddb-08d7fddb3158 X-MS-TrafficTypeDiagnostic: VE1PR04MB6381: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-Forefront-PRVS: 041032FF37 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U7WcV6RCNxsQMUIxfNvADOiLLGIHZevoZyQJDyj+STwpTy3scOouso4T9QD6LxOH2/xtZyW2KWHXLX7yP2O/GHtNbA9yMRLa0wCoxS4VBUG+oM9P1c1GaX7yqAmsEHTEfAOOR9SWs637B9+X18121WjOBnrJ1roZ+of4RS1pANSCUI0/N+iOnqsyV1/qWLrOlv8nHK3a2Ju4ivDP6jf4FmRPM3tTpdpH0SLtU/jKXcE83nGIB4olbZTgdc9BJZ6uonNCBCqUHbAGK9rb7k+YzSXziooqiG7sDMbz4bRszn9zwh8Pyv1Yv6iaawo7RPy1MJwLfE2GkHyqd5kmMlGVsA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB6702.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(346002)(376002)(136003)(366004)(396003)(39860400002)(6506007)(52116002)(66476007)(2616005)(956004)(44832011)(66946007)(8936002)(8676002)(4326008)(316002)(478600001)(2906002)(16526019)(186003)(66556008)(86362001)(6512007)(19627235002)(5660300002)(6666004)(6486002)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: pvS8XPeEnPWXhE+1nZdE3GOGDpyMkG0Whp4v3uu50oB5qPahCJJK4PuT7rt2uaIXYc+k7WOxsWQqe6SLPN54oHt8CveQ3mkL8gQDvuIirggjFfeQSy+GOSxhEU4npC3EGhZocGw4+UYtgvfSyIQvjzMtQrIMijiIcON9QceuToHaHZ8lqX6eNPTywJ30IA/2heMGRKrjCM6/jzfMEDFVAV7EUTAOZ7bheCoCOofj23yNgYBpDuSnH8qCEGUvKdEqKhC5E2MC0xrMU46Bes9pTmLc0A44HcwzCURRt54JB07Hf7bvoBw+I280SssWd5EwAWa8LuBgGA/zQaTjazmlqOcBzWrhHFG3kKZMQHokZZ1vLVGwA/j644ozXXwp/jrj2TvwrB+GOyhKVI1A9Oo0a4xnW8kIKQVDHL2vu5qrvDt+ap7wYbTlexsrEFbMPstzg04p/7OuVfaToMSn8jBiBAV848n9hsESKihhsFQjJpw= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 78fc4762-5f8b-475d-dddb-08d7fddb3158 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2020 23:03:36.6875 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jermywsT+q4LgmuDQ7ha6TM4NQ5KvScTwxYfw7nhlnDYiyFVgtU2njuOBuf4YaywEoSwTCQRsDFO6mkauUJfHw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6381 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Wasim Khan 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 --- 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] =20 [FixedPcd] gNxpQoriqLsTokenSpaceGuid.PcdPciExp1BaseAddr + +[Pcd] + gNxpQoriqLsTokenSpaceGuid.PcdPciCfgShiftEnable diff --git a/Silicon/NXP/Library/PciSegmentLib/PciSegmentLib.c b/Silicon/NX= P/Library/PciSegmentLib/PciSegmentLib.c index ecd36971b753..552a425c6832 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))) =3D=3D 0) =20 +static BOOLEAN CfgShiftEnable; + STATIC UINT64 PciLsCfgTarget ( @@ -88,11 +90,20 @@ PciLsGetConfigBase ( { UINT32 CfgAddr; =20 - CfgAddr =3D (UINT16)Offset; - if (Bus) { - return PciLsCfgTarget (PCI_SEG0_DBI_BASE + PCI_DBI_SIZE_DIFF * Segment= , Address, Segment, Bus, Offset); + if (CfgShiftEnable) { + CfgAddr =3D (UINT32)Address; + if (Bus) { + 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 =3D (UINT16)Offset; + if (Bus) { + return PciLsCfgTarget (PCI_SEG0_DBI_BASE + PCI_DBI_SIZE_DIFF * Segme= nt, Address, Segment, Bus, Offset); + } else { + return PCI_SEG0_DBI_BASE + PCI_DBI_SIZE_DIFF * Segment + CfgAddr; + } } } =20 @@ -608,5 +619,6 @@ PciSegLibInit ( IN EFI_SYSTEM_TABLE *SystemTable ) { + CfgShiftEnable =3D CFG_SHIFT_ENABLE; return EFI_SUCCESS; } --=20 2.7.4