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/config.h>
8 #include <linux/kernel.h>
9 #include <linux/threads.h>
10 #include <linux/string.h>
11 #include <linux/init.h>
14 #include <asm/oplib.h>
16 #include <asm/system.h>
18 struct prom_cpuinfo linux_cpus[NR_CPUS];
19 int linux_num_cpus = 0;
21 extern void cpu_probe(void);
22 extern void clock_stop_probe(void); /* tadpole.c */
23 extern void sun4c_probe_memerr_reg(void);
31 prom_getstring(prom_root_node, "device_type", node_str, sizeof(node_str));
33 prom_printf("Booting Linux...\n");
34 if(strcmp(node_str, "cpu") == 0) {
38 scan = prom_getchild(prom_root_node);
39 /* One can look it up in PROM instead */
40 while ((scan = prom_getsibling(scan)) != 0) {
41 prom_getstring(scan, "device_type",
42 node_str, sizeof(node_str));
43 if (strcmp(node_str, "cpu") == 0) {
44 linux_cpus[linux_num_cpus].prom_node = scan;
45 prom_getproperty(scan, "mid",
46 (char *) &thismid, sizeof(thismid));
47 linux_cpus[linux_num_cpus].mid = thismid;
48 printk("Found CPU %d <node=%08lx,mid=%d>\n",
49 linux_num_cpus, (unsigned long) scan, thismid);
53 if (linux_num_cpus == 0 && sparc_cpu_model == sun4d) {
54 scan = prom_getchild(prom_root_node);
55 for (scan = prom_searchsiblings(scan, "cpu-unit"); scan;
56 scan = prom_searchsiblings(prom_getsibling(scan), "cpu-unit")) {
57 int node = prom_getchild(scan);
59 prom_getstring(node, "device_type",
60 node_str, sizeof(node_str));
61 if (strcmp(node_str, "cpu") == 0) {
62 prom_getproperty(node, "cpu-id",
63 (char *) &thismid, sizeof(thismid));
64 linux_cpus[linux_num_cpus].prom_node = node;
65 linux_cpus[linux_num_cpus].mid = thismid;
66 printk("Found CPU %d <node=%08lx,mid=%d>\n",
67 linux_num_cpus, (unsigned long) node, thismid);
72 if (linux_num_cpus == 0) {
73 printk("No CPU nodes found, cannot continue.\n");
74 /* Probably a sun4e, Sun is trying to trick us ;-) */
77 printk("Found %d CPU prom device tree node(s).\n", linux_num_cpus);
81 #ifdef CONFIG_SUN_AUXIO
83 extern void auxio_probe(void);
84 extern void auxio_power_probe(void);
92 sun4c_probe_memerr_reg();