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.per...@citrix.com> Cc: Ard Biesheuvel <ardb+tianoc...@kernel.org> Cc: Jordan Justen <jordan.l.jus...@intel.com> Cc: Julien Grall <jul...@xen.org> Cc: Peter Grehan <gre...@freebsd.org> Cc: Philippe Mathieu-Daudé <phi...@redhat.com> Cc: Rebecca Cran <rebe...@bsdio.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122 Signed-off-by: Laszlo Ersek <ler...@redhat.com> --- OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf | 7 --- OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c | 63 +------------------- 2 files changed, 2 insertions(+), 68 deletions(-) diff --git a/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf index 46859388870f..1ba880be6782 100644 --- a/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf +++ b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf @@ -41,14 +41,7 @@ [LibraryClasses] MemoryAllocationLib PcdLib PciHostBridgeUtilityLib PciLib [Pcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId - gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase - gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize - gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Base - gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size - gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Base - gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size diff --git a/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c index 6c2acc9f99bc..f0166e0f7279 100644 --- a/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c +++ b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c @@ -4,26 +4,17 @@ Copyright (C) 2016-2021, Red Hat, Inc. Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> 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. @param Count Return the count of root bridge instances. @return All the root bridge instances in an array. @@ -33,63 +24,13 @@ STATIC PCI_ROOT_BRIDGE_APERTURE mNonExistAperture = { MAX_UINT64, 0 }; PCI_ROOT_BRIDGE * EFIAPI 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); } /** Free the root bridge instances array returned from PciHostBridgeGetRootBridges(). -- 2.19.1.3.g30247aa5d201 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#75704): https://edk2.groups.io/g/devel/message/75704 Mute This Topic: https://groups.io/mt/83111003/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-