diff options
Diffstat (limited to 'arch/alpha/kernel/pci_iommu.c')
-rw-r--r-- | arch/alpha/kernel/pci_iommu.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c index e07a23fc5b74..4e1c08636edd 100644 --- a/arch/alpha/kernel/pci_iommu.c +++ b/arch/alpha/kernel/pci_iommu.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/scatterlist.h> | 10 | #include <linux/scatterlist.h> |
11 | #include <linux/log2.h> | 11 | #include <linux/log2.h> |
12 | #include <linux/dma-mapping.h> | 12 | #include <linux/dma-mapping.h> |
13 | #include <linux/iommu-helper.h> | ||
13 | 14 | ||
14 | #include <asm/io.h> | 15 | #include <asm/io.h> |
15 | #include <asm/hwrpb.h> | 16 | #include <asm/hwrpb.h> |
@@ -125,14 +126,6 @@ iommu_arena_new(struct pci_controller *hose, dma_addr_t base, | |||
125 | return iommu_arena_new_node(0, hose, base, window_size, align); | 126 | return iommu_arena_new_node(0, hose, base, window_size, align); |
126 | } | 127 | } |
127 | 128 | ||
128 | static inline int is_span_boundary(unsigned int index, unsigned int nr, | ||
129 | unsigned long shift, | ||
130 | unsigned long boundary_size) | ||
131 | { | ||
132 | shift = (shift + index) & (boundary_size - 1); | ||
133 | return shift + nr > boundary_size; | ||
134 | } | ||
135 | |||
136 | /* Must be called with the arena lock held */ | 129 | /* Must be called with the arena lock held */ |
137 | static long | 130 | static long |
138 | iommu_arena_find_pages(struct device *dev, struct pci_iommu_arena *arena, | 131 | iommu_arena_find_pages(struct device *dev, struct pci_iommu_arena *arena, |
@@ -147,7 +140,6 @@ iommu_arena_find_pages(struct device *dev, struct pci_iommu_arena *arena, | |||
147 | base = arena->dma_base >> PAGE_SHIFT; | 140 | base = arena->dma_base >> PAGE_SHIFT; |
148 | if (dev) { | 141 | if (dev) { |
149 | boundary_size = dma_get_seg_boundary(dev) + 1; | 142 | boundary_size = dma_get_seg_boundary(dev) + 1; |
150 | BUG_ON(!is_power_of_2(boundary_size)); | ||
151 | boundary_size >>= PAGE_SHIFT; | 143 | boundary_size >>= PAGE_SHIFT; |
152 | } else { | 144 | } else { |
153 | boundary_size = 1UL << (32 - PAGE_SHIFT); | 145 | boundary_size = 1UL << (32 - PAGE_SHIFT); |
@@ -161,7 +153,7 @@ iommu_arena_find_pages(struct device *dev, struct pci_iommu_arena *arena, | |||
161 | 153 | ||
162 | again: | 154 | again: |
163 | while (i < n && p+i < nent) { | 155 | while (i < n && p+i < nent) { |
164 | if (!i && is_span_boundary(p, n, base, boundary_size)) { | 156 | if (!i && iommu_is_span_boundary(p, n, base, boundary_size)) { |
165 | p = ALIGN(p + 1, mask + 1); | 157 | p = ALIGN(p + 1, mask + 1); |
166 | goto again; | 158 | goto again; |
167 | } | 159 | } |