diff options
Diffstat (limited to 'arch/sparc/mm/iommu.c')
-rw-r--r-- | arch/sparc/mm/iommu.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c index a86c9f552fa1..8e9ab930f097 100644 --- a/arch/sparc/mm/iommu.c +++ b/arch/sparc/mm/iommu.c | |||
@@ -169,9 +169,9 @@ static void iommu_flush_iotlb(iopte_t *iopte, unsigned int niopte) | |||
169 | } | 169 | } |
170 | } | 170 | } |
171 | 171 | ||
172 | static u32 iommu_get_one(struct page *page, int npages, struct sbus_bus *sbus) | 172 | static u32 iommu_get_one(struct device *dev, struct page *page, int npages) |
173 | { | 173 | { |
174 | struct iommu_struct *iommu = sbus->ofdev.dev.archdata.iommu; | 174 | struct iommu_struct *iommu = dev->archdata.iommu; |
175 | int ioptex; | 175 | int ioptex; |
176 | iopte_t *iopte, *iopte0; | 176 | iopte_t *iopte, *iopte0; |
177 | unsigned int busa, busa0; | 177 | unsigned int busa, busa0; |
@@ -199,8 +199,7 @@ static u32 iommu_get_one(struct page *page, int npages, struct sbus_bus *sbus) | |||
199 | return busa0; | 199 | return busa0; |
200 | } | 200 | } |
201 | 201 | ||
202 | static u32 iommu_get_scsi_one(char *vaddr, unsigned int len, | 202 | static u32 iommu_get_scsi_one(struct device *dev, char *vaddr, unsigned int len) |
203 | struct sbus_bus *sbus) | ||
204 | { | 203 | { |
205 | unsigned long off; | 204 | unsigned long off; |
206 | int npages; | 205 | int npages; |
@@ -210,22 +209,22 @@ static u32 iommu_get_scsi_one(char *vaddr, unsigned int len, | |||
210 | off = (unsigned long)vaddr & ~PAGE_MASK; | 209 | off = (unsigned long)vaddr & ~PAGE_MASK; |
211 | npages = (off + len + PAGE_SIZE-1) >> PAGE_SHIFT; | 210 | npages = (off + len + PAGE_SIZE-1) >> PAGE_SHIFT; |
212 | page = virt_to_page((unsigned long)vaddr & PAGE_MASK); | 211 | page = virt_to_page((unsigned long)vaddr & PAGE_MASK); |
213 | busa = iommu_get_one(page, npages, sbus); | 212 | busa = iommu_get_one(dev, page, npages); |
214 | return busa + off; | 213 | return busa + off; |
215 | } | 214 | } |
216 | 215 | ||
217 | static __u32 iommu_get_scsi_one_noflush(char *vaddr, unsigned long len, struct sbus_bus *sbus) | 216 | static __u32 iommu_get_scsi_one_noflush(struct device *dev, char *vaddr, unsigned long len) |
218 | { | 217 | { |
219 | return iommu_get_scsi_one(vaddr, len, sbus); | 218 | return iommu_get_scsi_one(dev, vaddr, len); |
220 | } | 219 | } |
221 | 220 | ||
222 | static __u32 iommu_get_scsi_one_gflush(char *vaddr, unsigned long len, struct sbus_bus *sbus) | 221 | static __u32 iommu_get_scsi_one_gflush(struct device *dev, char *vaddr, unsigned long len) |
223 | { | 222 | { |
224 | flush_page_for_dma(0); | 223 | flush_page_for_dma(0); |
225 | return iommu_get_scsi_one(vaddr, len, sbus); | 224 | return iommu_get_scsi_one(dev, vaddr, len); |
226 | } | 225 | } |
227 | 226 | ||
228 | static __u32 iommu_get_scsi_one_pflush(char *vaddr, unsigned long len, struct sbus_bus *sbus) | 227 | static __u32 iommu_get_scsi_one_pflush(struct device *dev, char *vaddr, unsigned long len) |
229 | { | 228 | { |
230 | unsigned long page = ((unsigned long) vaddr) & PAGE_MASK; | 229 | unsigned long page = ((unsigned long) vaddr) & PAGE_MASK; |
231 | 230 | ||
@@ -233,23 +232,23 @@ static __u32 iommu_get_scsi_one_pflush(char *vaddr, unsigned long len, struct sb | |||
233 | flush_page_for_dma(page); | 232 | flush_page_for_dma(page); |
234 | page += PAGE_SIZE; | 233 | page += PAGE_SIZE; |
235 | } | 234 | } |
236 | return iommu_get_scsi_one(vaddr, len, sbus); | 235 | return iommu_get_scsi_one(dev, vaddr, len); |
237 | } | 236 | } |
238 | 237 | ||
239 | static void iommu_get_scsi_sgl_noflush(struct scatterlist *sg, int sz, struct sbus_bus *sbus) | 238 | static void iommu_get_scsi_sgl_noflush(struct device *dev, struct scatterlist *sg, int sz) |
240 | { | 239 | { |
241 | int n; | 240 | int n; |
242 | 241 | ||
243 | while (sz != 0) { | 242 | while (sz != 0) { |
244 | --sz; | 243 | --sz; |
245 | n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT; | 244 | n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT; |
246 | sg->dvma_address = iommu_get_one(sg_page(sg), n, sbus) + sg->offset; | 245 | sg->dvma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset; |
247 | sg->dvma_length = (__u32) sg->length; | 246 | sg->dvma_length = (__u32) sg->length; |
248 | sg = sg_next(sg); | 247 | sg = sg_next(sg); |
249 | } | 248 | } |
250 | } | 249 | } |
251 | 250 | ||
252 | static void iommu_get_scsi_sgl_gflush(struct scatterlist *sg, int sz, struct sbus_bus *sbus) | 251 | static void iommu_get_scsi_sgl_gflush(struct device *dev, struct scatterlist *sg, int sz) |
253 | { | 252 | { |
254 | int n; | 253 | int n; |
255 | 254 | ||
@@ -257,13 +256,13 @@ static void iommu_get_scsi_sgl_gflush(struct scatterlist *sg, int sz, struct sbu | |||
257 | while (sz != 0) { | 256 | while (sz != 0) { |
258 | --sz; | 257 | --sz; |
259 | n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT; | 258 | n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT; |
260 | sg->dvma_address = iommu_get_one(sg_page(sg), n, sbus) + sg->offset; | 259 | sg->dvma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset; |
261 | sg->dvma_length = (__u32) sg->length; | 260 | sg->dvma_length = (__u32) sg->length; |
262 | sg = sg_next(sg); | 261 | sg = sg_next(sg); |
263 | } | 262 | } |
264 | } | 263 | } |
265 | 264 | ||
266 | static void iommu_get_scsi_sgl_pflush(struct scatterlist *sg, int sz, struct sbus_bus *sbus) | 265 | static void iommu_get_scsi_sgl_pflush(struct device *dev, struct scatterlist *sg, int sz) |
267 | { | 266 | { |
268 | unsigned long page, oldpage = 0; | 267 | unsigned long page, oldpage = 0; |
269 | int n, i; | 268 | int n, i; |
@@ -288,15 +287,15 @@ static void iommu_get_scsi_sgl_pflush(struct scatterlist *sg, int sz, struct sbu | |||
288 | } | 287 | } |
289 | } | 288 | } |
290 | 289 | ||
291 | sg->dvma_address = iommu_get_one(sg_page(sg), n, sbus) + sg->offset; | 290 | sg->dvma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset; |
292 | sg->dvma_length = (__u32) sg->length; | 291 | sg->dvma_length = (__u32) sg->length; |
293 | sg = sg_next(sg); | 292 | sg = sg_next(sg); |
294 | } | 293 | } |
295 | } | 294 | } |
296 | 295 | ||
297 | static void iommu_release_one(u32 busa, int npages, struct sbus_bus *sbus) | 296 | static void iommu_release_one(struct device *dev, u32 busa, int npages) |
298 | { | 297 | { |
299 | struct iommu_struct *iommu = sbus->ofdev.dev.archdata.iommu; | 298 | struct iommu_struct *iommu = dev->archdata.iommu; |
300 | int ioptex; | 299 | int ioptex; |
301 | int i; | 300 | int i; |
302 | 301 | ||
@@ -310,17 +309,17 @@ static void iommu_release_one(u32 busa, int npages, struct sbus_bus *sbus) | |||
310 | bit_map_clear(&iommu->usemap, ioptex, npages); | 309 | bit_map_clear(&iommu->usemap, ioptex, npages); |
311 | } | 310 | } |
312 | 311 | ||
313 | static void iommu_release_scsi_one(__u32 vaddr, unsigned long len, struct sbus_bus *sbus) | 312 | static void iommu_release_scsi_one(struct device *dev, __u32 vaddr, unsigned long len) |
314 | { | 313 | { |
315 | unsigned long off; | 314 | unsigned long off; |
316 | int npages; | 315 | int npages; |
317 | 316 | ||
318 | off = vaddr & ~PAGE_MASK; | 317 | off = vaddr & ~PAGE_MASK; |
319 | npages = (off + len + PAGE_SIZE-1) >> PAGE_SHIFT; | 318 | npages = (off + len + PAGE_SIZE-1) >> PAGE_SHIFT; |
320 | iommu_release_one(vaddr & PAGE_MASK, npages, sbus); | 319 | iommu_release_one(dev, vaddr & PAGE_MASK, npages); |
321 | } | 320 | } |
322 | 321 | ||
323 | static void iommu_release_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus *sbus) | 322 | static void iommu_release_scsi_sgl(struct device *dev, struct scatterlist *sg, int sz) |
324 | { | 323 | { |
325 | int n; | 324 | int n; |
326 | 325 | ||
@@ -328,7 +327,7 @@ static void iommu_release_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_b | |||
328 | --sz; | 327 | --sz; |
329 | 328 | ||
330 | n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT; | 329 | n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT; |
331 | iommu_release_one(sg->dvma_address & PAGE_MASK, n, sbus); | 330 | iommu_release_one(dev, sg->dvma_address & PAGE_MASK, n); |
332 | sg->dvma_address = 0x21212121; | 331 | sg->dvma_address = 0x21212121; |
333 | sg = sg_next(sg); | 332 | sg = sg_next(sg); |
334 | } | 333 | } |