blob: f5d9e74b1e4ab70a718886961113cafbdb2f4fcc [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,
Joe Perchesa4c2d7d2008-03-23 01:03:37 -070011 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,
Joe Perchesa4c2d7d2008-03-23 01:03:37 -070013 size_t size, int dir);
Linus Torvalds1da177e2005-04-16 15:20:36 -070014extern void swiotlb_sync_single_for_cpu(struct device *hwdev,
Joe Perchesa4c2d7d2008-03-23 01:03:37 -070015 dma_addr_t dev_addr,
16 size_t size, int dir);
Linus Torvalds1da177e2005-04-16 15:20:36 -070017extern void swiotlb_sync_single_for_device(struct device *hwdev,
Joe Perchesa4c2d7d2008-03-23 01:03:37 -070018 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,
Joe Perchesa4c2d7d2008-03-23 01:03:37 -070029 struct scatterlist *sg, int nelems,
30 int dir);
Linus Torvalds1da177e2005-04-16 15:20:36 -070031extern void swiotlb_sync_sg_for_device(struct device *hwdev,
Joe Perchesa4c2d7d2008-03-23 01:03:37 -070032 struct scatterlist *sg, int nelems,
33 int dir);
Linus Torvalds1da177e2005-04-16 15:20:36 -070034extern int swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg,
Joe Perchesa4c2d7d2008-03-23 01:03:37 -070035 int nents, int direction);
Linus Torvalds1da177e2005-04-16 15:20:36 -070036extern void swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg,
Joe Perchesa4c2d7d2008-03-23 01:03:37 -070037 int nents, int direction);
Linus Torvalds1da177e2005-04-16 15:20:36 -070038extern int swiotlb_dma_mapping_error(dma_addr_t dma_addr);
Joe Perchesa4c2d7d2008-03-23 01:03:37 -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 */