]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/PciBus: return CPU address for GetBarAttributes
authorHeyi Guo <heyi.guo@linaro.org>
Thu, 8 Feb 2018 03:13:27 +0000 (11:13 +0800)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 15 Mar 2018 08:26:06 +0000 (08:26 +0000)
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>
MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c

index fef3eceb7f62eee18c338ee2d1dcab20b28286a6..62179eb44bbdbf9d4f57d34dc11f68f13444a182 100644 (file)
@@ -1972,6 +1972,10 @@ PciIoGetBarAttributes (
         return EFI_UNSUPPORTED;\r
       }\r
     }\r
         return EFI_UNSUPPORTED;\r
       }\r
     }\r
+\r
+    // According to UEFI spec 2.7, we need return host address for\r
+    // PciIo->GetBarAttributes, and host address = device address - translation.\r
+    Descriptor->AddrRangeMin -= Descriptor->AddrTranslationOffset;\r
   }\r
 \r
   return EFI_SUCCESS;\r
   }\r
 \r
   return EFI_SUCCESS;\r