]> 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 432c6f77c36ab62c6be8cff9ed9c8d6a7fea9aee..be316effdc8bc52e19fe5a9d8d6eece3f14b47ba 100644 (file)
@@ -1,13 +1,13 @@
 /**@file\r
 \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
-http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                          \r
-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
+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
+http://opensource.org/licenses/bsd-license.php\r
+\r
+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
 **/\r
 \r
@@ -294,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
@@ -1216,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
@@ -2161,7 +2192,7 @@ Returns:
 }\r
 \r
 EFI_STATUS\r
-ResetAllPpbBusReg (\r
+ResetAllPpbBusNumber (\r
   IN PCI_IO_DEVICE                      *Bridge,\r
   IN UINT8                              StartBusNumber\r
   )\r
@@ -2188,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
@@ -2207,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
@@ -2217,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