Skip to content

MdeModulePkg: Enable PciBus to handle CRS responses by ignoring the device. #11012

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,30 @@ PciDevicePresent (
Pci
);

if (!EFI_ERROR (Status) && ((Pci->Hdr).VendorId != 0xffff)) {
//
// Read the entire config header for the device
//
Status = PciRootBridgeIo->Pci.Read (
PciRootBridgeIo,
EfiPciWidthUint32,
Address,
sizeof (PCI_TYPE00) / sizeof (UINT32),
Pci
);
//
// The host bridge may be programmed to accept Configuration Retry Status (CRS). If the PCI device
// is slow, and CRS is enabled, the VendorId may read as 0x0001 when not ready.
// This behavior is defined in PCI spec that VendorId is 0x0001.
// PCI EXPRESS BASE SPECIFICATION, REV. 3.1 section 2.3.1.
// Skip the device, as all the other data read will be invalid.
//
if (!EFI_ERROR (Status)) {
if (((Pci->Hdr).VendorId != 0xffff) && ((Pci->Hdr).VendorId != 0x0001)) {
//
// Read the entire config header for the device
//
Status = PciRootBridgeIo->Pci.Read (
PciRootBridgeIo,
EfiPciWidthUint32,
Address,
sizeof (PCI_TYPE00) / sizeof (UINT32),
Pci
);

return EFI_SUCCESS;
return EFI_SUCCESS;
} else if ((Pci->Hdr).VendorId == 0x0001) {
DEBUG ((DEBUG_WARN, "CRS response detected. Devices that return a CRS response during enumeration are currently ignored\n"));
}
}

return EFI_NOT_FOUND;
Expand Down
Loading