x86: move dma_map_page and dma_unmap_page to common header
[linux-2.6/mini2440.git] / include / asm-x86 / dma-mapping_32.h
blobc61ae7ff222c55ca788818638c6e76176d5cc1ad
1 #ifndef _ASM_I386_DMA_MAPPING_H
2 #define _ASM_I386_DMA_MAPPING_H
4 #include <linux/mm.h>
5 #include <linux/scatterlist.h>
7 #include <asm/cache.h>
8 #include <asm/io.h>
9 #include <asm/bug.h>
11 static inline int
12 dma_mapping_error(dma_addr_t dma_addr)
14 return 0;
17 extern int forbid_dac;
19 static inline int
20 dma_supported(struct device *dev, u64 mask)
23 * we fall back to GFP_DMA when the mask isn't all 1s,
24 * so we can't guarantee allocations that must be
25 * within a tighter range than GFP_DMA..
27 if(mask < 0x00ffffff)
28 return 0;
30 /* Work around chipset bugs */
31 if (forbid_dac > 0 && mask > 0xffffffffULL)
32 return 0;
34 return 1;
37 static inline int
38 dma_set_mask(struct device *dev, u64 mask)
40 if(!dev->dma_mask || !dma_supported(dev, mask))
41 return -EIO;
43 *dev->dma_mask = mask;
45 return 0;
48 static inline int
49 dma_get_cache_alignment(void)
51 /* no easy way to get cache size on all x86, so return the
52 * maximum possible, to be safe */
53 return (1 << INTERNODE_CACHE_SHIFT);
56 #define dma_is_consistent(d, h) (1)
58 static inline void
59 dma_cache_sync(struct device *dev, void *vaddr, size_t size,
60 enum dma_data_direction direction)
62 flush_write_buffers();
65 #define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
66 extern int
67 dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
68 dma_addr_t device_addr, size_t size, int flags);
70 extern void
71 dma_release_declared_memory(struct device *dev);
73 extern void *
74 dma_mark_declared_memory_occupied(struct device *dev,
75 dma_addr_t device_addr, size_t size);
77 #endif