Message ID | 1478955748-14819-3-git-send-email-ard.biesheuvel@linaro.org |
---|---|
State | Accepted |
Commit | 0a99a65d2c8a68b72accfa636fe2633900269128 |
Headers | show |
On Sat, Nov 12, 2016 at 02:02:26PM +0100, Ard Biesheuvel wrote: > 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> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> > --- > ArmPkg/Library/ArmDmaLib/ArmDmaLib.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c b/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c > index 03fd9f3278e6..c2a44398d25a 100644 > --- a/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c > +++ b/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c > @@ -127,7 +127,7 @@ DmaMap ( > CopyMem (Buffer, HostAddress, *NumberOfBytes); > } > > - *DeviceAddress = (PHYSICAL_ADDRESS)(UINTN)Buffer; > + *DeviceAddress = ConvertToPhysicalAddress ((UINTN)Buffer); > } else { > Map->DoubleBuffer = FALSE; > } > -- > 2.7.4 > _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
diff --git a/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c b/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c index 03fd9f3278e6..c2a44398d25a 100644 --- a/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c +++ b/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c @@ -127,7 +127,7 @@ DmaMap ( CopyMem (Buffer, HostAddress, *NumberOfBytes); } - *DeviceAddress = (PHYSICAL_ADDRESS)(UINTN)Buffer; + *DeviceAddress = ConvertToPhysicalAddress ((UINTN)Buffer); } else { Map->DoubleBuffer = FALSE; }
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> --- ArmPkg/Library/ArmDmaLib/ArmDmaLib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel