From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (NAM12-BN8-obe.outbound.protection.outlook.com [40.107.237.67]) by mx.groups.io with SMTP id smtpd.web11.6959.1628265904481923180 for ; Fri, 06 Aug 2021 09:05:04 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@vmware.com header.s=selector2 header.b=g3gUPdWo; spf=pass (domain: vmware.com, ip: 40.107.237.67, mailfrom: awarkentin@vmware.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JykcWZRwrLOonQj4hBr0TAe83/WqwUs/7y70Sb1/IMOzspJZi/oM24Pr0TVXIWFuol+xklXTThU492h68kTGaTgRSlyvkkc8q/vYt6EOz6xHYpSgULzTudWrn+SbNmuAUOhbaS9C0hkMEq2FnHAz6V2ew/MRqwgD2fPIJf+0ILf/kUvnmwtgUapWkOEaLmJnJ1mqyOmFP6wZ+lZGJMi5WBz4qIDvo+GR6YK9SDaCANDjFyf7WEpH1FBvKMmYRIxf0+E8hUrG2xBtFo4Pm8kDJk/seAMtnazTd1Qk66/ahXKLC2HqSUzLUV8ukf+MY5eVt1A5+GXyKe/+8EcoHUB8Xw== 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=a2wy6H3HEsAXbvac4n59Dp8FT7eHsOFw6vSZ851j6L4=; b=ogdppXRJplToXS7oa1GmfFAwwUwE8O7fN+WOMEd4RQz1pvZCEurD65zBe646fSCDTxnsQNMnWMx4W926vdUINrssWm+6y/PKNE+41p3B5SECOp6tqCb5pKf2GSF6veXTDefR09j86ImtdTFNmkTHC9osCq1SJS2tbpzSsIV+T1WzUv6CJIL+ZNMK08SH6yRMCqVeOWQSzNRqap6BEDOd+KPLEUGT9l2POAutcPg7vgMJri4bqweAyp/B4IL3o3idXP8rvebH99eJGBnL/kYvQOEO1HWEGyx2zn4i+C1jxexAaX7S2DgHm8Ilj3H4cENm9nZsPjOfKxWZBAupHl7Njg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vmware.com; dmarc=pass action=none header.from=vmware.com; dkim=pass header.d=vmware.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=a2wy6H3HEsAXbvac4n59Dp8FT7eHsOFw6vSZ851j6L4=; b=g3gUPdWorhMP+7Zv6t05VFMYPqxFUviQ+Eku4f1iDve7xpVhVC+mm1EfR+ryqFNuW7pouEYN9tME01lzBsyFB4EOnt4sL1LwwrO53iG+uSQ5IuLKi862M9EueLsYjO3pAOHNOgre81bmS1vQgg+XLZLp6xEM29SXHjw+LOstKHk= Received: from PH0PR05MB8702.namprd05.prod.outlook.com (2603:10b6:510:b2::21) by PH0PR05MB8158.namprd05.prod.outlook.com (2603:10b6:510:ab::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.7; Fri, 6 Aug 2021 16:04:59 +0000 Received: from PH0PR05MB8702.namprd05.prod.outlook.com ([fe80::2566:a48:8045:d0fa]) by PH0PR05MB8702.namprd05.prod.outlook.com ([fe80::2566:a48:8045:d0fa%6]) with mapi id 15.20.4394.015; Fri, 6 Aug 2021 16:04:59 +0000 From: "Andrei Warkentin" To: "devel@edk2.groups.io" , "jeremy.linton@arm.com" CC: "pete@akeo.ie" , "ardb+tianocore@kernel.org" , "Sunny.Wang@arm.com" , "samer.el-haj-mahmoud@arm.com" , =?iso-8859-1?Q?Ren=E9_Treffer?= Subject: Re: [edk2-devel] [PATCH 4/5] Silicon/Broadcom/Bcm27xx: Tweak PCIe for CM4 Thread-Topic: [edk2-devel] [PATCH 4/5] Silicon/Broadcom/Bcm27xx: Tweak PCIe for CM4 Thread-Index: AQHXihgC3180Zz2870eK4TT/+TZp5atmowxSgAABzAc= Date: Fri, 6 Aug 2021 16:04:59 +0000 Message-ID: References: <20210805163551.488035-1-jeremy.linton@arm.com>,<20210805163551.488035-5-jeremy.linton@arm.com>, In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=vmware.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 3da6c5f1-d0b4-4b24-13dd-08d958f3f0ea x-ms-traffictypediagnostic: PH0PR05MB8158: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: zj2e+VP6n2wmsu6LHkkgXlo7lAmeylgq9MEP6xVP3Xu1sF0Oo1JLpvHSIGdh0sgJ7fyJot7NKei0NZ4Bxk8NbJ4jbebU5nEk0eps0ayE45RBFqVJ/kDav5+KArTv0YT8iMmDJRj2jeGXE3DEresD3UN9zN2roDfygtHPM277iTmaOFDKK4UVEMcVEB55S4pY/HA5iqv5YVEBaw+GWlTABkL0p3ATaV1wI95sFIySjsp6MojqxXOMGwdYQ1PJE6fmeEC6L54SGdDzgS/FkJ55FdDPlDEOGMwQcHcaXeQahkLtVHFGBsoSaSx001LTgIeG32DCiAWp8uznbXWlWWrnNhHbIemFFSgIF3ioTSWod7rKR/uwmR9ZXMD9oMh0dCG8IMgrtWpTTU1qyh82uEeqkDW0UMGt1nJg5zKX0nvwfUMuvDDfKMM7+lpQ+QWnXAaNyF/DTQDfDenCXEvsi5fRojYlwYc+R96hZzF+puwdAUuoXwnlxqbTIjr8l4Xkjm0tXWnv5WxHFmVp0WT+zskD2UIS+NWSav23Da2Nvf+/iTJ6tGlalGNAX7mo7ZDsDTsKfdD8rD3wWTtLIOG09Uyid1WKUXfCeJjDHqmFuMa7Towfps+Fw1f4T/CFg7i9Fk/XPSPHUXBSCrGLUVXZYqj65hsIfKd5w1WDvLVc1XSSyd0M3u6ZEIBSCJ0K1PmKlY9yYf2G0gTsgY5mM5RaPhDyuFfJ82Aand0wb9zhwRrtr9zXEuUCkEaZXLBWlJZIT2uIO07037g4X1gw5NWUYxgDAqqHCUBwk3JZ7moRIGpZkJQ= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR05MB8702.namprd05.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(136003)(39860400002)(366004)(376002)(346002)(122000001)(38100700002)(2940100002)(186003)(86362001)(966005)(5660300002)(478600001)(4326008)(7696005)(53546011)(6506007)(26005)(38070700005)(45080400002)(71200400001)(166002)(110136005)(83380400001)(8936002)(54906003)(33656002)(91956017)(8676002)(76116006)(66946007)(66446008)(19627235002)(66476007)(64756008)(66556008)(52536014)(9686003)(316002)(19627405001)(2906002)(55016002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?f2MsoqigpO0CbvWL9HeJnQF8pbHoeABvIui8lfNptUmh9gZ2jYh4N3ZYyu?= =?iso-8859-1?Q?e8/sqG5gKvgNBQHt934svMULdMu5rhTS3YlshXNPUz173NfdHuY75RIiRS?= =?iso-8859-1?Q?sNd6Lvih4+n5Nc0HYlBQjcbnM4tPeLInGEOba2osU8m77xJ5SzAYo737Vc?= =?iso-8859-1?Q?7/nhMa5Pi8eRpimTUryvX/d9BUulEgPVluZUF1Z7qPTdPwql455gZUfXf/?= =?iso-8859-1?Q?swfGdk1hmWVASYG9ga4krFkI/o4HmTf86H/NwvJuuvWjdRyWcrAwMT5bVo?= =?iso-8859-1?Q?kYEEewuFrBb62rh6BeIJVu1+nci5yRe9FuMv2Z/AO1kpjD81xHo0Rvv8zH?= =?iso-8859-1?Q?v2wRxnLkzIOxSGM7SvHpkRYyVKPTsgkt7keEilCPer+hqQw8Zv/YTZpVlB?= =?iso-8859-1?Q?LaMhAiIMvF/6FKZxaxONqWOlpG5iqPamCA3foSsgD3QJ7xoK9VduYXitK8?= =?iso-8859-1?Q?QHlADe2jwPUM61GprtPyyKwB9AdpNxfbizSBF9CA9bjygkwSmTy2IQ93Te?= =?iso-8859-1?Q?gjXIGJJlEMwh6VVD2XSt/QmnU8saQVDywHz3GHRfTO6Temg6+PJHvmDjid?= =?iso-8859-1?Q?ggDu8znL/Hkw/+CzU2nfZ+P4AC++3++ash8NIcZsDcGcmXDW/dGIyAzy9x?= =?iso-8859-1?Q?Zv5n2626FpqSS9mVuUmClX6Wcy3RFgPeDaZkFrlL6XUySqqB1A022L3L3R?= =?iso-8859-1?Q?8lIRZiF56cHtfMbSl6zeje0niJK67+qCjACWFSbFt9NjEOeiMTeVeC38P2?= =?iso-8859-1?Q?V7ze4V5/fPoc7QiRSh7PhtUATajzbYad3ewIWYLtfZCy2ZhmI5dE/FlJPK?= =?iso-8859-1?Q?eb8z0ypp31IMJv/YKpG17trJzWVg14MXVYlAWVSzGQiFSiWTxSQhMIB5+Y?= =?iso-8859-1?Q?ApSD0XJefT4fPfhrJVMfx3GsBjS367+Z3unxAM3ieoXRS8mPlfHd6O8JLn?= =?iso-8859-1?Q?VpJszLg87zVBSZHFcB32BlJd8KBJEhSQJo8Q7VFr0l0b/+SNAJevXOWKSp?= =?iso-8859-1?Q?VRd78XQdfKWEhXPhOmWprzMg2lbSIEWaTGlrEajuBlQ7OcaUWFqU5+5y3S?= =?iso-8859-1?Q?hnS2/OhWDDQKUyHVer0K7R/kGH1jL3seGsjj9fqeGhW4MkOHHzX/VGZkb6?= =?iso-8859-1?Q?/U8XGocPoTOyE+qKC1s+7ZX56CWGNC/fbU+fdMLCe3TkcaIfTHtxUjKl6f?= =?iso-8859-1?Q?JIZ2KhUyUADQpuyK2Hj8Z9CUHQhuqlQzLf5Vcx//lTOH/dmvv3MMjqdTxr?= =?iso-8859-1?Q?7QB4scQQ9bKyPaR4ifBWcFNdtyu94XmJP73E/nLDFrscbemS6RoA00Xigd?= =?iso-8859-1?Q?fuHscXJRh7MmxJ17TRIAmHY2wLXOx04sK+OASBJ9Lv2ezRUNk0kbUPo9/L?= =?iso-8859-1?Q?bpQ5z+UY19?= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR05MB8702.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3da6c5f1-d0b4-4b24-13dd-08d958f3f0ea X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Aug 2021 16:04:59.1277 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: At2qBSl2vUbq6uPlueDs/9Quxy8XjGUOiwQoDzgFpwTmMxKGge9A+o2+HiA/6XwbYE1b3r5WLOV3oaP7nAof7g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR05MB8158 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_PH0PR05MB8702E31339A2A814120A4062B9F39PH0PR05MB8702namp_" --_000_PH0PR05MB8702E31339A2A814120A4062B9F39PH0PR05MB8702namp_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Ok, I misunderstood the patch set (I thought the PciHostBridgeLib itself wo= uld eventually move to DEN0115). I still think that (in general) would be a good idea - if not for the benef= it of the Pi, then for the next upstreamed platform where you could avoid i= mplementing custom config access code... Reviewed-by: Andrei Warkentin -- Andrei Warkentin, Arm Enablement Architect, Cloud Platform Business Unit, VMware ________________________________ From: Andrei Warkentin Sent: Friday, August 6, 2021 7:02 PM To: devel@edk2.groups.io ; jeremy.linton@arm.com Cc: pete@akeo.ie ; ardb+tianocore@kernel.org ; Sunny.Wang@arm.com ; samer.el-haj-mahmoud@= arm.com ; Ren=E9 Treffer Subject: Re: [edk2-devel] [PATCH 4/5] Silicon/Broadcom/Bcm27xx: Tweak PCIe = for CM4 Hi Jeremy, Is any of this still conceptually necessary if we adopt the SMCCC interface= within UEFI? Instead of assuming the first downstream bus is bus 1, could you read the s= econdary BN from the RP? -- Andrei Warkentin, Arm Enablement Architect, Cloud Platform Business Unit, VMware ________________________________ From: devel@edk2.groups.io on behalf of Jeremy Linto= n via groups.io Sent: Thursday, August 5, 2021 7:35 PM To: devel@edk2.groups.io Cc: pete@akeo.ie ; ardb+tianocore@kernel.org ; Andrei Warkentin ; Sunny.Wang@arm.com <= Sunny.Wang@arm.com>; samer.el-haj-mahmoud@arm.com ; Jeremy Linton ; Ren=E9 Treffer Subject: [edk2-devel] [PATCH 4/5] Silicon/Broadcom/Bcm27xx: Tweak PCIe for = CM4 The CM4 has an actual pcie slot, so we need to move the linkup check to the configuration probe logic. Further the device restriction logic needs to be relaxed to support downstream PCIe switches. Suggested-by: Ren=E9 Treffer Signed-off-by: Jeremy Linton --- .../Bcm2711PciHostBridgeLibConstructor.c | 5 ----- .../Library/Bcm2711PciSegmentLib/PciSegmentLib.c | 24 +++++++++++++++---= ---- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciHostBridgeLib/Bcm27= 11PciHostBridgeLibConstructor.c b/Silicon/Broadcom/Bcm27xx/Library/Bcm2711P= ciHostBridgeLib/Bcm2711PciHostBridgeLibConstructor.c index 8587d2d36d..4d4c584726 100644 --- a/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciHostBridgeLib/Bcm2711PciHo= stBridgeLibConstructor.c +++ b/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciHostBridgeLib/Bcm2711PciHo= stBridgeLibConstructor.c @@ -204,11 +204,6 @@ Bcm2711PciHostBridgeLibConstructor ( } while (((Data & 0x30) !=3D 0x030) && (Timeout)); DEBUG ((DEBUG_VERBOSE, "PCIe link ready (status=3D%x) Timeout=3D%d\n", D= ata, Timeout)); - if ((Data & 0x30) !=3D 0x30) { - DEBUG ((DEBUG_ERROR, "PCIe link not ready (status=3D%x)\n", Data)); - return EFI_DEVICE_ERROR; - } - if ((Data & 0x80) !=3D 0x80) { DEBUG ((DEBUG_ERROR, "PCIe link not in RC mode (status=3D%x)\n", Data)= ); return EFI_UNSUPPORTED; diff --git a/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegme= ntLib.c b/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentL= ib.c index 44ce3b4b99..3ccc131eab 100644 --- a/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c +++ b/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c @@ -78,6 +78,8 @@ PciSegmentLibGetConfigBase ( UINT64 Base; UINT64 Offset; UINT32 Dev; + UINT32 Bus; + UINT32 Data; Base =3D PCIE_REG_BASE; Offset =3D Address & 0xFFF; /* Pick off the 4k register offset *= / @@ -89,17 +91,25 @@ PciSegmentLibGetConfigBase ( Base +=3D PCIE_EXT_CFG_DATA; if (mPciSegmentLastAccess !=3D Address) { Dev =3D EFI_PCI_ADDR_DEV (Address); + Bus =3D EFI_PCI_ADDR_BUS (Address); + /* - * Scan things out directly rather than translating the "bus" to a d= evice, etc.. - * only we need to limit each bus to a single device. + * There can only be a single device on bus 1 (downstream of root). + * Subsequent busses (behind a PCIe switch) can have more. */ - if (Dev < 1) { - MmioWrite32 (PCIE_REG_BASE + PCIE_EXT_CFG_INDEX, Address); - mPciSegmentLastAccess =3D Address; - } else { - mPciSegmentLastAccess =3D 0; + if (Dev > 0 && (Bus < 2)) { return 0xFFFFFFFF; } + + /* Don't probe slots if the link is down */ + Data =3D MmioRead32 (PCIE_REG_BASE + PCIE_MISC_PCIE_STATUS); + if ((Data & 0x30) !=3D 0x30) { + DEBUG ((DEBUG_ERROR, "PCIe link not ready (status=3D%x)\n", Data= )); + return 0xFFFFFFFF; + } + + MmioWrite32 (PCIE_REG_BASE + PCIE_EXT_CFG_INDEX, Address); + mPciSegmentLastAccess =3D Address; } } return Base + Offset; -- 2.13.7 --_000_PH0PR05MB8702E31339A2A814120A4062B9F39PH0PR05MB8702namp_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Ok, I misunderstood the patch set (I thought the PciHostBridgeLib itse= lf would eventually move to DEN0115).

I still think that (in general) would be a good idea - if not for the benef= it of the Pi, then for the next upstreamed platform where you could avoid i= mplementing custom config access code...

Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>

--
Andrei Warkentin,
Arm Enablement Architect,
Cloud Platform Business Unit, VMware

From: Andrei Warkentin <= awarkentin@vmware.com>
Sent: Friday, August 6, 2021 7:02 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>; jeremy.linton= @arm.com <jeremy.linton@arm.com>
Cc: pete@akeo.ie <pete@akeo.ie>; ardb+tianocore@kernel.org <= ;ardb+tianocore@kernel.org>; Sunny.Wang@arm.com <Sunny.Wang@arm.com&g= t;; samer.el-haj-mahmoud@arm.com <samer.el-haj-mahmoud@arm.com>; Ren= =E9 Treffer <treffer+groups.io@measite.de>
Subject: Re: [edk2-devel] [PATCH 4/5] Silicon/Broadcom/Bcm27xx: Twea= k PCIe for CM4
 
Hi Jeremy,

Is any of this still conceptually necessary if we adopt the SMCCC interface= within UEFI?

Instead of assuming the first downstream bus is bus 1, could you read the s= econdary BN from the RP?

--
Andrei Warkentin,
Arm Enablement Architect,
Cloud Platform Business Unit, VMware

From: devel@edk2.groups.i= o <devel@edk2.groups.io> on behalf of Jeremy Linton via groups.io <= ;jeremy.linton=3Darm.com@groups.io>
Sent: Thursday, August 5, 2021 7:35 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: pete@akeo.ie <pete@akeo.ie>; ardb+tianocore@kernel.org <= ;ardb+tianocore@kernel.org>; Andrei Warkentin <awarkentin@vmware.com&= gt;; Sunny.Wang@arm.com <Sunny.Wang@arm.com>; samer.el-haj-mahmoud@ar= m.com <samer.el-haj-mahmoud@arm.com>; Jeremy Linton <jeremy.linton= @arm.com>; Ren=E9 Treffer <treffer+groups.io@measite.de>
Subject: [edk2-devel] [PATCH 4/5] Silicon/Broadcom/Bcm27xx: Tweak PC= Ie for CM4
 
The CM4 has an actual pcie slot, so we need to m= ove the linkup
check to the configuration probe logic. Further the device
restriction logic needs to be relaxed to support downstream
PCIe switches.

Suggested-by: Ren=E9 Treffer <treffer+groups.io@measite.de>
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
 .../Bcm2711PciHostBridgeLibConstructor.c     = ;      |  5 -----
 .../Library/Bcm2711PciSegmentLib/PciSegmentLib.c   | 24 +++= ++++++++++++-------
 2 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciHostBridgeLib/Bcm27= 11PciHostBridgeLibConstructor.c b/Silicon/Broadcom/Bcm27xx/Library/Bcm2711P= ciHostBridgeLib/Bcm2711PciHostBridgeLibConstructor.c
index 8587d2d36d..4d4c584726 100644
--- a/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciHostBridgeLib/Bcm2711PciHo= stBridgeLibConstructor.c
+++ b/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciHostBridgeLib/Bcm2711PciHo= stBridgeLibConstructor.c
@@ -204,11 +204,6 @@ Bcm2711PciHostBridgeLibConstructor (
   } while (((Data & 0x30) !=3D 0x030) && (Timeout));=
   DEBUG ((DEBUG_VERBOSE, "PCIe link ready (status=3D%x) Tim= eout=3D%d\n", Data, Timeout));
 
-  if ((Data & 0x30) !=3D 0x30) {
-    DEBUG ((DEBUG_ERROR, "PCIe link not ready (status= =3D%x)\n", Data));
-    return EFI_DEVICE_ERROR;
-  }
-
   if ((Data & 0x80) !=3D 0x80) {
     DEBUG ((DEBUG_ERROR, "PCIe link not in RC mod= e (status=3D%x)\n", Data));
     return EFI_UNSUPPORTED;
diff --git a/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegme= ntLib.c b/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentL= ib.c
index 44ce3b4b99..3ccc131eab 100644
--- a/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c=
+++ b/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c=
@@ -78,6 +78,8 @@ PciSegmentLibGetConfigBase (
   UINT64        Base;
   UINT64        Offset;
   UINT32        Dev;
+  UINT32        Bus;
+  UINT32        Data;
 
   Base =3D PCIE_REG_BASE;
   Offset =3D Address & 0xFFF;     &= nbsp;   /* Pick off the 4k register offset */
@@ -89,17 +91,25 @@ PciSegmentLibGetConfigBase (
     Base +=3D PCIE_EXT_CFG_DATA;
     if (mPciSegmentLastAccess !=3D Address) {
       Dev =3D EFI_PCI_ADDR_DEV (Address); +      Bus =3D EFI_PCI_ADDR_BUS (Address);
+     
       /*
-       * Scan things out directly rather tha= n translating the "bus" to a device, etc..
-       * only we need to limit each bus to a= single device.
+       * There can only be a single device o= n bus 1 (downstream of root).
+       * Subsequent busses (behind a PCIe sw= itch) can have more.
        */
-      if (Dev < 1) {
-          MmioWrite32 (PCIE_R= EG_BASE + PCIE_EXT_CFG_INDEX, Address);
-          mPciSegmentLastAcce= ss =3D Address;
-      } else {
-          mPciSegmentLastAcce= ss =3D 0;
+      if (Dev > 0 && (Bus < 2)) {            return 0xFFFFF= FFF;
       }
+
+      /* Don't probe slots if the link is down */=
+      Data =3D MmioRead32 (PCIE_REG_BASE + PCIE_M= ISC_PCIE_STATUS);
+      if ((Data & 0x30) !=3D 0x30) {
+          DEBUG ((DEBUG_ERROR= , "PCIe link not ready (status=3D%x)\n", Data));
+          return 0xFFFFFFFF;<= br> +      }
+
+      MmioWrite32 (PCIE_REG_BASE + PCIE_EXT_CFG_I= NDEX, Address);
+      mPciSegmentLastAccess =3D Address;
     }
   }
   return Base + Offset;
--
2.13.7






--_000_PH0PR05MB8702E31339A2A814120A4062B9F39PH0PR05MB8702namp_--