summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorMa, Maurice <maurice.ma@intel.com>2016-05-17 05:26:06 +0800
committerFeng Tian <feng.tian@intel.com>2016-05-18 16:03:30 +0800
commitc28306c3d6e0c7721abc937d8f47c3f1ccecf323 (patch)
tree3eedcc3ad76fa750b379d40a8da1f55e244f1b10 /MdeModulePkg
parent720eea6aa80b48acb05c1adc0f835e849d71da97 (diff)
downloadedk2-c28306c3d6e0c7721abc937d8f47c3f1ccecf323.zip
edk2-c28306c3d6e0c7721abc937d8f47c3f1ccecf323.tar.gz
edk2-c28306c3d6e0c7721abc937d8f47c3f1ccecf323.tar.bz2
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 <feng.tian@intel.com> Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Maurice Ma <maurice.ma@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Lee Leahy <Leroy.p.leahy@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
index a6ade26..086c481 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
@@ -165,6 +165,14 @@ PciPciDeviceInfoCollector (
}
//
+ // 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
//
GetResourcePaddingPpb (PciIoDevice);