blob: f9c589539a82b7c11fae1425c5782b5189db9cc1 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _ASM_SWIOTLB_H
Jan Beulichcde14bb2007-02-05 18:46:40 -08002#define _ASM_SWIOTLB_H 1
Linus Torvalds1da177e2005-04-16 15:20:36 -07003
Muli Ben-Yehuda17a941d2006-01-11 22:44:42 +01004#include <asm/dma-mapping.h>
5
Linus Torvalds1da177e2005-04-16 15:20:36 -07006/* SWIOTLB interface */
7
Muli Ben-Yehuda17a941d2006-01-11 22:44:42 +01008extern dma_addr_t swiotlb_map_single(struct device *hwdev, void *ptr,
9 size_t size, int dir);
10extern void *swiotlb_alloc_coherent(struct device *hwdev, size_t size,
11 dma_addr_t *dma_handle, gfp_t flags);
Linus Torvalds1da177e2005-04-16 15:20:36 -070012extern void swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr,
13 size_t size, int dir);
14extern void swiotlb_sync_single_for_cpu(struct device *hwdev,
15 dma_addr_t dev_addr,
16 size_t size, int dir);
17extern void swiotlb_sync_single_for_device(struct device *hwdev,
18 dma_addr_t dev_addr,
19 size_t size, int dir);
John W. Linville878a97c2005-09-29 14:44:23 -070020extern 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);
24extern 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 Torvalds1da177e2005-04-16 15:20:36 -070028extern void swiotlb_sync_sg_for_cpu(struct device *hwdev,
29 struct scatterlist *sg, int nelems,
30 int dir);
31extern void swiotlb_sync_sg_for_device(struct device *hwdev,
32 struct scatterlist *sg, int nelems,
33 int dir);
34extern int swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg,
35 int nents, int direction);
36extern void swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg,
37 int nents, int direction);
38extern int swiotlb_dma_mapping_error(dma_addr_t dma_addr);
Linus Torvalds1da177e2005-04-16 15:20:36 -070039extern void swiotlb_free_coherent (struct device *hwdev, size_t size,
40 void *vaddr, dma_addr_t dma_handle);
Muli Ben-Yehuda17a941d2006-01-11 22:44:42 +010041extern int swiotlb_dma_supported(struct device *hwdev, u64 mask);
42extern void swiotlb_init(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070043
Andi Kleen65f87d82006-07-29 21:42:49 +020044extern int swiotlb_force;
45
Linus Torvalds1da177e2005-04-16 15:20:36 -070046#ifdef CONFIG_SWIOTLB
47extern int swiotlb;
48#else
49#define swiotlb 0
50#endif
51
Muli Ben-Yehuda17a941d2006-01-11 22:44:42 +010052extern void pci_swiotlb_init(void);
53
Jan Beulichcde14bb2007-02-05 18:46:40 -080054static inline void dma_mark_clean(void *addr, size_t size) {}
55
56#endif /* _ASM_SWIOTLB_H */