diff options
author | David S. Miller <davem@davemloft.net> | 2008-08-27 07:54:04 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-29 05:15:21 -0400 |
commit | 046e26a8ba10b8ceff822f8d91451ab6c1e08c4e (patch) | |
tree | 92e95380c0f7f6c5257023a59b88d4221d3f9744 /arch/sparc | |
parent | 5059625ed8862e897760b86effff0f8a35989c0d (diff) |
sparc: Remove generic SBUS probing layer.
The individual SBUS IOMMU arch code now sets the IOMMU information
directly into the OF device objects.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc')
-rw-r--r-- | arch/sparc/include/asm/io-unit.h | 2 | ||||
-rw-r--r-- | arch/sparc/include/asm/iommu_32.h | 2 | ||||
-rw-r--r-- | arch/sparc/include/asm/irq_64.h | 1 | ||||
-rw-r--r-- | arch/sparc/kernel/ioport.c | 23 | ||||
-rw-r--r-- | arch/sparc/mm/io-unit.c | 30 | ||||
-rw-r--r-- | arch/sparc/mm/iommu.c | 40 |
6 files changed, 41 insertions, 57 deletions
diff --git a/arch/sparc/include/asm/io-unit.h b/arch/sparc/include/asm/io-unit.h index 5df63ef95cf2..96823b47fd45 100644 --- a/arch/sparc/include/asm/io-unit.h +++ b/arch/sparc/include/asm/io-unit.h | |||
@@ -59,6 +59,4 @@ extern __u32 iounit_map_dma_init(struct sbus_bus *, int); | |||
59 | #define iounit_map_dma_finish(sbus, addr, len) mmu_release_scsi_one(addr, len, sbus) | 59 | #define iounit_map_dma_finish(sbus, addr, len) mmu_release_scsi_one(addr, len, sbus) |
60 | extern __u32 iounit_map_dma_page(__u32, void *, struct sbus_bus *); | 60 | extern __u32 iounit_map_dma_page(__u32, void *, struct sbus_bus *); |
61 | 61 | ||
62 | extern void iounit_init(struct sbus_bus *sbus); | ||
63 | |||
64 | #endif /* !(_SPARC_IO_UNIT_H) */ | 62 | #endif /* !(_SPARC_IO_UNIT_H) */ |
diff --git a/arch/sparc/include/asm/iommu_32.h b/arch/sparc/include/asm/iommu_32.h index 6b115a174c0c..70c589c05a10 100644 --- a/arch/sparc/include/asm/iommu_32.h +++ b/arch/sparc/include/asm/iommu_32.h | |||
@@ -118,6 +118,4 @@ static inline void iommu_invalidate_page(struct iommu_regs *regs, unsigned long | |||
118 | regs->pageflush = (ba & PAGE_MASK); | 118 | regs->pageflush = (ba & PAGE_MASK); |
119 | } | 119 | } |
120 | 120 | ||
121 | extern void iommu_init(struct device_node *dp, struct sbus_bus *sbus); | ||
122 | |||
123 | #endif /* !(_SPARC_IOMMU_H) */ | 121 | #endif /* !(_SPARC_IOMMU_H) */ |
diff --git a/arch/sparc/include/asm/irq_64.h b/arch/sparc/include/asm/irq_64.h index e3dd9303643d..71673eca3660 100644 --- a/arch/sparc/include/asm/irq_64.h +++ b/arch/sparc/include/asm/irq_64.h | |||
@@ -56,7 +56,6 @@ extern unsigned int sun4u_build_msi(u32 portid, unsigned int *virt_irq_p, | |||
56 | unsigned long imap_base, | 56 | unsigned long imap_base, |
57 | unsigned long iclr_base); | 57 | unsigned long iclr_base); |
58 | extern void sun4u_destroy_msi(unsigned int virt_irq); | 58 | extern void sun4u_destroy_msi(unsigned int virt_irq); |
59 | extern unsigned int sbus_build_irq(void *sbus, unsigned int ino); | ||
60 | 59 | ||
61 | extern unsigned char virt_irq_alloc(unsigned int dev_handle, | 60 | extern unsigned char virt_irq_alloc(unsigned int dev_handle, |
62 | unsigned int dev_ino); | 61 | unsigned int dev_ino); |
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c index 24645f9f56f5..bca2d6fd5c4c 100644 --- a/arch/sparc/kernel/ioport.c +++ b/arch/sparc/kernel/ioport.c | |||
@@ -377,22 +377,6 @@ void sbus_dma_sync_single_for_device(struct device *dev, dma_addr_t ba, size_t s | |||
377 | { | 377 | { |
378 | } | 378 | } |
379 | 379 | ||
380 | /* Support code for sbus_init(). */ | ||
381 | void __init sbus_setup_iommu(struct sbus_bus *sbus, struct device_node *dp) | ||
382 | { | ||
383 | #ifndef CONFIG_SUN4 | ||
384 | struct device_node *parent = dp->parent; | ||
385 | |||
386 | if (sparc_cpu_model != sun4d && | ||
387 | parent != NULL && | ||
388 | !strcmp(parent->name, "iommu")) | ||
389 | iommu_init(parent, sbus); | ||
390 | |||
391 | if (sparc_cpu_model == sun4d) | ||
392 | iounit_init(sbus); | ||
393 | #endif | ||
394 | } | ||
395 | |||
396 | static int __init sparc_register_ioport(void) | 380 | static int __init sparc_register_ioport(void) |
397 | { | 381 | { |
398 | register_proc_sparc_ioport(); | 382 | register_proc_sparc_ioport(); |
@@ -402,13 +386,6 @@ static int __init sparc_register_ioport(void) | |||
402 | 386 | ||
403 | arch_initcall(sparc_register_ioport); | 387 | arch_initcall(sparc_register_ioport); |
404 | 388 | ||
405 | void __init sbus_arch_postinit(void) | ||
406 | { | ||
407 | if (sparc_cpu_model == sun4d) { | ||
408 | extern void sun4d_init_sbi_irq(void); | ||
409 | sun4d_init_sbi_irq(); | ||
410 | } | ||
411 | } | ||
412 | #endif /* CONFIG_SBUS */ | 389 | #endif /* CONFIG_SBUS */ |
413 | 390 | ||
414 | #ifdef CONFIG_PCI | 391 | #ifdef CONFIG_PCI |
diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c index 0f97ab30df3f..caf551ad9d8c 100644 --- a/arch/sparc/mm/io-unit.c +++ b/arch/sparc/mm/io-unit.c | |||
@@ -34,18 +34,10 @@ | |||
34 | #define IOPERM (IOUPTE_CACHE | IOUPTE_WRITE | IOUPTE_VALID) | 34 | #define IOPERM (IOUPTE_CACHE | IOUPTE_WRITE | IOUPTE_VALID) |
35 | #define MKIOPTE(phys) __iopte((((phys)>>4) & IOUPTE_PAGE) | IOPERM) | 35 | #define MKIOPTE(phys) __iopte((((phys)>>4) & IOUPTE_PAGE) | IOPERM) |
36 | 36 | ||
37 | void __init iounit_init(struct sbus_bus *sbus) | 37 | static void __init iounit_iommu_init(struct of_device *op) |
38 | { | 38 | { |
39 | struct device_node *dp = sbus->ofdev.node; | ||
40 | struct iounit_struct *iounit; | 39 | struct iounit_struct *iounit; |
41 | iopte_t *xpt, *xptend; | 40 | iopte_t *xpt, *xptend; |
42 | struct of_device *op; | ||
43 | |||
44 | op = of_find_device_by_node(dp); | ||
45 | if (!op) { | ||
46 | prom_printf("SUN4D: Cannot find SBI of_device.\n"); | ||
47 | prom_halt(); | ||
48 | } | ||
49 | 41 | ||
50 | iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC); | 42 | iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC); |
51 | if (!iounit) { | 43 | if (!iounit) { |
@@ -66,7 +58,6 @@ void __init iounit_init(struct sbus_bus *sbus) | |||
66 | prom_halt(); | 58 | prom_halt(); |
67 | } | 59 | } |
68 | 60 | ||
69 | sbus->ofdev.dev.archdata.iommu = iounit; | ||
70 | op->dev.archdata.iommu = iounit; | 61 | op->dev.archdata.iommu = iounit; |
71 | iounit->page_table = xpt; | 62 | iounit->page_table = xpt; |
72 | spin_lock_init(&iounit->lock); | 63 | spin_lock_init(&iounit->lock); |
@@ -76,6 +67,25 @@ void __init iounit_init(struct sbus_bus *sbus) | |||
76 | iopte_val(*xpt++) = 0; | 67 | iopte_val(*xpt++) = 0; |
77 | } | 68 | } |
78 | 69 | ||
70 | static int __init iounit_init(void) | ||
71 | { | ||
72 | extern void sun4d_init_sbi_irq(void); | ||
73 | struct device_node *dp; | ||
74 | |||
75 | for_each_node_by_name(dp, "sbi") { | ||
76 | struct of_device *op = of_find_device_by_node(dp); | ||
77 | |||
78 | iounit_iommu_init(op); | ||
79 | of_propagate_archdata(op); | ||
80 | } | ||
81 | |||
82 | sun4d_init_sbi_irq(); | ||
83 | |||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | subsys_initcall(iounit_init); | ||
88 | |||
79 | /* One has to hold iounit->lock to call this */ | 89 | /* One has to hold iounit->lock to call this */ |
80 | static unsigned long iounit_get_area(struct iounit_struct *iounit, unsigned long vaddr, int size) | 90 | static unsigned long iounit_get_area(struct iounit_struct *iounit, unsigned long vaddr, int size) |
81 | { | 91 | { |
diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c index 2970cea877b1..7c55450b55b9 100644 --- a/arch/sparc/mm/iommu.c +++ b/arch/sparc/mm/iommu.c | |||
@@ -55,33 +55,20 @@ static pgprot_t dvma_prot; /* Consistent mapping pte flags */ | |||
55 | #define IOPERM (IOPTE_CACHE | IOPTE_WRITE | IOPTE_VALID) | 55 | #define IOPERM (IOPTE_CACHE | IOPTE_WRITE | IOPTE_VALID) |
56 | #define MKIOPTE(pfn, perm) (((((pfn)<<8) & IOPTE_PAGE) | (perm)) & ~IOPTE_WAZ) | 56 | #define MKIOPTE(pfn, perm) (((((pfn)<<8) & IOPTE_PAGE) | (perm)) & ~IOPTE_WAZ) |
57 | 57 | ||
58 | void __init iommu_init(struct device_node *parent, struct sbus_bus *sbus) | 58 | static void __init sbus_iommu_init(struct of_device *op) |
59 | { | 59 | { |
60 | struct of_device *parent_op, *op; | ||
61 | struct iommu_struct *iommu; | 60 | struct iommu_struct *iommu; |
62 | unsigned int impl, vers; | 61 | unsigned int impl, vers; |
63 | unsigned long *bitmap; | 62 | unsigned long *bitmap; |
64 | unsigned long tmp; | 63 | unsigned long tmp; |
65 | 64 | ||
66 | parent_op = of_find_device_by_node(parent); | ||
67 | if (!parent_op) { | ||
68 | prom_printf("Unable to find IOMMU of_device\n"); | ||
69 | prom_halt(); | ||
70 | } | ||
71 | |||
72 | op = of_find_device_by_node(sbus->ofdev.node); | ||
73 | if (!op) { | ||
74 | prom_printf("Unable to find SBUS of_device\n"); | ||
75 | prom_halt(); | ||
76 | } | ||
77 | |||
78 | iommu = kmalloc(sizeof(struct iommu_struct), GFP_ATOMIC); | 65 | iommu = kmalloc(sizeof(struct iommu_struct), GFP_ATOMIC); |
79 | if (!iommu) { | 66 | if (!iommu) { |
80 | prom_printf("Unable to allocate iommu structure\n"); | 67 | prom_printf("Unable to allocate iommu structure\n"); |
81 | prom_halt(); | 68 | prom_halt(); |
82 | } | 69 | } |
83 | 70 | ||
84 | iommu->regs = of_ioremap(&parent_op->resource[0], 0, PAGE_SIZE * 3, | 71 | iommu->regs = of_ioremap(&op->resource[0], 0, PAGE_SIZE * 3, |
85 | "iommu_regs"); | 72 | "iommu_regs"); |
86 | if (!iommu->regs) { | 73 | if (!iommu->regs) { |
87 | prom_printf("Cannot map IOMMU registers\n"); | 74 | prom_printf("Cannot map IOMMU registers\n"); |
@@ -132,14 +119,29 @@ void __init iommu_init(struct device_node *parent, struct sbus_bus *sbus) | |||
132 | else | 119 | else |
133 | iommu->usemap.num_colors = 1; | 120 | iommu->usemap.num_colors = 1; |
134 | 121 | ||
135 | printk("IOMMU: impl %d vers %d table 0x%p[%d B] map [%d b]\n", | 122 | printk(KERN_INFO "IOMMU: impl %d vers %d table 0x%p[%d B] map [%d b]\n", |
136 | impl, vers, iommu->page_table, | 123 | impl, vers, iommu->page_table, |
137 | (int)(IOMMU_NPTES*sizeof(iopte_t)), (int)IOMMU_NPTES); | 124 | (int)(IOMMU_NPTES*sizeof(iopte_t)), (int)IOMMU_NPTES); |
138 | 125 | ||
139 | sbus->ofdev.dev.archdata.iommu = iommu; | ||
140 | op->dev.archdata.iommu = iommu; | 126 | op->dev.archdata.iommu = iommu; |
141 | } | 127 | } |
142 | 128 | ||
129 | static int __init iommu_init(void) | ||
130 | { | ||
131 | struct device_node *dp; | ||
132 | |||
133 | for_each_node_by_name(dp, "iommu") { | ||
134 | struct of_device *op = of_find_device_by_node(dp); | ||
135 | |||
136 | sbus_iommu_init(op); | ||
137 | of_propagate_archdata(op); | ||
138 | } | ||
139 | |||
140 | return 0; | ||
141 | } | ||
142 | |||
143 | subsys_initcall(iommu_init); | ||
144 | |||
143 | /* This begs to be btfixup-ed by srmmu. */ | 145 | /* This begs to be btfixup-ed by srmmu. */ |
144 | /* Flush the iotlb entries to ram. */ | 146 | /* Flush the iotlb entries to ram. */ |
145 | /* This could be better if we didn't have to flush whole pages. */ | 147 | /* This could be better if we didn't have to flush whole pages. */ |