0001
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
0013 struct iommu_domain *domain;
0014
0015 unsigned long **bitmaps;
0016 unsigned int nr_bitmaps;
0017 unsigned int extensions;
0018 size_t bitmap_size;
0019 size_t bits;
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
0036 #endif