diff options
author | David S. Miller <davem@davemloft.net> | 2008-08-27 02:00:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-29 05:13:13 -0400 |
commit | 260489fa8a9735c76073ace95f03ffaf10cca884 (patch) | |
tree | 5cc56f69ba16de24886bb8fbab34f2404554ce31 /arch/sparc/mm | |
parent | 7a715f46012f3552294154978aed59cba9804928 (diff) |
sparc32: Make mmu_{get,release}_*() take a struct device pointer.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/mm')
-rw-r--r-- | arch/sparc/mm/io-unit.c | 16 | ||||
-rw-r--r-- | arch/sparc/mm/iommu.c | 45 |
2 files changed, 30 insertions, 31 deletions
diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c index 1093514a5773..4239655a6aaf 100644 --- a/arch/sparc/mm/io-unit.c +++ b/arch/sparc/mm/io-unit.c | |||
@@ -125,10 +125,10 @@ nexti: scan = find_next_zero_bit(iounit->bmap, limit, scan); | |||
125 | return vaddr; | 125 | return vaddr; |
126 | } | 126 | } |
127 | 127 | ||
128 | static __u32 iounit_get_scsi_one(char *vaddr, unsigned long len, struct sbus_bus *sbus) | 128 | static __u32 iounit_get_scsi_one(struct device *dev, char *vaddr, unsigned long len) |
129 | { | 129 | { |
130 | struct iounit_struct *iounit = dev->archdata.iommu; | ||
130 | unsigned long ret, flags; | 131 | unsigned long ret, flags; |
131 | struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu; | ||
132 | 132 | ||
133 | spin_lock_irqsave(&iounit->lock, flags); | 133 | spin_lock_irqsave(&iounit->lock, flags); |
134 | ret = iounit_get_area(iounit, (unsigned long)vaddr, len); | 134 | ret = iounit_get_area(iounit, (unsigned long)vaddr, len); |
@@ -136,10 +136,10 @@ static __u32 iounit_get_scsi_one(char *vaddr, unsigned long len, struct sbus_bus | |||
136 | return ret; | 136 | return ret; |
137 | } | 137 | } |
138 | 138 | ||
139 | static void iounit_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus *sbus) | 139 | static void iounit_get_scsi_sgl(struct device *dev, struct scatterlist *sg, int sz) |
140 | { | 140 | { |
141 | struct iounit_struct *iounit = dev->archdata.iommu; | ||
141 | unsigned long flags; | 142 | unsigned long flags; |
142 | struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu; | ||
143 | 143 | ||
144 | /* FIXME: Cache some resolved pages - often several sg entries are to the same page */ | 144 | /* FIXME: Cache some resolved pages - often several sg entries are to the same page */ |
145 | spin_lock_irqsave(&iounit->lock, flags); | 145 | spin_lock_irqsave(&iounit->lock, flags); |
@@ -152,10 +152,10 @@ static void iounit_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus | |||
152 | spin_unlock_irqrestore(&iounit->lock, flags); | 152 | spin_unlock_irqrestore(&iounit->lock, flags); |
153 | } | 153 | } |
154 | 154 | ||
155 | static void iounit_release_scsi_one(__u32 vaddr, unsigned long len, struct sbus_bus *sbus) | 155 | static void iounit_release_scsi_one(struct device *dev, __u32 vaddr, unsigned long len) |
156 | { | 156 | { |
157 | struct iounit_struct *iounit = dev->archdata.iommu; | ||
157 | unsigned long flags; | 158 | unsigned long flags; |
158 | struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu; | ||
159 | 159 | ||
160 | spin_lock_irqsave(&iounit->lock, flags); | 160 | spin_lock_irqsave(&iounit->lock, flags); |
161 | len = ((vaddr & ~PAGE_MASK) + len + (PAGE_SIZE-1)) >> PAGE_SHIFT; | 161 | len = ((vaddr & ~PAGE_MASK) + len + (PAGE_SIZE-1)) >> PAGE_SHIFT; |
@@ -166,11 +166,11 @@ static void iounit_release_scsi_one(__u32 vaddr, unsigned long len, struct sbus_ | |||
166 | spin_unlock_irqrestore(&iounit->lock, flags); | 166 | spin_unlock_irqrestore(&iounit->lock, flags); |
167 | } | 167 | } |
168 | 168 | ||
169 | static void iounit_release_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus *sbus) | 169 | static void iounit_release_scsi_sgl(struct device *dev, struct scatterlist *sg, int sz) |
170 | { | 170 | { |
171 | struct iounit_struct *iounit = dev->archdata.iommu; | ||
171 | unsigned long flags; | 172 | unsigned long flags; |
172 | unsigned long vaddr, len; | 173 | unsigned long vaddr, len; |
173 | struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu; | ||
174 | 174 | ||
175 | spin_lock_irqsave(&iounit->lock, flags); | 175 | spin_lock_irqsave(&iounit->lock, flags); |
176 | while (sz != 0) { | 176 | while (sz != 0) { |
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 | } |