summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorHeyi Guo <heyi.guo@linaro.org>2018-02-08 11:13:27 +0800
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2018-03-15 08:26:06 +0000
commitdc080d3b61e570e7a3163fc24afa6f8388d0c0bf (patch)
tree21e7e88aedd32da4f9d2c5c7179f9334b1421815 /MdeModulePkg
parentc03860d052335be405d45d9b6bb19de0d4693951 (diff)
downloadedk2-dc080d3b61e570e7a3163fc24afa6f8388d0c0bf.tar.gz
edk2-dc080d3b61e570e7a3163fc24afa6f8388d0c0bf.tar.bz2
edk2-dc080d3b61e570e7a3163fc24afa6f8388d0c0bf.zip
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 <heyi.guo@linaro.org> Signed-off-by: Yi Li <phoenix.liyi@huawei.com> Reviewed-by: Ni Ruiyu <ruiyu.ni@intel.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c4
1 files changed, 4 insertions, 0 deletions
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;