aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/mm
diff options
context:
space:
mode:
authorRobert Reif <reif@earthlink.net>2007-08-10 18:52:06 -0400
committerDavid S. Miller <davem@davemloft.net>2007-08-10 18:52:06 -0400
commit3ac4c949e02f26be1e4378f9acfb07ec87db947b (patch)
treeb22c949a7c20ae61f34cc6a12a240dbf600b1f2f /arch/sparc/mm
parentac07860264bd2b18834d3fa3be47032115524cea (diff)
[SPARC32]: Remove iommu from struct sbus_bus and use archdata like sparc64.
Signed-off-by: Robert Reif <reif@earthlink.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/mm')
-rw-r--r--arch/sparc/mm/io-unit.c18
-rw-r--r--arch/sparc/mm/iommu.c12
2 files changed, 15 insertions, 15 deletions
diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c
index 4ccda77d08d6..7c89893b1fe8 100644
--- a/arch/sparc/mm/io-unit.c
+++ b/arch/sparc/mm/io-unit.c
@@ -66,7 +66,7 @@ iounit_init(int sbi_node, int io_node, struct sbus_bus *sbus)
66 } 66 }
67 if(!xpt) panic("Cannot map External Page Table."); 67 if(!xpt) panic("Cannot map External Page Table.");
68 68
69 sbus->iommu = (struct iommu_struct *)iounit; 69 sbus->ofdev.dev.archdata.iommu = iounit;
70 iounit->page_table = xpt; 70 iounit->page_table = xpt;
71 spin_lock_init(&iounit->lock); 71 spin_lock_init(&iounit->lock);
72 72
@@ -127,7 +127,7 @@ nexti: scan = find_next_zero_bit(iounit->bmap, limit, scan);
127static __u32 iounit_get_scsi_one(char *vaddr, unsigned long len, struct sbus_bus *sbus) 127static __u32 iounit_get_scsi_one(char *vaddr, unsigned long len, struct sbus_bus *sbus)
128{ 128{
129 unsigned long ret, flags; 129 unsigned long ret, flags;
130 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 130 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
131 131
132 spin_lock_irqsave(&iounit->lock, flags); 132 spin_lock_irqsave(&iounit->lock, flags);
133 ret = iounit_get_area(iounit, (unsigned long)vaddr, len); 133 ret = iounit_get_area(iounit, (unsigned long)vaddr, len);
@@ -138,7 +138,7 @@ static __u32 iounit_get_scsi_one(char *vaddr, unsigned long len, struct sbus_bus
138static void iounit_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus *sbus) 138static void iounit_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus *sbus)
139{ 139{
140 unsigned long flags; 140 unsigned long flags;
141 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 141 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
142 142
143 /* FIXME: Cache some resolved pages - often several sg entries are to the same page */ 143 /* FIXME: Cache some resolved pages - often several sg entries are to the same page */
144 spin_lock_irqsave(&iounit->lock, flags); 144 spin_lock_irqsave(&iounit->lock, flags);
@@ -153,7 +153,7 @@ static void iounit_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus
153static void iounit_release_scsi_one(__u32 vaddr, unsigned long len, struct sbus_bus *sbus) 153static void iounit_release_scsi_one(__u32 vaddr, unsigned long len, struct sbus_bus *sbus)
154{ 154{
155 unsigned long flags; 155 unsigned long flags;
156 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 156 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
157 157
158 spin_lock_irqsave(&iounit->lock, flags); 158 spin_lock_irqsave(&iounit->lock, flags);
159 len = ((vaddr & ~PAGE_MASK) + len + (PAGE_SIZE-1)) >> PAGE_SHIFT; 159 len = ((vaddr & ~PAGE_MASK) + len + (PAGE_SIZE-1)) >> PAGE_SHIFT;
@@ -168,7 +168,7 @@ static void iounit_release_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_
168{ 168{
169 unsigned long flags; 169 unsigned long flags;
170 unsigned long vaddr, len; 170 unsigned long vaddr, len;
171 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 171 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
172 172
173 spin_lock_irqsave(&iounit->lock, flags); 173 spin_lock_irqsave(&iounit->lock, flags);
174 while (sz != 0) { 174 while (sz != 0) {
@@ -211,7 +211,7 @@ static int iounit_map_dma_area(dma_addr_t *pba, unsigned long va, __u32 addr, in
211 i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT); 211 i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT);
212 212
213 for_each_sbus(sbus) { 213 for_each_sbus(sbus) {
214 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 214 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
215 215
216 iopte = (iopte_t *)(iounit->page_table + i); 216 iopte = (iopte_t *)(iounit->page_table + i);
217 *iopte = MKIOPTE(__pa(page)); 217 *iopte = MKIOPTE(__pa(page));
@@ -235,7 +235,7 @@ static void iounit_unmap_dma_area(unsigned long addr, int len)
235static struct page *iounit_translate_dvma(unsigned long addr) 235static struct page *iounit_translate_dvma(unsigned long addr)
236{ 236{
237 struct sbus_bus *sbus = sbus_root; /* They are all the same */ 237 struct sbus_bus *sbus = sbus_root; /* They are all the same */
238 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 238 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
239 int i; 239 int i;
240 iopte_t *iopte; 240 iopte_t *iopte;
241 241
@@ -279,7 +279,7 @@ __u32 iounit_map_dma_init(struct sbus_bus *sbus, int size)
279 unsigned long rotor, scan, limit; 279 unsigned long rotor, scan, limit;
280 unsigned long flags; 280 unsigned long flags;
281 __u32 ret; 281 __u32 ret;
282 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 282 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
283 283
284 npages = (size + (PAGE_SIZE-1)) >> PAGE_SHIFT; 284 npages = (size + (PAGE_SIZE-1)) >> PAGE_SHIFT;
285 i = 0x0213; 285 i = 0x0213;
@@ -315,7 +315,7 @@ nexti: scan = find_next_zero_bit(iounit->bmap, limit, scan);
315__u32 iounit_map_dma_page(__u32 vaddr, void *addr, struct sbus_bus *sbus) 315__u32 iounit_map_dma_page(__u32 vaddr, void *addr, struct sbus_bus *sbus)
316{ 316{
317 int scan = (vaddr - IOUNIT_DMA_BASE) >> PAGE_SHIFT; 317 int scan = (vaddr - IOUNIT_DMA_BASE) >> PAGE_SHIFT;
318 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 318 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
319 319
320 iounit->page_table[scan] = MKIOPTE(__pa(((unsigned long)addr) & PAGE_MASK)); 320 iounit->page_table[scan] = MKIOPTE(__pa(((unsigned long)addr) & PAGE_MASK));
321 return vaddr + (((unsigned long)addr) & ~PAGE_MASK); 321 return vaddr + (((unsigned long)addr) & ~PAGE_MASK);
diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c
index be042efd1ba4..52e907af9d29 100644
--- a/arch/sparc/mm/iommu.c
+++ b/arch/sparc/mm/iommu.c
@@ -132,7 +132,7 @@ iommu_init(int iommund, struct sbus_bus *sbus)
132 impl, vers, iommu->page_table, 132 impl, vers, iommu->page_table,
133 (int)(IOMMU_NPTES*sizeof(iopte_t)), (int)IOMMU_NPTES); 133 (int)(IOMMU_NPTES*sizeof(iopte_t)), (int)IOMMU_NPTES);
134 134
135 sbus->iommu = iommu; 135 sbus->ofdev.dev.archdata.iommu = iommu;
136} 136}
137 137
138/* This begs to be btfixup-ed by srmmu. */ 138/* This begs to be btfixup-ed by srmmu. */
@@ -166,7 +166,7 @@ static void iommu_flush_iotlb(iopte_t *iopte, unsigned int niopte)
166 166
167static u32 iommu_get_one(struct page *page, int npages, struct sbus_bus *sbus) 167static u32 iommu_get_one(struct page *page, int npages, struct sbus_bus *sbus)
168{ 168{
169 struct iommu_struct *iommu = sbus->iommu; 169 struct iommu_struct *iommu = sbus->ofdev.dev.archdata.iommu;
170 int ioptex; 170 int ioptex;
171 iopte_t *iopte, *iopte0; 171 iopte_t *iopte, *iopte0;
172 unsigned int busa, busa0; 172 unsigned int busa, busa0;
@@ -291,7 +291,7 @@ static void iommu_get_scsi_sgl_pflush(struct scatterlist *sg, int sz, struct sbu
291 291
292static void iommu_release_one(u32 busa, int npages, struct sbus_bus *sbus) 292static void iommu_release_one(u32 busa, int npages, struct sbus_bus *sbus)
293{ 293{
294 struct iommu_struct *iommu = sbus->iommu; 294 struct iommu_struct *iommu = sbus->ofdev.dev.archdata.iommu;
295 int ioptex; 295 int ioptex;
296 int i; 296 int i;
297 297
@@ -334,7 +334,7 @@ static int iommu_map_dma_area(dma_addr_t *pba, unsigned long va,
334 unsigned long addr, int len) 334 unsigned long addr, int len)
335{ 335{
336 unsigned long page, end; 336 unsigned long page, end;
337 struct iommu_struct *iommu = sbus_root->iommu; 337 struct iommu_struct *iommu = sbus_root->ofdev.dev.archdata.iommu;
338 iopte_t *iopte = iommu->page_table; 338 iopte_t *iopte = iommu->page_table;
339 iopte_t *first; 339 iopte_t *first;
340 int ioptex; 340 int ioptex;
@@ -399,7 +399,7 @@ static int iommu_map_dma_area(dma_addr_t *pba, unsigned long va,
399 399
400static void iommu_unmap_dma_area(unsigned long busa, int len) 400static void iommu_unmap_dma_area(unsigned long busa, int len)
401{ 401{
402 struct iommu_struct *iommu = sbus_root->iommu; 402 struct iommu_struct *iommu = sbus_root->ofdev.dev.archdata.iommu;
403 iopte_t *iopte = iommu->page_table; 403 iopte_t *iopte = iommu->page_table;
404 unsigned long end; 404 unsigned long end;
405 int ioptex = (busa - iommu->start) >> PAGE_SHIFT; 405 int ioptex = (busa - iommu->start) >> PAGE_SHIFT;
@@ -420,7 +420,7 @@ static void iommu_unmap_dma_area(unsigned long busa, int len)
420 420
421static struct page *iommu_translate_dvma(unsigned long busa) 421static struct page *iommu_translate_dvma(unsigned long busa)
422{ 422{
423 struct iommu_struct *iommu = sbus_root->iommu; 423 struct iommu_struct *iommu = sbus_root->ofdev.dev.archdata.iommu;
424 iopte_t *iopte = iommu->page_table; 424 iopte_t *iopte = iommu->page_table;
425 425
426 iopte += ((busa - iommu->start) >> PAGE_SHIFT); 426 iopte += ((busa - iommu->start) >> PAGE_SHIFT);