1 #ifndef _LINUX_IOMMU_HELPER_H
2 #define _LINUX_IOMMU_HELPER_H
4 #include <linux/kernel.h>
6 static inline unsigned long iommu_device_max_index(unsigned long size,
10 if (size + offset > dma_mask)
11 return dma_mask - offset + 1;
16 extern int iommu_is_span_boundary(unsigned int index, unsigned int nr,
18 unsigned long boundary_size);
19 extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
20 unsigned long start, unsigned int nr,
22 unsigned long boundary_size,
23 unsigned long align_mask);
25 static inline unsigned long iommu_num_pages(unsigned long addr,
27 unsigned long io_page_size)
29 unsigned long size = (addr & (io_page_size - 1)) + len;
31 return DIV_ROUND_UP(size, io_page_size);