Import 2.3.9pre5
[davej-history.git] / arch / mips / sgi / kernel / system.c
blob03f81b685593152169e0312aef5d0c0f7024bf60
1 /*
2 * system.c: Probe the system type using ARCS prom interface library.
4 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
6 * $Id: system.c,v 1.7 1998/10/18 22:55:34 tsbogend Exp $
7 */
8 #include <linux/init.h>
9 #include <linux/kernel.h>
10 #include <linux/types.h>
11 #include <linux/string.h>
13 #include <asm/sgi.h>
14 #include <asm/sgialib.h>
15 #include <asm/bootinfo.h>
17 enum sgi_mach sgimach;
19 struct smatch {
20 char *name;
21 int type;
24 static struct smatch sgi_cputable[] = {
25 { "MIPS-R2000", CPU_R2000 },
26 { "MIPS-R3000", CPU_R3000 },
27 { "MIPS-R3000A", CPU_R3000A },
28 { "MIPS-R4000", CPU_R4000SC },
29 { "MIPS-R4400", CPU_R4400SC },
30 { "MIPS-R4600", CPU_R4600 },
31 { "MIPS-R8000", CPU_R8000 },
32 { "MIPS-R5000", CPU_R5000 },
33 { "MIPS-R5000A", CPU_R5000A }
36 #define NUM_CPUS 9 /* for now */
38 __initfunc(static int string_to_cpu(char *s))
40 int i;
42 for(i = 0; i < NUM_CPUS; i++) {
43 if(!strcmp(s, sgi_cputable[i].name))
44 return sgi_cputable[i].type;
46 prom_printf("\nYeee, could not determine MIPS cpu type <%s>\n", s);
47 prom_printf("press a key to reboot\n");
48 prom_getchar();
49 romvec->imode();
50 return 0;
54 * We' call this early before loadmmu(). If we do the other way around
55 * the firmware will crash and burn.
57 __initfunc(void sgi_sysinit(void))
59 pcomponent *p, *toplev, *cpup = 0;
60 int cputype = -1;
63 /* The root component tells us what machine architecture we
64 * have here.
66 p = prom_getchild(PROM_NULL_COMPONENT);
68 /* Now scan for cpu(s). */
69 toplev = p = prom_getchild(p);
70 while(p) {
71 int ncpus = 0;
73 if(p->type == Cpu) {
74 if(++ncpus > 1) {
75 prom_printf("\nYeee, SGI MP not ready yet\n");
76 prom_printf("press a key to reboot\n");
77 prom_getchar();
78 romvec->imode();
80 printk("CPU: %s ", p->iname);
81 cpup = p;
82 cputype = string_to_cpu(cpup->iname);
84 p = prom_getsibling(p);
86 if(cputype == -1) {
87 prom_printf("\nYeee, could not find cpu ARCS component\n");
88 prom_printf("press a key to reboot\n");
89 prom_getchar();
90 romvec->imode();
92 p = prom_getchild(cpup);
93 while(p) {
94 switch(p->class) {
95 case processor:
96 switch(p->type) {
97 case Fpu:
98 printk("FPU<%s> ", p->iname);
99 break;
101 default:
102 break;
104 break;
106 case cache:
107 switch(p->type) {
108 case picache:
109 printk("ICACHE ");
110 break;
112 case pdcache:
113 printk("DCACHE ");
114 break;
116 case sccache:
117 printk("SCACHE ");
118 break;
120 default:
121 break;
124 break;
126 default:
127 break;
129 p = prom_getsibling(p);
131 printk("\n");