diff --git a/OvmfPkg/AcpiPlatformDxe/PciDecoding.c b/OvmfPkg/AcpiPlatformDxe/PciDecoding.c index 3b9b12ccc8..d63b57e701 100644 --- a/OvmfPkg/AcpiPlatformDxe/PciDecoding.c +++ b/OvmfPkg/AcpiPlatformDxe/PciDecoding.c @@ -89,6 +89,7 @@ EnablePciDecoding ( for (Idx = 0; Idx < NoHandles; ++Idx) { EFI_PCI_IO_PROTOCOL *PciIo; + UINT64 Attributes; // // Look up PciIo on the handle and stash it @@ -109,12 +110,23 @@ EnablePciDecoding ( goto RestoreAttributes; } + // + // Retrieve supported attributes + // + Status = PciIo->Attributes (PciIo, EfiPciIoAttributeOperationSupported, 0, + &Attributes); + if (EFI_ERROR (Status)) { + DEBUG ((EFI_D_WARN, "%a: EfiPciIoAttributeOperationSupported: %r\n", + __FUNCTION__, Status)); + goto RestoreAttributes; + } + // // Enable IO and MMIO decoding // + Attributes &= EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_MEMORY; Status = PciIo->Attributes (PciIo, EfiPciIoAttributeOperationEnable, - EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_MEMORY, - NULL); + Attributes, NULL); if (EFI_ERROR (Status)) { DEBUG ((EFI_D_WARN, "%a: EfiPciIoAttributeOperationEnable: %r\n", __FUNCTION__, Status));