From: Heyi Guo Date: Thu, 8 Feb 2018 03:13:27 +0000 (+0800) Subject: MdeModulePkg/PciBus: return CPU address for GetBarAttributes X-Git-Tag: edk2-stable201903~2127 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=dc080d3b61e570e7a3163fc24afa6f8388d0c0bf;hp=c03860d052335be405d45d9b6bb19de0d4693951 MdeModulePkg/PciBus: return CPU address for GetBarAttributes According to UEFI spec 2.7, PciIo->GetBarAttributes should return host address (CPU view ddress) rather than device address (PCI view address), and device address = host address + address translation offset, so we subtract translation from device address before returning. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Heyi Guo Signed-off-by: Yi Li Reviewed-by: Ni Ruiyu Reviewed-by: Ard Biesheuvel --- diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c index fef3eceb7f..62179eb44b 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c @@ -1972,6 +1972,10 @@ PciIoGetBarAttributes ( return EFI_UNSUPPORTED; } } + + // According to UEFI spec 2.7, we need return host address for + // PciIo->GetBarAttributes, and host address = device address - translation. + Descriptor->AddrRangeMin -= Descriptor->AddrTranslationOffset; } return EFI_SUCCESS;