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>
This commit is contained in:
Heyi Guo 2018-02-08 11:13:27 +08:00 committed by Ard Biesheuvel
parent c03860d052
commit dc080d3b61
1 changed files with 4 additions and 0 deletions

View File

@ -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;