public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH V2] MdeModulePkg/PciBusDxe: Enumerator to check for RCiEP before looking for RP
@ 2021-09-20 16:20 Bassa, Damian
  2021-11-03 10:50 ` damian.bassa
  2021-12-22  5:28 ` Ni, Ray
  0 siblings, 2 replies; 3+ messages in thread
From: Bassa, Damian @ 2021-09-20 16:20 UTC (permalink / raw)
  To: devel@edk2.groups.io; +Cc: Ni, Ray, Wu, Hao A, Kolakowski, Jacek

[-- Attachment #1: Type: text/plain, Size: 2492 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.

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

Change-Id: Ib782a9d73daab9164d4189a50e06273660400695
---
.../Bus/Pci/PciBusDxe/PciEnumeratorSupport.c  | 26 ++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
index db1b35f8ef..687d055f49 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
@@ -2128,6 +2128,27 @@ AuthenticatePciDevice (
   return EFI_SUCCESS;
}
+/**
+  Checks if PCI device is Root Bridge
+
+  @param Bridge            Instance of PCI device
+
+  @retval TRUE             Device is Root Bridge
+  @return FALSE            Device is not Root Bridge
+
+**/
+BOOLEAN
+IsRootBridge (
+  IN PCI_IO_DEVICE                    *PciIoDevice
+  )
+{
+  if (PciIoDevice->Parent == NULL) {
+    return TRUE;
+  } else {
+    return FALSE;
+  }
+}
+
/**
   Create and initialize general PCI I/O device instance for
   PCI device/bridge device/hotplug bridge device.
@@ -2229,7 +2250,10 @@ CreatePciIoDevice (
     return NULL;
   }
-  if (PcdGetBool (PcdAriSupport)) {
+  //
+  // Check if device's parent is not Root Bridge
+  //
+  if (PcdGetBool (PcdAriSupport) && !IsRootBridge(Bridge)) {
     //
     // Check if the device is an ARI device.
     //
--
---------------------------------------------------------------------
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: 7441 bytes --]

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

* Re: [PATCH V2] MdeModulePkg/PciBusDxe: Enumerator to check for RCiEP before looking for RP
  2021-09-20 16:20 [PATCH V2] MdeModulePkg/PciBusDxe: Enumerator to check for RCiEP before looking for RP Bassa, Damian
@ 2021-11-03 10:50 ` damian.bassa
  2021-12-22  5:28 ` Ni, Ray
  1 sibling, 0 replies; 3+ messages in thread
From: damian.bassa @ 2021-11-03 10:50 UTC (permalink / raw)
  To: devel@edk2.groups.io, Ni, Ray, Wu, Hao A; +Cc: Kolakowski, Jacek

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

Hi,
Any update on this topic?

Damian

From: Bassa, Damian
Sent: Monday, September 20, 2021 6:21 PM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Kolakowski, Jacek <Jacek.Kolakowski@intel.com>
Subject: [PATCH V2] MdeModulePkg/PciBusDxe: Enumerator to check for RCiEP before looking for RP

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.

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

Change-Id: Ib782a9d73daab9164d4189a50e06273660400695
---
.../Bus/Pci/PciBusDxe/PciEnumeratorSupport.c  | 26 ++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
index db1b35f8ef..687d055f49 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
@@ -2128,6 +2128,27 @@ AuthenticatePciDevice (
   return EFI_SUCCESS;
}

+/**
+  Checks if PCI device is Root Bridge
+
+  @param Bridge            Instance of PCI device
+
+  @retval TRUE             Device is Root Bridge
+  @return FALSE            Device is not Root Bridge
+
+**/
+BOOLEAN
+IsRootBridge (
+  IN PCI_IO_DEVICE                    *PciIoDevice
+  )
+{
+  if (PciIoDevice->Parent == NULL) {
+    return TRUE;
+  } else {
+    return FALSE;
+  }
+}
+
/**
   Create and initialize general PCI I/O device instance for
   PCI device/bridge device/hotplug bridge device.
@@ -2229,7 +2250,10 @@ CreatePciIoDevice (
     return NULL;
   }

-  if (PcdGetBool (PcdAriSupport)) {
+  //
+  // Check if device's parent is not Root Bridge
+  //
+  if (PcdGetBool (PcdAriSupport) && !IsRootBridge(Bridge)) {
     //
     // Check if the device is an ARI device.
     //
--
---------------------------------------------------------------------
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: 8226 bytes --]

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

* Re: [PATCH V2] MdeModulePkg/PciBusDxe: Enumerator to check for RCiEP before looking for RP
  2021-09-20 16:20 [PATCH V2] MdeModulePkg/PciBusDxe: Enumerator to check for RCiEP before looking for RP Bassa, Damian
  2021-11-03 10:50 ` damian.bassa
@ 2021-12-22  5:28 ` Ni, Ray
  1 sibling, 0 replies; 3+ messages in thread
From: Ni, Ray @ 2021-12-22  5:28 UTC (permalink / raw)
  To: Bassa, Damian, devel@edk2.groups.io; +Cc: Wu, Hao A, Kolakowski, Jacek

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

Reviewed-by: Ray Ni <ray.ni@intel.com>

From: Bassa, Damian <damian.bassa@intel.com>
Sent: Tuesday, September 21, 2021 12:21 AM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Kolakowski, Jacek <Jacek.Kolakowski@intel.com>
Subject: [PATCH V2] MdeModulePkg/PciBusDxe: Enumerator to check for RCiEP before looking for RP

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.

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

Change-Id: Ib782a9d73daab9164d4189a50e06273660400695
---
.../Bus/Pci/PciBusDxe/PciEnumeratorSupport.c  | 26 ++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
index db1b35f8ef..687d055f49 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
@@ -2128,6 +2128,27 @@ AuthenticatePciDevice (
   return EFI_SUCCESS;
}

+/**
+  Checks if PCI device is Root Bridge
+
+  @param Bridge            Instance of PCI device
+
+  @retval TRUE             Device is Root Bridge
+  @return FALSE            Device is not Root Bridge
+
+**/
+BOOLEAN
+IsRootBridge (
+  IN PCI_IO_DEVICE                    *PciIoDevice
+  )
+{
+  if (PciIoDevice->Parent == NULL) {
+    return TRUE;
+  } else {
+    return FALSE;
+  }
+}
+
/**
   Create and initialize general PCI I/O device instance for
   PCI device/bridge device/hotplug bridge device.
@@ -2229,7 +2250,10 @@ CreatePciIoDevice (
     return NULL;
   }

-  if (PcdGetBool (PcdAriSupport)) {
+  //
+  // Check if device's parent is not Root Bridge
+  //
+  if (PcdGetBool (PcdAriSupport) && !IsRootBridge(Bridge)) {
     //
     // Check if the device is an ARI device.
     //
--

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

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

end of thread, other threads:[~2021-12-22  5:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-20 16:20 [PATCH V2] MdeModulePkg/PciBusDxe: Enumerator to check for RCiEP before looking for RP Bassa, Damian
2021-11-03 10:50 ` damian.bassa
2021-12-22  5:28 ` Ni, Ray

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