edk2/MdeModulePkg
Jiaqing Zhao e3e93cf092 MdeModulePkg/PciBusDxe: Fix Mem64 BAR handling in IsPciDeviceRejected()
IsPciDeviceRejected() masks BAR value with 0xFFFFFFF0 before testing
the type bits (2:1) that mark a 64-bit memory BAR, essentially clears
them, making the 64-bit BAR code path unreachable and treated as if
it were 32-bit.

The function rejects a device when BAR looks unprogrammed by comparing
if its size mask equals its value. When a 64-bit BAR is mistaken for a
32-bit one, only its lower part is compared, possibly leading a valid
BAR being falsely rejected. For example, a 2G BAR with size mask
0x80000000 at 0x180000000 matches and the device is dropped.

This code runs during light enumeration (PciEnumeratorLight), used when
PCI resources are already assigned by the platform (e.g. Xen HVM, where
hvmloader programs the BARs). The rejected device never receives a
PciIo handle, so no driver can bind to it. For example, a virtio-vga
with a 64-bit BAR vanishes under OVMF on Xen, leaving the guest with
no graphics output.

Fix by testing the type bits on the raw BAR value before masking.

Signed-off-by: Jiaqing Zhao <Zhao.Jiaqing@amd.com>
2026-06-29 02:25:40 +00:00
..
Application MdeModulePkg: Replace include guards with #pragma once 2026-02-23 21:01:28 +00:00
Bus MdeModulePkg/PciBusDxe: Fix Mem64 BAR handling in IsPciDeviceRejected() 2026-06-29 02:25:40 +00:00
Core MdeModulePkg: MemoryBins: Add GoogleTest and README 2026-06-24 15:53:58 +00:00
Include MdeModulePkg: Follow pragma once coding convention 2026-06-25 19:40:31 +00:00
Library MdeModulePkg/ArmFfaLib: return error when CurrentVersion is NULL 2026-05-29 18:44:57 +00:00
Logo MdeModulePkg: Remove ARM32 Support 2025-09-25 22:04:10 +00:00
Test MdeModulePkg: Follow pragma once coding convention 2026-06-25 19:40:31 +00:00
Universal MdeModulePkg/TerminalDxe: Change print level to eliminate interference 2026-06-22 20:06:47 +00:00
MdeModulePkg.ci.yaml MdeModulePkg: Add duplicate exception for gUiAppFileGuid 2025-03-06 14:18:10 +01:00
MdeModulePkg.dec MdeModulePkg/PciBusDxe: Scan funcs when func 0 is absent 2026-06-25 13:09:52 +00:00
MdeModulePkg.dsc MdeModulePkg: Add support for generation of HEST table 2026-05-26 23:45:14 +00:00
MdeModulePkg.uni MdeModulePkg: Add platform limit for size in Resizable BAR 2026-02-25 03:40:14 +00:00
MdeModulePkgExtra.uni MdeModulePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:08 -07:00