aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/dma-mapping.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/dma-mapping.h')
-rw-r--r--include/linux/dma-mapping.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index fd4aee29ad10..931b70986272 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -8,6 +8,12 @@
8#include <linux/dma-direction.h> 8#include <linux/dma-direction.h>
9#include <linux/scatterlist.h> 9#include <linux/scatterlist.h>
10 10
11/*
12 * A dma_addr_t can hold any valid DMA or bus address for the platform.
13 * It can be given to a device to use as a DMA source or target. A CPU cannot
14 * reference a dma_addr_t directly because there may be translation between
15 * its physical address space and the bus address space.
16 */
11struct dma_map_ops { 17struct dma_map_ops {
12 void* (*alloc)(struct device *dev, size_t size, 18 void* (*alloc)(struct device *dev, size_t size,
13 dma_addr_t *dma_handle, gfp_t gfp, 19 dma_addr_t *dma_handle, gfp_t gfp,
@@ -123,6 +129,13 @@ static inline int dma_coerce_mask_and_coherent(struct device *dev, u64 mask)
123 129
124extern u64 dma_get_required_mask(struct device *dev); 130extern u64 dma_get_required_mask(struct device *dev);
125 131
132#ifndef set_arch_dma_coherent_ops
133static inline int set_arch_dma_coherent_ops(struct device *dev)
134{
135 return 0;
136}
137#endif
138
126static inline unsigned int dma_get_max_seg_size(struct device *dev) 139static inline unsigned int dma_get_max_seg_size(struct device *dev)
127{ 140{
128 return dev->dma_parms ? dev->dma_parms->max_segment_size : 65536; 141 return dev->dma_parms ? dev->dma_parms->max_segment_size : 65536;
@@ -186,7 +199,7 @@ static inline int dma_get_cache_alignment(void)
186 199
187#ifndef ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY 200#ifndef ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
188static inline int 201static inline int
189dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr, 202dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
190 dma_addr_t device_addr, size_t size, int flags) 203 dma_addr_t device_addr, size_t size, int flags)
191{ 204{
192 return 0; 205 return 0;
@@ -217,13 +230,14 @@ extern void *dmam_alloc_noncoherent(struct device *dev, size_t size,
217extern void dmam_free_noncoherent(struct device *dev, size_t size, void *vaddr, 230extern void dmam_free_noncoherent(struct device *dev, size_t size, void *vaddr,
218 dma_addr_t dma_handle); 231 dma_addr_t dma_handle);
219#ifdef ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY 232#ifdef ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
220extern int dmam_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr, 233extern int dmam_declare_coherent_memory(struct device *dev,
234 phys_addr_t phys_addr,
221 dma_addr_t device_addr, size_t size, 235 dma_addr_t device_addr, size_t size,
222 int flags); 236 int flags);
223extern void dmam_release_declared_memory(struct device *dev); 237extern void dmam_release_declared_memory(struct device *dev);
224#else /* ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY */ 238#else /* ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY */
225static inline int dmam_declare_coherent_memory(struct device *dev, 239static inline int dmam_declare_coherent_memory(struct device *dev,
226 dma_addr_t bus_addr, dma_addr_t device_addr, 240 phys_addr_t phys_addr, dma_addr_t device_addr,
227 size_t size, gfp_t gfp) 241 size_t size, gfp_t gfp)
228{ 242{
229 return 0; 243 return 0;