Rev 4568 | Rev 6588 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4568 | Rev 6102 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #ifndef _LINUX_DMA_MAPPING_H |
1 | #ifndef _LINUX_DMA_MAPPING_H |
2 | #define _LINUX_DMA_MAPPING_H |
2 | #define _LINUX_DMA_MAPPING_H |
Line -... | Line 3... | ||
- | 3 | ||
- | 4 | #include |
|
- | 5 | #include |
|
- | 6 | #include |
|
3 | 7 | #include |
|
4 | #include |
8 | #include |
Line -... | Line 9... | ||
- | 9 | #include |
|
- | 10 | ||
- | 11 | extern void * |
|
- | 12 | dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, |
|
- | 13 | gfp_t flag); |
|
- | 14 | #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) |
|
- | 15 | ||
- | 16 | #define DMA_MASK_NONE 0x0ULL |
|
- | 17 | ||
- | 18 | static inline int valid_dma_direction(int dma_direction) |
|
- | 19 | { |
|
- | 20 | return ((dma_direction == DMA_BIDIRECTIONAL) || |
|
- | 21 | (dma_direction == DMA_TO_DEVICE) || |
|
- | 22 | (dma_direction == DMA_FROM_DEVICE)); |
|
- | 23 | } |
|
- | 24 | ||
- | 25 | static inline int is_device_dma_capable(struct device *dev) |
|
- | 26 | { |
|
- | 27 | return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE; |
|
- | 28 | } |
|
- | 29 | #ifndef dma_max_pfn |
|
- | 30 | static inline unsigned long dma_max_pfn(struct device *dev) |
|
- | 31 | { |
|
- | 32 | return *dev->dma_mask >> PAGE_SHIFT; |
|
- | 33 | } |
|
- | 34 | #endif |
|
- | 35 | ||
- | 36 | static inline void *dma_zalloc_coherent(struct device *dev, size_t size, |
|
- | 37 | dma_addr_t *dma_handle, gfp_t flag) |
|
- | 38 | { |
|
- | 39 | void *ret = dma_alloc_coherent(dev, size, dma_handle, |
|
- | 40 | flag | __GFP_ZERO); |
|
Line 5... | Line 41... | ||
5 | #include |
41 | return ret; |