-/*++\r
-\r
-Copyright (c) 2006 - 2007, 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
-Module Name:\r
-\r
- PciLib.c\r
-\r
-Abstract:\r
+/**@file\r
\r
PCI Bus Driver Lib file\r
It abstracts some functions that can be different\r
between light PCI bus driver and full PCI bus driver\r
\r
-Revision History\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
\r
---*/\r
+**/\r
\r
#include "pcibus.h"\r
\r
SecondBus = 0;\r
Register = 0;\r
\r
- ResetAllPpbBusReg (Bridge, StartBusNumber);\r
-\r
for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {\r
for (Func = 0; Func <= PCI_MAX_FUNC; Func++) {\r
\r
(IS_PCI_BRIDGE (&Pci) ||\r
IS_CARDBUS_BRIDGE (&Pci))) {\r
\r
+ DEBUG((EFI_D_ERROR, "Found DEV(%02d,%02d,%02d)\n", StartBusNumber, Device, Func ));\r
+\r
//\r
// Get the bridge information\r
//\r
return Status;\r
}\r
\r
+ //\r
+ // Add feature to support customized secondary bus number\r
+ //\r
+ if (*SubBusNumber == 0) { \r
+ *SubBusNumber = *PaddedBusRange;\r
+ *PaddedBusRange = 0;\r
+ }\r
+\r
(*SubBusNumber)++;\r
\r
SecondBus = (*SubBusNumber);\r
EfiPciBeforeChildBusEnumeration\r
);\r
\r
+ DEBUG((EFI_D_ERROR, "Scan PPB(%02d,%02d,%02d)\n", PciDevice->BusNumber, PciDevice->DeviceNumber,PciDevice->FunctionNumber ));\r
Status = PciScanBus (\r
PciDevice,\r
(UINT8) (SecondBus),\r
Attributes = (EFI_HPC_PADDING_ATTRIBUTES) 0;\r
BusRange = 0;\r
\r
- ResetAllPpbBusReg (Bridge, StartBusNumber);\r
-\r
for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {\r
for (Func = 0; Func <= PCI_MAX_FUNC; Func++) {\r
\r
continue;\r
}\r
\r
+ DEBUG((EFI_D_ERROR, "Found DEV(%02d,%02d,%02d)\n", StartBusNumber, Device, Func ));\r
+ \r
//\r
// Get the PCI device information\r
//\r
PciDevice->FunctionNumber,\r
EfiPciBeforeChildBusEnumeration\r
);\r
- continue;\r
}\r
}\r
}\r
}\r
}\r
\r
+ //\r
+ // Add feature to support customized secondary bus number\r
+ //\r
+ if (*SubBusNumber == 0) { \r
+ *SubBusNumber = *PaddedBusRange;\r
+ *PaddedBusRange = 0;\r
+ }\r
+\r
(*SubBusNumber)++;\r
SecondBus = *SubBusNumber;\r
\r
EfiPciBeforeChildBusEnumeration\r
);\r
\r
+ DEBUG((EFI_D_ERROR, "Scan PPB(%02d,%02d,%02d)\n", PciDevice->BusNumber, PciDevice->DeviceNumber,PciDevice->FunctionNumber ));\r
Status = PciScanBus (\r
PciDevice,\r
(UINT8) (SecondBus),\r
//\r
NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginBusAllocation);\r
\r
+ DEBUG((EFI_D_ERROR, "PCI Bus First Scanning\n"));\r
RootBridgeHandle = NULL;\r
while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {\r
\r
//\r
NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginBusAllocation);\r
\r
+ DEBUG((EFI_D_ERROR, "PCI Bus Second Scanning\n")); \r
RootBridgeHandle = NULL;\r
while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {\r
\r
\r
Stride = 1 << AccessWidth;\r
AccessAddress += Stride;\r
- if (AccessAddress >= (Address + (1 << Width))) {\r
+ if (AccessAddress >= (Address + LShiftU64 (1ULL, (UINTN)Width))) {\r
//\r
// if all datas have been read, exist\r
//\r
\r
Stride = 1 << AccessWidth;\r
AccessAddress += Stride;\r
- if (AccessAddress >= (Address + (1 << Width))) {\r
+ if (AccessAddress >= (Address + LShiftU64 (1ULL, (UINTN)Width))) {\r
//\r
// if all datas have been written, exist\r
//\r