X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;ds=sidebyside;f=IntelFrameworkModulePkg%2FBus%2FPci%2FPciBusDxe%2FPciEnumeratorSupport.c;h=be316effdc8bc52e19fe5a9d8d6eece3f14b47ba;hb=ea5632e56d882e39ae60e8de85711298f627b9e5;hp=432c6f77c36ab62c6be8cff9ed9c8d6a7fea9aee;hpb=3db510989eb500296c3f4839c427325a02aea2e3;p=mirror_edk2.git diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c index 432c6f77c3..be316effdc 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c @@ -1,13 +1,13 @@ /**@file -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ @@ -294,9 +294,7 @@ Returns: // // Update the bar information for this PCI device so as to support some specific device // - if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_ACPI_RESOURCE_SUPPORT) { - UpdatePciInfo (PciIoDevice); - } + UpdatePciInfo (PciIoDevice); if (PciIoDevice->DevicePath == NULL) { return EFI_OUT_OF_RESOURCES; @@ -1216,21 +1214,54 @@ Returns: EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr; Configuration = NULL; + Status = EFI_SUCCESS; - // - // Check whether the device belongs to incompatible devices or not - // If it is , then get its special requirement in the ACPI table - // - PciDeviceInfo.VendorID = PciIoDevice->Pci.Hdr.VendorId; - PciDeviceInfo.DeviceID = PciIoDevice->Pci.Hdr.DeviceId; - PciDeviceInfo.RevisionID = PciIoDevice->Pci.Hdr.RevisionID; - PciDeviceInfo.SubsystemVendorID = PciIoDevice->Pci.Device.SubsystemVendorID; - PciDeviceInfo.SubsystemID = PciIoDevice->Pci.Device.SubsystemID; + if (gEfiIncompatiblePciDeviceSupport == NULL) { + // + // It can only be supported after the Incompatible PCI Device + // Support Protocol has been installed + // + Status = gBS->LocateProtocol ( + &gEfiIncompatiblePciDeviceSupportProtocolGuid, + NULL, + (VOID **) &gEfiIncompatiblePciDeviceSupport + ); + } + if (Status == EFI_SUCCESS) { + // + // Check whether the device belongs to incompatible devices from protocol or not + // If it is , then get its special requirement in the ACPI table + // + Status = gEfiIncompatiblePciDeviceSupport->CheckDevice ( + gEfiIncompatiblePciDeviceSupport, + PciIoDevice->Pci.Hdr.VendorId, + PciIoDevice->Pci.Hdr.DeviceId, + PciIoDevice->Pci.Hdr.RevisionID, + PciIoDevice->Pci.Device.SubsystemVendorID, + PciIoDevice->Pci.Device.SubsystemID, + &Configuration + ); - Status = PciResourceUpdateCheck (&PciDeviceInfo, &Configuration); + } if (EFI_ERROR (Status)) { - return Status; + // + // Check whether the device belongs to incompatible devices from library or not + // If it is , then get its special requirement in the ACPI table + // + if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_ACPI_RESOURCE_SUPPORT) { + PciDeviceInfo.VendorID = PciIoDevice->Pci.Hdr.VendorId; + PciDeviceInfo.DeviceID = PciIoDevice->Pci.Hdr.DeviceId; + PciDeviceInfo.RevisionID = PciIoDevice->Pci.Hdr.RevisionID; + PciDeviceInfo.SubsystemVendorID = PciIoDevice->Pci.Device.SubsystemVendorID; + PciDeviceInfo.SubsystemID = PciIoDevice->Pci.Device.SubsystemID; + + Status = PciResourceUpdateCheck (&PciDeviceInfo, &Configuration); + } + } + + if (EFI_ERROR (Status)) { + return EFI_UNSUPPORTED; } // @@ -2161,7 +2192,7 @@ Returns: } EFI_STATUS -ResetAllPpbBusReg ( +ResetAllPpbBusNumber ( IN PCI_IO_DEVICE *Bridge, IN UINT8 StartBusNumber ) @@ -2188,6 +2219,7 @@ Returns: UINT32 Register; UINT8 Func; UINT64 Address; + UINT8 SecondaryBus; EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo; PciRootBridgeIo = Bridge->PciRootBridgeIo; @@ -2207,6 +2239,7 @@ Returns: ); if (!EFI_ERROR (Status) && (IS_PCI_BRIDGE (&Pci))) { + Register = 0; Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x18); Status = PciRootBridgeIoRead ( @@ -2217,6 +2250,12 @@ Returns: 1, &Register ); + SecondaryBus = (UINT8)(Register >> 8); + + if (SecondaryBus != 0) { + ResetAllPpbBusNumber (Bridge, SecondaryBus); + } + // // Reset register 18h, 19h, 1Ah on PCI Bridge //