summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2015-05-27 01:22:13 +0000
committerniruiyu <niruiyu@Edk2>2015-05-27 01:22:13 +0000
commitedf289685b9244d27602addd9ea5d933fade839f (patch)
treeb9da7f4fa23c5359ddcce72d55923804e73d8c20 /MdeModulePkg
parente6557276f0cf3c114dc881be2478cf724b171e39 (diff)
downloadedk2-platforms-edf289685b9244d27602addd9ea5d933fade839f.tar.xz
MdeModulePkg: Fix PciBus hang issue
LocatePciExpressCapabilityRegBlock () doesn't check the return status of Pci.Read(). Certain platform's PciRootBridge.Pci.Read() doesn't support PCIE access causing the CapabilityEntry not updated. If the uninitialized CapabilityEntry equals to a big enough initial value, the while-loop will never end. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Maurice Ma <maurice.ma@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17513 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Bus/Pci/PciBusDxe/PciCommand.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciCommand.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciCommand.c
index 9f3fcce6f7..8a8b4b8fac 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciCommand.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciCommand.c
@@ -1,7 +1,7 @@
/** @file
PCI command register operations supporting functions implementation for PCI Bus module.
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -200,9 +200,10 @@ LocatePciExpressCapabilityRegBlock (
OUT UINT32 *NextRegBlock OPTIONAL
)
{
- UINT32 CapabilityPtr;
- UINT32 CapabilityEntry;
- UINT16 CapabilityID;
+ EFI_STATUS Status;
+ UINT32 CapabilityPtr;
+ UINT32 CapabilityEntry;
+ UINT16 CapabilityID;
//
// To check the capability of this device supports
@@ -222,13 +223,16 @@ LocatePciExpressCapabilityRegBlock (
// Mask it to DWORD alignment per PCI spec
//
CapabilityPtr &= 0xFFC;
- PciIoDevice->PciIo.Pci.Read (
- &PciIoDevice->PciIo,
- EfiPciIoWidthUint32,
- CapabilityPtr,
- 1,
- &CapabilityEntry
- );
+ Status = PciIoDevice->PciIo.Pci.Read (
+ &PciIoDevice->PciIo,
+ EfiPciIoWidthUint32,
+ CapabilityPtr,
+ 1,
+ &CapabilityEntry
+ );
+ if (EFI_ERROR (Status)) {
+ break;
+ }
CapabilityID = (UINT16) CapabilityEntry;