EmbeddedPkg/CoherentDmaLib: add support for non-1:1 DMA translation
Bring CoherentDmaLib in line with ArmDmaLib, and add support for defining a static offset between the host's and the bus master's view of memory. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
This commit is contained in:
@@ -19,6 +19,14 @@
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
|
||||
|
||||
STATIC
|
||||
PHYSICAL_ADDRESS
|
||||
HostToDeviceAddress (
|
||||
IN VOID *Address
|
||||
)
|
||||
{
|
||||
return (PHYSICAL_ADDRESS)(UINTN)Address + PcdGet64 (PcdDmaDeviceOffset);
|
||||
}
|
||||
|
||||
/**
|
||||
Provides the DMA controller-specific addresses needed to access system memory.
|
||||
@@ -50,7 +58,7 @@ DmaMap (
|
||||
OUT VOID **Mapping
|
||||
)
|
||||
{
|
||||
*DeviceAddress = (PHYSICAL_ADDRESS)(UINTN)HostAddress;
|
||||
*DeviceAddress = HostToDeviceAddress (HostAddress);
|
||||
*Mapping = NULL;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
Reference in New Issue
Block a user