public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 2.6.13] x86_64: implement dma_sync_single_range_for_{cpu,device}
@ 2005-08-29 20:09 John W. Linville
  2005-08-29 20:54 ` Andi Kleen
  0 siblings, 1 reply; 7+ messages in thread
From: John W. Linville @ 2005-08-29 20:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: ak, discuss

Implement dma_sync_single_range_for_{cpu,device}, based on curent
implementations of dma_sync_single_for_{cpu,device}.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
It is hard to use this API if common platforms do not implement it. :-)
Hopefully I did not miss something obvious?

This is a naive implementation, so flame away...

 include/asm-x86_64/dma-mapping.h |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+)

diff --git a/include/asm-x86_64/dma-mapping.h b/include/asm-x86_64/dma-mapping.h
--- a/include/asm-x86_64/dma-mapping.h
+++ b/include/asm-x86_64/dma-mapping.h
@@ -85,6 +85,34 @@ static inline void dma_sync_single_for_d
 	flush_write_buffers();
 }
 
+static inline void dma_sync_single_range_for_cpu(struct device *hwdev,
+						 dma_addr_t dma_handle,
+						 unsigned long offset,
+						 size_t size, int direction)
+{
+	if (direction == DMA_NONE)
+		out_of_line_bug();
+
+	if (swiotlb)
+		return swiotlb_sync_single_for_cpu(hwdev,dma_handle+offset,size,direction);
+
+	flush_write_buffers();
+}
+
+static inline void dma_sync_single_range_for_device(struct device *hwdev,
+						    dma_addr_t dma_handle,
+						    unsigned long offset,
+						    size_t size, int direction)
+{
+        if (direction == DMA_NONE)
+		out_of_line_bug();
+
+	if (swiotlb)
+		return swiotlb_sync_single_for_device(hwdev,dma_handle+offset,size,direction);
+
+	flush_write_buffers();
+}
+
 static inline void dma_sync_sg_for_cpu(struct device *hwdev,
 				       struct scatterlist *sg,
 				       int nelems, int direction)
-- 
John W. Linville
linville@tuxdriver.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-08-30 18:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-29 20:09 [patch 2.6.13] x86_64: implement dma_sync_single_range_for_{cpu,device} John W. Linville
2005-08-29 20:54 ` Andi Kleen
2005-08-29 21:48   ` John W. Linville
2005-08-30  1:14     ` [discuss] " Andi Kleen
2005-08-30 17:54       ` John W. Linville
2005-08-30 17:58         ` [patch 2.6.13] swiotlb: add swiotlb_sync_single_range_for_{cpu,device} John W. Linville
2005-08-30 18:00           ` [patch 2.6.13] x86_64: implement dma_sync_single_range_for_{cpu,device} John W. Linville

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox