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>
Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
Ray Ni 2021-12-29 21:21:09 +08:00 committed by mergify[bot]
parent 7935be0fbd
commit c095122d4b
1 changed files with 25 additions and 1 deletions

View File

@ -2115,6 +2115,27 @@ AuthenticatePciDevice (
return EFI_SUCCESS; return EFI_SUCCESS;
} }
/**
Checks if PCI device is Root Bridge.
@param PciIoDevice Instance of PCI device
@retval TRUE Device is Root Bridge
@retval 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 Create and initialize general PCI I/O device instance for
PCI device/bridge device/hotplug bridge device. PCI device/bridge device/hotplug bridge device.
@ -2217,7 +2238,10 @@ CreatePciIoDevice (
return NULL; 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. // Check if the device is an ARI device.
// //