1 /* devices.c: Initial scan of the prom device tree for important
2 * Sparc device nodes which we need to find.
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
7 #include <linux/kernel.h>
8 #include <linux/threads.h>
9 #include <linux/init.h>
10 #include <linux/ioport.h>
13 #include <asm/oplib.h>
14 #include <asm/system.h>
16 #include <asm/spitfire.h>
18 struct prom_cpuinfo linux_cpus[64] __initdata = { { 0 } };
19 unsigned prom_cpu_nodes[64];
20 int linux_num_cpus = 0;
22 extern void cpu_probe(void);
23 extern void central_probe(void);
25 void __init device_scan(void)
28 int nd, prom_node_cpu, thismid;
29 int cpu_nds[64]; /* One node for each cpu */
32 /* FIX ME FAST... -DaveM */
33 ioport_resource.end = 0xffffffffffffffffUL;
34 iomem_resource.end = 0xffffffffffffffffUL;
36 prom_getstring(prom_root_node, "device_type", node_str, sizeof(node_str));
38 prom_printf("Booting Linux...\n");
39 if(strcmp(node_str, "cpu") == 0) {
40 cpu_nds[0] = prom_root_node;
41 linux_cpus[0].prom_node = prom_root_node;
42 linux_cpus[0].mid = 0;
46 scan = prom_getchild(prom_root_node);
47 /* prom_printf("root child is %08x\n", (unsigned) scan); */
49 while((scan = prom_getsibling(scan)) != 0) {
50 prom_getstring(scan, "device_type", node_str, sizeof(node_str));
51 if(strcmp(node_str, "cpu") == 0) {
52 cpu_nds[cpu_ctr] = scan;
53 linux_cpus[cpu_ctr].prom_node = scan;
55 if (tlb_type == spitfire) {
56 prom_getproperty(scan, "upa-portid",
57 (char *) &thismid, sizeof(thismid));
58 } else if (tlb_type == cheetah) {
59 prom_getproperty(scan, "portid",
60 (char *) &thismid, sizeof(thismid));
62 linux_cpus[cpu_ctr].mid = thismid;
63 printk("Found CPU %d (node=%08x,mid=%d)\n",
64 cpu_ctr, (unsigned) scan, thismid);
69 prom_printf("No CPU nodes found, cannot continue.\n");
72 printk("Found %d CPU prom device tree node(s).\n", cpu_ctr);
74 prom_node_cpu = cpu_nds[0];
76 linux_num_cpus = cpu_ctr;
78 prom_cpu_nodes[0] = prom_node_cpu;