aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/mm
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-08-27 07:54:04 -0400
committerDavid S. Miller <davem@davemloft.net>2008-08-29 05:15:21 -0400
commit046e26a8ba10b8ceff822f8d91451ab6c1e08c4e (patch)
tree92e95380c0f7f6c5257023a59b88d4221d3f9744 /arch/sparc/mm
parent5059625ed8862e897760b86effff0f8a35989c0d (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/mm')
-rw-r--r--arch/sparc/mm/io-unit.c30
-rw-r--r--arch/sparc/mm/iommu.c40
2 files changed, 41 insertions, 29 deletions
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
37void __init iounit_init(struct sbus_bus *sbus) 37static 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
70static 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
87subsys_initcall(iounit_init);
88
79/* One has to hold iounit->lock to call this */ 89/* One has to hold iounit->lock to call this */
80static unsigned long iounit_get_area(struct iounit_struct *iounit, unsigned long vaddr, int size) 90static 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
58void __init iommu_init(struct device_node *parent, struct sbus_bus *sbus) 58static 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
129static 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
143subsys_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. */