xen: cleancache shim to Xen Transcendent Memory
[linux-2.6/next.git] / include / linux / iommu-helper.h
blob86bdeffe43ad69e3dba2781eeed06b8cbe847a69
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,
7 unsigned long offset,
8 u64 dma_mask)
10 if (size + offset > dma_mask)
11 return dma_mask - offset + 1;
12 else
13 return size;
16 extern int iommu_is_span_boundary(unsigned int index, unsigned int nr,
17 unsigned long shift,
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,
21 unsigned long shift,
22 unsigned long boundary_size,
23 unsigned long align_mask);
25 static inline unsigned long iommu_num_pages(unsigned long addr,
26 unsigned long len,
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);
34 #endif