blob: a0083be5d5295157bc11b82a343b58f798488bb8 [file] [log] [blame]
Konrad Rzeszutek Wilkb0971862010-05-11 10:05:49 -04001#ifndef __LINUX_SWIOTLB_XEN_H
2#define __LINUX_SWIOTLB_XEN_H
3
Stefano Stabellini6fe19272013-11-04 17:54:27 +00004#include <linux/dma-direction.h>
Konrad Rzeszutek Wilkb0971862010-05-11 10:05:49 -04005#include <linux/swiotlb.h>
6
Konrad Rzeszutek Wilkb8277602012-08-23 14:36:15 -04007extern int xen_swiotlb_init(int verbose, bool early);
Konrad Rzeszutek Wilkb0971862010-05-11 10:05:49 -04008
9extern void
10*xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size,
Andrzej Pietrasiewiczbaa676f2012-03-27 14:28:18 +020011 dma_addr_t *dma_handle, gfp_t flags,
Krzysztof Kozlowski00085f12016-08-03 13:46:00 -070012 unsigned long attrs);
Konrad Rzeszutek Wilkb0971862010-05-11 10:05:49 -040013
14extern void
15xen_swiotlb_free_coherent(struct device *hwdev, size_t size,
Andrzej Pietrasiewiczbaa676f2012-03-27 14:28:18 +020016 void *vaddr, dma_addr_t dma_handle,
Krzysztof Kozlowski00085f12016-08-03 13:46:00 -070017 unsigned long attrs);
Konrad Rzeszutek Wilkb0971862010-05-11 10:05:49 -040018
19extern dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
20 unsigned long offset, size_t size,
21 enum dma_data_direction dir,
Krzysztof Kozlowski00085f12016-08-03 13:46:00 -070022 unsigned long attrs);
Konrad Rzeszutek Wilkb0971862010-05-11 10:05:49 -040023
24extern void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
25 size_t size, enum dma_data_direction dir,
Krzysztof Kozlowski00085f12016-08-03 13:46:00 -070026 unsigned long attrs);
Konrad Rzeszutek Wilkb0971862010-05-11 10:05:49 -040027extern int
28xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
29 int nelems, enum dma_data_direction dir,
Krzysztof Kozlowski00085f12016-08-03 13:46:00 -070030 unsigned long attrs);
Konrad Rzeszutek Wilkb0971862010-05-11 10:05:49 -040031
32extern void
33xen_swiotlb_unmap_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
34 int nelems, enum dma_data_direction dir,
Krzysztof Kozlowski00085f12016-08-03 13:46:00 -070035 unsigned long attrs);
Konrad Rzeszutek Wilkb0971862010-05-11 10:05:49 -040036
37extern void
38xen_swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr,
39 size_t size, enum dma_data_direction dir);
40
41extern void
42xen_swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg,
43 int nelems, enum dma_data_direction dir);
44
45extern void
46xen_swiotlb_sync_single_for_device(struct device *hwdev, dma_addr_t dev_addr,
47 size_t size, enum dma_data_direction dir);
48
49extern void
50xen_swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
51 int nelems, enum dma_data_direction dir);
52
53extern int
Konrad Rzeszutek Wilkb0971862010-05-11 10:05:49 -040054xen_swiotlb_dma_supported(struct device *hwdev, u64 mask);
55
Stefano Stabellinieb1ddc02013-10-09 16:56:33 +000056extern int
57xen_swiotlb_set_dma_mask(struct device *dev, u64 dma_mask);
Konrad Rzeszutek Wilkb0971862010-05-11 10:05:49 -040058#endif /* __LINUX_SWIOTLB_XEN_H */