diff options
author | Paul Mackerras <paulus@samba.org> | 2005-10-23 17:23:21 +1000 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-10-23 17:23:21 +1000 |
commit | a575b807172ca7d8850e6e979c8e83d4258e8c43 (patch) | |
tree | 83c3a6be6f16e4e1d325ecb9b43d26bb4d3d1ab7 /arch/powerpc/kernel/prom.c | |
parent | 96c44507601d64f29b8ccc867637292e326c7019 (diff) | |
download | blackbird-op-linux-a575b807172ca7d8850e6e979c8e83d4258e8c43.tar.gz blackbird-op-linux-a575b807172ca7d8850e6e979c8e83d4258e8c43.zip |
powerpc: Run on old powermacs.
Old powermacs have a number of differences from current machines:
- there is no interrupt tree in the device tree, just interrupt
or AAPL,interrupt properties
- the chosen node in the device tree is called /chosen@0
- the OF claim method doesn't map the memory, so we have to do
an explicit map call as well
- there is no /chosen/cpu property on SMP machines
- the NVRAM isn't structured as a set of partitions.
This adapts the merged powermac support code to cope with these
issues.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/prom.c')
-rw-r--r-- | arch/powerpc/kernel/prom.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index c8d288457b4c..69f69c38fd27 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c @@ -309,6 +309,37 @@ static int __devinit finish_node_interrupts(struct device_node *np, unsigned int *irq, virq; struct device_node *ic; + if (num_interrupt_controllers == 0) { + /* + * Old machines just have a list of interrupt numbers + * and no interrupt-controller nodes. + */ + ints = (unsigned int *) get_property(np, "AAPL,interrupts", + &intlen); + /* XXX old interpret_pci_props looked in parent too */ + /* XXX old interpret_macio_props looked for interrupts + before AAPL,interrupts */ + if (ints == NULL) + ints = (unsigned int *) get_property(np, "interrupts", + &intlen); + if (ints == NULL) + return 0; + + np->n_intrs = intlen / sizeof(unsigned int); + np->intrs = prom_alloc(np->n_intrs * sizeof(np->intrs[0]), + mem_start); + if (!np->intrs) + return -ENOMEM; + if (measure_only) + return 0; + + for (i = 0; i < np->n_intrs; ++i) { + np->intrs[i].line = *ints++; + np->intrs[i].sense = 1; + } + return 0; + } + ints = (unsigned int *) get_property(np, "interrupts", &intlen); if (ints == NULL) return 0; @@ -1024,6 +1055,8 @@ void __init unflatten_device_tree(void) /* Get pointer to OF "/chosen" node for use everywhere */ of_chosen = of_find_node_by_path("/chosen"); + if (of_chosen == NULL) + of_chosen = of_find_node_by_path("/chosen@0"); /* Retreive command line */ if (of_chosen != NULL) { @@ -1123,7 +1156,8 @@ static int __init early_init_dt_scan_chosen(unsigned long node, DBG("search \"chosen\", depth: %d, uname: %s\n", depth, uname); - if (depth != 1 || strcmp(uname, "chosen") != 0) + if (depth != 1 || + (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0)) return 0; /* get platform type */ |