diff --git a/DuetPkg/PciBusNoEnumerationDxe/PciCommand.c b/DuetPkg/PciBusNoEnumerationDxe/PciCommand.c index 6d524c1a25..58b482c636 100644 --- a/DuetPkg/PciBusNoEnumerationDxe/PciCommand.c +++ b/DuetPkg/PciBusNoEnumerationDxe/PciCommand.c @@ -433,11 +433,7 @@ Returns: } } - while (CapabilityPtr > 0x3F) { - // - // Mask it to DWORD alignment per PCI spec - // - CapabilityPtr &= 0xFC; + while ((CapabilityPtr >= 0x40) && ((CapabilityPtr & 0x03) == 0x00)) { PciIoDevice->PciIo.Pci.Read ( &PciIoDevice->PciIo, EfiPciIoWidthUint16,