PCI Bus Driver Enhancement

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3960 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
xli24 2007-09-28 04:40:49 +00:00
parent 73c7e13392
commit ff62de3730
4 changed files with 43 additions and 7 deletions

View File

@ -200,12 +200,21 @@ Returns:
// Get the bus number to start with
//
StartBusNumber = (UINT8) (pConfiguration->AddrRangeMin);
PaddedBusRange = (UINT8) (pConfiguration->AddrRangeMax);
//
// Initialize the subordinate bus number
//
SubBusNumber = StartBusNumber;
//
// Reset all assigned PCI bus number
//
ResetAllPpbBusNumber (
RootBridgeDev,
StartBusNumber
);
//
// Assign bus number
//

View File

@ -2161,7 +2161,7 @@ Returns:
}
EFI_STATUS
ResetAllPpbBusReg (
ResetAllPpbBusNumber (
IN PCI_IO_DEVICE *Bridge,
IN UINT8 StartBusNumber
)
@ -2188,6 +2188,7 @@ Returns:
UINT32 Register;
UINT8 Func;
UINT64 Address;
UINT8 SecondaryBus;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
PciRootBridgeIo = Bridge->PciRootBridgeIo;
@ -2207,6 +2208,7 @@ Returns:
);
if (!EFI_ERROR (Status) && (IS_PCI_BRIDGE (&Pci))) {
Register = 0;
Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x18);
Status = PciRootBridgeIoRead (
@ -2217,6 +2219,12 @@ Returns:
1,
&Register
);
SecondaryBus = (UINT8)(Register >> 8);
if (SecondaryBus != 0) {
ResetAllPpbBusNumber (Bridge, SecondaryBus);
}
//
// Reset register 18h, 19h, 1Ah on PCI Bridge
//

View File

@ -1258,8 +1258,6 @@ Returns:
SecondBus = 0;
Register = 0;
ResetAllPpbBusReg (Bridge, StartBusNumber);
for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {
for (Func = 0; Func <= PCI_MAX_FUNC; Func++) {
@ -1278,6 +1276,8 @@ Returns:
(IS_PCI_BRIDGE (&Pci) ||
IS_CARDBUS_BRIDGE (&Pci))) {
DEBUG((EFI_D_ERROR, "Found DEV(%02d,%02d,%02d)\n", StartBusNumber, Device, Func ));
//
// Get the bridge information
//
@ -1294,6 +1294,14 @@ Returns:
return Status;
}
//
// Add feature to support customized secondary bus number
//
if (*SubBusNumber == 0) {
*SubBusNumber = *PaddedBusRange;
*PaddedBusRange = 0;
}
(*SubBusNumber)++;
SecondBus = (*SubBusNumber);
@ -1350,6 +1358,7 @@ Returns:
EfiPciBeforeChildBusEnumeration
);
DEBUG((EFI_D_ERROR, "Scan PPB(%02d,%02d,%02d)\n", PciDevice->BusNumber, PciDevice->DeviceNumber,PciDevice->FunctionNumber ));
Status = PciScanBus (
PciDevice,
(UINT8) (SecondBus),
@ -1446,8 +1455,6 @@ Returns:
Attributes = (EFI_HPC_PADDING_ATTRIBUTES) 0;
BusRange = 0;
ResetAllPpbBusReg (Bridge, StartBusNumber);
for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {
for (Func = 0; Func <= PCI_MAX_FUNC; Func++) {
@ -1473,6 +1480,8 @@ Returns:
continue;
}
DEBUG((EFI_D_ERROR, "Found DEV(%02d,%02d,%02d)\n", StartBusNumber, Device, Func ));
//
// Get the PCI device information
//
@ -1534,7 +1543,6 @@ Returns:
PciDevice->FunctionNumber,
EfiPciBeforeChildBusEnumeration
);
continue;
}
}
}
@ -1583,6 +1591,14 @@ Returns:
}
}
//
// Add feature to support customized secondary bus number
//
if (*SubBusNumber == 0) {
*SubBusNumber = *PaddedBusRange;
*PaddedBusRange = 0;
}
(*SubBusNumber)++;
SecondBus = *SubBusNumber;
@ -1629,6 +1645,7 @@ Returns:
EfiPciBeforeChildBusEnumeration
);
DEBUG((EFI_D_ERROR, "Scan PPB(%02d,%02d,%02d)\n", PciDevice->BusNumber, PciDevice->DeviceNumber,PciDevice->FunctionNumber ));
Status = PciScanBus (
PciDevice,
(UINT8) (SecondBus),
@ -1851,6 +1868,7 @@ Returns:
//
NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginBusAllocation);
DEBUG((EFI_D_ERROR, "PCI Bus First Scanning\n"));
RootBridgeHandle = NULL;
while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
@ -1901,6 +1919,7 @@ Returns:
//
NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginBusAllocation);
DEBUG((EFI_D_ERROR, "PCI Bus Second Scanning\n"));
RootBridgeHandle = NULL;
while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {

View File

@ -705,7 +705,7 @@ Returns:
;
EFI_STATUS
ResetAllPpbBusReg (
ResetAllPpbBusNumber (
IN PCI_IO_DEVICE *Bridge,
IN UINT8 StartBusNumber
)