]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
1. Remove USB HC Protocol installing from Uhci module. It only installs USB2 HC protocol.
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Pci / PciBusDxe / PciEnumeratorSupport.c
index 8020ab120f3e38d38ae887206162218b9bf1f0af..be316effdc8bc52e19fe5a9d8d6eece3f14b47ba 100644 (file)
@@ -1,6 +1,6 @@
-/*++\r
+/**@file\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation\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
@@ -9,17 +9,8 @@ http://opensource.org/licenses/bsd-license.php
 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
-  PciEnumeratorSupport.c\r
-\r
-Abstract:\r
-\r
-  PCI Bus Driver\r
+**/\r
 \r
-Revision History\r
-\r
---*/\r
 \r
 #include "pcibus.h"\r
 #include "PciEnumeratorSupport.h"\r
@@ -303,9 +294,7 @@ Returns:
   //\r
   // Update the bar information for this PCI device so as to support some specific device\r
   //\r
-  if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_ACPI_RESOURCE_SUPPORT) {\r
-    UpdatePciInfo (PciIoDevice);\r
-  }\r
+  UpdatePciInfo (PciIoDevice);\r
 \r
   if (PciIoDevice->DevicePath == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
@@ -1225,21 +1214,54 @@ Returns:
   EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr;\r
 \r
   Configuration = NULL;\r
+  Status        = EFI_SUCCESS;\r
 \r
-  //\r
-  // Check whether the device belongs to incompatible devices or not\r
-  // If it is , then get its special requirement in the ACPI table\r
-  //\r
-  PciDeviceInfo.VendorID          = PciIoDevice->Pci.Hdr.VendorId;\r
-  PciDeviceInfo.DeviceID          = PciIoDevice->Pci.Hdr.DeviceId;\r
-  PciDeviceInfo.RevisionID        = PciIoDevice->Pci.Hdr.RevisionID;\r
-  PciDeviceInfo.SubsystemVendorID = PciIoDevice->Pci.Device.SubsystemVendorID;\r
-  PciDeviceInfo.SubsystemID       = PciIoDevice->Pci.Device.SubsystemID;\r
+  if (gEfiIncompatiblePciDeviceSupport == NULL) {\r
+    //\r
+    // It can only be supported after the Incompatible PCI Device\r
+    // Support Protocol has been installed\r
+    //\r
+    Status = gBS->LocateProtocol (\r
+                    &gEfiIncompatiblePciDeviceSupportProtocolGuid,\r
+                    NULL,\r
+                    (VOID **) &gEfiIncompatiblePciDeviceSupport\r
+                    );\r
+  }\r
+  if (Status == EFI_SUCCESS) {\r
+      //\r
+      // Check whether the device belongs to incompatible devices from protocol or not\r
+      // If it is , then get its special requirement in the ACPI table\r
+      //\r
+      Status = gEfiIncompatiblePciDeviceSupport->CheckDevice (\r
+                                                  gEfiIncompatiblePciDeviceSupport,\r
+                                                  PciIoDevice->Pci.Hdr.VendorId,\r
+                                                  PciIoDevice->Pci.Hdr.DeviceId,\r
+                                                  PciIoDevice->Pci.Hdr.RevisionID,\r
+                                                  PciIoDevice->Pci.Device.SubsystemVendorID,\r
+                                                  PciIoDevice->Pci.Device.SubsystemID,\r
+                                                  &Configuration\r
+                                                  );\r
 \r
-  Status = PciResourceUpdateCheck (&PciDeviceInfo, &Configuration);\r
+  }\r
 \r
   if (EFI_ERROR (Status)) {\r
-    return Status;\r
+    //\r
+    // Check whether the device belongs to incompatible devices from library or not\r
+    // If it is , then get its special requirement in the ACPI table\r
+    //\r
+    if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_ACPI_RESOURCE_SUPPORT) {\r
+      PciDeviceInfo.VendorID          = PciIoDevice->Pci.Hdr.VendorId;\r
+      PciDeviceInfo.DeviceID          = PciIoDevice->Pci.Hdr.DeviceId;\r
+      PciDeviceInfo.RevisionID        = PciIoDevice->Pci.Hdr.RevisionID;\r
+      PciDeviceInfo.SubsystemVendorID = PciIoDevice->Pci.Device.SubsystemVendorID;\r
+      PciDeviceInfo.SubsystemID       = PciIoDevice->Pci.Device.SubsystemID;\r
+\r
+      Status = PciResourceUpdateCheck (&PciDeviceInfo, &Configuration);\r
+    }\r
+  }\r
+\r
+  if (EFI_ERROR (Status)) {\r
+    return EFI_UNSUPPORTED;\r
   }\r
 \r
   //\r
@@ -2170,7 +2192,7 @@ Returns:
 }\r
 \r
 EFI_STATUS\r
-ResetAllPpbBusReg (\r
+ResetAllPpbBusNumber (\r
   IN PCI_IO_DEVICE                      *Bridge,\r
   IN UINT8                              StartBusNumber\r
   )\r
@@ -2197,6 +2219,7 @@ Returns:
   UINT32                          Register;\r
   UINT8                           Func;\r
   UINT64                          Address;\r
+  UINT8                           SecondaryBus;\r
   EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;\r
 \r
   PciRootBridgeIo = Bridge->PciRootBridgeIo;\r
@@ -2216,6 +2239,7 @@ Returns:
                 );\r
 \r
       if (!EFI_ERROR (Status) && (IS_PCI_BRIDGE (&Pci))) {\r
+\r
         Register  = 0;\r
         Address   = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x18);\r
         Status   = PciRootBridgeIoRead (\r
@@ -2226,6 +2250,12 @@ Returns:
                                         1,\r
                                         &Register\r
                                         );\r
+        SecondaryBus = (UINT8)(Register >> 8);\r
+\r
+        if (SecondaryBus != 0) {\r
+          ResetAllPpbBusNumber (Bridge, SecondaryBus);\r
+        }\r
+\r
         //\r
         // Reset register 18h, 19h, 1Ah on PCI Bridge\r
         //\r