Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #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 */ |
| 9 | enum 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 Romieu | 4c1b462 | 2006-05-10 12:48:57 -0700 | [diff] [blame] | 17 | #define DMA_48BIT_MASK 0x0000ffffffffffffULL |
Lee Revell | b8112df | 2005-06-15 14:19:03 -0400 | [diff] [blame] | 18 | #define DMA_40BIT_MASK 0x000000ffffffffffULL |
| 19 | #define DMA_39BIT_MASK 0x0000007fffffffffULL |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | #define DMA_32BIT_MASK 0x00000000ffffffffULL |
Lee Revell | b8112df | 2005-06-15 14:19:03 -0400 | [diff] [blame] | 21 | #define DMA_31BIT_MASK 0x000000007fffffffULL |
| 22 | #define DMA_30BIT_MASK 0x000000003fffffffULL |
| 23 | #define DMA_29BIT_MASK 0x000000001fffffffULL |
Tobias Klauser | 9d2f928 | 2006-03-22 10:53:19 +0100 | [diff] [blame] | 24 | #define DMA_28BIT_MASK 0x000000000fffffffULL |
Tobias Klauser | 56b146d | 2006-04-10 22:54:21 -0700 | [diff] [blame] | 25 | #define DMA_24BIT_MASK 0x0000000000ffffffULL |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | |
Rolf Eike Beer | d6bd3a3 | 2006-09-29 01:59:48 -0700 | [diff] [blame] | 27 | static inline int valid_dma_direction(int dma_direction) |
| 28 | { |
| 29 | return ((dma_direction == DMA_BIDIRECTIONAL) || |
| 30 | (dma_direction == DMA_TO_DEVICE) || |
| 31 | (dma_direction == DMA_FROM_DEVICE)); |
| 32 | } |
| 33 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | #include <asm/dma-mapping.h> |
| 35 | |
| 36 | /* Backwards compat, remove in 2.7.x */ |
| 37 | #define dma_sync_single dma_sync_single_for_cpu |
| 38 | #define dma_sync_sg dma_sync_sg_for_cpu |
| 39 | |
| 40 | extern u64 dma_get_required_mask(struct device *dev); |
| 41 | |
| 42 | /* flags for the coherent memory api */ |
| 43 | #define DMA_MEMORY_MAP 0x01 |
| 44 | #define DMA_MEMORY_IO 0x02 |
| 45 | #define DMA_MEMORY_INCLUDES_CHILDREN 0x04 |
| 46 | #define DMA_MEMORY_EXCLUSIVE 0x08 |
| 47 | |
| 48 | #ifndef ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY |
| 49 | static inline int |
| 50 | dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr, |
| 51 | dma_addr_t device_addr, size_t size, int flags) |
| 52 | { |
| 53 | return 0; |
| 54 | } |
| 55 | |
| 56 | static inline void |
| 57 | dma_release_declared_memory(struct device *dev) |
| 58 | { |
| 59 | } |
| 60 | |
| 61 | static inline void * |
| 62 | dma_mark_declared_memory_occupied(struct device *dev, |
| 63 | dma_addr_t device_addr, size_t size) |
| 64 | { |
| 65 | return ERR_PTR(-EBUSY); |
| 66 | } |
| 67 | #endif |
| 68 | |
| 69 | #endif |
| 70 | |
| 71 | |