summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2021-05-26 22:14:36 +0200
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-06-04 16:01:50 +0000
commit33d4f3e39ee6ea0743bd6a3a8a3261c9a4d16a29 (patch)
treee0fbedbf510304159fb15d8fc7cb7856a1041e1c
parent242678da2a807a286281791d88e7c16295d74269 (diff)
downloadedk2-33d4f3e39ee6ea0743bd6a3a8a3261c9a4d16a29.tar.gz
edk2-33d4f3e39ee6ea0743bd6a3a8a3261c9a4d16a29.tar.bz2
edk2-33d4f3e39ee6ea0743bd6a3a8a3261c9a4d16a29.zip
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>
-rw-r--r--OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c63
-rw-r--r--OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf7
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 <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);
}
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