blob: 28dfd2e2989a8fd81e8513c43aec7c78b73faa06 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#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
22struct smatch {
23 char *arcname;
24 char *liname;
Linus Torvalds1da177e2005-04-16 15:20:36 -070025 int type;
26 int flags;
27};
28
29static struct smatch mach_table[] = {
Ralf Baechle112b20a2007-10-11 23:46:07 +010030 {
31 .arcname = "SGI-IP22",
32 .liname = "SGI Indy",
Ralf Baechle112b20a2007-10-11 23:46:07 +010033 .type = MACH_SGI_IP22,
34 .flags = PROM_FLAG_ARCS,
35 }, {
36 .arcname = "SGI-IP27",
37 .liname = "SGI Origin",
Ralf Baechle112b20a2007-10-11 23:46:07 +010038 .type = MACH_SGI_IP27,
39 .flags = PROM_FLAG_ARCS,
40 }, {
41 .arcname = "SGI-IP28",
42 .liname = "SGI IP28",
Ralf Baechle112b20a2007-10-11 23:46:07 +010043 .type = MACH_SGI_IP28,
44 .flags = PROM_FLAG_ARCS,
45 }, {
46 .arcname = "SGI-IP30",
47 .liname = "SGI Octane",
Ralf Baechle112b20a2007-10-11 23:46:07 +010048 .type = MACH_SGI_IP30,
49 .flags = PROM_FLAG_ARCS,
50 }, {
51 .arcname = "SGI-IP32",
52 .liname = "SGI O2",
Ralf Baechle112b20a2007-10-11 23:46:07 +010053 .type = MACH_SGI_IP32,
54 .flags = PROM_FLAG_ARCS,
55 }, {
56 .arcname = "Microsoft-Jazz",
57 .liname = "Jazz MIPS_Magnum_4000",
Ralf Baechle112b20a2007-10-11 23:46:07 +010058 .type = MACH_MIPS_MAGNUM_4000,
59 .flags = 0,
60 }, {
61 .arcname = "PICA-61",
62 .liname = "Jazz Acer_PICA_61",
Ralf Baechle112b20a2007-10-11 23:46:07 +010063 .type = MACH_ACER_PICA_61,
64 .flags = 0,
65 }, {
66 .arcname = "RM200PCI",
67 .liname = "SNI RM200_PCI",
Ralf Baechle112b20a2007-10-11 23:46:07 +010068 .type = MACH_SNI_RM200_PCI,
69 .flags = PROM_FLAG_DONT_FREE_TEMP,
Linus Torvalds1da177e2005-04-16 15:20:36 -070070 }
71};
72
73int prom_flags;
74
75static struct smatch * __init string_to_mach(const char *s)
76{
77 int i;
78
Ahmed S. Darwish25b8ac32007-02-05 04:42:11 +020079 for (i = 0; i < ARRAY_SIZE(mach_table); i++) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070080 if (!strcmp(s, mach_table[i].arcname))
81 return &mach_table[i];
82 }
83
84 panic("Yeee, could not determine architecture type <%s>", s);
85}
86
87char *system_type;
88
89const char *get_system_type(void)
90{
91 return system_type;
92}
93
94void __init prom_identify_arch(void)
95{
96 pcomponent *p;
97 struct smatch *mach;
98 const char *iname;
99
100 /*
101 * The root component tells us what machine architecture we have here.
102 */
103 p = ArcGetChild(PROM_NULL_COMPONENT);
104 if (p == NULL) {
105#ifdef CONFIG_SGI_IP27
106 /* IP27 PROM misbehaves, seems to not implement ARC
107 GetChild(). So we just assume it's an IP27. */
108 iname = "SGI-IP27";
109#else
110 iname = "Unknown";
111#endif
112 } else
113 iname = (char *) (long) p->iname;
114
115 printk("ARCH: %s\n", iname);
116 mach = string_to_mach(iname);
117 system_type = mach->liname;
118
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119 mips_machtype = mach->type;
120 prom_flags = mach->flags;
121}