blob: 60757efd1353b9770fc240008955c9dcbfd1ae10 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _ASM_SWIOTLB_H
2#define _ASM_SWTIOLB_H 1
3
4#include <linux/config.h>
5
Muli Ben-Yehuda17a941d2006-01-11 22:44:42 +01006#include <asm/dma-mapping.h>
7
Linus Torvalds1da177e2005-04-16 15:20:36 -07008/* SWIOTLB interface */
9
Muli Ben-Yehuda17a941d2006-01-11 22:44:42 +010010extern dma_addr_t swiotlb_map_single(struct device *hwdev, void *ptr,
11 size_t size, int dir);
12extern void *swiotlb_alloc_coherent(struct device *hwdev, size_t size,
13 dma_addr_t *dma_handle, gfp_t flags);
Linus Torvalds1da177e2005-04-16 15:20:36 -070014extern void swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr,
15 size_t size, int dir);
16extern void swiotlb_sync_single_for_cpu(struct device *hwdev,
17 dma_addr_t dev_addr,
18 size_t size, int dir);
19extern void swiotlb_sync_single_for_device(struct device *hwdev,
20 dma_addr_t dev_addr,
21 size_t size, int dir);
John W. Linville878a97c2005-09-29 14:44:23 -070022extern void swiotlb_sync_single_range_for_cpu(struct device *hwdev,
23 dma_addr_t dev_addr,
24 unsigned long offset,
25 size_t size, int dir);
26extern void swiotlb_sync_single_range_for_device(struct device *hwdev,
27 dma_addr_t dev_addr,
28 unsigned long offset,
29 size_t size, int dir);
Linus Torvalds1da177e2005-04-16 15:20:36 -070030extern void swiotlb_sync_sg_for_cpu(struct device *hwdev,
31 struct scatterlist *sg, int nelems,
32 int dir);
33extern void swiotlb_sync_sg_for_device(struct device *hwdev,
34 struct scatterlist *sg, int nelems,
35 int dir);
36extern int swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg,
37 int nents, int direction);
38extern void swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg,
39 int nents, int direction);
40extern int swiotlb_dma_mapping_error(dma_addr_t dma_addr);
Linus Torvalds1da177e2005-04-16 15:20:36 -070041extern void swiotlb_free_coherent (struct device *hwdev, size_t size,
42 void *vaddr, dma_addr_t dma_handle);
Muli Ben-Yehuda17a941d2006-01-11 22:44:42 +010043extern int swiotlb_dma_supported(struct device *hwdev, u64 mask);
44extern void swiotlb_init(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070045
46#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
54#endif /* _ASM_SWTIOLB_H */