]> git.proxmox.com Git - mirror_edk2.git/commit
ArmPkg/ArmDmaLib: reject consistent DMA mappings of cached memory
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 19 Apr 2016 14:26:00 +0000 (16:26 +0200)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 10 May 2016 12:44:39 +0000 (14:44 +0200)
commita24f7d6680dd71616b0fcb9c5a65263fce1722be
tree3a463d017ff1832491895ab125510de1dbc371c5
parent885d57ef091fd58916163e79ee694ddaf8fcc25e
ArmPkg/ArmDmaLib: reject consistent DMA mappings of cached memory

DmaMap () operations of type MapOperationBusMasterCommonBuffer should
return a mapping that is coherent between the CPU and the device. For
this reason, the API only allows DmaMap () to be called with this operation
type if the memory to be mapped was allocated by DmaAllocateBuffer (),
which in this implementation guarantees the coherency by using uncached
mappings on the CPU side.

This means that, if we encounter a cached mapping in DmaMap () with this
operation type, the code is either broken, or someone is violating the
API, but simply proceeding with a double buffer makes no sense at all,
and can only cause problems.

So instead, actively reject this operation type for cached memory mappings.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
ArmPkg/Library/ArmDmaLib/ArmDmaLib.c