Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Robert Reif and committed by
David S. Miller
3ac4c949 ac078602

+16 -16
+1
arch/sparc/kernel/ebus.c
··· 238 238 sd = &dev->ofdev.dev.archdata; 239 239 sd->prom_node = dp; 240 240 sd->op = &dev->ofdev; 241 + sd->iommu = dev->bus->ofdev.dev.parent->archdata.iommu; 241 242 242 243 dev->ofdev.node = dp; 243 244 dev->ofdev.dev.parent = &dev->bus->ofdev.dev;
+9 -9
arch/sparc/mm/io-unit.c
··· 66 66 } 67 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 70 iounit->page_table = xpt; 71 71 spin_lock_init(&iounit->lock); 72 72 ··· 127 127 static __u32 iounit_get_scsi_one(char *vaddr, unsigned long len, struct sbus_bus *sbus) 128 128 { 129 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 132 spin_lock_irqsave(&iounit->lock, flags); 133 133 ret = iounit_get_area(iounit, (unsigned long)vaddr, len); ··· 138 138 static void iounit_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus *sbus) 139 139 { 140 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 143 /* FIXME: Cache some resolved pages - often several sg entries are to the same page */ 144 144 spin_lock_irqsave(&iounit->lock, flags); ··· 153 153 static void iounit_release_scsi_one(__u32 vaddr, unsigned long len, struct sbus_bus *sbus) 154 154 { 155 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 158 spin_lock_irqsave(&iounit->lock, flags); 159 159 len = ((vaddr & ~PAGE_MASK) + len + (PAGE_SIZE-1)) >> PAGE_SHIFT; ··· 168 168 { 169 169 unsigned long flags; 170 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 173 spin_lock_irqsave(&iounit->lock, flags); 174 174 while (sz != 0) { ··· 211 211 i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT); 212 212 213 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 216 iopte = (iopte_t *)(iounit->page_table + i); 217 217 *iopte = MKIOPTE(__pa(page)); ··· 235 235 static struct page *iounit_translate_dvma(unsigned long addr) 236 236 { 237 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 239 int i; 240 240 iopte_t *iopte; 241 241 ··· 279 279 unsigned long rotor, scan, limit; 280 280 unsigned long flags; 281 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 284 npages = (size + (PAGE_SIZE-1)) >> PAGE_SHIFT; 285 285 i = 0x0213; ··· 315 315 __u32 iounit_map_dma_page(__u32 vaddr, void *addr, struct sbus_bus *sbus) 316 316 { 317 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 320 iounit->page_table[scan] = MKIOPTE(__pa(((unsigned long)addr) & PAGE_MASK)); 321 321 return vaddr + (((unsigned long)addr) & ~PAGE_MASK);
+6 -6
arch/sparc/mm/iommu.c
··· 132 132 impl, vers, iommu->page_table, 133 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 138 /* This begs to be btfixup-ed by srmmu. */ ··· 166 166 167 167 static 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 170 int ioptex; 171 171 iopte_t *iopte, *iopte0; 172 172 unsigned int busa, busa0; ··· 291 291 292 292 static 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 295 int ioptex; 296 296 int i; 297 297 ··· 334 334 unsigned long addr, int len) 335 335 { 336 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 338 iopte_t *iopte = iommu->page_table; 339 339 iopte_t *first; 340 340 int ioptex; ··· 399 399 400 400 static 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 403 iopte_t *iopte = iommu->page_table; 404 404 unsigned long end; 405 405 int ioptex = (busa - iommu->start) >> PAGE_SHIFT; ··· 420 420 421 421 static 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 424 iopte_t *iopte = iommu->page_table; 425 425 426 426 iopte += ((busa - iommu->start) >> PAGE_SHIFT);
-1
include/asm-sparc/sbus.h
··· 68 68 /* This struct describes the SBus(s) found on this machine. */ 69 69 struct sbus_bus { 70 70 struct of_device ofdev; 71 - void *iommu; /* Opaque IOMMU cookie */ 72 71 struct sbus_dev *devices; /* Link to devices on this SBus */ 73 72 struct sbus_bus *next; /* next SBus, if more than one SBus */ 74 73 int prom_node; /* PROM device tree node for this SBus */