From c70637de12e0d5cee78ebf5a0b5d09cdb1db53c9 Mon Sep 17 00:00:00 2001 From: Phil Noh Date: Thu, 25 Jun 2026 15:41:25 -0500 Subject: [PATCH] MdeModulePkg/PciBusDxe: Honor SpecificFlag for PMem64 in UpdatePciInfo When UpdatePciInfo() downgrades a PciBarTypePMem64 BAR to a 32-bit type via EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL, it unconditionally assigns PciBarTypePMem32 regardless of SpecificFlag, placing the BAR in the prefetchable bridge window even when the platform intended the non-prefetchable window. The ACPI resource descriptor's SpecificFlag field encodes the intended prefetchability of the constrained resource, using the bit: EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE. Fix this by checking the bit in SpecificFlag to select PciBarTypePMem32 or PciBarTypeMem32, consistent with DumpPpbPaddingResource() in PciEnumeratorSupport.c that uses the bit as the sole discriminator between the two 32-bit BAR types. Signed-off-by: Phil Noh --- MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c index a0f86f2806..ae94462f60 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c @@ -4,7 +4,7 @@ Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
(C) Copyright 2015 Hewlett Packard Enterprise Development LP
-Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+Copyright (C) 2023 - 2026 Advanced Micro Devices, Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -1595,7 +1595,14 @@ UpdatePciInfo ( if (PciIoDevice->PciBar[BarIndex].BarType == PciBarTypePMem64) { switch (Ptr->AddrSpaceGranularity) { case 32: - PciIoDevice->PciBar[BarIndex].BarType = PciBarTypePMem32; + if ((Ptr->SpecificFlag & EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE) == + EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE) + { + PciIoDevice->PciBar[BarIndex].BarType = PciBarTypePMem32; + } else { + PciIoDevice->PciBar[BarIndex].BarType = PciBarTypeMem32; + } + case 64: PciIoDevice->PciBar[BarIndex].BarTypeFixed = TRUE; break;