···6666 }6767 if(!xpt) panic("Cannot map External Page Table.");68686969- sbus->iommu = (struct iommu_struct *)iounit;6969+ sbus->ofdev.dev.archdata.iommu = iounit;7070 iounit->page_table = xpt;7171 spin_lock_init(&iounit->lock);7272···127127static __u32 iounit_get_scsi_one(char *vaddr, unsigned long len, struct sbus_bus *sbus)128128{129129 unsigned long ret, flags;130130- struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu;130130+ struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;131131132132 spin_lock_irqsave(&iounit->lock, flags);133133 ret = iounit_get_area(iounit, (unsigned long)vaddr, len);···138138static void iounit_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus *sbus)139139{140140 unsigned long flags;141141- struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu;141141+ struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;142142143143 /* FIXME: Cache some resolved pages - often several sg entries are to the same page */144144 spin_lock_irqsave(&iounit->lock, flags);···153153static void iounit_release_scsi_one(__u32 vaddr, unsigned long len, struct sbus_bus *sbus)154154{155155 unsigned long flags;156156- struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu;156156+ struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;157157158158 spin_lock_irqsave(&iounit->lock, flags);159159 len = ((vaddr & ~PAGE_MASK) + len + (PAGE_SIZE-1)) >> PAGE_SHIFT;···168168{169169 unsigned long flags;170170 unsigned long vaddr, len;171171- struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu;171171+ struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;172172173173 spin_lock_irqsave(&iounit->lock, flags);174174 while (sz != 0) {···211211 i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT);212212213213 for_each_sbus(sbus) {214214- struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu;214214+ struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;215215216216 iopte = (iopte_t *)(iounit->page_table + i);217217 *iopte = MKIOPTE(__pa(page));···235235static struct page *iounit_translate_dvma(unsigned long addr)236236{237237 struct sbus_bus *sbus = sbus_root; /* They are all the same */238238- struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu;238238+ struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;239239 int i;240240 iopte_t *iopte;241241···279279 unsigned long rotor, scan, limit;280280 unsigned long flags;281281 __u32 ret;282282- struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu;282282+ struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;283283284284 npages = (size + (PAGE_SIZE-1)) >> PAGE_SHIFT;285285 i = 0x0213;···315315__u32 iounit_map_dma_page(__u32 vaddr, void *addr, struct sbus_bus *sbus)316316{317317 int scan = (vaddr - IOUNIT_DMA_BASE) >> PAGE_SHIFT;318318- struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu;318318+ struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;319319320320 iounit->page_table[scan] = MKIOPTE(__pa(((unsigned long)addr) & PAGE_MASK));321321 return vaddr + (((unsigned long)addr) & ~PAGE_MASK);
+6-6
arch/sparc/mm/iommu.c
···132132 impl, vers, iommu->page_table,133133 (int)(IOMMU_NPTES*sizeof(iopte_t)), (int)IOMMU_NPTES);134134135135- sbus->iommu = iommu;135135+ sbus->ofdev.dev.archdata.iommu = iommu;136136}137137138138/* This begs to be btfixup-ed by srmmu. */···166166167167static u32 iommu_get_one(struct page *page, int npages, struct sbus_bus *sbus)168168{169169- struct iommu_struct *iommu = sbus->iommu;169169+ struct iommu_struct *iommu = sbus->ofdev.dev.archdata.iommu;170170 int ioptex;171171 iopte_t *iopte, *iopte0;172172 unsigned int busa, busa0;···291291292292static void iommu_release_one(u32 busa, int npages, struct sbus_bus *sbus)293293{294294- struct iommu_struct *iommu = sbus->iommu;294294+ struct iommu_struct *iommu = sbus->ofdev.dev.archdata.iommu;295295 int ioptex;296296 int i;297297···334334 unsigned long addr, int len)335335{336336 unsigned long page, end;337337- struct iommu_struct *iommu = sbus_root->iommu;337337+ struct iommu_struct *iommu = sbus_root->ofdev.dev.archdata.iommu;338338 iopte_t *iopte = iommu->page_table;339339 iopte_t *first;340340 int ioptex;···399399400400static void iommu_unmap_dma_area(unsigned long busa, int len)401401{402402- struct iommu_struct *iommu = sbus_root->iommu;402402+ struct iommu_struct *iommu = sbus_root->ofdev.dev.archdata.iommu;403403 iopte_t *iopte = iommu->page_table;404404 unsigned long end;405405 int ioptex = (busa - iommu->start) >> PAGE_SHIFT;···420420421421static struct page *iommu_translate_dvma(unsigned long busa)422422{423423- struct iommu_struct *iommu = sbus_root->iommu;423423+ struct iommu_struct *iommu = sbus_root->ofdev.dev.archdata.iommu;424424 iopte_t *iopte = iommu->page_table;425425426426 iopte += ((busa - iommu->start) >> PAGE_SHIFT);
-1
include/asm-sparc/sbus.h
···6868/* This struct describes the SBus(s) found on this machine. */6969struct sbus_bus {7070 struct of_device ofdev;7171- void *iommu; /* Opaque IOMMU cookie */7271 struct sbus_dev *devices; /* Link to devices on this SBus */7372 struct sbus_bus *next; /* next SBus, if more than one SBus */7473 int prom_node; /* PROM device tree node for this SBus */