[MIPS] ARC: Convert mach_table[] to ISO C initializers.
[firefly-linux-kernel-4.4.55.git] / arch / mips / fw / arc / identify.c
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         {
32                 .arcname        = "SGI-IP22",
33                 .liname         = "SGI Indy",
34                 .group          = MACH_GROUP_SGI,
35                 .type           = MACH_SGI_IP22,
36                 .flags          = PROM_FLAG_ARCS,
37         }, {
38                 .arcname        = "SGI-IP27",
39                 .liname         = "SGI Origin",
40                 .group          = MACH_GROUP_SGI,
41                 .type           = MACH_SGI_IP27,
42                 .flags          = PROM_FLAG_ARCS,
43         }, {
44                 .arcname        = "SGI-IP28",
45                 .liname         = "SGI IP28",
46                 .group          = MACH_GROUP_SGI,
47                 .type           = MACH_SGI_IP28,
48                 .flags          = PROM_FLAG_ARCS,
49         }, {
50                 .arcname        = "SGI-IP30",
51                 .liname         = "SGI Octane",
52                 .group          = MACH_GROUP_SGI,
53                 .type           = MACH_SGI_IP30,
54                 .flags          = PROM_FLAG_ARCS,
55         }, {
56                 .arcname        = "SGI-IP32",
57                 .liname         = "SGI O2",
58                 .group          = MACH_GROUP_SGI,
59                 .type           = MACH_SGI_IP32,
60                 .flags          = PROM_FLAG_ARCS,
61         }, {
62                 .arcname        = "Microsoft-Jazz",
63                 .liname         = "Jazz MIPS_Magnum_4000",
64                 .group          = MACH_GROUP_JAZZ,
65                 .type           = MACH_MIPS_MAGNUM_4000,
66                 .flags          = 0,
67         }, {
68                 .arcname        = "PICA-61",
69                 .liname         = "Jazz Acer_PICA_61",
70                 .group          = MACH_GROUP_JAZZ,
71                 .type           = MACH_ACER_PICA_61,
72                 .flags          = 0,
73         }, {
74                 .arcname        = "RM200PCI",
75                 .liname         = "SNI RM200_PCI",
76                 .group          = MACH_GROUP_SNI_RM,
77                 .type           = MACH_SNI_RM200_PCI,
78                 .flags          = PROM_FLAG_DONT_FREE_TEMP,
79         }
80 };
81
82 int prom_flags;
83
84 static struct smatch * __init string_to_mach(const char *s)
85 {
86         int i;
87
88         for (i = 0; i < ARRAY_SIZE(mach_table); i++) {
89                 if (!strcmp(s, mach_table[i].arcname))
90                         return &mach_table[i];
91         }
92
93         panic("Yeee, could not determine architecture type <%s>", s);
94 }
95
96 char *system_type;
97
98 const char *get_system_type(void)
99 {
100         return system_type;
101 }
102
103 void __init prom_identify_arch(void)
104 {
105         pcomponent *p;
106         struct smatch *mach;
107         const char *iname;
108
109         /*
110          * The root component tells us what machine architecture we have here.
111          */
112         p = ArcGetChild(PROM_NULL_COMPONENT);
113         if (p == NULL) {
114 #ifdef CONFIG_SGI_IP27
115                 /* IP27 PROM misbehaves, seems to not implement ARC
116                    GetChild().  So we just assume it's an IP27.  */
117                 iname = "SGI-IP27";
118 #else
119                 iname = "Unknown";
120 #endif
121         } else
122                 iname = (char *) (long) p->iname;
123
124         printk("ARCH: %s\n", iname);
125         mach = string_to_mach(iname);
126         system_type = mach->liname;
127
128         mips_machgroup = mach->group;
129         mips_machtype = mach->type;
130         prom_flags = mach->flags;
131 }