diff options
-rw-r--r-- | include/linux/dma-mapping.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index ba9114ec5d3a..d7d090d21031 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
@@ -3,6 +3,8 @@ | |||
3 | 3 | ||
4 | #include <linux/device.h> | 4 | #include <linux/device.h> |
5 | #include <linux/err.h> | 5 | #include <linux/err.h> |
6 | #include <linux/dma-attrs.h> | ||
7 | #include <linux/scatterlist.h> | ||
6 | 8 | ||
7 | /* These definitions mirror those in pci.h, so they can be used | 9 | /* These definitions mirror those in pci.h, so they can be used |
8 | * interchangeably with their PCI_ counterparts */ | 10 | * interchangeably with their PCI_ counterparts */ |
@@ -13,6 +15,52 @@ enum dma_data_direction { | |||
13 | DMA_NONE = 3, | 15 | DMA_NONE = 3, |
14 | }; | 16 | }; |
15 | 17 | ||
18 | struct dma_map_ops { | ||
19 | void* (*alloc_coherent)(struct device *dev, size_t size, | ||
20 | dma_addr_t *dma_handle, gfp_t gfp); | ||
21 | void (*free_coherent)(struct device *dev, size_t size, | ||
22 | void *vaddr, dma_addr_t dma_handle); | ||
23 | dma_addr_t (*map_page)(struct device *dev, struct page *page, | ||
24 | unsigned long offset, size_t size, | ||
25 | enum dma_data_direction dir, | ||
26 | struct dma_attrs *attrs); | ||
27 | void (*unmap_page)(struct device *dev, dma_addr_t dma_handle, | ||
28 | size_t size, enum dma_data_direction dir, | ||
29 | struct dma_attrs *attrs); | ||
30 | int (*map_sg)(struct device *dev, struct scatterlist *sg, | ||
31 | int nents, enum dma_data_direction dir, | ||
32 | struct dma_attrs *attrs); | ||
33 | void (*unmap_sg)(struct device *dev, | ||
34 | struct scatterlist *sg, int nents, | ||
35 | enum dma_data_direction dir, | ||
36 | struct dma_attrs *attrs); | ||
37 | void (*sync_single_for_cpu)(struct device *dev, | ||
38 | dma_addr_t dma_handle, size_t size, | ||
39 | enum dma_data_direction dir); | ||
40 | void (*sync_single_for_device)(struct device *dev, | ||
41 | dma_addr_t dma_handle, size_t size, | ||
42 | enum dma_data_direction dir); | ||
43 | void (*sync_single_range_for_cpu)(struct device *dev, | ||
44 | dma_addr_t dma_handle, | ||
45 | unsigned long offset, | ||
46 | size_t size, | ||
47 | enum dma_data_direction dir); | ||
48 | void (*sync_single_range_for_device)(struct device *dev, | ||
49 | dma_addr_t dma_handle, | ||
50 | unsigned long offset, | ||
51 | size_t size, | ||
52 | enum dma_data_direction dir); | ||
53 | void (*sync_sg_for_cpu)(struct device *dev, | ||
54 | struct scatterlist *sg, int nents, | ||
55 | enum dma_data_direction dir); | ||
56 | void (*sync_sg_for_device)(struct device *dev, | ||
57 | struct scatterlist *sg, int nents, | ||
58 | enum dma_data_direction dir); | ||
59 | int (*mapping_error)(struct device *dev, dma_addr_t dma_addr); | ||
60 | int (*dma_supported)(struct device *dev, u64 mask); | ||
61 | int is_phys; | ||
62 | }; | ||
63 | |||
16 | #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) | 64 | #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) |
17 | 65 | ||
18 | /* | 66 | /* |