Reviewed-by: Ray Ni <ray...@intel.com> From: Bassa, Damian <damian.ba...@intel.com> Sent: Tuesday, September 21, 2021 12:21 AM To: devel@edk2.groups.io Cc: Ni, Ray <ray...@intel.com>; Wu, Hao A <hao.a...@intel.com>; Kolakowski, Jacek <jacek.kolakow...@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.ba...@intel.com<mailto:damian.ba...@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. // -- -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#85155): https://edk2.groups.io/g/devel/message/85155 Mute This Topic: https://groups.io/mt/85745259/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-