aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86_64/dma-mapping.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-x86_64/dma-mapping.h')
-rw-r--r--include/asm-x86_64/dma-mapping.h33
1 files changed, 28 insertions, 5 deletions
diff --git a/include/asm-x86_64/dma-mapping.h b/include/asm-x86_64/dma-mapping.h
index e784fdc524f1..36d16dfbac88 100644
--- a/include/asm-x86_64/dma-mapping.h
+++ b/include/asm-x86_64/dma-mapping.h
@@ -17,7 +17,7 @@ extern dma_addr_t bad_dma_address;
17 (swiotlb ? swiotlb_dma_mapping_error(x) : ((x) == bad_dma_address)) 17 (swiotlb ? swiotlb_dma_mapping_error(x) : ((x) == bad_dma_address))
18 18
19void *dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, 19void *dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
20 unsigned gfp); 20 gfp_t gfp);
21void dma_free_coherent(struct device *dev, size_t size, void *vaddr, 21void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
22 dma_addr_t dma_handle); 22 dma_addr_t dma_handle);
23 23
@@ -85,10 +85,33 @@ static inline void dma_sync_single_for_device(struct device *hwdev,
85 flush_write_buffers(); 85 flush_write_buffers();
86} 86}
87 87
88#define dma_sync_single_range_for_cpu(dev, dma_handle, offset, size, dir) \ 88static inline void dma_sync_single_range_for_cpu(struct device *hwdev,
89 dma_sync_single_for_cpu(dev, dma_handle, size, dir) 89 dma_addr_t dma_handle,
90#define dma_sync_single_range_for_device(dev, dma_handle, offset, size, dir) \ 90 unsigned long offset,
91 dma_sync_single_for_device(dev, dma_handle, size, dir) 91 size_t size, int direction)
92{
93 if (direction == DMA_NONE)
94 out_of_line_bug();
95
96 if (swiotlb)
97 return swiotlb_sync_single_range_for_cpu(hwdev,dma_handle,offset,size,direction);
98
99 flush_write_buffers();
100}
101
102static inline void dma_sync_single_range_for_device(struct device *hwdev,
103 dma_addr_t dma_handle,
104 unsigned long offset,
105 size_t size, int direction)
106{
107 if (direction == DMA_NONE)
108 out_of_line_bug();
109
110 if (swiotlb)
111 return swiotlb_sync_single_range_for_device(hwdev,dma_handle,offset,size,direction);
112
113 flush_write_buffers();
114}
92 115
93static inline void dma_sync_sg_for_cpu(struct device *hwdev, 116static inline void dma_sync_sg_for_cpu(struct device *hwdev,
94 struct scatterlist *sg, 117 struct scatterlist *sg,