original comment: +Wilson03172004,marked due to this pci host does not support MWI
[linux-2.4.git] / arch / sparc / kernel / devices.c
1 /* devices.c: Initial scan of the prom device tree for important
2  *            Sparc device nodes which we need to find.
3  *
4  * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
5  */
6
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>
12
13 #include <asm/page.h>
14 #include <asm/oplib.h>
15 #include <asm/smp.h>
16 #include <asm/system.h>
17
18 struct prom_cpuinfo linux_cpus[NR_CPUS];
19 int linux_num_cpus = 0;
20
21 extern void cpu_probe(void);
22 extern void clock_stop_probe(void); /* tadpole.c */
23 extern void sun4c_probe_memerr_reg(void);
24
25 void __init
26 device_scan(void)
27 {
28         char node_str[128];
29         int thismid;
30
31         prom_getstring(prom_root_node, "device_type", node_str, sizeof(node_str));
32
33         prom_printf("Booting Linux...\n");
34         if(strcmp(node_str, "cpu") == 0) {
35                 linux_num_cpus++;
36         } else {
37                 int scan;
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);
50                                 linux_num_cpus++;
51                         }
52                 }
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);
58
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);
68                                         linux_num_cpus++;
69                                 }
70                         }
71                 }
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 ;-) */
75                         prom_halt();
76                 }
77                 printk("Found %d CPU prom device tree node(s).\n", linux_num_cpus);
78         }
79
80         cpu_probe();
81 #ifdef CONFIG_SUN_AUXIO
82         {
83                 extern void auxio_probe(void);
84                 extern void auxio_power_probe(void);
85                 auxio_probe();
86                 auxio_power_probe();
87         }
88 #endif
89         clock_stop_probe();
90
91         if (ARCH_SUN4C_SUN4)
92                 sun4c_probe_memerr_reg();
93
94         return;
95 }