dma-iommu.h 930 字节
Newer Older
1 2 3 4 5 6 7 8 9
#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>
10
#include <linux/kref.h>
11 12 13 14 15

struct dma_iommu_mapping {
	/* iommu specific data */
	struct iommu_domain	*domain;

16 17 18 19 20
	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 */
21 22 23 24 25 26 27
	dma_addr_t		base;

	spinlock_t		lock;
	struct kref		kref;
};

struct dma_iommu_mapping *
28
arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size);
29 30 31 32 33

void arm_iommu_release_mapping(struct dma_iommu_mapping *mapping);

int arm_iommu_attach_device(struct device *dev,
					struct dma_iommu_mapping *mapping);
34
void arm_iommu_detach_device(struct device *dev);
35 36 37

#endif /* __KERNEL__ */
#endif