summaryrefslogtreecommitdiffstats
path: root/ArmPkg
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2016-04-19 16:37:04 +0200
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2016-05-10 14:44:40 +0200
commit32e5fb76e5692911d5176ac4dc9cedafbe7fa5c9 (patch)
treea28488ba4edb0a63d4a5eeddd602b4ea359a05a5 /ArmPkg
parenta24f7d6680dd71616b0fcb9c5a65263fce1722be (diff)
downloadedk2-32e5fb76e5692911d5176ac4dc9cedafbe7fa5c9.tar.gz
edk2-32e5fb76e5692911d5176ac4dc9cedafbe7fa5c9.tar.bz2
edk2-32e5fb76e5692911d5176ac4dc9cedafbe7fa5c9.zip
ArmPkg/ArmDmaLib: do not remap arbitrary memory regions as uncached
In the DmaMap () operation, if the region to be mapped happens to be aligned to the Cache Writeback Granule (CWG) (whose value is typically 64 or 128 bytes and 2 KB maximum), we remap the memory as uncached. Since remapping memory occurs at page granularity, while the buffer and the CWG may be much smaller, there is no telling what other memory we affect by doing this, especially since the operation is not reverted in DmaUnmap(). So remove the remapping call. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Diffstat (limited to 'ArmPkg')
-rw-r--r--ArmPkg/Library/ArmDmaLib/ArmDmaLib.c6
1 files changed, 0 insertions, 6 deletions
diff --git a/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c b/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c
index 0e6fdce8ab..f5788b3756 100644
--- a/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c
+++ b/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c
@@ -138,12 +138,6 @@ DmaMap (
// Flush the Data Cache (should not have any effect if the memory region is uncached)
gCpu->FlushDataCache (gCpu, *DeviceAddress, *NumberOfBytes, EfiCpuFlushTypeWriteBackInvalidate);
-
- if ((Operation == MapOperationBusMasterRead) || (Operation == MapOperationBusMasterCommonBuffer)) {
- // In case the buffer is used for instance to send command to a PCI controller, we must ensure the memory is uncached
- Status = gDS->SetMemorySpaceAttributes (*DeviceAddress & ~(BASE_4KB - 1), ALIGN_VALUE (*NumberOfBytes, BASE_4KB), EFI_MEMORY_WC);
- ASSERT_EFI_ERROR (Status);
- }
}
Map->HostAddress = (UINTN)HostAddress;