aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sparc64/kernel/ebus.c65
-rw-r--r--arch/sparc64/kernel/isa.c68
-rw-r--r--include/asm-sparc64/ebus.h5
-rw-r--r--include/asm-sparc64/isa.h8
4 files changed, 41 insertions, 105 deletions
diff --git a/arch/sparc64/kernel/ebus.c b/arch/sparc64/kernel/ebus.c
index 919a91d9e5de..33d79e10c653 100644
--- a/arch/sparc64/kernel/ebus.c
+++ b/arch/sparc64/kernel/ebus.c
@@ -283,60 +283,32 @@ static inline void *ebus_alloc(size_t size)
283 return mem; 283 return mem;
284} 284}
285 285
286static void __init ebus_ranges_init(struct linux_ebus *ebus) 286int __init ebus_intmap_match(struct linux_ebus *ebus,
287{ 287 struct linux_prom_registers *reg,
288 struct linux_prom_ebus_ranges *rngs; 288 int *interrupt)
289 int len;
290
291 ebus->num_ebus_ranges = 0;
292 rngs = of_get_property(ebus->prom_node, "ranges", &len);
293 if (rngs) {
294 memcpy(ebus->ebus_ranges, rngs, len);
295 ebus->num_ebus_ranges =
296 (len / sizeof(struct linux_prom_ebus_ranges));
297 }
298}
299
300static void __init ebus_intmap_init(struct linux_ebus *ebus)
301{ 289{
302 struct linux_prom_ebus_intmap *imap; 290 struct linux_prom_ebus_intmap *imap;
303 struct linux_prom_ebus_intmask *imask; 291 struct linux_prom_ebus_intmask *imask;
304 int len; 292 unsigned int hi, lo, irq;
293 int i, len, n_imap;
305 294
306 ebus->num_ebus_intmap = 0;
307 imap = of_get_property(ebus->prom_node, "interrupt-map", &len); 295 imap = of_get_property(ebus->prom_node, "interrupt-map", &len);
308 if (!imap) 296 if (!imap)
309 return; 297 return 0;
310 298 n_imap = len / sizeof(imap[0]);
311 memcpy(ebus->ebus_intmap, imap, len);
312 ebus->num_ebus_intmap = (len / sizeof(struct linux_prom_ebus_intmap));
313
314 imask = of_get_property(ebus->prom_node, "interrupt-map-mask", &len);
315 if (!imask) {
316 prom_printf("EBUS: can't get interrupt-map-mask\n");
317 prom_halt();
318 }
319 memcpy(&ebus->ebus_intmask, imask, sizeof(ebus->ebus_intmask));
320}
321
322int __init ebus_intmap_match(struct linux_ebus *ebus,
323 struct linux_prom_registers *reg,
324 int *interrupt)
325{
326 unsigned int hi, lo, irq;
327 int i;
328 299
329 if (!ebus->num_ebus_intmap) 300 imask = of_get_property(ebus->prom_node, "interrupt-map-mask", NULL);
301 if (!imask)
330 return 0; 302 return 0;
331 303
332 hi = reg->which_io & ebus->ebus_intmask.phys_hi; 304 hi = reg->which_io & imask->phys_hi;
333 lo = reg->phys_addr & ebus->ebus_intmask.phys_lo; 305 lo = reg->phys_addr & imask->phys_lo;
334 irq = *interrupt & ebus->ebus_intmask.interrupt; 306 irq = *interrupt & imask->interrupt;
335 for (i = 0; i < ebus->num_ebus_intmap; i++) { 307 for (i = 0; i < n_imap; i++) {
336 if ((ebus->ebus_intmap[i].phys_hi == hi) && 308 if ((imap[i].phys_hi == hi) &&
337 (ebus->ebus_intmap[i].phys_lo == lo) && 309 (imap[i].phys_lo == lo) &&
338 (ebus->ebus_intmap[i].interrupt == irq)) { 310 (imap[i].interrupt == irq)) {
339 *interrupt = ebus->ebus_intmap[i].cinterrupt; 311 *interrupt = imap[i].cinterrupt;
340 return 0; 312 return 0;
341 } 313 }
342 } 314 }
@@ -598,9 +570,6 @@ void __init ebus_init(void)
598 ebus->self = pdev; 570 ebus->self = pdev;
599 ebus->parent = pbm = cookie->pbm; 571 ebus->parent = pbm = cookie->pbm;
600 572
601 ebus_ranges_init(ebus);
602 ebus_intmap_init(ebus);
603
604 child = dp->child; 573 child = dp->child;
605 if (!child) 574 if (!child)
606 goto next_ebus; 575 goto next_ebus;
diff --git a/arch/sparc64/kernel/isa.c b/arch/sparc64/kernel/isa.c
index 8c8c5a491ad6..2693f2de549c 100644
--- a/arch/sparc64/kernel/isa.c
+++ b/arch/sparc64/kernel/isa.c
@@ -72,19 +72,30 @@ static struct {
72static int __init isa_dev_get_irq_using_imap(struct sparc_isa_device *isa_dev, 72static int __init isa_dev_get_irq_using_imap(struct sparc_isa_device *isa_dev,
73 struct sparc_isa_bridge *isa_br, 73 struct sparc_isa_bridge *isa_br,
74 int *interrupt, 74 int *interrupt,
75 struct linux_prom_registers *pregs) 75 struct linux_prom_registers *reg)
76{ 76{
77 struct linux_prom_ebus_intmap *imap;
78 struct linux_prom_ebus_intmap *imask;
77 unsigned int hi, lo, irq; 79 unsigned int hi, lo, irq;
78 int i; 80 int i, len, n_imap;
79 81
80 hi = pregs->which_io & isa_br->isa_intmask.phys_hi; 82 imap = of_get_property(isa_br->prom_node, "interrupt-map", &len);
81 lo = pregs->phys_addr & isa_br->isa_intmask.phys_lo; 83 if (!imap)
82 irq = *interrupt & isa_br->isa_intmask.interrupt; 84 return 0;
83 for (i = 0; i < isa_br->num_isa_intmap; i++) { 85 n_imap = len / sizeof(imap[0]);
84 if ((isa_br->isa_intmap[i].phys_hi == hi) && 86
85 (isa_br->isa_intmap[i].phys_lo == lo) && 87 imask = of_get_property(isa_br->prom_node, "interrupt-map-mask", NULL);
86 (isa_br->isa_intmap[i].interrupt == irq)) { 88 if (!imask)
87 *interrupt = isa_br->isa_intmap[i].cinterrupt; 89 return 0;
90
91 hi = reg->which_io & imask->phys_hi;
92 lo = reg->phys_addr & imask->phys_lo;
93 irq = *interrupt & imask->interrupt;
94 for (i = 0; i < n_imap; i++) {
95 if ((imap[i].phys_hi == hi) &&
96 (imap[i].phys_lo == lo) &&
97 (imap[i].interrupt == irq)) {
98 *interrupt = imap[i].cinterrupt;
88 return 0; 99 return 0;
89 } 100 }
90 } 101 }
@@ -105,7 +116,8 @@ static void __init isa_dev_get_irq(struct sparc_isa_device *isa_dev,
105 struct pci_pbm_info *pbm; 116 struct pci_pbm_info *pbm;
106 int i; 117 int i;
107 118
108 if (isa_dev->bus->num_isa_intmap) { 119 if (of_find_property(isa_dev->bus->prom_node,
120 "interrupt-map", NULL)) {
109 if (!isa_dev_get_irq_using_imap(isa_dev, 121 if (!isa_dev_get_irq_using_imap(isa_dev,
110 isa_dev->bus, 122 isa_dev->bus,
111 &irq_prop, 123 &irq_prop,
@@ -218,36 +230,6 @@ static void __init isa_fill_devices(struct sparc_isa_bridge *isa_br)
218 } 230 }
219} 231}
220 232
221static void __init get_bridge_props(struct sparc_isa_bridge *isa_br)
222{
223 struct device_node *dp = isa_br->prom_node;
224 void *pval;
225 int len;
226
227 pval = of_get_property(dp, "ranges", &len);
228 if (pval) {
229 memcpy(isa_br->isa_ranges, pval, len);
230 isa_br->num_isa_ranges =
231 len / sizeof(struct linux_prom_isa_ranges);
232 } else {
233 isa_br->num_isa_ranges = 0;
234 }
235
236 pval = of_get_property(dp, "interrupt-map", &len);
237 if (pval) {
238 memcpy(isa_br->isa_intmap, pval, len);
239 isa_br->num_isa_intmap =
240 (len / sizeof(struct linux_prom_isa_intmap));
241 } else {
242 isa_br->num_isa_intmap = 0;
243 }
244
245 pval = of_get_property(dp, "interrupt-map-mask", &len);
246 if (pval)
247 memcpy(&isa_br->isa_intmask, pval,
248 sizeof(isa_br->isa_intmask));
249}
250
251void __init isa_init(void) 233void __init isa_init(void)
252{ 234{
253 struct pci_dev *pdev; 235 struct pci_dev *pdev;
@@ -288,8 +270,6 @@ void __init isa_init(void)
288 isa_br->index = index++; 270 isa_br->index = index++;
289 isa_br->prom_node = pdev_cookie->prom_node; 271 isa_br->prom_node = pdev_cookie->prom_node;
290 272
291 get_bridge_props(isa_br);
292
293 printk("isa%d:", isa_br->index); 273 printk("isa%d:", isa_br->index);
294 274
295 isa_fill_devices(isa_br); 275 isa_fill_devices(isa_br);
diff --git a/include/asm-sparc64/ebus.h b/include/asm-sparc64/ebus.h
index 876912f4d83b..545882bd3563 100644
--- a/include/asm-sparc64/ebus.h
+++ b/include/asm-sparc64/ebus.h
@@ -42,11 +42,6 @@ struct linux_ebus {
42 int index; 42 int index;
43 int is_rio; 43 int is_rio;
44 struct device_node *prom_node; 44 struct device_node *prom_node;
45 struct linux_prom_ebus_ranges ebus_ranges[PROMREG_MAX];
46 int num_ebus_ranges;
47 struct linux_prom_ebus_intmap ebus_intmap[PROMREG_MAX];
48 int num_ebus_intmap;
49 struct linux_prom_ebus_intmask ebus_intmask;
50}; 45};
51 46
52struct ebus_dma_info { 47struct ebus_dma_info {
diff --git a/include/asm-sparc64/isa.h b/include/asm-sparc64/isa.h
index e110435b14ef..2e7fb18ec1be 100644
--- a/include/asm-sparc64/isa.h
+++ b/include/asm-sparc64/isa.h
@@ -29,14 +29,6 @@ struct sparc_isa_bridge {
29 struct pci_dev *self; 29 struct pci_dev *self;
30 int index; 30 int index;
31 struct device_node *prom_node; 31 struct device_node *prom_node;
32#define linux_prom_isa_ranges linux_prom_ebus_ranges
33 struct linux_prom_isa_ranges isa_ranges[PROMREG_MAX];
34 int num_isa_ranges;
35#define linux_prom_isa_intmap linux_prom_ebus_intmap
36 struct linux_prom_isa_intmap isa_intmap[PROMREG_MAX];
37 int num_isa_intmap;
38#define linux_prom_isa_intmask linux_prom_ebus_intmask
39 struct linux_prom_isa_intmap isa_intmask;
40}; 32};
41 33
42extern struct sparc_isa_bridge *isa_chain; 34extern struct sparc_isa_bridge *isa_chain;