From c28306c3d6e0c7721abc937d8f47c3f1ccecf323 Mon Sep 17 00:00:00 2001 From: "Ma, Maurice" Date: Tue, 17 May 2016 05:26:06 +0800 Subject: MdeModulePkg: Skip invalid bus number scanning in PciBusDxe driver When PcdPciDisableBusEnumeration is enabled, the PciBus driver might get into a dead loop if the secondary bus register on PCI bridge is not programmed or programmed improperly. Adding this check to avoid any potential dead loop caused by this. Cc: Feng Tian Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Maurice Ma Reviewed-by: Ruiyu Ni Reviewed-by: Lee Leahy --- MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c index a6ade26e3a..086c481130 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c @@ -164,6 +164,14 @@ PciPciDeviceInfoCollector ( return Status; } + // + // Ensure secondary bus number is greater than the primary bus number to avoid + // any potential dead loop when PcdPciDisableBusEnumeration is set to TRUE + // + if (SecBus <= StartBusNumber) { + break; + } + // // Get resource padding for PPB // -- cgit v1.2.3