summaryrefslogtreecommitdiff
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)
return mem;
}
-static void __init ebus_ranges_init(struct linux_ebus *ebus)
-{
- struct linux_prom_ebus_ranges *rngs;
- int len;
-
- ebus->num_ebus_ranges = 0;
- rngs = of_get_property(ebus->prom_node, "ranges", &len);
- if (rngs) {
- memcpy(ebus->ebus_ranges, rngs, len);
- ebus->num_ebus_ranges =
- (len / sizeof(struct linux_prom_ebus_ranges));
- }
-}
-
-static void __init ebus_intmap_init(struct linux_ebus *ebus)
+int __init ebus_intmap_match(struct linux_ebus *ebus,
+ struct linux_prom_registers *reg,
+ int *interrupt)
{
struct linux_prom_ebus_intmap *imap;
struct linux_prom_ebus_intmask *imask;
- int len;
+ unsigned int hi, lo, irq;
+ int i, len, n_imap;
- ebus->num_ebus_intmap = 0;
imap = of_get_property(ebus->prom_node, "interrupt-map", &len);
if (!imap)
- return;
-
- memcpy(ebus->ebus_intmap, imap, len);
- ebus->num_ebus_intmap = (len / sizeof(struct linux_prom_ebus_intmap));
-
- imask = of_get_property(ebus->prom_node, "interrupt-map-mask", &len);
- if (!imask) {
- prom_printf("EBUS: can't get interrupt-map-mask\n");
- prom_halt();
- }
- memcpy(&ebus->ebus_intmask, imask, sizeof(ebus->ebus_intmask));
-}
-
-int __init ebus_intmap_match(struct linux_ebus *ebus,
- struct linux_prom_registers *reg,
- int *interrupt)
-{
- unsigned int hi, lo, irq;
- int i;
+ return 0;
+ n_imap = len / sizeof(imap[0]);
- if (!ebus->num_ebus_intmap)
+ imask = of_get_property(ebus->prom_node, "interrupt-map-mask", NULL);
+ if (!imask)
return 0;
- hi = reg->which_io & ebus->ebus_intmask.phys_hi;
- lo = reg->phys_addr & ebus->ebus_intmask.phys_lo;
- irq = *interrupt & ebus->ebus_intmask.interrupt;
- for (i = 0; i < ebus->num_ebus_intmap; i++) {
- if ((ebus->ebus_intmap[i].phys_hi == hi) &&
- (ebus->ebus_intmap[i].phys_lo == lo) &&
- (ebus->ebus_intmap[i].interrupt == irq)) {
- *interrupt = ebus->ebus_intmap[i].cinterrupt;
+ hi = reg->which_io & imask->phys_hi;
+ lo = reg->phys_addr & imask->phys_lo;
+ irq = *interrupt & imask->interrupt;
+ for (i = 0; i < n_imap; i++) {
+ if ((imap[i].phys_hi == hi) &&
+ (imap[i].phys_lo == lo) &&
+ (imap[i].interrupt == irq)) {
+ *interrupt = imap[i].cinterrupt;
return 0;
}
}
@@ -598,9 +570,6 @@ void __init ebus_init(void)
ebus->self = pdev;
ebus->parent = pbm = cookie->pbm;
- ebus_ranges_init(ebus);
- ebus_intmap_init(ebus);
-
child = dp->child;
if (!child)
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 {
static int __init isa_dev_get_irq_using_imap(struct sparc_isa_device *isa_dev,
struct sparc_isa_bridge *isa_br,
int *interrupt,
- struct linux_prom_registers *pregs)
+ struct linux_prom_registers *reg)
{
+ struct linux_prom_ebus_intmap *imap;
+ struct linux_prom_ebus_intmap *imask;
unsigned int hi, lo, irq;
- int i;
-
- hi = pregs->which_io & isa_br->isa_intmask.phys_hi;
- lo = pregs->phys_addr & isa_br->isa_intmask.phys_lo;
- irq = *interrupt & isa_br->isa_intmask.interrupt;
- for (i = 0; i < isa_br->num_isa_intmap; i++) {
- if ((isa_br->isa_intmap[i].phys_hi == hi) &&
- (isa_br->isa_intmap[i].phys_lo == lo) &&
- (isa_br->isa_intmap[i].interrupt == irq)) {
- *interrupt = isa_br->isa_intmap[i].cinterrupt;
+ int i, len, n_imap;
+
+ imap = of_get_property(isa_br->prom_node, "interrupt-map", &len);
+ if (!imap)
+ return 0;
+ n_imap = len / sizeof(imap[0]);
+
+ imask = of_get_property(isa_br->prom_node, "interrupt-map-mask", NULL);
+ if (!imask)
+ return 0;
+
+ hi = reg->which_io & imask->phys_hi;
+ lo = reg->phys_addr & imask->phys_lo;
+ irq = *interrupt & imask->interrupt;
+ for (i = 0; i < n_imap; i++) {
+ if ((imap[i].phys_hi == hi) &&
+ (imap[i].phys_lo == lo) &&
+ (imap[i].interrupt == irq)) {
+ *interrupt = imap[i].cinterrupt;
return 0;
}
}
@@ -105,7 +116,8 @@ static void __init isa_dev_get_irq(struct sparc_isa_device *isa_dev,
struct pci_pbm_info *pbm;
int i;
- if (isa_dev->bus->num_isa_intmap) {
+ if (of_find_property(isa_dev->bus->prom_node,
+ "interrupt-map", NULL)) {
if (!isa_dev_get_irq_using_imap(isa_dev,
isa_dev->bus,
&irq_prop,
@@ -218,36 +230,6 @@ static void __init isa_fill_devices(struct sparc_isa_bridge *isa_br)
}
}
-static void __init get_bridge_props(struct sparc_isa_bridge *isa_br)
-{
- struct device_node *dp = isa_br->prom_node;
- void *pval;
- int len;
-
- pval = of_get_property(dp, "ranges", &len);
- if (pval) {
- memcpy(isa_br->isa_ranges, pval, len);
- isa_br->num_isa_ranges =
- len / sizeof(struct linux_prom_isa_ranges);
- } else {
- isa_br->num_isa_ranges = 0;
- }
-
- pval = of_get_property(dp, "interrupt-map", &len);
- if (pval) {
- memcpy(isa_br->isa_intmap, pval, len);
- isa_br->num_isa_intmap =
- (len / sizeof(struct linux_prom_isa_intmap));
- } else {
- isa_br->num_isa_intmap = 0;
- }
-
- pval = of_get_property(dp, "interrupt-map-mask", &len);
- if (pval)
- memcpy(&isa_br->isa_intmask, pval,
- sizeof(isa_br->isa_intmask));
-}
-
void __init isa_init(void)
{
struct pci_dev *pdev;
@@ -288,8 +270,6 @@ void __init isa_init(void)
isa_br->index = index++;
isa_br->prom_node = pdev_cookie->prom_node;
- get_bridge_props(isa_br);
-
printk("isa%d:", isa_br->index);
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 {
int index;
int is_rio;
struct device_node *prom_node;
- struct linux_prom_ebus_ranges ebus_ranges[PROMREG_MAX];
- int num_ebus_ranges;
- struct linux_prom_ebus_intmap ebus_intmap[PROMREG_MAX];
- int num_ebus_intmap;
- struct linux_prom_ebus_intmask ebus_intmask;
};
struct 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 {
struct pci_dev *self;
int index;
struct device_node *prom_node;
-#define linux_prom_isa_ranges linux_prom_ebus_ranges
- struct linux_prom_isa_ranges isa_ranges[PROMREG_MAX];
- int num_isa_ranges;
-#define linux_prom_isa_intmap linux_prom_ebus_intmap
- struct linux_prom_isa_intmap isa_intmap[PROMREG_MAX];
- int num_isa_intmap;
-#define linux_prom_isa_intmask linux_prom_ebus_intmask
- struct linux_prom_isa_intmap isa_intmask;
};
extern struct sparc_isa_bridge *isa_chain;