From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (EUR05-AM6-obe.outbound.protection.outlook.com [40.107.22.88]) by mx.groups.io with SMTP id smtpd.web10.13401.1593413145758089303 for ; Sun, 28 Jun 2020 23:45:46 -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=R1nZIoG1; spf=pass (domain: oss.nxp.com, ip: 40.107.22.88, mailfrom: wasim.khan@oss.nxp.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dN18P6nfvfR4MYxAABwm37xtoPY6L9DP9xZ/iDjjDVteYtWkOPVRXB80RHmsKJY1JTAQ5PCB1jbmxVpzjQzJsljFUDgXBz7UruQiREhYpzBTw0dMUK+uaLlI+uhx+GjYcbNPLfK4neatBVDYWDGIrNCRq3QOI8zt3DVXCgl1ftpMJBd8QqYiCdvbW8zqhV1iCUNCzc6zXvthEEB5NFMKrp7QquPZJW6efqfRy61Lk09WzN09Omv1sOjjv6uawYc81Hv6EujjLeJC4RNBO9eJXKNSdH7aFPjh8SOTvui7cPQkmuJJnsBQ9Tx1+CizACijD6BMGvBN33OlkyVbWtC3Ig== 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=BaXIIzOSoJc79vO5aYTPmhIRc3K4sAJN5rOWhV7vvC8=; b=S29j39BfI6RFO/QYlmm0CMJjv7k0C5EdeszfMVxe42nSEgcCHs8eKy+ilKdsmqqOM1XDavIUz/Vmz1NC3d0DmlH4gmIu050femBiBDW4Yy4Y+6SdTtHbf2O00RylUS5gtmcL2hmJJbeMkhtXu8z3MyCwvliJrAqUD4VObTDXngYN6F9T6QqSAWLP+weSEwP+Yu4MvSEWMbKctlY3KlrToZCLmwg6gX91T6jrJsHW7iTTprnzZjYVsBIP/XAYaRSZiHl3TVFN81hqKB89WVmdT281BDmEoCuZU2Yjsu3BlsvgzoAc2O4l+O6gH96My6qzr6rr0zkmqZR7d3tiOb/nuQ== 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=BaXIIzOSoJc79vO5aYTPmhIRc3K4sAJN5rOWhV7vvC8=; b=R1nZIoG15yIkUNq2iKrnupO1CuLGpaneCJfaC4h07cveri3xnvDBUAwHPn1HSg33pKhAXquVInm6owo8HJq4Ep7Vio+ZBUghymXh09dFuU4FgDW2OMHb5QgR+OkvwKDP0wHMti7XN8aQCQSijOGX96cAPHiVroNgGXQeyICve64= 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 VI1PR04MB4816.eurprd04.prod.outlook.com (2603:10a6:803:5b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.20; Mon, 29 Jun 2020 06:45:43 +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.3131.026; Mon, 29 Jun 2020 06:45:43 +0000 From: Wasim Khan To: devel@edk2.groups.io, meenakshi.aggarwal@nxp.com, V.Sethi@nxp.com, ard.biesheuvel@arm.com, leif@nuviainc.com CC: Wasim Khan Subject: [PATCH edk2-platforms v2 5/7] Platform/NXP: LX2160aRdbPkg: Hide Root Port for LX2160A-Rev2 Date: Mon, 29 Jun 2020 12:15:04 +0530 Message-ID: <1593413106-1672-6-git-send-email-wasim.khan@oss.nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1593413106-1672-1-git-send-email-wasim.khan@oss.nxp.com> References: <1593413106-1672-1-git-send-email-wasim.khan@oss.nxp.com> X-ClientProxiedBy: BMXPR01CA0083.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:54::23) 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.37.149.241) by BMXPR01CA0083.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:54::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3131.20 via Frontend Transport; Mon, 29 Jun 2020 06:45:40 +0000 X-Mailer: git-send-email 2.7.4 X-Originating-IP: [157.37.149.241] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 1bda33ee-c615-4645-2d53-08d81bf80b9f X-MS-TrafficTypeDiagnostic: VI1PR04MB4816: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 044968D9E1 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m3/ZdsODoLYB1J7RHI9GfxDMuXUfttf7BQPDrwgYYRu3sNH9Ve278e+9DI4ewCLobSOSRqN6gBHyHCi/HJHhrG2USPMwVVziN8MBTltI/OfIYyZGcKK+hshVi31rEfkWTN9poD7ciV9AvLqvL79rCtc4j9km1nLTiwltpiNmZaZaBeNM6XudwJ+rsKP/nkbI51hlTW/+padSG6Ebz261TVmEjpsyoiHTgzNyBnAJZ2EWoHik/sNW/wJz2SIFYhq3GLmVqcOhv9/Urwcq7kuSDHuk3bac0V7eEZBZhfXT49TsCW6i0aogsFvLiCzoXKtENbhcCtWHKXGKDfqWPj2GbQ== 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)(136003)(39860400002)(376002)(396003)(346002)(366004)(4326008)(52116002)(86362001)(66946007)(26005)(2906002)(6506007)(83380400001)(44832011)(66556008)(66476007)(2616005)(956004)(186003)(16526019)(6512007)(6486002)(8676002)(6666004)(8936002)(478600001)(19627235002)(316002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: uj8ldaCB3IHlakcL6FoAyNH9CexpeMuGVA37FraAmCi+JDgOIdrgguS6Y/fxH0hIY1+AY2vLn9xdLcy4UxwIJOToeSt9ptkxqdYTemUYRv4VFQXG4bZn+92oi+rIeHzr1QM3cBbo4B8VB5j6qJA5BSDIZC2fJhlfQhn9bGI5KqGknV0afiaL6jiXkhcbdOVzcWJtdGTnRsWlu6rTHEW3MsDZ6xV6iUYtGHnSkXQBNX8iPxCqz2hW5oeS7KdO9hOX8doWftVbGLHcNRNpIQFBWYS7T88fl9Up6HNVjCa2lIty4is6yTe5POZ6Plv1K8a4TfyZeqjPwavTlsQDNKl/wQjxETe/BwXHVsDtIiteF0Vv6Pg+EFc5vCCQ+wPOqJ7NBlEV4UjsZ3gOAOnkri1SPFTWmAeMR+tks6nWNMZ3kaVENmOEasZIMwUflUXrWuWzOOLqSz5LRPW+P25BpQUus62XQxvKsxgpyaFCUYB5UpCmrrL8CYGmEc7mbqadZugh X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1bda33ee-c615-4645-2d53-08d81bf80b9f X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6702.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jun 2020 06:45:43.6414 (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: IgM9LVXKedci1/2rs1clrX2UOvoOKdqW5zpM2jka2uUj+e/zriEGuBOYmGk4yhfpwYVvtSb86FvRrHt2dfzoNA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4816 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Wasim Khan 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 --- 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 =20 [Depex] TRUE diff --git a/Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.inf b/Si= licon/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 accord= ingly. + // + 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/Sili= con/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 =3D SIZE_1MB; Cfg1BusAddress =3D SIZE_2MB; // Region for type0 CFG transactions (only for bus1) - Cfg0Size =3D ECAM_BUS_SIZE; + if (PcdGetBool (PcdPciHideRootPort)) { + Cfg0Size =3D ECAM_DEVICE_SIZE; + } else { + Cfg0Size =3D ECAM_BUS_SIZE; + } // Region for type1 CFG transactions (for bus > 1) Cfg1Size =3D (ECAM_CFG_REGION_SIZE - ECAM_BUS_SIZE); // 255MB } else { --=20 2.7.4