blob: 2d80cc761a15948179fefc0abe5a686b9abc2b81 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _ASM_LINUX_DMA_MAPPING_H
2#define _ASM_LINUX_DMA_MAPPING_H
3
4#include <linux/device.h>
5#include <linux/err.h>
6
7/* These definitions mirror those in pci.h, so they can be used
8 * interchangeably with their PCI_ counterparts */
9enum dma_data_direction {
10 DMA_BIDIRECTIONAL = 0,
11 DMA_TO_DEVICE = 1,
12 DMA_FROM_DEVICE = 2,
13 DMA_NONE = 3,
14};
15
16#define DMA_64BIT_MASK 0xffffffffffffffffULL
Lee Revellb8112df2005-06-15 14:19:03 -040017#define DMA_40BIT_MASK 0x000000ffffffffffULL
18#define DMA_39BIT_MASK 0x0000007fffffffffULL
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#define DMA_32BIT_MASK 0x00000000ffffffffULL
Lee Revellb8112df2005-06-15 14:19:03 -040020#define DMA_31BIT_MASK 0x000000007fffffffULL
21#define DMA_30BIT_MASK 0x000000003fffffffULL
22#define DMA_29BIT_MASK 0x000000001fffffffULL
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
24#include <asm/dma-mapping.h>
25
26/* Backwards compat, remove in 2.7.x */
27#define dma_sync_single dma_sync_single_for_cpu
28#define dma_sync_sg dma_sync_sg_for_cpu
29
30extern u64 dma_get_required_mask(struct device *dev);
31
32/* flags for the coherent memory api */
33#define DMA_MEMORY_MAP 0x01
34#define DMA_MEMORY_IO 0x02
35#define DMA_MEMORY_INCLUDES_CHILDREN 0x04
36#define DMA_MEMORY_EXCLUSIVE 0x08
37
38#ifndef ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
39static inline int
40dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
41 dma_addr_t device_addr, size_t size, int flags)
42{
43 return 0;
44}
45
46static inline void
47dma_release_declared_memory(struct device *dev)
48{
49}
50
51static inline void *
52dma_mark_declared_memory_occupied(struct device *dev,
53 dma_addr_t device_addr, size_t size)
54{
55 return ERR_PTR(-EBUSY);
56}
57#endif
58
59#endif
60
61