public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Bassa, Damian" <damian.bassa@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>
Subject: [PATCH] MdeModulePkg/PciBusDxe: Enumerator to check for RCiEP before looking for RP
Date: Tue, 24 Aug 2021 15:15:16 +0000	[thread overview]
Message-ID: <CO1PR11MB5187A7CAB74E244971F060498DC59@CO1PR11MB5187.namprd11.prod.outlook.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2429 bytes --]

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<mailto: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/MdeModulePkg/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 = AllocateZeroPool (sizeof (PCI_IO_DEVICE));
   if (PciIoDevice == NULL) {
@@ -2229,7 +2230,16 @@ CreatePciIoDevice (
     return NULL;
   }
-  if (PcdGetBool (PcdAriSupport)) {
+  PciIo->Pci.Read (
+                PciIo,
+                EfiPciIoWidthUint16,
+                PciIoDevice->PciExpressCapabilityOffset + OFFSET_OF (PCI_CAPABILITY_PCIEXP, Capability),
+                1,
+                &Capability.Uint16
+                );
+
+  if (PcdGetBool (PcdAriSupport) &&
+    Capability.Bits.DevicePortType != 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 Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | 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 wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.

[-- Attachment #2: Type: text/html, Size: 7194 bytes --]

             reply	other threads:[~2021-08-24 15:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24 15:15 Bassa, Damian [this message]
2021-08-31  4:24 ` [PATCH] MdeModulePkg/PciBusDxe: Enumerator to check for RCiEP before looking for RP Wu, Hao A
2021-08-31  4:28   ` [edk2-devel] " Wu, Hao A
2021-08-31 17:44     ` Bassa, Damian
2021-09-08  7:16       ` Wu, Hao A
2021-09-15 11:53         ` Bassa, Damian
2021-09-15 13:21           ` Ni, Ray
2021-09-16 16:02             ` Bassa, Damian
2021-09-17 16:31               ` Ni, Ray
2021-09-20 16:24                 ` Bassa, Damian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CO1PR11MB5187A7CAB74E244971F060498DC59@CO1PR11MB5187.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox