diff options
author | Ruiyu Ni <ruiyu.ni@intel.com> | 2015-11-16 08:20:17 +0000 |
---|---|---|
committer | vanjeff <vanjeff@Edk2> | 2015-11-16 08:20:17 +0000 |
commit | aa498e38bf2f7e86b695587a3487bca830b9bbde (patch) | |
tree | 288f71df32d254aa5bf6cdcabc47dc1187280222 /MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c | |
parent | 595df205dd889bf0a6bc3e92b50aa60d5e83f0c2 (diff) | |
download | edk2-platforms-aa498e38bf2f7e86b695587a3487bca830b9bbde.tar.xz |
MdeModulePkg: Fix a PciBusDxe hot plug bug
For a hot plug bridge with device attached, PciBusDxe driver reserves
the resources which equal to the total amount of padding resource
returned from HotPlug->GetResourcePadding() and the actual occupied
resource by the attached device. The behavior is incorrect.
Correct behavior is to reserve the bigger one between the padding
resource and the actual occupied resource.
(Sync patch r18719 from main trunk.)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@18822 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c')
-rw-r--r-- | MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c index bfb7e5bee9..12647be85f 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c @@ -976,7 +976,8 @@ PciScanBus ( UINT8 Device;
UINT8 Func;
UINT64 Address;
- UINTN SecondBus;
+ UINT8 SecondBus;
+ UINT8 PaddedSubBus;
UINT16 Register;
UINTN HpIndex;
PCI_IO_DEVICE *PciDevice;
@@ -1210,7 +1211,7 @@ PciScanBus ( Status = PciScanBus (
PciDevice,
- (UINT8) (SecondBus),
+ SecondBus,
SubBusNumber,
PaddedBusRange
);
@@ -1226,12 +1227,16 @@ PciScanBus ( if ((Attributes == EfiPaddingPciRootBridge) &&
(State & EFI_HPC_STATE_ENABLED) != 0 &&
(State & EFI_HPC_STATE_INITIALIZED) != 0) {
- *PaddedBusRange = (UINT8) ((UINT8) (BusRange) +*PaddedBusRange);
+ *PaddedBusRange = (UINT8) ((UINT8) (BusRange) + *PaddedBusRange);
} else {
- Status = PciAllocateBusNumber (PciDevice, *SubBusNumber, (UINT8) (BusRange), SubBusNumber);
+ //
+ // Reserve the larger one between the actual occupied bus number and padded bus number
+ //
+ Status = PciAllocateBusNumber (PciDevice, StartBusNumber, (UINT8) (BusRange), &PaddedSubBus);
if (EFI_ERROR (Status)) {
return Status;
}
+ *SubBusNumber = MAX (PaddedSubBus, *SubBusNumber);
}
}
|