···5656 unsigned long imap_base,5757 unsigned long iclr_base);5858extern void sun4u_destroy_msi(unsigned int virt_irq);5959-extern unsigned int sbus_build_irq(void *sbus, unsigned int ino);60596160extern unsigned char virt_irq_alloc(unsigned int dev_handle,6261 unsigned int dev_ino);
-23
arch/sparc/kernel/ioport.c
···377377{378378}379379380380-/* Support code for sbus_init(). */381381-void __init sbus_setup_iommu(struct sbus_bus *sbus, struct device_node *dp)382382-{383383-#ifndef CONFIG_SUN4384384- struct device_node *parent = dp->parent;385385-386386- if (sparc_cpu_model != sun4d &&387387- parent != NULL &&388388- !strcmp(parent->name, "iommu"))389389- iommu_init(parent, sbus);390390-391391- if (sparc_cpu_model == sun4d)392392- iounit_init(sbus);393393-#endif394394-}395395-396380static int __init sparc_register_ioport(void)397381{398382 register_proc_sparc_ioport();···386402387403arch_initcall(sparc_register_ioport);388404389389-void __init sbus_arch_postinit(void)390390-{391391- if (sparc_cpu_model == sun4d) {392392- extern void sun4d_init_sbi_irq(void);393393- sun4d_init_sbi_irq();394394- }395395-}396405#endif /* CONFIG_SBUS */397406398407#ifdef CONFIG_PCI
+20-10
arch/sparc/mm/io-unit.c
···3434#define IOPERM (IOUPTE_CACHE | IOUPTE_WRITE | IOUPTE_VALID)3535#define MKIOPTE(phys) __iopte((((phys)>>4) & IOUPTE_PAGE) | IOPERM)36363737-void __init iounit_init(struct sbus_bus *sbus)3737+static void __init iounit_iommu_init(struct of_device *op)3838{3939- struct device_node *dp = sbus->ofdev.node;4039 struct iounit_struct *iounit;4140 iopte_t *xpt, *xptend;4242- struct of_device *op;4343-4444- op = of_find_device_by_node(dp);4545- if (!op) {4646- prom_printf("SUN4D: Cannot find SBI of_device.\n");4747- prom_halt();4848- }49415042 iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC);5143 if (!iounit) {···5866 prom_halt();5967 }60686161- sbus->ofdev.dev.archdata.iommu = iounit;6269 op->dev.archdata.iommu = iounit;6370 iounit->page_table = xpt;6471 spin_lock_init(&iounit->lock);···6675 xpt < xptend;)6776 iopte_val(*xpt++) = 0;6877}7878+7979+static int __init iounit_init(void)8080+{8181+ extern void sun4d_init_sbi_irq(void);8282+ struct device_node *dp;8383+8484+ for_each_node_by_name(dp, "sbi") {8585+ struct of_device *op = of_find_device_by_node(dp);8686+8787+ iounit_iommu_init(op);8888+ of_propagate_archdata(op);8989+ }9090+9191+ sun4d_init_sbi_irq();9292+9393+ return 0;9494+}9595+9696+subsys_initcall(iounit_init);69977098/* One has to hold iounit->lock to call this */7199static unsigned long iounit_get_area(struct iounit_struct *iounit, unsigned long vaddr, int size)
+21-19
arch/sparc/mm/iommu.c
···5555#define IOPERM (IOPTE_CACHE | IOPTE_WRITE | IOPTE_VALID)5656#define MKIOPTE(pfn, perm) (((((pfn)<<8) & IOPTE_PAGE) | (perm)) & ~IOPTE_WAZ)57575858-void __init iommu_init(struct device_node *parent, struct sbus_bus *sbus)5858+static void __init sbus_iommu_init(struct of_device *op)5959{6060- struct of_device *parent_op, *op;6160 struct iommu_struct *iommu;6261 unsigned int impl, vers;6362 unsigned long *bitmap;6463 unsigned long tmp;6565-6666- parent_op = of_find_device_by_node(parent);6767- if (!parent_op) {6868- prom_printf("Unable to find IOMMU of_device\n");6969- prom_halt();7070- }7171-7272- op = of_find_device_by_node(sbus->ofdev.node);7373- if (!op) {7474- prom_printf("Unable to find SBUS of_device\n");7575- prom_halt();7676- }77647865 iommu = kmalloc(sizeof(struct iommu_struct), GFP_ATOMIC);7966 if (!iommu) {···6881 prom_halt();6982 }70837171- iommu->regs = of_ioremap(&parent_op->resource[0], 0, PAGE_SIZE * 3,8484+ iommu->regs = of_ioremap(&op->resource[0], 0, PAGE_SIZE * 3,7285 "iommu_regs");7386 if (!iommu->regs) {7487 prom_printf("Cannot map IOMMU registers\n");···119132 else120133 iommu->usemap.num_colors = 1;121134122122- printk("IOMMU: impl %d vers %d table 0x%p[%d B] map [%d b]\n",123123- impl, vers, iommu->page_table,124124- (int)(IOMMU_NPTES*sizeof(iopte_t)), (int)IOMMU_NPTES);135135+ printk(KERN_INFO "IOMMU: impl %d vers %d table 0x%p[%d B] map [%d b]\n",136136+ impl, vers, iommu->page_table,137137+ (int)(IOMMU_NPTES*sizeof(iopte_t)), (int)IOMMU_NPTES);125138126126- sbus->ofdev.dev.archdata.iommu = iommu;127139 op->dev.archdata.iommu = iommu;128140}141141+142142+static int __init iommu_init(void)143143+{144144+ struct device_node *dp;145145+146146+ for_each_node_by_name(dp, "iommu") {147147+ struct of_device *op = of_find_device_by_node(dp);148148+149149+ sbus_iommu_init(op);150150+ of_propagate_archdata(op);151151+ }152152+153153+ return 0;154154+}155155+156156+subsys_initcall(iommu_init);129157130158/* This begs to be btfixup-ed by srmmu. */131159/* Flush the iotlb entries to ram. */