From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web10.8.1629818423411610121 for ; Tue, 24 Aug 2021 08:20:24 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=QHQh0bUr; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: damian.bassa@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10086"; a="239482132" X-IronPort-AV: E=Sophos;i="5.84,347,1620716400"; d="scan'208,217";a="239482132" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2021 08:15:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,347,1620716400"; d="scan'208,217";a="685399884" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga005.fm.intel.com with ESMTP; 24 Aug 2021 08:15:25 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Tue, 24 Aug 2021 08:15:19 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Tue, 24 Aug 2021 08:15:18 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Tue, 24 Aug 2021 08:15:17 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.170) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Tue, 24 Aug 2021 08:15:17 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PC/82lC4W7URjPZtXmGg1yA4Rq2FDfne5d/na/xOiuArIm+p+TiHZAQSn0dbdyTN4VR/LPMslZ3SH1YxbLRujBaJZcmwVmctfHjDDOzcUTxmmEFkCJrd1Q0s8xRLteBP8xBbZCV8jPbU8r1fFu0+8Fck90hzcTTmqe3KfsBItKilbVfuh/IjKq1pZz6Xcd+DhXd4XNBNTiQKwq3ttscODEPV9zgbSI1KSAtre0RpjIPH+Uf/ARnMXKKcBAxpf8VIUhS4XHgO9byavg1It++FN61lKKyVd5KtyCgosK/lfRdv4oYFXqZtv+YHcy4pqTyDme0nEYr0DgLTt2/Uv2Z5tw== 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=MrxXs/1c5cWOo1HM3ES+3MSMDoNwJzGmFXkdBkTAE8A=; b=HNqnP2fDcX0nMZHCOYiKyuoTOQ0Rxt1eShiZW0WgcqaK3xEX69Dz85+SFYsIRgEfN7GIQ8QIXv8Ih0iWPUQ6TTju9faane1Djn90JO2S6DD1gHu1s8F3Y5mKT+SlcrD42mMhAJpV7Ouh8xoarjJGiAcE3AYDq/sfu6z99qPuRIj4kPq/vuhTZp0YvXQYTK4aJpr7ll6ZmkCcpR+ba1Nj+Ssgw53vyMWK8VssTGZh1n20/gbJkNNT+vkkciA/W5mwWAirjWMQ7SxQIMGrbmwGtHNEQNhBv/6g1tvYR2eTftTxTB+7wfcizrILpaI9WSqgmKZgjeUc+WzDMc/ZpeK+xQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MrxXs/1c5cWOo1HM3ES+3MSMDoNwJzGmFXkdBkTAE8A=; b=QHQh0bUrn9b5jzjlZGBhGJFK9dmZm6e0690+o5uO+F3KFvmjywChbuVpw/ZDCw/DxWd4u3fpXqIvPklQyUWUo4UFkAjDhlvlw6j57ySyrjT3b/hJr+IUTnnOapDNq6MTywFxxKaphhpGf8i+WbQaYhy1JPpvWcLonLlHMHYucS0= Received: from CO1PR11MB5187.namprd11.prod.outlook.com (2603:10b6:303:95::15) by MW3PR11MB4667.namprd11.prod.outlook.com (2603:10b6:303:53::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Tue, 24 Aug 2021 15:15:16 +0000 Received: from CO1PR11MB5187.namprd11.prod.outlook.com ([fe80::d8dc:bc22:7235:8a44]) by CO1PR11MB5187.namprd11.prod.outlook.com ([fe80::d8dc:bc22:7235:8a44%6]) with mapi id 15.20.4436.024; Tue, 24 Aug 2021 15:15:16 +0000 From: "Bassa, Damian" To: "devel@edk2.groups.io" Subject: [PATCH] MdeModulePkg/PciBusDxe: Enumerator to check for RCiEP before looking for RP Thread-Topic: [PATCH] MdeModulePkg/PciBusDxe: Enumerator to check for RCiEP before looking for RP Thread-Index: AdeY+paMpehWSOTWSAKEuG98y9jpqA== Date: Tue, 24 Aug 2021 15:15:16 +0000 Message-ID: Accept-Language: pl-PL, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ad1f75a8-b9bb-4198-da8f-08d96711faaa x-ms-traffictypediagnostic: MW3PR11MB4667: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2331; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Kp4CSinLj6zx5USbxQx8kyXNiJZ8WhBvp7Qfx07qPchdhU7E9qh/6uaw1vJJU3ngHtG4ZPrMON2CTkoh7KtNb1C8RsBvQ8vvvNE2QqLuyKli7sODkOyzq/xjCyGLIu5hrWWewnCWao8ljaDWsoS13LVg4/Phbe2+gs4QUFPbvvVR6jnewaNrmnlLXx9XSPquMcgw0uFRv7MezYcCgxDqR5vfljlDOvyU5sFGvPs8z8PPXhDQ5oiXFdfwjYw7K9WK4Ndp2PENcDiXsvzB+YpxQEqW79yUZpABQXREm2dgPSBPKlKO7zkSfxeZmYC5OpBMuLw4yENKNRKVod7rssiBuOGaTzeh5BbQB1q2/oAedQNbVbXJ00C1IHGUbGOFHR7BjyZT3lpy1cHR16GUGEnwJLpJq19wIXB1iOF+0pgHsGMQ1/RhduwM3SzrxI4zlyi9IJlrcQXio07NIElN/tkAgDQIhd5g51aEv/nZJWxZ05juNuN9mBsX4GnUHPE00hk6hP8kRt+FWnmjTov0oXiWVOigeotlEeQpMBaG/fL3EZ9LWaJUWIExiMeNLO+uPYqU53eFgbhgWtPlqsRICJv6ZSYbt++7Gq4lGQ7I8SrsQUt3dx9+x0BK8+wqKzPgR0e8Jgyz2ViZQiYBwHsGFN6s5n24eVsy/ny6fw0OfZZpdQRNeaNvgzIak747nNo/fIMLROYwQBg2Qdx6QP4x2yUKew== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR11MB5187.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(396003)(39860400002)(136003)(346002)(366004)(38100700002)(33656002)(7696005)(122000001)(316002)(8936002)(83380400001)(478600001)(38070700005)(2906002)(6916009)(66946007)(66476007)(71200400001)(64756008)(66556008)(8676002)(76116006)(66446008)(186003)(52536014)(86362001)(9686003)(26005)(5660300002)(55016002)(6506007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?EyYOdABCpQKMHemEADMruCGUA8KZh062A4BJiy24kbmcnmMWgYdWlaeWpWEV?= =?us-ascii?Q?sUlWfJI3nkz9MisIlBPQD1U9w9NrUt5p5jSD0RERaawyrSW6M2CjOkByQ20P?= =?us-ascii?Q?7YeXsc+j+q31LX9pciOkLuvNS+lep5rjI2EzQAGh53Ioer7B0kgYHYbC6Ac7?= =?us-ascii?Q?5vWO3erSzEFuJf9SR2Kz3qlKFYANK1w0EtFVIzI1UaxZB6eMyilMujIxqolp?= =?us-ascii?Q?2QQ9XetL7b3mqSp23mhJYiYT3nCv3HldOiecmt5fsaMOITx1JbtryuSNOBYt?= =?us-ascii?Q?/KPB9Wuyl5IJ/MaSsvYyPC53v7kZZy7bPdW5jQ6Cq0hP7SefUe6DLeG1QFcS?= =?us-ascii?Q?uyDeiH5X1Ba112VexXsUH1gVdyFKlWQMUtvlvE136l+Xa0AHEUt8+ItDcGJi?= =?us-ascii?Q?pGIUQbxD5uVNeyEvfQAmRM0ziwEO3v6gcetylOOnBsT6+sqXIaKTzSPL9dRd?= =?us-ascii?Q?32dm6yeAu8w/EwLRqUmq66cR9mSB5WExsEjqdSL5KPKRiDP/by8C2evL6A9k?= =?us-ascii?Q?TR2H578AKLPZO14dANYVx0qN11cr3WlYwWiwEqOX12vwXfK4bvNNTfKnARHP?= =?us-ascii?Q?WAQaypPfioMvetLV2PtCJq6GErmP9H/ha1XTUBJ5HyJd1XrkxUOyOm+/OFBi?= =?us-ascii?Q?8Qjg9AIwqfSTZ1bgxIMPGHR3vp4JjIYG/9/FxTSkCyuyZCCGgMqqO3q5RlP9?= =?us-ascii?Q?FYl/NrdEJroso99EgJA+6xnNzeqnwXH21p48AOTDVEHkMwzt8Fp3hDn1n/K2?= =?us-ascii?Q?ShpMebr/XtuG4gPpEMs5dGzUAvZO9Q3IbOBmcShcK6bpqdXtiS8PbxKfWXHu?= =?us-ascii?Q?9df11GwhTgdhsdgJA+aUT7eBC4wNIjr/8J2nHc8Mb4A/LQyJf9Dz2hX+Rh3W?= =?us-ascii?Q?TmppDPQv/QB7R0lzARIHQtXShLdxIrOz7iT1YvCvhcPugWKogc8pwMSkwL8I?= =?us-ascii?Q?7oCKcY+5q4nJJCXAXYHcZGyE+BvVKY1BTMulScfw3awZ22a7HM3j8UwHgrBs?= =?us-ascii?Q?dod0RkTsgcHeLczgmQD9KM90GaxFSUxzz0minXur/52PNnhjGN+IXyF5Enia?= =?us-ascii?Q?aJnvkiR9qGhlu4o/1vj+rzrx44c+1C742rnp4BOSy+3xlgSGBXwsMYaYmFa9?= =?us-ascii?Q?SaDxeS7/5ORh8ncDHsnebwJHr2vT0Y/zzRouCwDfAhrMMFak5QqFaE0Nnt0X?= =?us-ascii?Q?eOK797fxbTgkh4JxZVQC/DrzDIszIN6Zob8JAvbVAWAcfMgH6TUxK1Zyes3+?= =?us-ascii?Q?VJvzyyc9Pn9VSWazME7QPppqbLCgjGXxMXcMMhDNO6GcNxW3NWR4kcvTgoue?= =?us-ascii?Q?HePoPM8TmCxsbLg4cZbxj7aC?= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB5187.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ad1f75a8-b9bb-4198-da8f-08d96711faaa X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Aug 2021 15:15:16.5887 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: uKkdeQuFZyh7NsvTf2WY7GTYt4cIlTgZRT1PbEk4tS+SG+vxWHiDEObPglrKfupmMmoY4k/b6EHwlsetrQ3Zzg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR11MB4667 Return-Path: damian.bassa@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_CO1PR11MB5187A7CAB74E244971F060498DC59CO1PR11MB5187namp_" --_000_CO1PR11MB5187A7CAB74E244971F060498DC59CO1PR11MB5187namp_ Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Before trying to access parent root port to check ARI capabilities, enumerator should see if Endpoint device is not Root Complex integrated to avoid undefined parent register accesses in these cases. Signed-off-by: Damian Bassa damian.bassa@intel.com --- .../Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeMod= ulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c index db1b35f8ef..6451fb8af9 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c @@ -2153,6 +2153,7 @@ CreatePciIoDevice ( PCI_IO_DEVICE *PciIoDevice; EFI_PCI_IO_PROTOCOL *PciIo; EFI_STATUS Status; + PCI_REG_PCIE_CAPABILITY Capability; PciIoDevice =3D AllocateZeroPool (sizeof (PCI_IO_DEVICE)); if (PciIoDevice =3D=3D NULL) { @@ -2229,7 +2230,16 @@ CreatePciIoDevice ( return NULL; } - if (PcdGetBool (PcdAriSupport)) { + PciIo->Pci.Read ( + PciIo, + EfiPciIoWidthUint16, + PciIoDevice->PciExpressCapabilityOffset + OFFSET_OF (PCI_C= APABILITY_PCIEXP, Capability), + 1, + &Capability.Uint16 + ); + + if (PcdGetBool (PcdAriSupport) && + Capability.Bits.DevicePortType !=3D PCIE_DEVICE_PORT_TYPE_ROOT_COMPLEX= _INTEGRATED_ENDPOINT) { // // Check if the device is an ARI device. // -- 2.27.0.windows.1 --------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydz= ial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-31= 6 | Kapital zakladowy 200.000 PLN. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata= i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wi= adomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiek= olwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the s= ole use of the intended recipient(s). If you are not the intended recipient= , please contact the sender and delete all copies; any review or distributi= on by others is strictly prohibited. --_000_CO1PR11MB5187A7CAB74E244971F060498DC59CO1PR11MB5187namp_ Content-Type: text/html; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable

Before trying to access parent root port to check AR= I capabilities,

enumerator should see if Endpoint device is not Root= Complex integrated

to avoid undefined parent register accesses in these= cases.

 

Signed-off-by: Damian Bassa damian.bassa@intel.com

 

---

.../Bus/Pci/PciBusDxe/PciEnumeratorSupport.c &n= bsp;       | 12 +++++++++++-

1 file changed, 11 insertions(+), 1 deletion(-)=

 

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnume= ratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c=

index db1b35f8ef..6451fb8af9 100644

--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSu= pport.c

+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSu= pport.c

@@ -2153,6 +2153,7 @@ CreatePciIoDevice (=

   PCI_IO_DEVICE    &n= bsp;   *PciIoDevice;

   EFI_PCI_IO_PROTOCOL  *PciIo;<= /o:p>

   EFI_STATUS     &nbs= p;     Status;

+  PCI_REG_PCIE_CAPABILITY Capability;

   PciIoDevice =3D AllocateZeroPool (= sizeof (PCI_IO_DEVICE));

   if (PciIoDevice =3D=3D NULL) {

@@ -2229,7 +2230,16 @@ CreatePciIoDevice (

     return NULL;

   }

-  if (PcdGetBool (PcdAriSupport)) {=

+  PciIo->Pci.Read (

+        &nb= sp;       PciIo,

+        &nb= sp;       EfiPciIoWidthUint16,

+        &nb= sp;       PciIoDevice->PciExpressCapabilit= yOffset + OFFSET_OF (PCI_CAPABILITY_PCIEXP, Capability),

+        &nb= sp;       1,

+        &nb= sp;       &Capability.Uint16

+        &nb= sp;       );

+

+  if (PcdGetBool (PcdAriSupport) &&

+    Capability.Bits.DevicePortType != =3D PCIE_DEVICE_PORT_TYPE_ROOT_COMPLEX_INTEGRATED_ENDPOINT) {

     //

     // Check if the device is a= n ARI device.

     //

--

2.27.0.windows.1

 


Intel = Technology Poland sp. z o.o.
ul. Słowackiego 173 | 80-298 Gdańsk | Sąd Rejonowy G= dańsk Północ | VII Wydział Gospodarczy Krajowego Rejest= ru Sądowego - KRS 101882 | NIP 957-07-52-316 | Kapitał zakła= dowy 200.000 PLN.

Ta wiadomość wraz z załącznikami jest przeznacz= ona dla określonego adresata i może zawierać informacje pouf= ne. W razie przypadkowego otrzymania tej wiadomości, prosimy o powiado= mienie nadawcy oraz trwałe jej usunięcie; jakiekolwiek przegl= 1;danie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material f= or the sole use of the intended recipient(s). If you are not the intended r= ecipient, please contact the sender and delete all copies; any review or di= stribution by others is strictly prohibited.

--_000_CO1PR11MB5187A7CAB74E244971F060498DC59CO1PR11MB5187namp_--