]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/PciBusNoEnumerationDxe/PciEnumeratorSupport.c
StandaloneMmPkg: MM driver entry point library.
[mirror_edk2.git] / DuetPkg / PciBusNoEnumerationDxe / PciEnumeratorSupport.c
index 6f3979a9c26141d4b6cce281a70499c19378e8f9..ca300cf675f70d01163f2f0ba07fdd99767ecd55 100644 (file)
@@ -1,6 +1,7 @@
 /*++\r
 \r
-Copyright (c) 2005 - 2012, 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
@@ -196,8 +197,9 @@ Returns:
   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
@@ -215,6 +217,13 @@ Returns:
                 (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
@@ -248,13 +257,14 @@ Returns:
           }\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