aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/fw/arc/identify.c
blob: 5d28dbe06f40827a6013e4bfd4d737865abdfa8d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 *
 * identify.c: identify machine by looking up system identifier
 *
 * Copyright (C) 1998 Thomas Bogendoerfer
 *
 * This code is based on arch/mips/sgi/kernel/system.c, which is
 *
 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
 */
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/string.h>

#include <asm/sgialib.h>
#include <asm/bootinfo.h>

struct smatch {
	char *arcname;
	char *liname;
	int group;
	int type;
	int flags;
};

static struct smatch mach_table[] = {
	{
		.arcname	= "SGI-IP22",
		.liname		= "SGI Indy",
		.group		= MACH_GROUP_SGI,
		.type		= MACH_SGI_IP22,
		.flags		= PROM_FLAG_ARCS,
	}, {
		.arcname	= "SGI-IP27",
		.liname		= "SGI Origin",
		.group		= MACH_GROUP_SGI,
		.type		= MACH_SGI_IP27,
		.flags		= PROM_FLAG_ARCS,
	}, {
		.arcname	= "SGI-IP28",
		.liname		= "SGI IP28",
		.group		= MACH_GROUP_SGI,
		.type		= MACH_SGI_IP28,
		.flags		= PROM_FLAG_ARCS,
	}, {
		.arcname	= "SGI-IP30",
		.liname		= "SGI Octane",
		.group		= MACH_GROUP_SGI,
		.type		= MACH_SGI_IP30,
		.flags		= PROM_FLAG_ARCS,
	}, {
		.arcname	= "SGI-IP32",
		.liname		= "SGI O2",
		.group		= MACH_GROUP_SGI,
		.type		= MACH_SGI_IP32,
		.flags		= PROM_FLAG_ARCS,
	}, {
		.arcname	= "Microsoft-Jazz",
		.liname		= "Jazz MIPS_Magnum_4000",
		.group		= MACH_GROUP_JAZZ,
		.type		= MACH_MIPS_MAGNUM_4000,
		.flags		= 0,
	}, {
		.arcname	= "PICA-61",
		.liname		= "Jazz Acer_PICA_61",
		.group		= MACH_GROUP_JAZZ,
		.type		= MACH_ACER_PICA_61,
		.flags		= 0,
	}, {
		.arcname	= "RM200PCI",
		.liname		= "SNI RM200_PCI",
		.group		= MACH_GROUP_SNI_RM,
		.type		= MACH_SNI_RM200_PCI,
		.flags		= PROM_FLAG_DONT_FREE_TEMP,
	}
};

int prom_flags;

static struct smatch * __init string_to_mach(const char *s)
{
	int i;

	for (i = 0; i < ARRAY_SIZE(mach_table); i++) {
		if (!strcmp(s, mach_table[i].arcname))
			return &mach_table[i];
	}

	panic("Yeee, could not determine architecture type <%s>", s);
}

char *system_type;

const char *get_system_type(void)
{
	return system_type;
}

void __init prom_identify_arch(void)
{
	pcomponent *p;
	struct smatch *mach;
	const char *iname;

	/*
	 * The root component tells us what machine architecture we have here.
	 */
	p = ArcGetChild(PROM_NULL_COMPONENT);
	if (p == NULL) {
#ifdef CONFIG_SGI_IP27
		/* IP27 PROM misbehaves, seems to not implement ARC
		   GetChild().  So we just assume it's an IP27.  */
		iname = "SGI-IP27";
#else
		iname = "Unknown";
#endif
	} else
		iname = (char *) (long) p->iname;

	printk("ARCH: %s\n", iname);
	mach = string_to_mach(iname);
	system_type = mach->liname;

	mips_machgroup = mach->group;
	mips_machtype = mach->type;
	prom_flags = mach->flags;
}