diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2008-09-12 06:42:33 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-09-14 10:42:36 -0400 |
commit | eecfffc154ffbfe70686a9905c090b488778c28e (patch) | |
tree | 3bcbd7e67d198680fd16b217af2d78b59bba36c8 /include | |
parent | 6e03f99803195e5aaf7f247db31b0d11857ccc35 (diff) |
iommu: add iommu_device_max_index IOMMU helper function
This function helps IOMMUs to know the highest address that a device
can access to.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/iommu-helper.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h index c975caf75385..58f41107e4ae 100644 --- a/include/linux/iommu-helper.h +++ b/include/linux/iommu-helper.h | |||
@@ -1,3 +1,13 @@ | |||
1 | static inline unsigned long iommu_device_max_index(unsigned long size, | ||
2 | unsigned long offset, | ||
3 | u64 dma_mask) | ||
4 | { | ||
5 | if (size + offset > dma_mask) | ||
6 | return dma_mask - offset + 1; | ||
7 | else | ||
8 | return size; | ||
9 | } | ||
10 | |||
1 | extern int iommu_is_span_boundary(unsigned int index, unsigned int nr, | 11 | extern int iommu_is_span_boundary(unsigned int index, unsigned int nr, |
2 | unsigned long shift, | 12 | unsigned long shift, |
3 | unsigned long boundary_size); | 13 | unsigned long boundary_size); |