mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-23 05:34:31 +02:00
MdeModulePkg/PciBus: convert host address to device address
According to UEFI spec 2.7, PciRootBridgeIo->Configuration() should return host address (CPU view ddress) rather than device address (PCI view address), so in function GetMmioAddressTranslationOffset we need to convert the range to device address before comparing. And device address = host address + translation offset. 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:
parent
74d0a339b8
commit
c03860d052
@ -1812,10 +1812,14 @@ GetMmioAddressTranslationOffset (
|
||||
return (UINT64) -1;
|
||||
}
|
||||
|
||||
// According to UEFI 2.7, EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL::Configuration()
|
||||
// returns host address instead of device address, while AddrTranslationOffset
|
||||
// is not zero, and device address = host address + AddrTranslationOffset, so
|
||||
// we convert host address to device address for range compare.
|
||||
while (Configuration->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR) {
|
||||
if ((Configuration->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM) &&
|
||||
(Configuration->AddrRangeMin <= AddrRangeMin) &&
|
||||
(Configuration->AddrRangeMin + Configuration->AddrLen >= AddrRangeMin + AddrLen)
|
||||
(Configuration->AddrRangeMin + Configuration->AddrTranslationOffset <= AddrRangeMin) &&
|
||||
(Configuration->AddrRangeMin + Configuration->AddrLen + Configuration->AddrTranslationOffset >= AddrRangeMin + AddrLen)
|
||||
) {
|
||||
return Configuration->AddrTranslationOffset;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user