Skip to contentSkip to conversation

: sparc: Remove generic SBUS probing layer.

PATCH In review David Miller 1 participant 1 message Aug 28, 2008 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

PATCH 44/49 : sparc: Remove generic SBUS probing layer.

sparc: Remove generic SBUS probing layer.

The individual SBUS IOMMU arch code now sets the IOMMU information directly into the OF device objects.

---
 arch/sparc/include/asm/io-unit.h  |    2 -
 arch/sparc/include/asm/iommu_32.h |    2 -
 arch/sparc/include/asm/irq_64.h   |    1 -
 arch/sparc/kernel/ioport.c        |   23 -----
 arch/sparc/mm/io-unit.c           |   30 +++++--
 arch/sparc/mm/iommu.c             |   40 +++++----
 arch/sparc64/kernel/sbus.c        |  122 +++++++++++++++------------
 drivers/sbus/Makefile             |    4 -
 drivers/sbus/sbus.c               |  170 -------------------------------------
 9 files changed, 108 insertions(+), 286 deletions(-)
 delete mode 100644 drivers/sbus/sbus.c
arch/sparc/include/asm/io-unit.h +0 -2
index 5df63ef..96823b4 100644
@@ -59,6 +59,4 @@ extern __u32 iounit_map_dma_init(struct sbus_bus *, int);
 #define iounit_map_dma_finish(sbus, addr, len) mmu_release_scsi_one(addr, len, sbus)
 extern __u32 iounit_map_dma_page(__u32, void *, struct sbus_bus *);
 
-extern void iounit_init(struct sbus_bus *sbus);
-
 #endif /* !(_SPARC_IO_UNIT_H) */
arch/sparc/include/asm/iommu_32.h +0 -2
index 6b115a1..70c589c 100644
@@ -118,6 +118,4 @@ static inline void iommu_invalidate_page(struct iommu_regs *regs, unsigned long
 	regs->pageflush = (ba & PAGE_MASK);
 }
 
-extern void iommu_init(struct device_node *dp, struct sbus_bus *sbus);
-
 #endif /* !(_SPARC_IOMMU_H) */
arch/sparc/include/asm/irq_64.h +0 -1
index e3dd930..71673ec 100644
@@ -56,7 +56,6 @@ extern unsigned int sun4u_build_msi(u32 portid, unsigned int *virt_irq_p,
 				    unsigned long imap_base,
 				    unsigned long iclr_base);
 extern void sun4u_destroy_msi(unsigned int virt_irq);
-extern unsigned int sbus_build_irq(void *sbus, unsigned int ino);
 
 extern unsigned char virt_irq_alloc(unsigned int dev_handle,
 				    unsigned int dev_ino);
arch/sparc/kernel/ioport.c +0 -23
index 24645f9..bca2d6f 100644
@@ -377,22 +377,6 @@ void sbus_dma_sync_single_for_device(struct device *dev, dma_addr_t ba, size_t s
 {
 }
 
-/* Support code for sbus_init().  */
-void __init sbus_setup_iommu(struct sbus_bus *sbus, struct device_node *dp)
-{
-#ifndef CONFIG_SUN4
-	struct device_node *parent = dp->parent;
-
-	if (sparc_cpu_model != sun4d &&
-	    parent != NULL &&
-	    !strcmp(parent->name, "iommu"))
-		iommu_init(parent, sbus);
-
-	if (sparc_cpu_model = sun4d)
-		iounit_init(sbus);
-#endif
-}
-
 static int __init sparc_register_ioport(void)
 {
 	register_proc_sparc_ioport();
@@ -402,13 +386,6 @@ static int __init sparc_register_ioport(void)
 
 arch_initcall(sparc_register_ioport);
 
-void __init sbus_arch_postinit(void)
-{
-	if (sparc_cpu_model = sun4d) {
-		extern void sun4d_init_sbi_irq(void);
-		sun4d_init_sbi_irq();
-	}
-}
 #endif /* CONFIG_SBUS */
 
 #ifdef CONFIG_PCI
arch/sparc/mm/io-unit.c +20 -10
index 0f97ab3..caf551a 100644
@@ -34,18 +34,10 @@
 #define IOPERM        (IOUPTE_CACHE | IOUPTE_WRITE | IOUPTE_VALID)
 #define MKIOPTE(phys) __iopte((((phys)>>4) & IOUPTE_PAGE) | IOPERM)
 
-void __init iounit_init(struct sbus_bus *sbus)
+static void __init iounit_iommu_init(struct of_device *op)
 {
-	struct device_node *dp = sbus->ofdev.node;
 	struct iounit_struct *iounit;
 	iopte_t *xpt, *xptend;
-	struct of_device *op;
-
-	op = of_find_device_by_node(dp);
-	if (!op) {
-		prom_printf("SUN4D: Cannot find SBI of_device.\n");
-		prom_halt();
-	}
 
 	iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC);
 	if (!iounit) {
@@ -66,7 +58,6 @@ void __init iounit_init(struct sbus_bus *sbus)
 		prom_halt();
 	}
 	
-	sbus->ofdev.dev.archdata.iommu = iounit;
 	op->dev.archdata.iommu = iounit;
 	iounit->page_table = xpt;
 	spin_lock_init(&iounit->lock);
@@ -76,6 +67,25 @@ void __init iounit_init(struct sbus_bus *sbus)
 	     	iopte_val(*xpt++) = 0;
 }
 
+static int __init iounit_init(void)
+{
+	extern void sun4d_init_sbi_irq(void);
+	struct device_node *dp;
+
+	for_each_node_by_name(dp, "sbi") {
+		struct of_device *op = of_find_device_by_node(dp);
+
+		iounit_iommu_init(op);
+		of_propagate_archdata(op);
+	}
+
+	sun4d_init_sbi_irq();
+
+	return 0;
+}
+
+subsys_initcall(iounit_init);
+
 /* One has to hold iounit->lock to call this */
 static unsigned long iounit_get_area(struct iounit_struct *iounit, unsigned long vaddr, int size)
 {
arch/sparc/mm/iommu.c +21 -19
index 2970cea..7c55450 100644
@@ -55,33 +55,20 @@ static pgprot_t dvma_prot;		/* Consistent mapping pte flags */
 #define IOPERM        (IOPTE_CACHE | IOPTE_WRITE | IOPTE_VALID)
 #define MKIOPTE(pfn, perm) (((((pfn)<<8) & IOPTE_PAGE) | (perm)) & ~IOPTE_WAZ)
 
-void __init iommu_init(struct device_node *parent, struct sbus_bus *sbus)
+static void __init sbus_iommu_init(struct of_device *op)
 {
-	struct of_device *parent_op, *op;
 	struct iommu_struct *iommu;
 	unsigned int impl, vers;
 	unsigned long *bitmap;
 	unsigned long tmp;
 
-	parent_op = of_find_device_by_node(parent);
-	if (!parent_op) {
-		prom_printf("Unable to find IOMMU of_device\n");
-		prom_halt();
-	}
-
-	op = of_find_device_by_node(sbus->ofdev.node);
-	if (!op) {
-		prom_printf("Unable to find SBUS of_device\n");
-		prom_halt();
-	}
-
 	iommu = kmalloc(sizeof(struct iommu_struct), GFP_ATOMIC);
 	if (!iommu) {
 		prom_printf("Unable to allocate iommu structure\n");
 		prom_halt();
 	}
 
-	iommu->regs = of_ioremap(&parent_op->resource[0], 0, PAGE_SIZE * 3,
+	iommu->regs = of_ioremap(&op->resource[0], 0, PAGE_SIZE * 3,
 				 "iommu_regs");
 	if (!iommu->regs) {
 		prom_printf("Cannot map IOMMU registers\n");
@@ -132,14 +119,29 @@ void __init iommu_init(struct device_node *parent, struct sbus_bus *sbus)
 	else
 		iommu->usemap.num_colors = 1;
 
-	printk("IOMMU: impl %d vers %d table 0x%p[%d B] map [%d b]\n",
-	    impl, vers, iommu->page_table,
-	    (int)(IOMMU_NPTES*sizeof(iopte_t)), (int)IOMMU_NPTES);
+	printk(KERN_INFO "IOMMU: impl %d vers %d table 0x%p[%d B] map [%d b]\n",
+	       impl, vers, iommu->page_table,
+	       (int)(IOMMU_NPTES*sizeof(iopte_t)), (int)IOMMU_NPTES);
 
-	sbus->ofdev.dev.archdata.iommu = iommu;
 	op->dev.archdata.iommu = iommu;
 }
 
+static int __init iommu_init(void)
+{
+	struct device_node *dp;
+
+	for_each_node_by_name(dp, "iommu") {
+		struct of_device *op = of_find_device_by_node(dp);
+
+		sbus_iommu_init(op);
+		of_propagate_archdata(op);
+	}
+
+	return 0;
+}
+
+subsys_initcall(iommu_init);
+
 /* This begs to be btfixup-ed by srmmu. */
 /* Flush the iotlb entries to ram. */
 /* This could be better if we didn't have to flush whole pages. */
arch/sparc64/kernel/sbus.c +67 -55

268 lines not on this page · raw message

drivers/sbus/Makefile +0 -4
index 56f7331..e94dc25 100644
@@ -2,8 +2,4 @@
 # Makefile for the linux kernel.
 #
 
-ifneq ($(ARCH),m68k)
-obj-y    := sbus.o
-endif
-
 obj-$(CONFIG_SBUSCHAR) += char/
drivers/sbus/sbus.c deleted +0 -168

168 lines not on this page · raw message

Signature · 1 line
1.5.6.5.GIT