From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.50]) by mx.groups.io with SMTP id smtpd.web08.3106.1629490610705687544 for ; Fri, 20 Aug 2021 13:16:51 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@vmware.com header.s=selector2 header.b=tBbVWs+4; spf=pass (domain: vmware.com, ip: 40.107.244.50, mailfrom: awarkentin@vmware.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IZYzyqLHH/znTv7s/Wyy08X265JERDHWrWhDXwFnZo9eMMo9aCusp2A2XlYpT8QSpaydeM6pwCyztxqGjMjJbrC7T/e+m0xQUfwV5iy6awKIvpOzKnbi5tUIjzs4oZE4/3if3OQhJY6j4Crv3Ak0p67ybhBjpOFCeMxWcxv/r5Yif9NCvQWqL7nQb1GTafjKYhscAVNh+Ldg6XsZbloGUhdt8Y/z8Q0UdBJ+XnDsN+e7pBeefzUiwAXK7vXjO9chaBmoe2Z+dJgvs2qMsKQX6rtMPUxcns9NaQJmHZKa10CAvRS+nUraWT0eVovIODQonRpDqNgmvgjr8I+wcmtpiQ== 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=lh3EWJrtsrHmHePDUMXc5dU+/q9HrpeTFz7Uq+eEBdU=; b=UK1uzoO+awXvOYydr1oyb13dxw9P9b4UxFqyP9XZQ9bfWE0g+iZfVZFyvCD7AYpkDvIlKbF5u6QoAMCkmf3K9IU9jMCsfBcHnigQ0sSJfqYwyWEuhYtkGiGrLOp9Z686588UzBfj0MRt7tmi5/6qN4yrh05GAIasNbGoKXHsuzjB/yJOOrLwc164/ifijBDdHcJVlC7rLw89Bue8ToBGpEVMvKP8WQ3EAbxAC9LzQSeuNZOqIsGxmC4zlnvPOnowUJUBa3Mr+DZ51H+IXaiPIwun4+V/hYL/+wcBfUT8oivPtUdg13hNzOInX0R+szkgSwfJKFYBIlWMcHpVunV5JA== 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=lh3EWJrtsrHmHePDUMXc5dU+/q9HrpeTFz7Uq+eEBdU=; b=tBbVWs+4k0lIckcU6d/xiC6CHFDrZUSW0U9STKYCnYTm8zT7xzJwXWpoOfkeDSu0ZswHLKYCv9VkLBx/tE64IuQDvC7X+n8Hv7qsa1IZnDoM+hQNH4g7Iczq6JjqO5vEzpGiRm3LXTC15Mn005aw/ag7SCGV2DtH1naVjKBLo80= Received: from PH0PR05MB8702.namprd05.prod.outlook.com (2603:10b6:510:b2::21) by PH0PR05MB8749.namprd05.prod.outlook.com (2603:10b6:510:b7::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.5; Fri, 20 Aug 2021 20:16:45 +0000 Received: from PH0PR05MB8702.namprd05.prod.outlook.com ([fe80::c88e:73c1:db37:5b94]) by PH0PR05MB8702.namprd05.prod.outlook.com ([fe80::c88e:73c1:db37:5b94%6]) with mapi id 15.20.4457.005; Fri, 20 Aug 2021 20:16:44 +0000 From: "Andrei Warkentin" To: Jeremy Linton , "devel@edk2.groups.io" CC: "pete@akeo.ie" , "ardb+tianocore@kernel.org" , "Sunny.Wang@arm.com" , "samer.el-haj-mahmoud@arm.com" Subject: Re: [PATCH v3 5/7] Silicon/Broadcom/Bcm27xx: Move linkup check into the cfg accessor Thread-Topic: [PATCH v3 5/7] Silicon/Broadcom/Bcm27xx: Move linkup check into the cfg accessor Thread-Index: AQHXlXolE34t5U3wjUyBobfCe4glcat81Z8u Date: Fri, 20 Aug 2021 20:16:44 +0000 Message-ID: References: <20210820041619.87248-1-jeremy.linton@arm.com> <20210820041619.87248-6-jeremy.linton@arm.com> In-Reply-To: <20210820041619.87248-6-jeremy.linton@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=vmware.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8796c4ee-f411-4dcc-79ca-08d964176e50 x-ms-traffictypediagnostic: PH0PR05MB8749: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: JgaCPgYghYHajwzMAYra0s2Obdg6lX0nBUlUwP1UbLMc0SQ5YHtLRFLic/cq+oCJHwyQuDT23z5XxBA/02lpyVdR2Jpsa8DOC/xzSfK8Odc8ckHsrwdyA3Jo+s0MkM9kTp1wHKMvLu25KL5ipqz+4lyFV3MLbzZjZ8IXft/DVYQM72Blu1GXRtOcsESyt6qS7aOsFPOvlJ1tPLBulQhJvlPn/J5SH+V7YM/Q0Yr6+QIp2gCAm+wRCVEUlow86JKHQNUJ4W9bJLP5d5y8vWodkq7mXy5jqIGJ8wOIg/Xjejc7mrRrbAzEjg/D5siAw1aasjydtfnvUTkcnqr9NoqyhJslzSWNGCh4+yAdLQC5yyrWMeEEjD+AVQHVtepB9J8r96xc+MndN0bpFdPtoU+QD2dnJ3HmoiuHbUSF7ORZnx8L+t3VyJOPI31gZOtOs5UUduqdoHqZtKhZ3LBVJu61+Fc8yZEpE/XftqLIvlRFWx9vwBhdy7dZDgB6Dl1VVrnXacFFrz2b1Cf6Vh3Wft662JfLurNaKJk1wJ6rQG3ZW/dlVHEVVyjBYLNbQGOKJ6ypJGvuIEBdi+gZFJgnyhbD7j/jV22IEZHMsMoMC37HR2MUoEHC8o9Tw9N/c+boNy/uOnPE/qr6pdblJ2dkHSZBuCE82jrg33k3r4r7fKuIv4iAmQX/m+w4Bhj7vTy526c8khkLFHeHzxwOw1qkQSP6jg== 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)(366004)(55016002)(91956017)(66556008)(8676002)(4326008)(83380400001)(38070700005)(38100700002)(498600001)(76116006)(64756008)(66476007)(86362001)(66446008)(19627405001)(33656002)(7696005)(122000001)(6506007)(52536014)(53546011)(186003)(71200400001)(26005)(8936002)(110136005)(5660300002)(54906003)(9686003)(19627235002)(66946007)(2906002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ASZyh2HVeiiTy1DYUh7zgs1pxZaAm8RugS75LL2o0Zyx0lA5YiVcARB8VxmU?= =?us-ascii?Q?JgzIMirQOTfaXwzvNYO+eLku6IQRc4DDrJe3iz8UvSWWL0hOmXADbm32WlFF?= =?us-ascii?Q?8jmNtX36kpZlSOYltkWBV6Xwj9Xuf7uUZhi+rv+bnHuCJsPyweRiTpGwI6CO?= =?us-ascii?Q?TPKo7kZJBQ0r2ahX7Ne86ZOKuEObI6sNu0iL1jWnWD4S/aeW4HQd80gfgp0V?= =?us-ascii?Q?ys5qVBiBgmnqYZI+lBgr0Fs5Qj7c7Dsdv4pzS5CnhzBJ6ydxEEzG4n6AZ/RX?= =?us-ascii?Q?vbJAtbO0OVCHNwtAr1roXU1dBIQ6iyngM68XiOUWWw6WEdR/FVsuPVfaPlLN?= =?us-ascii?Q?ceMz5FtOjb0h1rHkglx9TOnZtzm62QHIyQzK8Izy2Qxckr3indj7umfq4Ie/?= =?us-ascii?Q?xphREb+pQyZFvNdQf/bEYDoJ2b0I5BMM4JgRyFbrByAarHuSu+7AIKWbUCaP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sVdw?= 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: 8796c4ee-f411-4dcc-79ca-08d964176e50 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Aug 2021 20:16:44.6682 (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: GIm0PmgvUnDmG3Iqt9eK+BquiSfxay05gwnKVu/hLgFCGWh0cEtjOOGkei2/608ivq5iQe0onkX1G7tcq1UZQQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR05MB8749 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_PH0PR05MB87027DB6D0AA6EDA562B46E6B9C19PH0PR05MB8702namp_" --_000_PH0PR05MB87027DB6D0AA6EDA562B46E6B9C19PH0PR05MB8702namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Andrei Warkentin ________________________________ From: Jeremy Linton Sent: Thursday, August 19, 2021 11:16 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 Subject: [PATCH v3 5/7] Silicon/Broadcom/Bcm27xx: Move linkup check into th= e cfg accessor The existing code fails to create/finish configuring the pcie subsystem if it fails to get a linkup. This is reasonable on the RPi4 because it generally won't happen, and the OS could not see the root port. Now that the OS can see the root port, its a bit odd if it only shows up when something is plugged into the first slot. Lets move the link up check into the config accessor where it will be used to restrict sending CFG TLP's out the port when nothing is plugged in. Thus avoiding a SERROR during probe. Signed-off-by: Jeremy Linton --- .../Bcm2711PciHostBridgeLib/Bcm2711PciHostBridgeLibConstructor.c | 5 ---= -- .../Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c | 7 +++= ++++ 2 files changed, 7 insertions(+), 5 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 6d15e82fa2..b627e5730b 100644 --- a/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c +++ b/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c @@ -105,6 +105,13 @@ PciSegmentLibGetConfigBase ( 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; } -- 2.13.7 --_000_PH0PR05MB87027DB6D0AA6EDA562B46E6B9C19PH0PR05MB8702namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>

From: Jeremy Linton <jer= emy.linton@arm.com>
Sent: Thursday, August 19, 2021 11:16 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>
Subject: [PATCH v3 5/7] Silicon/Broadcom/Bcm27xx: Move linkup check = into the cfg accessor
 
The existing code fails to create/finish configuri= ng the
pcie subsystem if it fails to get a linkup. This is reasonable
on the RPi4 because it generally won't happen, and the OS
could not see the root port. Now that the OS can see the
root port, its a bit odd if it only shows up when
something is plugged into the first slot. Lets move the
link up check into the config accessor where it will be used
to restrict sending CFG TLP's out the port when nothing is
plugged in. Thus avoiding a SERROR during probe.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
 .../Bcm2711PciHostBridgeLib/Bcm2711PciHostBridgeLibConstructor.c = ;  | 5 -----
 .../Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c&nbs= p; | 7 +++++++
 2 files changed, 7 insertions(+), 5 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 6d15e82fa2..b627e5730b 100644
--- a/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c=
+++ b/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c=
@@ -105,6 +105,13 @@ PciSegmentLibGetConfigBase (
           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_INDEX, Address);
       mPciSegmentLastAccess =3D Address;
     }
--
2.13.7

--_000_PH0PR05MB87027DB6D0AA6EDA562B46E6B9C19PH0PR05MB8702namp_--