It abstracts some functions that can be different\r
between light PCI bus driver and full PCI bus driver\r
\r
-Copyright (c) 2006, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+Copyright (c) 2006 - 2008, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
**/\r
\r
//\r
// Add feature to support customized secondary bus number\r
//\r
- if (*SubBusNumber == 0) { \r
+ if (*SubBusNumber == 0) {\r
*SubBusNumber = *PaddedBusRange;\r
*PaddedBusRange = 0;\r
}\r
}\r
\r
DEBUG((EFI_D_ERROR, "Found DEV(%02d,%02d,%02d)\n", StartBusNumber, Device, Func ));\r
- \r
+\r
//\r
// Get the PCI device information\r
//\r
//\r
// Add feature to support customized secondary bus number\r
//\r
- if (*SubBusNumber == 0) { \r
+ if (*SubBusNumber == 0) {\r
*SubBusNumber = *PaddedBusRange;\r
*PaddedBusRange = 0;\r
}\r
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;\r
UINT16 MinBus;\r
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;\r
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *pConfiguration;\r
+ UINT8 StartBusNumber;\r
+ LIST_ENTRY RootBridgeList;\r
+ LIST_ENTRY *Link;\r
\r
InitializeHotPlugSupport ();\r
\r
+ InitializeListHead (&RootBridgeList);\r
+\r
//\r
// Notify the bus allocation phase is about to start\r
//\r
RootBridgeDev\r
);\r
\r
- DestroyRootBridge (RootBridgeDev);\r
+ if (gPciHotPlugInit != NULL) {\r
+ InsertTailList (&RootBridgeList, &(RootBridgeDev->Link));\r
+ } else {\r
+ DestroyRootBridge (RootBridgeDev);\r
+ }\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
\r
if (gPciHotPlugInit != NULL) {\r
//\r
- // Wait for all HPC initialized\r
+ // Reset all assigned PCI bus number in all PPB\r
+ //\r
+ RootBridgeHandle = NULL;\r
+ Link = GetFirstNode (&RootBridgeList);\r
+ while ((PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) &&\r
+ (!IsNull (&RootBridgeList, Link))) {\r
+ RootBridgeDev = PCI_IO_DEVICE_FROM_LINK (Link);\r
+ //\r
+ // Get the Bus information\r
+ //\r
+ Status = PciResAlloc->StartBusEnumeration (\r
+ PciResAlloc,\r
+ RootBridgeHandle,\r
+ (VOID **) &pConfiguration\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ //\r
+ // Get the bus number to start with\r
+ //\r
+ StartBusNumber = (UINT8) (pConfiguration->AddrRangeMin);\r
+\r
+ ResetAllPpbBusNumber (\r
+ RootBridgeDev,\r
+ StartBusNumber\r
+ );\r
+\r
+ gBS->FreePool (pConfiguration);\r
+ Link = GetNextNode (&RootBridgeList, Link);\r
+ DestroyRootBridge (RootBridgeDev);\r
+ }\r
+\r
//\r
+ // Wait for all HPC initialized\r
+ //\r
Status = AllRootHPCInitialized (STALL_1_SECOND * 15);\r
\r
if (EFI_ERROR (Status)) {\r
//\r
NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginBusAllocation);\r
\r
- DEBUG((EFI_D_ERROR, "PCI Bus Second Scanning\n")); \r
+ DEBUG((EFI_D_ERROR, "PCI Bus Second Scanning\n"));\r
RootBridgeHandle = NULL;\r
while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {\r
\r