blob: 635690cf3e3dc77ff54f8d07555da2ffc4dff165 [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
Francois Romieu4c1b4622006-05-10 12:48:57 -070017#define DMA_48BIT_MASK 0x0000ffffffffffffULL
Lee Revellb8112df2005-06-15 14:19:03 -040018#define DMA_40BIT_MASK 0x000000ffffffffffULL
19#define DMA_39BIT_MASK 0x0000007fffffffffULL
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#define DMA_32BIT_MASK 0x00000000ffffffffULL
Lee Revellb8112df2005-06-15 14:19:03 -040021#define DMA_31BIT_MASK 0x000000007fffffffULL
22#define DMA_30BIT_MASK 0x000000003fffffffULL
23#define DMA_29BIT_MASK 0x000000001fffffffULL
Tobias Klauser9d2f9282006-03-22 10:53:19 +010024#define DMA_28BIT_MASK 0x000000000fffffffULL
Tobias Klauser56b146d2006-04-10 22:54:21 -070025#define DMA_24BIT_MASK 0x0000000000ffffffULL
Linus Torvalds1da177e2005-04-16 15:20:36 -070026
27#include <asm/dma-mapping.h>
28
29/* Backwards compat, remove in 2.7.x */
30#define dma_sync_single dma_sync_single_for_cpu
31#define dma_sync_sg dma_sync_sg_for_cpu
32
33extern u64 dma_get_required_mask(struct device *dev);
34
35/* flags for the coherent memory api */
36#define DMA_MEMORY_MAP 0x01
37#define DMA_MEMORY_IO 0x02
38#define DMA_MEMORY_INCLUDES_CHILDREN 0x04
39#define DMA_MEMORY_EXCLUSIVE 0x08
40
41#ifndef ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
42static inline int
43dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
44 dma_addr_t device_addr, size_t size, int flags)
45{
46 return 0;
47}
48
49static inline void
50dma_release_declared_memory(struct device *dev)
51{
52}
53
54static inline void *
55dma_mark_declared_memory_occupied(struct device *dev,
56 dma_addr_t device_addr, size_t size)
57{
58 return ERR_PTR(-EBUSY);
59}
60#endif
61
62#endif
63
64