From 33d4f3e39ee6ea0743bd6a3a8a3261c9a4d16a29 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Wed, 26 May 2021 22:14:36 +0200 Subject: OvmfPkg/PciHostBridgeLibScan: remove QEMU (fw_cfg) support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Julien Grall Cc: Peter Grehan Cc: Philippe Mathieu-Daudé Cc: Rebecca Cran Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122 Signed-off-by: Laszlo Ersek Message-Id: <20210526201446.12554-34-lersek@redhat.com> Reviewed-by: Ard Biesheuvel Reviewed-by: Philippe Mathieu-Daudé --- .../PciHostBridgeLibScan/PciHostBridgeLib.c | 63 +--------------------- .../PciHostBridgeLibScan/PciHostBridgeLibScan.inf | 7 --- 2 files changed, 2 insertions(+), 68 deletions(-) diff --git a/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c index 6c2acc9f99..f0166e0f72 100644 --- a/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c +++ b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c @@ -7,20 +7,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#include // PCI_MAX_BUS -#include // INTEL_Q35_MCH_DEVIC... -#include // ZeroMem() -#include // PcdGet64() -#include // PCI_ROOT_BRIDGE_APE... +#include // PCI_ROOT_BRIDGE #include // PciHostBridgeUtilit... -#include // EFI_PCI_HOST_BRIDGE... -#include // 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); } diff --git a/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf index 4685938887..1ba880be67 100644 --- a/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf +++ b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf @@ -44,11 +44,4 @@ PciLib [Pcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId - gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase - gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize - gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Base - gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size - gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Base - gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size -- cgit v1.2.3