Thomas Gleixner | 1e19b16 | 2008-10-06 14:15:24 +0200 | [diff] [blame] | 1 | #ifndef _LINUX_IOMMU_HELPER_H |
| 2 | #define _LINUX_IOMMU_HELPER_H |
| 3 | |
FUJITA Tomonori | eecfffc | 2008-09-12 19:42:33 +0900 | [diff] [blame] | 4 | static inline unsigned long iommu_device_max_index(unsigned long size, |
| 5 | unsigned long offset, |
| 6 | u64 dma_mask) |
| 7 | { |
| 8 | if (size + offset > dma_mask) |
| 9 | return dma_mask - offset + 1; |
| 10 | else |
| 11 | return size; |
| 12 | } |
| 13 | |
FUJITA Tomonori | 3715863 | 2008-03-04 14:29:27 -0800 | [diff] [blame] | 14 | extern int iommu_is_span_boundary(unsigned int index, unsigned int nr, |
| 15 | unsigned long shift, |
| 16 | unsigned long boundary_size); |
FUJITA Tomonori | d26dbc5 | 2008-09-22 22:35:07 +0900 | [diff] [blame] | 17 | extern void iommu_area_reserve(unsigned long *map, unsigned long i, int len); |
FUJITA Tomonori | 0291df8 | 2008-02-04 22:28:07 -0800 | [diff] [blame] | 18 | extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, |
| 19 | unsigned long start, unsigned int nr, |
| 20 | unsigned long shift, |
| 21 | unsigned long boundary_size, |
| 22 | unsigned long align_mask); |
| 23 | extern void iommu_area_free(unsigned long *map, unsigned long start, |
| 24 | unsigned int nr); |
Thomas Gleixner | 1e19b16 | 2008-10-06 14:15:24 +0200 | [diff] [blame] | 25 | |
Joerg Roedel | 56d9366 | 2008-10-15 22:02:10 -0700 | [diff] [blame] | 26 | extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len, |
| 27 | unsigned long io_page_size); |
| 28 | |
Thomas Gleixner | 1e19b16 | 2008-10-06 14:15:24 +0200 | [diff] [blame] | 29 | #endif |