/*++\r
\r
-Copyright (c) 2005 - 2009, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR>\r
+(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
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
PCI_IO_DEVICE *PciIoDevice;\r
EFI_PCI_IO_PROTOCOL *PciIo;\r
\r
- Status = EFI_SUCCESS;\r
- SecBus = 0;\r
+ Status = EFI_SUCCESS;\r
+ SecBus = 0;\r
+ PciIoDevice = NULL;\r
\r
for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {\r
\r
(UINT8) Func\r
);\r
\r
+ if (EFI_ERROR (Status) && Func == 0) {\r
+ //\r
+ // go to next device if there is no Function 0\r
+ //\r
+ break;\r
+ }\r
+\r
if (!EFI_ERROR (Status)) {\r
\r
//\r
}\r
\r
//\r
- // Deep enumerate the next level bus\r
+ // If the PCI bridge is initialized then enumerate the next level bus\r
//\r
- Status = PciPciDeviceInfoCollector (\r
- PciIoDevice,\r
- (UINT8) (SecBus)\r
- );\r
-\r
+ if (SecBus != 0) {\r
+ Status = PciPciDeviceInfoCollector (\r
+ PciIoDevice,\r
+ (UINT8) (SecBus)\r
+ );\r
+ }\r
}\r
\r
if (Func == 0 && !IS_PCI_MULTI_FUNC (&Pci)) {\r
--*/\r
{\r
UINT32 Value;\r
- //UINT64 BarValue64;\r
UINT32 OriginalValue;\r
UINT32 Mask;\r
- UINT32 Data;\r
- UINT8 Index;\r
EFI_STATUS Status;\r
\r
OriginalValue = 0;\r
Value = 0;\r
- //BarValue64 = 0;\r
\r
Status = BarExisted (\r
PciIoDevice,\r
//\r
// Fix the length to support some spefic 64 bit BAR\r
//\r
- Data = Value;\r
- Index = 0;\r
- for (Data = Value; Data != 0; Data >>= 1) {\r
- Index ++;\r
- }\r
- Value |= ((UINT32)(-1) << Index); \r
+ Value |= ((UINT32)(-1) << HighBitSet32 (Value)); \r
\r
//\r
// Calculate the size of 64bit bar\r