GNU Linux-libre 4.4.290-gnu1
[releases.git] / arch / mips / include / asm / cpu-type.h
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  * Copyright (C) 2003, 2004 Ralf Baechle
7  * Copyright (C) 2004  Maciej W. Rozycki
8  */
9 #ifndef __ASM_CPU_TYPE_H
10 #define __ASM_CPU_TYPE_H
11
12 #include <linux/smp.h>
13 #include <linux/compiler.h>
14
15 static inline int __pure __get_cpu_type(const int cpu_type)
16 {
17         switch (cpu_type) {
18 #if defined(CONFIG_SYS_HAS_CPU_LOONGSON2E) || \
19     defined(CONFIG_SYS_HAS_CPU_LOONGSON2F)
20         case CPU_LOONGSON2:
21 #endif
22
23 #ifdef CONFIG_SYS_HAS_CPU_LOONGSON3
24         case CPU_LOONGSON3:
25 #endif
26
27 #ifdef CONFIG_SYS_HAS_CPU_LOONGSON1B
28         case CPU_LOONGSON1:
29 #endif
30
31 #ifdef CONFIG_SYS_HAS_CPU_MIPS32_R1
32         case CPU_4KC:
33         case CPU_ALCHEMY:
34         case CPU_PR4450:
35 #endif
36
37 #if defined(CONFIG_SYS_HAS_CPU_MIPS32_R1) || \
38     defined(CONFIG_SYS_HAS_CPU_MIPS32_R2)
39         case CPU_4KEC:
40         case CPU_JZRISC:
41 #endif
42
43 #ifdef CONFIG_SYS_HAS_CPU_MIPS32_R2
44         case CPU_4KSC:
45         case CPU_24K:
46         case CPU_34K:
47         case CPU_1004K:
48         case CPU_74K:
49         case CPU_1074K:
50         case CPU_M14KC:
51         case CPU_M14KEC:
52         case CPU_INTERAPTIV:
53         case CPU_PROAPTIV:
54         case CPU_P5600:
55         case CPU_M5150:
56 #endif
57
58 #if defined(CONFIG_SYS_HAS_CPU_MIPS32_R2) || \
59     defined(CONFIG_SYS_HAS_CPU_MIPS32_R6) || \
60     defined(CONFIG_SYS_HAS_CPU_MIPS64_R2) || \
61     defined(CONFIG_SYS_HAS_CPU_MIPS64_R6)
62         case CPU_QEMU_GENERIC:
63 #endif
64
65 #ifdef CONFIG_SYS_HAS_CPU_MIPS64_R1
66         case CPU_5KC:
67         case CPU_5KE:
68         case CPU_20KC:
69         case CPU_25KF:
70         case CPU_SB1:
71         case CPU_SB1A:
72 #endif
73
74 #ifdef CONFIG_SYS_HAS_CPU_MIPS64_R2
75         /*
76          * All MIPS64 R2 processors have their own special symbols.  That is,
77          * there currently is no pure R2 core
78          */
79 #endif
80
81 #ifdef CONFIG_SYS_HAS_CPU_MIPS64_R6
82         case CPU_I6400:
83 #endif
84
85 #ifdef CONFIG_SYS_HAS_CPU_R3000
86         case CPU_R2000:
87         case CPU_R3000:
88         case CPU_R3000A:
89         case CPU_R3041:
90         case CPU_R3051:
91         case CPU_R3052:
92         case CPU_R3081:
93         case CPU_R3081E:
94 #endif
95
96 #ifdef CONFIG_SYS_HAS_CPU_TX39XX
97         case CPU_TX3912:
98         case CPU_TX3922:
99         case CPU_TX3927:
100 #endif
101
102 #ifdef CONFIG_SYS_HAS_CPU_VR41XX
103         case CPU_VR41XX:
104         case CPU_VR4111:
105         case CPU_VR4121:
106         case CPU_VR4122:
107         case CPU_VR4131:
108         case CPU_VR4133:
109         case CPU_VR4181:
110         case CPU_VR4181A:
111 #endif
112
113 #ifdef CONFIG_SYS_HAS_CPU_R4300
114         case CPU_R4300:
115         case CPU_R4310:
116 #endif
117
118 #ifdef CONFIG_SYS_HAS_CPU_R4X00
119         case CPU_R4000PC:
120         case CPU_R4000SC:
121         case CPU_R4000MC:
122         case CPU_R4200:
123         case CPU_R4400PC:
124         case CPU_R4400SC:
125         case CPU_R4400MC:
126         case CPU_R4600:
127         case CPU_R4700:
128         case CPU_R4640:
129         case CPU_R4650:
130 #endif
131
132 #ifdef CONFIG_SYS_HAS_CPU_TX49XX
133         case CPU_TX49XX:
134 #endif
135
136 #ifdef CONFIG_SYS_HAS_CPU_R5000
137         case CPU_R5000:
138 #endif
139
140 #ifdef CONFIG_SYS_HAS_CPU_R5432
141         case CPU_R5432:
142 #endif
143
144 #ifdef CONFIG_SYS_HAS_CPU_R5500
145         case CPU_R5500:
146 #endif
147
148 #ifdef CONFIG_SYS_HAS_CPU_R6000
149         case CPU_R6000:
150         case CPU_R6000A:
151 #endif
152
153 #ifdef CONFIG_SYS_HAS_CPU_NEVADA
154         case CPU_NEVADA:
155 #endif
156
157 #ifdef CONFIG_SYS_HAS_CPU_R8000
158         case CPU_R8000:
159 #endif
160
161 #ifdef CONFIG_SYS_HAS_CPU_R10000
162         case CPU_R10000:
163         case CPU_R12000:
164         case CPU_R14000:
165         case CPU_R16000:
166 #endif
167 #ifdef CONFIG_SYS_HAS_CPU_RM7000
168         case CPU_RM7000:
169         case CPU_SR71000:
170 #endif
171 #ifdef CONFIG_SYS_HAS_CPU_SB1
172         case CPU_SB1:
173         case CPU_SB1A:
174 #endif
175 #ifdef CONFIG_SYS_HAS_CPU_CAVIUM_OCTEON
176         case CPU_CAVIUM_OCTEON:
177         case CPU_CAVIUM_OCTEON_PLUS:
178         case CPU_CAVIUM_OCTEON2:
179         case CPU_CAVIUM_OCTEON3:
180 #endif
181
182 #if defined(CONFIG_SYS_HAS_CPU_BMIPS32_3300) || \
183         defined (CONFIG_SYS_HAS_CPU_MIPS32_R1)
184         case CPU_BMIPS32:
185         case CPU_BMIPS3300:
186 #endif
187
188 #ifdef CONFIG_SYS_HAS_CPU_BMIPS4350
189         case CPU_BMIPS4350:
190 #endif
191
192 #ifdef CONFIG_SYS_HAS_CPU_BMIPS4380
193         case CPU_BMIPS4380:
194 #endif
195
196 #ifdef CONFIG_SYS_HAS_CPU_BMIPS5000
197         case CPU_BMIPS5000:
198 #endif
199
200 #ifdef CONFIG_SYS_HAS_CPU_XLP
201         case CPU_XLP:
202 #endif
203
204 #ifdef CONFIG_SYS_HAS_CPU_XLR
205         case CPU_XLR:
206 #endif
207                 break;
208         default:
209                 unreachable();
210         }
211
212         return cpu_type;
213 }
214
215 static inline int __pure current_cpu_type(void)
216 {
217         const int cpu_type = current_cpu_data.cputype;
218
219         return __get_cpu_type(cpu_type);
220 }
221
222 static inline int __pure boot_cpu_type(void)
223 {
224         const int cpu_type = cpu_data[0].cputype;
225
226         return __get_cpu_type(cpu_type);
227 }
228
229 #endif /* __ASM_CPU_TYPE_H */