OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uClinux-2.0.x/] [arch/] [sparc/] [kernel/] [devices.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/* 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/kernel.h>
8
#include <linux/tasks.h>
9
#include <linux/config.h>
10
 
11
#include <asm/page.h>
12
#include <asm/oplib.h>
13
#include <asm/smp.h>
14
#include <asm/system.h>
15
 
16
struct prom_cpuinfo linux_cpus[NCPUS];
17
int linux_num_cpus;
18
 
19
extern void cpu_probe(void);
20
extern void clock_stop_probe(void); /* tadpole.c */
21
 
22
unsigned long
23
device_scan(unsigned long mem_start)
24
{
25
        char node_str[128];
26
        int nd, prom_node_cpu, thismid;
27
        int cpu_nds[NCPUS];  /* One node for each cpu */
28
        int cpu_ctr = 0;
29
 
30
#if CONFIG_AP1000
31
        printk("Not scanning device list for CPUs\n");
32
        linux_num_cpus = 1;
33
        return;
34
#endif
35
 
36
        prom_getstring(prom_root_node, "device_type", node_str, sizeof(node_str));
37
 
38
        if(strcmp(node_str, "cpu") == 0) {
39
                cpu_nds[0] = prom_root_node;
40
                cpu_ctr++;
41
        } else {
42
                int scan;
43
                scan = prom_getchild(prom_root_node);
44
                prom_printf("root child is %08lx\n", (unsigned long) scan);
45
                nd = 0;
46
                while((scan = prom_getsibling(scan)) != 0) {
47
                        prom_getstring(scan, "device_type", node_str, sizeof(node_str));
48
                        if(strcmp(node_str, "cpu") == 0) {
49
                                cpu_nds[cpu_ctr] = scan;
50
                                linux_cpus[cpu_ctr].prom_node = scan;
51
                                prom_getproperty(scan, "mid", (char *) &thismid, sizeof(thismid));
52
                                linux_cpus[cpu_ctr].mid = thismid;
53
                                prom_printf("Found CPU %d <node=%08lx,mid=%d>\n",
54
                                            cpu_ctr, (unsigned long) scan,
55
                                            thismid);
56
                                cpu_ctr++;
57
                        }
58
                };
59
                if(cpu_ctr == 0) {
60
                        printk("No CPU nodes found, cannot continue.\n");
61
                        /* Probably a sun4d or sun4e, Sun is trying to trick us ;-) */
62
                        halt();
63
                }
64
                printk("Found %d CPU prom device tree node(s).\n", cpu_ctr);
65
        };
66
        prom_node_cpu = cpu_nds[0];
67
 
68
        linux_num_cpus = cpu_ctr;
69
 
70
        cpu_probe();
71
#if CONFIG_SUN_AUXIO
72
        {
73
          extern void auxio_probe(void);
74
          auxio_probe();
75
        }
76
#endif
77
        clock_stop_probe();
78
 
79
        return mem_start;
80
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.