aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/mm/io-unit.c
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/io-unit.c
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/io-unit.c')
-rw-r--r--arch/sparc/mm/io-unit.c18
1 files changed, 9 insertions, 9 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);