From nobody Sat Feb 7 05:57:18 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+60899+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+60899+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=fail(p=none dis=none) header.from=oss.nxp.com Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1591638971522294.9798027083672; Mon, 8 Jun 2020 10:56:11 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 4tEwYY1788612x5uRdJxnOSj; Mon, 08 Jun 2020 10:56:11 -0700 X-Received: from EUR02-HE1-obe.outbound.protection.outlook.com (EUR02-HE1-obe.outbound.protection.outlook.com [40.107.1.40]) by mx.groups.io with SMTP id smtpd.web11.32.1591637343697693420 for ; Mon, 08 Jun 2020 10:29:04 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eci4R5hjpaZnUa+fIAh//dQSBLcpdAzylUwMDuCKXyspFsXSeX8WQmsqdhV0lyqYOzpJhWTJUzDpsXo7yC+Yp+2FWXwQHNhkjUAQ5lYVCLW9GJnMFm0/z5u/nnYZwHBPrMUEir+HvanLZnaCKrNnby1mW3Mm8RyxCmOq8CZsNODJgd54QHW0/bsXLP//y6w+GizaGSENd0kh3eGpmP+HdpqB40XrOPhXG9EP0fE4IyQg37pY1i3zxDEwz/dMaHukARLoz3gSsQURCkP7ty4P/UemgzpepwmmmuR6yNG5dIkvYqA6rurIKsafmDunNWuu8Gb5KqtKAgYrmgi6Eqj6DA== 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=A045oJwAOzcTX/ou3lsQo8Pwel1DlFbP3PiXhXmILhE=; b=WszPy7xVfgGAbZJuIBbSoisJ9NE6aknqasYaBhN2ZslFlZ7cpUlWv0z+i4PhgYMWvS2NqrEtYzfVKpd6wPipNmDRnFtjMXiXNAzjg2BS9wkCRdpEmkZmGyWbqwQokvkqfKsr9Z5XcDli4Xwl56BJiA2qLtEOXc8CoQzXbOluwew4T3sU/TjbXUAPIO1kHYcap3yxLBWiDwuMi7MuIpjU6yo3k7KP3kf+EIEdBflGcpdYJCHxEOdzqY24XAumTg4vUSV0Z6cLrW3KNNaifrQneyf+FO775LU9cLVSc2exfxoOZ8yJdzG5Fv5SlIW6xY+xdR14a9lzcH1ahDSd9b048Q== 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 X-Received: from VE1PR04MB6702.eurprd04.prod.outlook.com (2603:10a6:803:123::13) by VE1PR04MB6671.eurprd04.prod.outlook.com (2603:10a6:803:11f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.18; Mon, 8 Jun 2020 17:29:01 +0000 X-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.3066.023; Mon, 8 Jun 2020 17:29:01 +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: [edk2-devel] [PATCH edk2-platforms v3 3/3] Silicon/NXP: PciHostBridgeLib: Initialize only enabled PCIe controllers Date: Mon, 8 Jun 2020 22:58:17 +0530 Message-ID: <1591637297-16073-4-git-send-email-wasim.khan@oss.nxp.com> In-Reply-To: <1591637297-16073-1-git-send-email-wasim.khan@oss.nxp.com> References: <1591637297-16073-1-git-send-email-wasim.khan@oss.nxp.com> X-ClientProxiedBy: BM1PR0101CA0064.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:19::26) To VE1PR04MB6702.eurprd04.prod.outlook.com (2603:10a6:803:123::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Received: from wasimk-VirtualBox.nxp.com (157.37.163.9) by BM1PR0101CA0064.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:19::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3066.18 via Frontend Transport; Mon, 8 Jun 2020 17:28:53 +0000 X-Originating-IP: [157.37.163.9] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f735118a-e0d9-4f92-4123-08d80bd16e56 X-MS-TrafficTypeDiagnostic: VE1PR04MB6671: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: oOO1XXDmyo+ft7vIAHHYQZRe251H8KgBj15ABqX18EcvDFWk35ER3sPuIw566d+qlk/aQM9lbV6FhHyaJD4GDgv+Dfd6/GnwV3irWlmP78uKvPHql3AMYrAtDue67XjbEKJG1lE5uQMS1aVLpPmYmO2QVaaNK4Clgzg0rkb+Z+wN/gIZ9xlZrNpp3Oz2oNa13anKcrcFUsbyv7NX/S2XLaKGi15QC+NZrvfzq7nj0/FMq1FlalI67mMD2JvbhZmwKfomRP7F+oJZwO5OCE9plJtRYbGerowdWlq/ItS9nyb0hRerFXCcurpJX1E4tWItRajEkDUM0XXMd9RVzNufmA== X-MS-Exchange-AntiSpam-MessageData: WtYx1rHb/FvrKFeuhxA7N5E7iGNFhoup0huQXPuVb8ZTO15CI8uydJkR255JyAmGcSRZnK5VXXW/+BWueEdjjAK6OTFA0yXBsURoOWlafXOSnbw+Q0OlcDGDl/ap/Rci8ftbw9OG7ef1Pu37OnkST4X/dqEpvqIahfs7mCmrgSWe8LDfxGeJ2Cd/E9brjZNHRkYzd7LJlMP2cwi2VtzN3HD3/+h6eaD42Tp3CRm25H7Fen9g8hBs/ugDR66jRAy+oybfJnxaXUW8LGr6w9wnXClk3Us9N1fGcCxvIx+CgfjjeFLJ+X+Nx8sy90oNliMn55drz5B9Iue9vQDk4j5xs7UH4YLzt+GT3YBxrAlOKv2GDTfwkl9hLjGTycmKuUFxRxi43uHb+nHblqzhocGsWnzaylGC0FFfQNulLvk4m46khuDP+OA8gWOdLZ1TYQNJlGIX/e4Qd3q2hPOT71e5ZVlxqP5fSbJbzb0kVtAcFfU= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f735118a-e0d9-4f92-4123-08d80bd16e56 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2020 17:29:01.3474 (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: IH1cHQk66irrakOA1kd0kQI0qVNP+k+Gzr9MYmr3SyK9o35MMMvjeVi7N5soNglxDowtghTW8lqHlfVgH0jW2w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6671 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,wasim.khan@oss.nxp.com X-Gm-Message-State: bUuDxKvuXelB4XRWeHZLdXOdx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1591638971; bh=E27qNVeuStLPhxXt857hNXZdl4J099EuaxJkbUvY2xo=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=mqUwOcy80m2a9Tl3WLlJXoDu5LnBCsHNTZxkuIGGRbBGrepBis93twnZjXf8snvdPhF MEhaa7hp4xzWn00X6OdPOwDCK88Yk3BmaLoRp0JWasOnsm4KHeTwezRBqB3vx2CT/9J6+ b5zNXnxwDfRHFWeMYH29YEkETG7SWXsQsR0= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Wasim Khan Based on the serdes protocol value in reset configuration word (RCW), different PCIe controllers are enabled. Get SerDes protocol map and initialize only enabled PCIe controllers. Signed-off-by: Wasim Khan Reviewed-by: Leif Lindholm --- Notes: Changes in V3: - No Change =20 Changes in V2: - Addressed review comments for structure, variable and function names - Using BIT0 instead of 0x1u Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.inf | 1 + Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.c | 35 +++++++++++= ++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.inf b/Si= licon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.inf index aa5a9dec7c34..6003da708698 100644 --- a/Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.inf +++ b/Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.inf @@ -28,6 +28,7 @@ [LibraryClasses] IoAccessLib MemoryAllocationLib PcdLib + SocLib =20 [FeaturePcd] gNxpQoriqLsTokenSpaceGuid.PcdPciLutBigEndian diff --git a/Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.c b/Sili= con/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.c index e5309a4f4248..8bbbaaa6e24d 100644 --- a/Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.c +++ b/Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -721,6 +722,32 @@ PcieSetupCntrl ( } =20 /** + This function checks whether PCIe is enabled or not + depending upon SoC serdes protocol map + + @param PcieNum PCIe number. + + @return The PCIe number enabled in map. + @return FALSE PCIe number is disabled in map. + +**/ +STATIC +BOOLEAN +IsPcieNumEnabled( + IN UINTN PcieNum + ) +{ + UINT64 SerDesProtocolMap; + + SerDesProtocolMap =3D 0; + + // Reading serdes protocol map + GetSerDesProtocolMap (&SerDesProtocolMap); + + return (SerDesProtocolMap & (BIT0 << (PcieNum))) !=3D 0; +} + +/** Return all the root bridge instances in an array. =20 @param Count Return the count of root bridge instances. @@ -752,13 +779,19 @@ PciHostBridgeGetRootBridges ( PciPhyIoAddr [Idx] =3D PCI_SEG0_PHY_IO_BASE + (PCI_BASE_DIFF * Idx); Regs[Idx] =3D PCI_SEG0_DBI_BASE + (PCI_DBI_SIZE_DIFF * Idx); =20 + // Check is the PCIe controller is enabled + if (IsPcieNumEnabled (Idx + 1) =3D=3D 0) { + DEBUG ((DEBUG_INFO, "PCIE%d reg @ 0x%lx is disabled \n", Idx + 1, Re= gs[Idx])); + continue; + } + // Check PCIe Link LinkUp =3D PcieLinkUp(Regs[Idx], Idx); =20 if (!LinkUp) { continue; } - DEBUG ((DEBUG_INFO, "PCIE%d Passed Linkup Phase\n", Idx + 1)); + DEBUG ((DEBUG_INFO, "PCIE%d reg @ 0x%lx :Passed Linkup Phase\n", Idx += 1, Regs[Idx])); // Set up PCIe Controller and ATU windows PcieSetupCntrl (Regs[Idx], PciPhyCfg0Addr[Idx], --=20 2.7.4 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#60899): https://edk2.groups.io/g/devel/message/60899 Mute This Topic: https://groups.io/mt/74757674/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-