aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64/kernel/u3_iommu.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ppc64/kernel/u3_iommu.c')
-rw-r--r--arch/ppc64/kernel/u3_iommu.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/arch/ppc64/kernel/u3_iommu.c b/arch/ppc64/kernel/u3_iommu.c
index 115cbdf3b13b..df9c775f4955 100644
--- a/arch/ppc64/kernel/u3_iommu.c
+++ b/arch/ppc64/kernel/u3_iommu.c
@@ -125,18 +125,21 @@ static void dart_build(struct iommu_table *tbl, long index,
125 125
126 DBG("dart: build at: %lx, %lx, addr: %x\n", index, npages, uaddr); 126 DBG("dart: build at: %lx, %lx, addr: %x\n", index, npages, uaddr);
127 127
128 index <<= DART_PAGE_FACTOR;
129 npages <<= DART_PAGE_FACTOR;
130
128 dp = ((unsigned int*)tbl->it_base) + index; 131 dp = ((unsigned int*)tbl->it_base) + index;
129 132
130 /* On U3, all memory is contigous, so we can move this 133 /* On U3, all memory is contigous, so we can move this
131 * out of the loop. 134 * out of the loop.
132 */ 135 */
133 while (npages--) { 136 while (npages--) {
134 rpn = virt_to_abs(uaddr) >> PAGE_SHIFT; 137 rpn = virt_to_abs(uaddr) >> DART_PAGE_SHIFT;
135 138
136 *(dp++) = DARTMAP_VALID | (rpn & DARTMAP_RPNMASK); 139 *(dp++) = DARTMAP_VALID | (rpn & DARTMAP_RPNMASK);
137 140
138 rpn++; 141 rpn++;
139 uaddr += PAGE_SIZE; 142 uaddr += DART_PAGE_SIZE;
140 } 143 }
141 144
142 dart_dirty = 1; 145 dart_dirty = 1;
@@ -154,6 +157,9 @@ static void dart_free(struct iommu_table *tbl, long index, long npages)
154 157
155 DBG("dart: free at: %lx, %lx\n", index, npages); 158 DBG("dart: free at: %lx, %lx\n", index, npages);
156 159
160 index <<= DART_PAGE_FACTOR;
161 npages <<= DART_PAGE_FACTOR;
162
157 dp = ((unsigned int *)tbl->it_base) + index; 163 dp = ((unsigned int *)tbl->it_base) + index;
158 164
159 while (npages--) 165 while (npages--)
@@ -182,10 +188,10 @@ static int dart_init(struct device_node *dart_node)
182 * that to work around what looks like a problem with the HT bridge 188 * that to work around what looks like a problem with the HT bridge
183 * prefetching into invalid pages and corrupting data 189 * prefetching into invalid pages and corrupting data
184 */ 190 */
185 tmp = lmb_alloc(PAGE_SIZE, PAGE_SIZE); 191 tmp = lmb_alloc(DART_PAGE_SIZE, DART_PAGE_SIZE);
186 if (!tmp) 192 if (!tmp)
187 panic("U3-DART: Cannot allocate spare page!"); 193 panic("U3-DART: Cannot allocate spare page!");
188 dart_emptyval = DARTMAP_VALID | ((tmp >> PAGE_SHIFT) & DARTMAP_RPNMASK); 194 dart_emptyval = DARTMAP_VALID | ((tmp >> DART_PAGE_SHIFT) & DARTMAP_RPNMASK);
189 195
190 /* Map in DART registers. FIXME: Use device node to get base address */ 196 /* Map in DART registers. FIXME: Use device node to get base address */
191 dart = ioremap(DART_BASE, 0x7000); 197 dart = ioremap(DART_BASE, 0x7000);
@@ -196,8 +202,8 @@ static int dart_init(struct device_node *dart_node)
196 * table size and enable bit 202 * table size and enable bit
197 */ 203 */
198 regword = DARTCNTL_ENABLE | 204 regword = DARTCNTL_ENABLE |
199 ((dart_tablebase >> PAGE_SHIFT) << DARTCNTL_BASE_SHIFT) | 205 ((dart_tablebase >> DART_PAGE_SHIFT) << DARTCNTL_BASE_SHIFT) |
200 (((dart_tablesize >> PAGE_SHIFT) & DARTCNTL_SIZE_MASK) 206 (((dart_tablesize >> DART_PAGE_SHIFT) & DARTCNTL_SIZE_MASK)
201 << DARTCNTL_SIZE_SHIFT); 207 << DARTCNTL_SIZE_SHIFT);
202 dart_vbase = ioremap(virt_to_abs(dart_tablebase), dart_tablesize); 208 dart_vbase = ioremap(virt_to_abs(dart_tablebase), dart_tablesize);
203 209