2012-05-16 21:48:21 +08:00
|
|
|
#ifndef ASMARM_DMA_IOMMU_H
|
|
|
|
#define ASMARM_DMA_IOMMU_H
|
|
|
|
|
|
|
|
#ifdef __KERNEL__
|
|
|
|
|
|
|
|
#include <linux/mm_types.h>
|
|
|
|
#include <linux/scatterlist.h>
|
|
|
|
#include <linux/dma-debug.h>
|
|
|
|
#include <linux/kmemcheck.h>
|
2012-12-16 20:32:03 +08:00
|
|
|
#include <linux/kref.h>
|
2012-05-16 21:48:21 +08:00
|
|
|
|
2017-05-22 16:53:03 +08:00
|
|
|
#define ARM_MAPPING_ERROR (~(dma_addr_t)0x0)
|
|
|
|
|
2012-05-16 21:48:21 +08:00
|
|
|
struct dma_iommu_mapping {
|
|
|
|
/* iommu specific data */
|
|
|
|
struct iommu_domain *domain;
|
|
|
|
|
2014-02-25 20:09:53 +08:00
|
|
|
unsigned long **bitmaps; /* array of bitmaps */
|
|
|
|
unsigned int nr_bitmaps; /* nr of elements in array */
|
|
|
|
unsigned int extensions;
|
|
|
|
size_t bitmap_size; /* size of a single bitmap */
|
|
|
|
size_t bits; /* per bitmap */
|
2012-05-16 21:48:21 +08:00
|
|
|
dma_addr_t base;
|
|
|
|
|
|
|
|
spinlock_t lock;
|
|
|
|
struct kref kref;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct dma_iommu_mapping *
|
2015-04-29 18:29:19 +08:00
|
|
|
arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, u64 size);
|
2012-05-16 21:48:21 +08:00
|
|
|
|
|
|
|
void arm_iommu_release_mapping(struct dma_iommu_mapping *mapping);
|
|
|
|
|
|
|
|
int arm_iommu_attach_device(struct device *dev,
|
|
|
|
struct dma_iommu_mapping *mapping);
|
2013-01-24 21:16:57 +08:00
|
|
|
void arm_iommu_detach_device(struct device *dev);
|
2012-05-16 21:48:21 +08:00
|
|
|
|
|
|
|
#endif /* __KERNEL__ */
|
|
|
|
#endif
|