]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmbeddedPkg/Library/CoherentDmaLib/CoherentDmaLib.c
EmbeddedPkg/CoherentDmaLib: add support for non-1:1 DMA translation
[mirror_edk2.git] / EmbeddedPkg / Library / CoherentDmaLib / CoherentDmaLib.c
index 4cbe349190a99c534ed124203cb5d4f2634706dd..564db83c901c0a80a78fed729c0d5caacabf6f42 100644 (file)
 #include <Library/MemoryAllocationLib.h>\r
 \r
 \r
+STATIC\r
+PHYSICAL_ADDRESS\r
+HostToDeviceAddress (\r
+  IN  VOID      *Address\r
+  )\r
+{\r
+  return (PHYSICAL_ADDRESS)(UINTN)Address + PcdGet64 (PcdDmaDeviceOffset);\r
+}\r
 \r
 /**\r
   Provides the DMA controller-specific addresses needed to access system memory.\r
@@ -50,7 +58,7 @@ DmaMap (
   OUT    VOID                           **Mapping\r
   )\r
 {\r
-  *DeviceAddress = (PHYSICAL_ADDRESS)(UINTN)HostAddress;\r
+  *DeviceAddress = HostToDeviceAddress (HostAddress);\r
   *Mapping = NULL;\r
   return EFI_SUCCESS;\r
 }\r