public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg/PciBusDxe: Enumerator to check for RCiEP before looking for RP
@ 2021-08-24 15:15 Bassa, Damian
  2021-08-31  4:24 ` Wu, Hao A
  0 siblings, 1 reply; 10+ messages in thread
From: Bassa, Damian @ 2021-08-24 15:15 UTC (permalink / raw)
  To: devel@edk2.groups.io

[-- 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 --]

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-09-20 16:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-24 15:15 [PATCH] MdeModulePkg/PciBusDxe: Enumerator to check for RCiEP before looking for RP Bassa, Damian
2021-08-31  4:24 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox