diff options
Diffstat (limited to 'arch/mips/fw/arc/identify.c')
-rw-r--r-- | arch/mips/fw/arc/identify.c | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/arch/mips/fw/arc/identify.c b/arch/mips/fw/arc/identify.c new file mode 100644 index 000000000000..4b907369b0f9 --- /dev/null +++ b/arch/mips/fw/arc/identify.c | |||
@@ -0,0 +1,123 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * identify.c: identify machine by looking up system identifier | ||
7 | * | ||
8 | * Copyright (C) 1998 Thomas Bogendoerfer | ||
9 | * | ||
10 | * This code is based on arch/mips/sgi/kernel/system.c, which is | ||
11 | * | ||
12 | * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com) | ||
13 | */ | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/types.h> | ||
17 | #include <linux/string.h> | ||
18 | |||
19 | #include <asm/sgialib.h> | ||
20 | #include <asm/bootinfo.h> | ||
21 | |||
22 | struct smatch { | ||
23 | char *arcname; | ||
24 | char *liname; | ||
25 | int group; | ||
26 | int type; | ||
27 | int flags; | ||
28 | }; | ||
29 | |||
30 | static struct smatch mach_table[] = { | ||
31 | { "SGI-IP22", | ||
32 | "SGI Indy", | ||
33 | MACH_GROUP_SGI, | ||
34 | MACH_SGI_IP22, | ||
35 | PROM_FLAG_ARCS | ||
36 | }, { "SGI-IP27", | ||
37 | "SGI Origin", | ||
38 | MACH_GROUP_SGI, | ||
39 | MACH_SGI_IP27, | ||
40 | PROM_FLAG_ARCS | ||
41 | }, { "SGI-IP28", | ||
42 | "SGI IP28", | ||
43 | MACH_GROUP_SGI, | ||
44 | MACH_SGI_IP28, | ||
45 | PROM_FLAG_ARCS | ||
46 | }, { "SGI-IP30", | ||
47 | "SGI Octane", | ||
48 | MACH_GROUP_SGI, | ||
49 | MACH_SGI_IP30, | ||
50 | PROM_FLAG_ARCS | ||
51 | }, { "SGI-IP32", | ||
52 | "SGI O2", | ||
53 | MACH_GROUP_SGI, | ||
54 | MACH_SGI_IP32, | ||
55 | PROM_FLAG_ARCS | ||
56 | }, { "Microsoft-Jazz", | ||
57 | "Jazz MIPS_Magnum_4000", | ||
58 | MACH_GROUP_JAZZ, | ||
59 | MACH_MIPS_MAGNUM_4000, | ||
60 | 0 | ||
61 | }, { "PICA-61", | ||
62 | "Jazz Acer_PICA_61", | ||
63 | MACH_GROUP_JAZZ, | ||
64 | MACH_ACER_PICA_61, | ||
65 | 0 | ||
66 | }, { "RM200PCI", | ||
67 | "SNI RM200_PCI", | ||
68 | MACH_GROUP_SNI_RM, | ||
69 | MACH_SNI_RM200_PCI, | ||
70 | PROM_FLAG_DONT_FREE_TEMP | ||
71 | } | ||
72 | }; | ||
73 | |||
74 | int prom_flags; | ||
75 | |||
76 | static struct smatch * __init string_to_mach(const char *s) | ||
77 | { | ||
78 | int i; | ||
79 | |||
80 | for (i = 0; i < ARRAY_SIZE(mach_table); i++) { | ||
81 | if (!strcmp(s, mach_table[i].arcname)) | ||
82 | return &mach_table[i]; | ||
83 | } | ||
84 | |||
85 | panic("Yeee, could not determine architecture type <%s>", s); | ||
86 | } | ||
87 | |||
88 | char *system_type; | ||
89 | |||
90 | const char *get_system_type(void) | ||
91 | { | ||
92 | return system_type; | ||
93 | } | ||
94 | |||
95 | void __init prom_identify_arch(void) | ||
96 | { | ||
97 | pcomponent *p; | ||
98 | struct smatch *mach; | ||
99 | const char *iname; | ||
100 | |||
101 | /* | ||
102 | * The root component tells us what machine architecture we have here. | ||
103 | */ | ||
104 | p = ArcGetChild(PROM_NULL_COMPONENT); | ||
105 | if (p == NULL) { | ||
106 | #ifdef CONFIG_SGI_IP27 | ||
107 | /* IP27 PROM misbehaves, seems to not implement ARC | ||
108 | GetChild(). So we just assume it's an IP27. */ | ||
109 | iname = "SGI-IP27"; | ||
110 | #else | ||
111 | iname = "Unknown"; | ||
112 | #endif | ||
113 | } else | ||
114 | iname = (char *) (long) p->iname; | ||
115 | |||
116 | printk("ARCH: %s\n", iname); | ||
117 | mach = string_to_mach(iname); | ||
118 | system_type = mach->liname; | ||
119 | |||
120 | mips_machgroup = mach->group; | ||
121 | mips_machtype = mach->type; | ||
122 | prom_flags = mach->flags; | ||
123 | } | ||