aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/iommu_common.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc64/kernel/iommu_common.h')
-rw-r--r--arch/sparc64/kernel/iommu_common.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/arch/sparc64/kernel/iommu_common.h b/arch/sparc64/kernel/iommu_common.h
index 0713bd58499c..f3575a614fa2 100644
--- a/arch/sparc64/kernel/iommu_common.h
+++ b/arch/sparc64/kernel/iommu_common.h
@@ -12,6 +12,7 @@
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <linux/scatterlist.h> 13#include <linux/scatterlist.h>
14#include <linux/device.h> 14#include <linux/device.h>
15#include <linux/iommu-helper.h>
15 16
16#include <asm/iommu.h> 17#include <asm/iommu.h>
17#include <asm/scatterlist.h> 18#include <asm/scatterlist.h>
@@ -45,17 +46,16 @@ static inline unsigned long iommu_num_pages(unsigned long vaddr,
45 return npages; 46 return npages;
46} 47}
47 48
48static inline unsigned long calc_npages(struct scatterlist *sglist, int nelems) 49static inline int is_span_boundary(unsigned long entry,
50 unsigned long shift,
51 unsigned long boundary_size,
52 struct scatterlist *outs,
53 struct scatterlist *sg)
49{ 54{
50 unsigned long i, npages = 0; 55 unsigned long paddr = SG_ENT_PHYS_ADDRESS(outs);
51 struct scatterlist *sg; 56 int nr = iommu_num_pages(paddr, outs->dma_length + sg->length);
52 57
53 for_each_sg(sglist, sg, nelems, i) { 58 return iommu_is_span_boundary(entry, nr, shift, boundary_size);
54 unsigned long paddr = SG_ENT_PHYS_ADDRESS(sg);
55 npages += iommu_num_pages(paddr, sg->length);
56 }
57
58 return npages;
59} 59}
60 60
61extern unsigned long iommu_range_alloc(struct device *dev, 61extern unsigned long iommu_range_alloc(struct device *dev,