From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR03-DB5-obe.outbound.protection.outlook.com (EUR03-DB5-obe.outbound.protection.outlook.com [40.107.4.71]) by mx.groups.io with SMTP id smtpd.web11.141.1591741079699935459 for ; Tue, 09 Jun 2020 15:18:00 -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=H3aIvyG6; spf=pass (domain: oss.nxp.com, ip: 40.107.4.71, mailfrom: wasim.khan@oss.nxp.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e65xuZDIdnQHGeEU6lSU61bFKxNqqPgyNKg/juucNUxU00oLzCofKgFx08f6+uNWhXdFcyWTpzrDE8reshr30nFjnWyzUL38Kv0GR7zX/XqtZdSWJD6UJqWi5mC8LAttYRd6Kl3qCarFKwpN07ZUhe5PJ0Lb1Ydbk3ArLdksSG7bE3CTmW/F67C99g87QsFVsKmc7SmjT09QkkpTso3kER40Gk39CXyMD045s3axnl0t8UumqldiZMcIYOcjEAAy5IGmQxoh8nESjyIms9sMSdisiV+97Ptu+nZsv/OUG7MWMjJJa2YO8EekJIgJtdGb/X9WP+lCrQfWd1eWRaQv5g== 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=PaliM9PIFtA0JKyyx3BvIk0Qc9yxB6x15EfEbsg/w8A=; b=QCTOkB2dHoSm6a9a4w4qk4posIkOI85Z/0pcs0wKdoiUelEhEkIXtNPzL1MeaydgZBwaaejB6JrQrX2HlSZ0Cfvkr5xGz5NQ+qIffep0GK9QXNpLbb4qQoNPjWAEgIqpeW/yQz5rpcBQR/uTcp5DhEPkXn8W/Ch1f0JTtoMOvTjtlcWlM5uc3lDtod6RenVvNZJLvp/sWUWh619tSM0Hp+TE/rFht2yqR0DH35XulEpIjGWzT5ucvBZ4atLMEm5MMSDp9jNTbNVXk9ntx3zY3yd9cCMJrmC0kxopxWIOPuNimRQcMgWGJpIBQ9Cz+fdKFvvnZgwbNTJ2v7Kx/1KpkA== 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=PaliM9PIFtA0JKyyx3BvIk0Qc9yxB6x15EfEbsg/w8A=; b=H3aIvyG6WLT/WiBQ1qDKaV+P43BGy6afzfA4y/9GbRmIanTd5YG3xvLko9KfeRqGka7EzqBrWoFvdPGG3JIo5FgdpoxOPEpQwuw8qOu3j04ESjQcMgfGItAL7AliNqnhIBJWmeLi9nKylglauI6kXNgNkqVSCeIEmRp0fuf3ONA= 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 VE1PR04MB6493.eurprd04.prod.outlook.com (2603:10a6:803:11f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.20; Tue, 9 Jun 2020 22:17:57 +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.3088.018; Tue, 9 Jun 2020 22:17:57 +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 5/7] Platform/NXP: LX2160aRdbPkg: Hide Root Port for LX2160A-Rev2 Date: Wed, 10 Jun 2020 03:47:28 +0530 Message-ID: <1591741050-11645-6-git-send-email-wasim.khan@oss.nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1591741050-11645-1-git-send-email-wasim.khan@oss.nxp.com> References: <1591741050-11645-1-git-send-email-wasim.khan@oss.nxp.com> X-ClientProxiedBy: PN1PR0101CA0004.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:e::14) 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 localhost.localdomain (157.37.179.16) by PN1PR0101CA0004.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3088.18 via Frontend Transport; Tue, 9 Jun 2020 22:17:55 +0000 X-Mailer: git-send-email 2.7.4 X-Originating-IP: [157.37.179.16] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 512067ea-bbf6-46b2-20a8-08d80cc2f69f X-MS-TrafficTypeDiagnostic: VE1PR04MB6493: 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: 042957ACD7 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EAOU+lRRRLHsE/vDXqFv7hKjmYGDIiGtFkgkZsBNnIPmL1ybnMYNGDm0pc5WiY1aq35OtC+NYDtp4GKlPk79JQ4rZGtnON2iGTC1334XQDlX0KOAiZ6e2e4ZmrsT/s+XNpbx1yFm9ymXgOWjOHIj+Sns9zdv7UNU+KvDprF1uhQ6hX7p4VKHGOCNxQg5X20rWi96UHHjK4FBmgkWFMDNUIo1P+uleOgpwWQL9ue9B3Ir0MYZo/UzhUmyHQUFhMGSCtxsnn8X5bM2ZwQhQQ2FI2ECtbB9kWSDKX3Z2+3h7rflLraSuIVGNg//YLrwsv24Y8NGWuqZQ7a+l5+60a9kdvruv8cBExAMeVS8gBwoutBnmF7yVjIBO7izbiA1lxKs 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)(39860400002)(366004)(136003)(396003)(376002)(186003)(26005)(16526019)(478600001)(8676002)(4326008)(8936002)(86362001)(83380400001)(69590400007)(6666004)(66946007)(5660300002)(6486002)(316002)(2906002)(66476007)(2616005)(19627235002)(6512007)(52116002)(6506007)(66556008)(956004)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: PuAtZrTiT+aMOYXoB+b2UxznXjC28hcnfkEN8l37K3p91B6u19ZDRoA1J4o8oy9x3zTGBA78wcjtn+DMTLJqTfV2L/itl2CrqDAlRMISI3YQUAiVatHMaBn0uOnc+lP8Mdzm6NJvOwC7pT6oWcP8qIXwUVbuylZU92Abov1P196niWDqy9OqfCn+YAcsOXFBEqSYrFTF/ybxUxcD45aOkIOfDIdiT7Qq2jq/MAY8UKuWqdq2VBlZ80bGJw57yDc77RpXDeI6gWdBwJWIgymJPMiciplKgvhTL6r3UFehbV1/TsnbizHGB/eMk1+RpRhBYCr/h1xqVJQtKWk9Z9YJPhQ8apKgMVrf0bx2owbEzxAAlQXmYymPY6+Cm1VWwKLBC6JQd0IHlpeiegwoZYJb2tYasY+55QuX/Lva0sS+vTB4TgrM8xBwhS+bdW7+0CFlWve+XYwRm9OTp/iONRKYqfg8Qr5IkJEv1ar3T9LmHWg= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 512067ea-bbf6-46b2-20a8-08d80cc2f69f X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2020 22:17:57.6645 (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: UpGX5iY0hvdFLI+AW61p+KiEoUbxyta5pZP6LmbfuEQKIZipBO5Ru46vZAFCJi6oMwZ2tudZl7KtWlvm+JChkg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6493 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 | 18 ++++++= ++++++++++++ Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.c | 6 +++++- 6 files changed, 27 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 73599aaeb7bf..4733309da47c 100644 --- a/Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.c +++ b/Platform/NXP/LX2160aRdbPkg/Drivers/PlatformDxe/PlatformDxe.c @@ -9,6 +9,23 @@ #include =20 /** + Hide PCI Root Port for LX2160A-Rev2 + +**/ +VOID +HidePciRootPort ( + VOID + ) +{ + UINT32 Svr; + + Svr =3D SocGetSvr (); + if ((SVR_SOC_VER(Svr) =3D=3D SVR_LX2160A) && (SVR_MAJOR(Svr) =3D=3D 0x2)= ) { + PcdSetBoolS (PcdPciHideRootPort, TRUE); + } +} + +/** Enable PciCfgShift feature for LX2160-Rev2 =20 **/ @@ -53,6 +70,7 @@ PlatformPciInit ( { EnableCfgShift (); EnablePciController (); + HidePciRootPort (); } =20 /** 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