]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/ArmDmaLib: fix incorrect device address of double buffer
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Sat, 12 Nov 2016 13:02:26 +0000 (14:02 +0100)
committerLeif Lindholm <leif.lindholm@linaro.org>
Wed, 30 Nov 2016 16:42:59 +0000 (16:42 +0000)
If double buffering is not required in DmaMap(), the returned device
address is passed through ConvertToPhysicalAddress () to convert the
host address (which in case of DebugUncachedMemoryAllocationLib is not
1:1 mapped) to a physical address, which is what a device would expect
to be able to perform DMA.

By the same reasoning, a double buffer allocated using DmaAllocateBuffer ()
should be converted in the same way, considering that the buffer is allocated
using UncachedAllocatePages (), to which the above equally applies.

So add the missing ConvertToPhysicalAddress () invocation.

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

index e836feff1ef85db9af53341780fc95a76699571e..6afce87024e7a2d018076b25ba7ec3a590868c19 100644 (file)
@@ -126,7 +126,7 @@ DmaMap (
         CopyMem (Buffer, HostAddress, *NumberOfBytes);\r
       }\r
 \r
-      *DeviceAddress = (PHYSICAL_ADDRESS)(UINTN)Buffer;\r
+      *DeviceAddress = ConvertToPhysicalAddress ((UINTN)Buffer);\r
     } else {\r
       Map->DoubleBuffer  = FALSE;\r
     }\r