Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef ASMARM_DMA_IOMMU_H
0003 #define ASMARM_DMA_IOMMU_H
0004 
0005 #ifdef __KERNEL__
0006 
0007 #include <linux/mm_types.h>
0008 #include <linux/scatterlist.h>
0009 #include <linux/kref.h>
0010 
0011 struct dma_iommu_mapping {
0012     /* iommu specific data */
0013     struct iommu_domain *domain;
0014 
0015     unsigned long       **bitmaps;  /* array of bitmaps */
0016     unsigned int        nr_bitmaps; /* nr of elements in array */
0017     unsigned int        extensions;
0018     size_t          bitmap_size;    /* size of a single bitmap */
0019     size_t          bits;       /* per bitmap */
0020     dma_addr_t      base;
0021 
0022     spinlock_t      lock;
0023     struct kref     kref;
0024 };
0025 
0026 struct dma_iommu_mapping *
0027 arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, u64 size);
0028 
0029 void arm_iommu_release_mapping(struct dma_iommu_mapping *mapping);
0030 
0031 int arm_iommu_attach_device(struct device *dev,
0032                     struct dma_iommu_mapping *mapping);
0033 void arm_iommu_detach_device(struct device *dev);
0034 
0035 #endif /* __KERNEL__ */
0036 #endif