• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <linux/types.h>
2 #include <linux/kernel.h>
3 #include <linux/module.h>
4 #include <linux/intel-iommu.h>
5 
6 void *
vtd_alloc_coherent(struct device * dev,size_t size,dma_addr_t * dma_handle,gfp_t flags)7 vtd_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
8 		 gfp_t flags)
9 {
10 	return intel_alloc_coherent(dev, size, dma_handle, flags);
11 }
12 EXPORT_SYMBOL_GPL(vtd_alloc_coherent);
13 
14 void
vtd_free_coherent(struct device * dev,size_t size,void * vaddr,dma_addr_t dma_handle)15 vtd_free_coherent(struct device *dev, size_t size, void *vaddr,
16 		 dma_addr_t dma_handle)
17 {
18 	intel_free_coherent(dev, size, vaddr, dma_handle);
19 }
20 EXPORT_SYMBOL_GPL(vtd_free_coherent);
21 
22 dma_addr_t
vtd_map_single_attrs(struct device * dev,void * addr,size_t size,int dir,struct dma_attrs * attrs)23 vtd_map_single_attrs(struct device *dev, void *addr, size_t size,
24 		     int dir, struct dma_attrs *attrs)
25 {
26 	return intel_map_single(dev, (phys_addr_t)addr, size, dir);
27 }
28 EXPORT_SYMBOL_GPL(vtd_map_single_attrs);
29 
30 void
vtd_unmap_single_attrs(struct device * dev,dma_addr_t iova,size_t size,int dir,struct dma_attrs * attrs)31 vtd_unmap_single_attrs(struct device *dev, dma_addr_t iova, size_t size,
32 		       int dir, struct dma_attrs *attrs)
33 {
34 	intel_unmap_single(dev, iova, size, dir);
35 }
36 EXPORT_SYMBOL_GPL(vtd_unmap_single_attrs);
37 
38 int
vtd_map_sg_attrs(struct device * dev,struct scatterlist * sglist,int nents,int dir,struct dma_attrs * attrs)39 vtd_map_sg_attrs(struct device *dev, struct scatterlist *sglist, int nents,
40 		 int dir, struct dma_attrs *attrs)
41 {
42 	return intel_map_sg(dev, sglist, nents, dir);
43 }
44 EXPORT_SYMBOL_GPL(vtd_map_sg_attrs);
45 
46 void
vtd_unmap_sg_attrs(struct device * dev,struct scatterlist * sglist,int nents,int dir,struct dma_attrs * attrs)47 vtd_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist,
48 		   int nents, int dir, struct dma_attrs *attrs)
49 {
50 	intel_unmap_sg(dev, sglist, nents, dir);
51 }
52 EXPORT_SYMBOL_GPL(vtd_unmap_sg_attrs);
53 
54 int
vtd_dma_mapping_error(struct device * dev,dma_addr_t dma_addr)55 vtd_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
56 {
57 	return 0;
58 }
59 EXPORT_SYMBOL_GPL(vtd_dma_mapping_error);
60