mirror of https://github.com/acidanthera/audk.git
OvmfPkg/PciHostBridgeLibScan: remove QEMU (fw_cfg) support
The "OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf" instance is used in the following platforms in edk2: OvmfPkg/Bhyve/BhyveX64.dsc OvmfPkg/OvmfXen.dsc Both platforms define "PcdPciDisableBusEnumeration" with Fixed-at-Build access method, and TRUE value. Remove the PCD from the PciHostBridgeLibScan instance, and everything else that is useful only when the PCD is FALSE. In practice, this removes the PciHostBridgeUtilityGetRootBridges() function call, which is based on fw-cfg; see "OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c". (Note that the dependency on PciHostBridgeUtilityLib remains in place, given that the PciHostBridgeLibScan instance continues using lower-level functions from the library that do not depend on fw-cfg.) Cc: Anthony Perard <anthony.perard@citrix.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Julien Grall <julien@xen.org> Cc: Peter Grehan <grehan@freebsd.org> Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Cc: Rebecca Cran <rebecca@bsdio.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20210526201446.12554-34-lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
This commit is contained in:
parent
242678da2a
commit
33d4f3e39e
|
@ -7,20 +7,11 @@
|
|||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
#include <IndustryStandard/Pci.h> // PCI_MAX_BUS
|
||||
#include <IndustryStandard/Q35MchIch9.h> // INTEL_Q35_MCH_DEVIC...
|
||||
#include <Library/BaseMemoryLib.h> // ZeroMem()
|
||||
#include <Library/PcdLib.h> // PcdGet64()
|
||||
#include <Library/PciHostBridgeLib.h> // PCI_ROOT_BRIDGE_APE...
|
||||
#include <Library/PciHostBridgeLib.h> // PCI_ROOT_BRIDGE
|
||||
#include <Library/PciHostBridgeUtilityLib.h> // PciHostBridgeUtilit...
|
||||
#include <Protocol/PciHostBridgeResourceAllocation.h> // EFI_PCI_HOST_BRIDGE...
|
||||
#include <Protocol/PciRootBridgeIo.h> // EFI_PCI_ATTRIBUTE_I...
|
||||
|
||||
#include "PciHostBridge.h"
|
||||
|
||||
STATIC PCI_ROOT_BRIDGE_APERTURE mNonExistAperture = { MAX_UINT64, 0 };
|
||||
|
||||
|
||||
/**
|
||||
Return all the root bridge instances in an array.
|
||||
|
||||
|
@ -36,57 +27,7 @@ PciHostBridgeGetRootBridges (
|
|||
UINTN *Count
|
||||
)
|
||||
{
|
||||
UINT64 Attributes;
|
||||
UINT64 AllocationAttributes;
|
||||
PCI_ROOT_BRIDGE_APERTURE Io;
|
||||
PCI_ROOT_BRIDGE_APERTURE Mem;
|
||||
PCI_ROOT_BRIDGE_APERTURE MemAbove4G;
|
||||
|
||||
if (PcdGetBool (PcdPciDisableBusEnumeration)) {
|
||||
return ScanForRootBridges (Count);
|
||||
}
|
||||
|
||||
ZeroMem (&Io, sizeof (Io));
|
||||
ZeroMem (&Mem, sizeof (Mem));
|
||||
ZeroMem (&MemAbove4G, sizeof (MemAbove4G));
|
||||
|
||||
Attributes = EFI_PCI_ATTRIBUTE_IDE_PRIMARY_IO |
|
||||
EFI_PCI_ATTRIBUTE_IDE_SECONDARY_IO |
|
||||
EFI_PCI_ATTRIBUTE_ISA_IO_16 |
|
||||
EFI_PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO |
|
||||
EFI_PCI_ATTRIBUTE_VGA_MEMORY |
|
||||
EFI_PCI_ATTRIBUTE_VGA_IO_16 |
|
||||
EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO_16;
|
||||
|
||||
AllocationAttributes = EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM;
|
||||
if (PcdGet64 (PcdPciMmio64Size) > 0) {
|
||||
AllocationAttributes |= EFI_PCI_HOST_BRIDGE_MEM64_DECODE;
|
||||
MemAbove4G.Base = PcdGet64 (PcdPciMmio64Base);
|
||||
MemAbove4G.Limit = PcdGet64 (PcdPciMmio64Base) +
|
||||
PcdGet64 (PcdPciMmio64Size) - 1;
|
||||
} else {
|
||||
CopyMem (&MemAbove4G, &mNonExistAperture, sizeof (mNonExistAperture));
|
||||
}
|
||||
|
||||
Io.Base = PcdGet64 (PcdPciIoBase);
|
||||
Io.Limit = PcdGet64 (PcdPciIoBase) + (PcdGet64 (PcdPciIoSize) - 1);
|
||||
Mem.Base = PcdGet64 (PcdPciMmio32Base);
|
||||
Mem.Limit = PcdGet64 (PcdPciMmio32Base) + (PcdGet64 (PcdPciMmio32Size) - 1);
|
||||
|
||||
return PciHostBridgeUtilityGetRootBridges (
|
||||
Count,
|
||||
Attributes,
|
||||
AllocationAttributes,
|
||||
FALSE,
|
||||
PcdGet16 (PcdOvmfHostBridgePciDevId) != INTEL_Q35_MCH_DEVICE_ID,
|
||||
0,
|
||||
PCI_MAX_BUS,
|
||||
&Io,
|
||||
&Mem,
|
||||
&MemAbove4G,
|
||||
&mNonExistAperture,
|
||||
&mNonExistAperture
|
||||
);
|
||||
return ScanForRootBridges (Count);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -44,11 +44,4 @@
|
|||
PciLib
|
||||
|
||||
[Pcd]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
|
||||
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
|
||||
gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase
|
||||
gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize
|
||||
gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Base
|
||||
gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size
|
||||
gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Base
|
||||
gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size
|
||||
|
|
Loading…
Reference in New Issue