Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _M68K_DMA_MAPPING_H |
| 2 | #define _M68K_DMA_MAPPING_H |
| 3 | |
Roman Zippel | 742636f | 2006-06-25 05:46:57 -0700 | [diff] [blame] | 4 | #include <asm/cache.h> |
| 5 | |
Roman Zippel | b035c96 | 2006-06-25 05:46:56 -0700 | [diff] [blame] | 6 | struct scatterlist; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | |
Al Viro | 58ba81d | 2006-10-09 02:11:47 +0100 | [diff] [blame] | 8 | #ifndef CONFIG_MMU_SUN3 |
Roman Zippel | b035c96 | 2006-06-25 05:46:56 -0700 | [diff] [blame] | 9 | static inline int dma_supported(struct device *dev, u64 mask) |
| 10 | { |
| 11 | return 1; |
| 12 | } |
| 13 | |
| 14 | static inline int dma_set_mask(struct device *dev, u64 mask) |
| 15 | { |
| 16 | return 0; |
| 17 | } |
| 18 | |
Roman Zippel | 742636f | 2006-06-25 05:46:57 -0700 | [diff] [blame] | 19 | static inline int dma_get_cache_alignment(void) |
| 20 | { |
| 21 | return 1 << L1_CACHE_SHIFT; |
| 22 | } |
| 23 | |
Ralf Baechle | f67637e | 2006-12-06 20:38:54 -0800 | [diff] [blame] | 24 | static inline int dma_is_consistent(struct device *dev, dma_addr_t dma_addr) |
Roman Zippel | 742636f | 2006-06-25 05:46:57 -0700 | [diff] [blame] | 25 | { |
| 26 | return 0; |
| 27 | } |
| 28 | |
Roman Zippel | b035c96 | 2006-06-25 05:46:56 -0700 | [diff] [blame] | 29 | extern void *dma_alloc_coherent(struct device *, size_t, |
Al Viro | dc36670 | 2006-10-06 00:43:58 -0700 | [diff] [blame] | 30 | dma_addr_t *, gfp_t); |
Roman Zippel | b035c96 | 2006-06-25 05:46:56 -0700 | [diff] [blame] | 31 | extern void dma_free_coherent(struct device *, size_t, |
| 32 | void *, dma_addr_t); |
| 33 | |
Roman Zippel | 742636f | 2006-06-25 05:46:57 -0700 | [diff] [blame] | 34 | static inline void *dma_alloc_noncoherent(struct device *dev, size_t size, |
Al Viro | 6930043 | 2007-03-14 09:20:40 +0000 | [diff] [blame] | 35 | dma_addr_t *handle, gfp_t flag) |
Roman Zippel | 742636f | 2006-06-25 05:46:57 -0700 | [diff] [blame] | 36 | { |
| 37 | return dma_alloc_coherent(dev, size, handle, flag); |
| 38 | } |
| 39 | static inline void dma_free_noncoherent(struct device *dev, size_t size, |
| 40 | void *addr, dma_addr_t handle) |
| 41 | { |
| 42 | dma_free_coherent(dev, size, addr, handle); |
| 43 | } |
Ralf Baechle | d3fa72e | 2006-12-06 20:38:56 -0800 | [diff] [blame] | 44 | static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, |
Roman Zippel | 742636f | 2006-06-25 05:46:57 -0700 | [diff] [blame] | 45 | enum dma_data_direction dir) |
| 46 | { |
| 47 | /* we use coherent allocation, so not much to do here. */ |
| 48 | } |
| 49 | |
Roman Zippel | b035c96 | 2006-06-25 05:46:56 -0700 | [diff] [blame] | 50 | extern dma_addr_t dma_map_single(struct device *, void *, size_t, |
| 51 | enum dma_data_direction); |
| 52 | static inline void dma_unmap_single(struct device *dev, dma_addr_t addr, |
| 53 | size_t size, enum dma_data_direction dir) |
| 54 | { |
| 55 | } |
| 56 | |
| 57 | extern dma_addr_t dma_map_page(struct device *, struct page *, |
| 58 | unsigned long, size_t size, |
| 59 | enum dma_data_direction); |
| 60 | static inline void dma_unmap_page(struct device *dev, dma_addr_t address, |
| 61 | size_t size, enum dma_data_direction dir) |
| 62 | { |
| 63 | } |
| 64 | |
| 65 | extern int dma_map_sg(struct device *, struct scatterlist *, int, |
| 66 | enum dma_data_direction); |
| 67 | static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg, |
| 68 | int nhwentries, enum dma_data_direction dir) |
| 69 | { |
| 70 | } |
| 71 | |
| 72 | extern void dma_sync_single_for_device(struct device *, dma_addr_t, size_t, |
| 73 | enum dma_data_direction); |
| 74 | extern void dma_sync_sg_for_device(struct device *, struct scatterlist *, int, |
| 75 | enum dma_data_direction); |
| 76 | |
| 77 | static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle, |
| 78 | size_t size, enum dma_data_direction dir) |
| 79 | { |
| 80 | } |
| 81 | |
| 82 | static inline void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, |
| 83 | int nents, enum dma_data_direction dir) |
| 84 | { |
| 85 | } |
| 86 | |
FUJITA Tomonori | 8d8bb39 | 2008-07-25 19:44:49 -0700 | [diff] [blame] | 87 | static inline int dma_mapping_error(struct device *dev, dma_addr_t handle) |
Roman Zippel | b035c96 | 2006-06-25 05:46:56 -0700 | [diff] [blame] | 88 | { |
| 89 | return 0; |
| 90 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | |
Al Viro | 58ba81d | 2006-10-09 02:11:47 +0100 | [diff] [blame] | 92 | #else |
| 93 | #include <asm-generic/dma-mapping-broken.h> |
| 94 | #endif |
| 95 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | #endif /* _M68K_DMA_MAPPING_H */ |