diff --git a/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c b/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
index 9af8c21a21..4912355999 100644
--- a/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
+++ b/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
@@ -2,6 +2,7 @@
PCI Host Bridge Library instance for pci-ecam-generic DT nodes
Copyright (c) 2016, Linaro Ltd. All rights reserved.
+ Copyright (c) 2026, Arm Ltd. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -10,7 +11,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -42,46 +43,6 @@ typedef struct {
#define DTB_PCI_HOST_RANGE_IO BIT24
#define DTB_PCI_HOST_RANGE_TYPEMASK (BIT31 | BIT30 | BIT29 | BIT25 | BIT24)
-STATIC
-EFI_STATUS
-MapGcdMmioSpace (
- IN UINT64 Base,
- IN UINT64 Size
- )
-{
- EFI_STATUS Status;
-
- Status = gDS->AddMemorySpace (
- EfiGcdMemoryTypeMemoryMappedIo,
- Base,
- Size,
- EFI_MEMORY_UC
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "%a: failed to add GCD memory space for region [0x%Lx+0x%Lx)\n",
- __func__,
- Base,
- Size
- ));
- return Status;
- }
-
- Status = gDS->SetMemorySpaceAttributes (Base, Size, EFI_MEMORY_UC);
- if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "%a: failed to set memory space attributes for region [0x%Lx+0x%Lx)\n",
- __func__,
- Base,
- Size
- ));
- }
-
- return Status;
-}
-
STATIC
EFI_STATUS
ProcessPciHost (
@@ -322,7 +283,7 @@ ProcessPciHost (
));
// Map the ECAM space in the GCD memory map
- Status = MapGcdMmioSpace (ConfigBase, ConfigSize);
+ Status = MapMmioMemory (ConfigBase, ConfigSize, EFI_MEMORY_UC);
ASSERT_EFI_ERROR (Status);
if (EFI_ERROR (Status)) {
return Status;
@@ -334,7 +295,7 @@ ProcessPciHost (
// is not aware of this translation and so it will only map the I/O view
// in the GCD I/O map.
//
- Status = MapGcdMmioSpace (*IoBase + IoTranslation, *IoSize);
+ Status = MapMmioMemory (*IoBase + IoTranslation, *IoSize, EFI_MEMORY_UC);
ASSERT_EFI_ERROR (Status);
}
diff --git a/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf b/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
index 26b38b5966..5c6bbba912 100644
--- a/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
+++ b/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
@@ -29,7 +29,7 @@
BaseMemoryLib
DebugLib
DevicePathLib
- DxeServicesTableLib
+ MapMmioLib
MemoryAllocationLib
PciHostBridgeUtilityLib
PciPcdProducerLib
diff --git a/OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc b/OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc
index 15bb9a856a..aa8c10493b 100644
--- a/OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc
+++ b/OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc
@@ -332,6 +332,7 @@
QemuFwCfgLib | OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioDxeLib.inf
PciPcdProducerLib | OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
AcpiPlatformLib | OvmfPkg/Library/AcpiPlatformLib/DxeAcpiPlatformLib.inf
+ MapMmioLib | OvmfPkg/Library/MapMmioLib/MapMmioLib.inf
MpInitLib | UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
!if $(TPM2_ENABLE) == TRUE
Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibTcg2/Tpm2DeviceLibTcg2.inf
diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc
index 0211e960f6..ee8cf56ca6 100644
--- a/OvmfPkg/Microvm/MicrovmX64.dsc
+++ b/OvmfPkg/Microvm/MicrovmX64.dsc
@@ -397,6 +397,7 @@
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLibMicrovm.inf
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+ MapMmioLib|OvmfPkg/Library/MapMmioLib/MapMmioLib.inf
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
diff --git a/OvmfPkg/RiscVVirt/RiscVVirt.dsc.inc b/OvmfPkg/RiscVVirt/RiscVVirt.dsc.inc
index 47248f2312..83e0cdaefa 100644
--- a/OvmfPkg/RiscVVirt/RiscVVirt.dsc.inc
+++ b/OvmfPkg/RiscVVirt/RiscVVirt.dsc.inc
@@ -186,6 +186,7 @@
[LibraryClasses.common.DXE_DRIVER]
SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
+ MapMmioLib|OvmfPkg/Library/MapMmioLib/MapMmioLib.inf
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf