Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _ASM_SWIOTLB_H |
Jan Beulich | cde14bb | 2007-02-05 18:46:40 -0800 | [diff] [blame] | 2 | #define _ASM_SWIOTLB_H 1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | |
Muli Ben-Yehuda | 17a941d | 2006-01-11 22:44:42 +0100 | [diff] [blame] | 4 | #include <asm/dma-mapping.h> |
| 5 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | /* SWIOTLB interface */ |
| 7 | |
Muli Ben-Yehuda | 17a941d | 2006-01-11 22:44:42 +0100 | [diff] [blame] | 8 | extern dma_addr_t swiotlb_map_single(struct device *hwdev, void *ptr, |
| 9 | size_t size, int dir); |
| 10 | extern void *swiotlb_alloc_coherent(struct device *hwdev, size_t size, |
Joe Perches | a4c2d7d | 2008-03-23 01:03:37 -0700 | [diff] [blame] | 11 | dma_addr_t *dma_handle, gfp_t flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | extern void swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr, |
Joe Perches | a4c2d7d | 2008-03-23 01:03:37 -0700 | [diff] [blame] | 13 | size_t size, int dir); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | extern void swiotlb_sync_single_for_cpu(struct device *hwdev, |
Joe Perches | a4c2d7d | 2008-03-23 01:03:37 -0700 | [diff] [blame] | 15 | dma_addr_t dev_addr, |
| 16 | size_t size, int dir); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | extern void swiotlb_sync_single_for_device(struct device *hwdev, |
Joe Perches | a4c2d7d | 2008-03-23 01:03:37 -0700 | [diff] [blame] | 18 | dma_addr_t dev_addr, |
| 19 | size_t size, int dir); |
John W. Linville | 878a97c | 2005-09-29 14:44:23 -0700 | [diff] [blame] | 20 | extern void swiotlb_sync_single_range_for_cpu(struct device *hwdev, |
| 21 | dma_addr_t dev_addr, |
| 22 | unsigned long offset, |
| 23 | size_t size, int dir); |
| 24 | extern void swiotlb_sync_single_range_for_device(struct device *hwdev, |
| 25 | dma_addr_t dev_addr, |
| 26 | unsigned long offset, |
| 27 | size_t size, int dir); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | extern void swiotlb_sync_sg_for_cpu(struct device *hwdev, |
Joe Perches | a4c2d7d | 2008-03-23 01:03:37 -0700 | [diff] [blame] | 29 | struct scatterlist *sg, int nelems, |
| 30 | int dir); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | extern void swiotlb_sync_sg_for_device(struct device *hwdev, |
Joe Perches | a4c2d7d | 2008-03-23 01:03:37 -0700 | [diff] [blame] | 32 | struct scatterlist *sg, int nelems, |
| 33 | int dir); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | extern int swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, |
Joe Perches | a4c2d7d | 2008-03-23 01:03:37 -0700 | [diff] [blame] | 35 | int nents, int direction); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | extern void swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, |
Joe Perches | a4c2d7d | 2008-03-23 01:03:37 -0700 | [diff] [blame] | 37 | int nents, int direction); |
FUJITA Tomonori | 8d8bb39 | 2008-07-25 19:44:49 -0700 | [diff] [blame^] | 38 | extern int swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr); |
Joe Perches | a4c2d7d | 2008-03-23 01:03:37 -0700 | [diff] [blame] | 39 | extern void swiotlb_free_coherent(struct device *hwdev, size_t size, |
| 40 | void *vaddr, dma_addr_t dma_handle); |
Muli Ben-Yehuda | 17a941d | 2006-01-11 22:44:42 +0100 | [diff] [blame] | 41 | extern int swiotlb_dma_supported(struct device *hwdev, u64 mask); |
| 42 | extern void swiotlb_init(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | |
Andi Kleen | 65f87d8 | 2006-07-29 21:42:49 +0200 | [diff] [blame] | 44 | extern int swiotlb_force; |
| 45 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | #ifdef CONFIG_SWIOTLB |
| 47 | extern int swiotlb; |
FUJITA Tomonori | be54f9d | 2008-07-11 10:23:45 +0900 | [diff] [blame] | 48 | extern void pci_swiotlb_init(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | #else |
| 50 | #define swiotlb 0 |
FUJITA Tomonori | be54f9d | 2008-07-11 10:23:45 +0900 | [diff] [blame] | 51 | static inline void pci_swiotlb_init(void) |
| 52 | { |
| 53 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | #endif |
| 55 | |
Jan Beulich | cde14bb | 2007-02-05 18:46:40 -0800 | [diff] [blame] | 56 | static inline void dma_mark_clean(void *addr, size_t size) {} |
| 57 | |
| 58 | #endif /* _ASM_SWIOTLB_H */ |