aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/prom.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2005-10-23 03:23:21 -0400
committerPaul Mackerras <paulus@samba.org>2005-10-23 03:23:21 -0400
commita575b807172ca7d8850e6e979c8e83d4258e8c43 (patch)
tree83c3a6be6f16e4e1d325ecb9b43d26bb4d3d1ab7 /arch/powerpc/kernel/prom.c
parent96c44507601d64f29b8ccc867637292e326c7019 (diff)
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.c36
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,
309 unsigned int *irq, virq; 309 unsigned int *irq, virq;
310 struct device_node *ic; 310 struct device_node *ic;
311 311
312 if (num_interrupt_controllers == 0) {
313 /*
314 * Old machines just have a list of interrupt numbers
315 * and no interrupt-controller nodes.
316 */
317 ints = (unsigned int *) get_property(np, "AAPL,interrupts",
318 &intlen);
319 /* XXX old interpret_pci_props looked in parent too */
320 /* XXX old interpret_macio_props looked for interrupts
321 before AAPL,interrupts */
322 if (ints == NULL)
323 ints = (unsigned int *) get_property(np, "interrupts",
324 &intlen);
325 if (ints == NULL)
326 return 0;
327
328 np->n_intrs = intlen / sizeof(unsigned int);
329 np->intrs = prom_alloc(np->n_intrs * sizeof(np->intrs[0]),
330 mem_start);
331 if (!np->intrs)
332 return -ENOMEM;
333 if (measure_only)
334 return 0;
335
336 for (i = 0; i < np->n_intrs; ++i) {
337 np->intrs[i].line = *ints++;
338 np->intrs[i].sense = 1;
339 }
340 return 0;
341 }
342
312 ints = (unsigned int *) get_property(np, "interrupts", &intlen); 343 ints = (unsigned int *) get_property(np, "interrupts", &intlen);
313 if (ints == NULL) 344 if (ints == NULL)
314 return 0; 345 return 0;
@@ -1024,6 +1055,8 @@ void __init unflatten_device_tree(void)
1024 1055
1025 /* Get pointer to OF "/chosen" node for use everywhere */ 1056 /* Get pointer to OF "/chosen" node for use everywhere */
1026 of_chosen = of_find_node_by_path("/chosen"); 1057 of_chosen = of_find_node_by_path("/chosen");
1058 if (of_chosen == NULL)
1059 of_chosen = of_find_node_by_path("/chosen@0");
1027 1060
1028 /* Retreive command line */ 1061 /* Retreive command line */
1029 if (of_chosen != NULL) { 1062 if (of_chosen != NULL) {
@@ -1123,7 +1156,8 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
1123 1156
1124 DBG("search \"chosen\", depth: %d, uname: %s\n", depth, uname); 1157 DBG("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
1125 1158
1126 if (depth != 1 || strcmp(uname, "chosen") != 0) 1159 if (depth != 1 ||
1160 (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0))
1127 return 0; 1161 return 0;
1128 1162
1129 /* get platform type */ 1163 /* get platform type */