]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
The PCI HotPlug Init Protocol returns a list of Root HPC, but it is possible that...
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / PciBusDxe / PciLib.c
index 548b8a2298205e328619ad968b61fb6609240887..eee251ac71a2677857209718d82ab35c98c26d54 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Internal library implementation for PCI Bus module.\r
 \r
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<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
@@ -738,50 +738,43 @@ PciScanBus (
                 );\r
 \r
       if (EFI_ERROR (Status)) {\r
-        if (Func == 0) {\r
-          //\r
-          // Skip sub functions, this is not a multi function device\r
-          //\r
-          Func = PCI_MAX_FUNC;\r
-        }\r
-\r
         continue;\r
       }\r
 \r
       DEBUG((EFI_D_INFO, "Found DEV(%02d,%02d,%02d)\n", StartBusNumber, Device, Func ));\r
 \r
-      if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {\r
-        //\r
-        // Get the PCI device information\r
-        //\r
-        Status = PciSearchDevice (\r
-                  Bridge,\r
-                  &Pci,\r
-                  StartBusNumber,\r
-                  Device,\r
-                  Func,\r
-                  &PciDevice\r
-                  );\r
+      //\r
+      // Get the PCI device information\r
+      //\r
+      Status = PciSearchDevice (\r
+                Bridge,\r
+                &Pci,\r
+                StartBusNumber,\r
+                Device,\r
+                Func,\r
+                &PciDevice\r
+                );\r
 \r
-        ASSERT (!EFI_ERROR (Status));\r
+      ASSERT (!EFI_ERROR (Status));\r
 \r
-        PciAddress = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0);\r
+      PciAddress = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0);\r
 \r
-        if (!IS_PCI_BRIDGE (&Pci)) {\r
-          //\r
-          // PCI bridges will be called later\r
-          // Here just need for PCI device or PCI to cardbus controller\r
-          // EfiPciBeforeChildBusEnumeration for PCI Device Node\r
-          //\r
-          PreprocessController (\r
-              PciDevice,\r
-              PciDevice->BusNumber,\r
-              PciDevice->DeviceNumber,\r
-              PciDevice->FunctionNumber,\r
-              EfiPciBeforeChildBusEnumeration\r
-              );\r
-        }\r
+      if (!IS_PCI_BRIDGE (&Pci)) {\r
+        //\r
+        // PCI bridges will be called later\r
+        // Here just need for PCI device or PCI to cardbus controller\r
+        // EfiPciBeforeChildBusEnumeration for PCI Device Node\r
+        //\r
+        PreprocessController (\r
+            PciDevice,\r
+            PciDevice->BusNumber,\r
+            PciDevice->DeviceNumber,\r
+            PciDevice->FunctionNumber,\r
+            EfiPciBeforeChildBusEnumeration\r
+            );\r
+      }\r
 \r
+      if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {\r
         //\r
         // For Pci Hotplug controller devcie only\r
         //\r
@@ -790,6 +783,7 @@ PciScanBus (
           // Check if it is a Hotplug PCI controller\r
           //\r
           if (IsRootPciHotPlugController (PciDevice->DevicePath, &HpIndex)) {\r
+            gPciRootHpcData[HpIndex].Found = TRUE;\r
 \r
             if (!gPciRootHpcData[HpIndex].Initialized) {\r
 \r
@@ -976,18 +970,9 @@ PciScanBus (
       } else  {\r
         //\r
         // It is device. Check PCI IOV for Bus reservation\r
-        //\r
-        if (PciDevice == NULL) {\r
-          //\r
-          // No PciDevice found, conitue Scan\r
-          //\r
-          continue;\r
-        }\r
-        //\r
         // Go through each function, just reserve the MAX ReservedBusNum for one device\r
         //\r
-        if ((PciDevice->AriCapabilityOffset != 0) && ((FeaturePcdGet(PcdSrIovSupport)& EFI_PCI_IOV_POLICY_SRIOV) != 0)) {\r
-\r
+        if (PcdGetBool (PcdSrIovSupport) && PciDevice->SrIovCapabilityOffset != 0) {\r
           if (TempReservedBusNum < PciDevice->ReservedBusNum) {\r
 \r
             (*SubBusNumber) = (UINT8)((*SubBusNumber) + PciDevice->ReservedBusNum - TempReservedBusNum);\r
@@ -1241,7 +1226,7 @@ PciHostBridgeEnumerator (
       );\r
 \r
       FreePool (Configuration);\r
-      Link = GetNextNode (&RootBridgeList, Link);\r
+      Link = RemoveEntryList (Link);\r
       DestroyRootBridge (RootBridgeDev);\r
     }\r
 \r
@@ -1251,6 +1236,7 @@ PciHostBridgeEnumerator (
     Status = AllRootHPCInitialized (STALL_1_SECOND * 15);\r
 \r
     if (EFI_ERROR (Status)) {\r
+      DEBUG ((EFI_D_ERROR, "Some root HPC failed to initialize\n"));\r
       return Status;\r
     }\r
 \r