]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
MdeModulePkg: Fix typos in comments and variables
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / PciBusDxe / PciEnumerator.c
index bd1e6804661c9387994a3a406c9c16d349daa8da..d31144739fc9a2c309d83b26f7ff3ea20a52bb52 100644 (file)
@@ -1,7 +1,8 @@
 /** @file\r
   PCI eunmeration implementation on entire PCI bus system for PCI Bus module.\r
 \r
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 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
@@ -29,7 +30,6 @@ PciEnumerator (
   IN EFI_HANDLE                    Controller\r
   )\r
 {\r
-  EFI_HANDLE                                        Handle;\r
   EFI_HANDLE                                        HostBridgeHandle;\r
   EFI_STATUS                                        Status;\r
   EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL  *PciResAlloc;\r
@@ -82,7 +82,11 @@ PciEnumerator (
   //\r
   // Notify the pci bus enumeration is about to begin\r
   //\r
-  NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginEnumeration);\r
+  Status = NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginEnumeration);\r
+\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
 \r
   //\r
   // Start the bus allocation phase\r
@@ -105,7 +109,11 @@ PciEnumerator (
   //\r
   // Notify the pci bus enumeration is about to complete\r
   //\r
-  NotifyPhase (PciResAlloc, EfiPciHostBridgeEndEnumeration);\r
+  Status = NotifyPhase (PciResAlloc, EfiPciHostBridgeEndEnumeration);\r
+\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
 \r
   //\r
   // Process P2C\r
@@ -126,9 +134,8 @@ PciEnumerator (
 \r
   gFullEnumeration = FALSE;\r
 \r
-  Handle = NULL;\r
   Status = gBS->InstallProtocolInterface (\r
-                  &Handle,\r
+                  &HostBridgeHandle,\r
                   &gEfiPciEnumerationCompleteProtocolGuid,\r
                   EFI_NATIVE_INTERFACE,\r
                   NULL\r
@@ -401,6 +408,13 @@ PciAssignBusNumber (
                 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
           (IS_PCI_BRIDGE (&Pci) || IS_CARDBUS_BRIDGE (&Pci))) {\r
 \r
@@ -948,7 +962,7 @@ GetMaxResourceConsumerDevice (
   @param Mem64ResStatus   Status of 64-bit memory resource node.\r
   @param PMem64ResStatus  Status of 64-bit Prefetchable memory resource node.\r
 \r
-  @retval EFI_SUCCESS     Successfully adjusted resoruce on host bridge.\r
+  @retval EFI_SUCCESS     Successfully adjusted resource on host bridge.\r
   @retval EFI_ABORTED     Host bridge hasn't this resource type or no resource be adjusted.\r
 \r
 **/\r
@@ -1077,7 +1091,7 @@ PciHostBridgeAdjustAllocation (
 }\r
 \r
 /**\r
-  Summary requests for all resource type, and contruct ACPI resource\r
+  Summary requests for all resource type, and construct ACPI resource\r
   requestor instance.\r
 \r
   @param Bridge           detecting bridge\r
@@ -1089,7 +1103,7 @@ PciHostBridgeAdjustAllocation (
   @param Config           Output buffer holding new constructed APCI resource requestor\r
 \r
   @retval EFI_SUCCESS           Successfully constructed ACPI resource.\r
-  @retval EFI_OUT_OF_RESOURCES  No memory availabe.\r
+  @retval EFI_OUT_OF_RESOURCES  No memory available.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1293,15 +1307,12 @@ ConstructAcpiResourceRequestor (
     //\r
     // If there is no resource request\r
     //\r
-    Configuration = AllocateZeroPool (sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR));\r
+    Configuration = AllocateZeroPool (sizeof (EFI_ACPI_END_TAG_DESCRIPTOR));\r
     if (Configuration == NULL) {\r
       return EFI_OUT_OF_RESOURCES;\r
     }\r
 \r
-    Ptr               = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) (Configuration);\r
-    Ptr->Desc         = ACPI_ADDRESS_SPACE_DESCRIPTOR;\r
-\r
-    PtrEnd            = (EFI_ACPI_END_TAG_DESCRIPTOR *) (Ptr + 1);\r
+    PtrEnd            = (EFI_ACPI_END_TAG_DESCRIPTOR *) (Configuration);\r
     PtrEnd->Desc      = ACPI_END_TAG_DESCRIPTOR;\r
     PtrEnd->Checksum  = 0;\r
   }\r