Skip to content

Commit

Permalink
MdeModulePkg/PciBusDxe: Enumerator to check for RCiEP before looking …
Browse files Browse the repository at this point in the history
…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 <[email protected]>
Reviewed-by: Ray Ni <[email protected]>
  • Loading branch information
niruiyu authored and mergify[bot] committed Dec 29, 2021
1 parent 7935be0 commit c095122
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
Original file line number Diff line number Diff line change
Expand Up @@ -2115,6 +2115,27 @@ AuthenticatePciDevice (
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
PCI device/bridge device/hotplug bridge device.
Expand Down Expand Up @@ -2217,7 +2238,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.
//
Expand Down

0 comments on commit c095122

Please sign in to comment.