diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c index f72598d..0fb150c 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c @@ -1824,6 +1824,7 @@ PciIoGetBarAttributes ( PCI_IO_DEVICE *PciIoDevice; EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptor; EFI_ACPI_END_TAG_DESCRIPTOR *End; + BOOLEAN EnablePciEnumeration; PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); @@ -1918,7 +1919,8 @@ PciIoGetBarAttributes ( // // Get the Address Translation Offset // - if (Descriptor->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM) { + EnablePciEnumeration = !PcdGetBool (PcdPciDisableBusEnumeration); + if (Descriptor->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM && EnablePciEnumeration) { Descriptor->AddrTranslationOffset = GetMmioAddressTranslationOffset ( PciIoDevice->PciRootBridgeIo, Descriptor->AddrRangeMin, diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf index ab5d87e..712497d 100644 --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf @@ -53,3 +53,6 @@ [Protocols] [Depex] gEfiCpuIo2ProtocolGuid AND gEfiMetronomeArchProtocolGuid + +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration ## SOMETIMES_CONSUMES diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c index cda9b49..4bac355 100644 --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ +#include #include "PciHostBridge.h" #include "PciRootBridge.h" #include "PciHostResource.h" @@ -1495,6 +1496,7 @@ RootBridgeIoConfiguration ( PCI_RES_NODE *ResAllocNode; EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptor; EFI_ACPI_END_TAG_DESCRIPTOR *End; + BOOLEAN EnablePciEnumeration; // // Get this instance of the Root Bridge. @@ -1505,19 +1507,22 @@ RootBridgeIoConfiguration ( TypeMax * sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR) ); Descriptor = RootBridge->ConfigBuffer; + EnablePciEnumeration = !PcdGetBool (PcdPciDisableBusEnumeration); for (Index = TypeIo; Index < TypeMax; Index++) { ResAllocNode = &RootBridge->ResAllocNode[Index]; - if (ResAllocNode->Status != ResAllocated) { + if (ResAllocNode->Status != ResAllocated && EnablePciEnumeration) { continue; } Descriptor->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR; Descriptor->Len = sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) - 3; - Descriptor->AddrRangeMin = ResAllocNode->Base; - Descriptor->AddrRangeMax = ResAllocNode->Base + ResAllocNode->Length - 1; - Descriptor->AddrLen = ResAllocNode->Length; + if (ResAllocNode->Status == ResAllocated) { + Descriptor->AddrRangeMin = ResAllocNode->Base; + Descriptor->AddrRangeMax = ResAllocNode->Base + ResAllocNode->Length - 1; + Descriptor->AddrLen = ResAllocNode->Length; + } switch (ResAllocNode->Type) { case TypeIo: