aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-mips/dma-mapping.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-mips/dma-mapping.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/asm-mips/dma-mapping.h')
-rw-r--r--include/asm-mips/dma-mapping.h79
1 files changed, 79 insertions, 0 deletions
diff --git a/include/asm-mips/dma-mapping.h b/include/asm-mips/dma-mapping.h
new file mode 100644
index 000000000000..af28dc88930b
--- /dev/null
+++ b/include/asm-mips/dma-mapping.h
@@ -0,0 +1,79 @@
1#ifndef _ASM_DMA_MAPPING_H
2#define _ASM_DMA_MAPPING_H
3
4#include <asm/scatterlist.h>
5#include <asm/cache.h>
6
7void *dma_alloc_noncoherent(struct device *dev, size_t size,
8 dma_addr_t *dma_handle, int flag);
9
10void dma_free_noncoherent(struct device *dev, size_t size,
11 void *vaddr, dma_addr_t dma_handle);
12
13void *dma_alloc_coherent(struct device *dev, size_t size,
14 dma_addr_t *dma_handle, int flag);
15
16void dma_free_coherent(struct device *dev, size_t size,
17 void *vaddr, dma_addr_t dma_handle);
18
19extern dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,
20 enum dma_data_direction direction);
21extern void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
22 size_t size, enum dma_data_direction direction);
23extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
24 enum dma_data_direction direction);
25extern dma_addr_t dma_map_page(struct device *dev, struct page *page,
26 unsigned long offset, size_t size, enum dma_data_direction direction);
27extern void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
28 size_t size, enum dma_data_direction direction);
29extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
30 int nhwentries, enum dma_data_direction direction);
31extern void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
32 size_t size, enum dma_data_direction direction);
33extern void dma_sync_single_for_device(struct device *dev,
34 dma_addr_t dma_handle, size_t size, enum dma_data_direction direction);
35extern void dma_sync_single_range_for_cpu(struct device *dev,
36 dma_addr_t dma_handle, unsigned long offset, size_t size,
37 enum dma_data_direction direction);
38extern void dma_sync_single_range_for_device(struct device *dev,
39 dma_addr_t dma_handle, unsigned long offset, size_t size,
40 enum dma_data_direction direction);
41extern void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
42 int nelems, enum dma_data_direction direction);
43extern void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
44 int nelems, enum dma_data_direction direction);
45extern int dma_mapping_error(dma_addr_t dma_addr);
46extern int dma_supported(struct device *dev, u64 mask);
47
48static inline int
49dma_set_mask(struct device *dev, u64 mask)
50{
51 if(!dev->dma_mask || !dma_supported(dev, mask))
52 return -EIO;
53
54 *dev->dma_mask = mask;
55
56 return 0;
57}
58
59static inline int
60dma_get_cache_alignment(void)
61{
62 /* XXX Largest on any MIPS */
63 return 128;
64}
65
66extern int dma_is_consistent(dma_addr_t dma_addr);
67
68extern void dma_cache_sync(void *vaddr, size_t size,
69 enum dma_data_direction direction);
70
71#define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
72
73extern int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
74 dma_addr_t device_addr, size_t size, int flags);
75extern void dma_release_declared_memory(struct device *dev);
76extern void * dma_mark_declared_memory_occupied(struct device *dev,
77 dma_addr_t device_addr, size_t size);
78
79#endif /* _ASM_DMA_MAPPING_H */