Merge branch 'gup_flag-cleanups'
[cascardo/linux.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 #if defined(CONFIG_SYS_HAS_CPU_LOONGSON1B) || \
28     defined(CONFIG_SYS_HAS_CPU_LOONGSON1C)
29         case CPU_LOONGSON1:
30 #endif
31
32 #ifdef CONFIG_SYS_HAS_CPU_MIPS32_R1
33         case CPU_4KC:
34         case CPU_ALCHEMY:
35         case CPU_PR4450:
36 #endif
37
38 #if defined(CONFIG_SYS_HAS_CPU_MIPS32_R1) || \
39     defined(CONFIG_SYS_HAS_CPU_MIPS32_R2)
40         case CPU_4KEC:
41         case CPU_JZRISC:
42 #endif
43
44 #ifdef CONFIG_SYS_HAS_CPU_MIPS32_R2
45         case CPU_4KSC:
46         case CPU_24K:
47         case CPU_34K:
48         case CPU_1004K:
49         case CPU_74K:
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_MIPS32_R6
82         case CPU_M6250:
83 #endif
84
85 #ifdef CONFIG_SYS_HAS_CPU_MIPS64_R6
86         case CPU_I6400:
87         case CPU_P6600:
88 #endif
89
90 #ifdef CONFIG_SYS_HAS_CPU_R3000
91         case CPU_R2000:
92         case CPU_R3000:
93         case CPU_R3000A:
94         case CPU_R3041:
95         case CPU_R3051:
96         case CPU_R3052:
97         case CPU_R3081:
98         case CPU_R3081E:
99 #endif
100
101 #ifdef CONFIG_SYS_HAS_CPU_TX39XX
102         case CPU_TX3912:
103         case CPU_TX3922:
104         case CPU_TX3927:
105 #endif
106
107 #ifdef CONFIG_SYS_HAS_CPU_VR41XX
108         case CPU_VR41XX:
109         case CPU_VR4111:
110         case CPU_VR4121:
111         case CPU_VR4122:
112         case CPU_VR4131:
113         case CPU_VR4133:
114         case CPU_VR4181:
115         case CPU_VR4181A:
116 #endif
117
118 #ifdef CONFIG_SYS_HAS_CPU_R4300
119         case CPU_R4300:
120         case CPU_R4310:
121 #endif
122
123 #ifdef CONFIG_SYS_HAS_CPU_R4X00
124         case CPU_R4000PC:
125         case CPU_R4000SC:
126         case CPU_R4000MC:
127         case CPU_R4200:
128         case CPU_R4400PC:
129         case CPU_R4400SC:
130         case CPU_R4400MC:
131         case CPU_R4600:
132         case CPU_R4700:
133         case CPU_R4640:
134         case CPU_R4650:
135 #endif
136
137 #ifdef CONFIG_SYS_HAS_CPU_TX49XX
138         case CPU_TX49XX:
139 #endif
140
141 #ifdef CONFIG_SYS_HAS_CPU_R5000
142         case CPU_R5000:
143 #endif
144
145 #ifdef CONFIG_SYS_HAS_CPU_R5432
146         case CPU_R5432:
147 #endif
148
149 #ifdef CONFIG_SYS_HAS_CPU_R5500
150         case CPU_R5500:
151 #endif
152
153 #ifdef CONFIG_SYS_HAS_CPU_R6000
154         case CPU_R6000:
155         case CPU_R6000A:
156 #endif
157
158 #ifdef CONFIG_SYS_HAS_CPU_NEVADA
159         case CPU_NEVADA:
160 #endif
161
162 #ifdef CONFIG_SYS_HAS_CPU_R8000
163         case CPU_R8000:
164 #endif
165
166 #ifdef CONFIG_SYS_HAS_CPU_R10000
167         case CPU_R10000:
168         case CPU_R12000:
169         case CPU_R14000:
170         case CPU_R16000:
171 #endif
172 #ifdef CONFIG_SYS_HAS_CPU_RM7000
173         case CPU_RM7000:
174         case CPU_SR71000:
175 #endif
176 #ifdef CONFIG_SYS_HAS_CPU_SB1
177         case CPU_SB1:
178         case CPU_SB1A:
179 #endif
180 #ifdef CONFIG_SYS_HAS_CPU_CAVIUM_OCTEON
181         case CPU_CAVIUM_OCTEON:
182         case CPU_CAVIUM_OCTEON_PLUS:
183         case CPU_CAVIUM_OCTEON2:
184         case CPU_CAVIUM_OCTEON3:
185 #endif
186
187 #if defined(CONFIG_SYS_HAS_CPU_BMIPS32_3300) || \
188         defined (CONFIG_SYS_HAS_CPU_MIPS32_R1)
189         case CPU_BMIPS32:
190         case CPU_BMIPS3300:
191 #endif
192
193 #ifdef CONFIG_SYS_HAS_CPU_BMIPS4350
194         case CPU_BMIPS4350:
195 #endif
196
197 #ifdef CONFIG_SYS_HAS_CPU_BMIPS4380
198         case CPU_BMIPS4380:
199 #endif
200
201 #ifdef CONFIG_SYS_HAS_CPU_BMIPS5000
202         case CPU_BMIPS5000:
203 #endif
204
205 #ifdef CONFIG_SYS_HAS_CPU_XLP
206         case CPU_XLP:
207 #endif
208
209 #ifdef CONFIG_SYS_HAS_CPU_XLR
210         case CPU_XLR:
211 #endif
212                 break;
213         default:
214                 unreachable();
215         }
216
217         return cpu_type;
218 }
219
220 static inline int __pure current_cpu_type(void)
221 {
222         const int cpu_type = current_cpu_data.cputype;
223
224         return __get_cpu_type(cpu_type);
225 }
226
227 static inline int __pure boot_cpu_type(void)
228 {
229         const int cpu_type = cpu_data[0].cputype;
230
231         return __get_cpu_type(cpu_type);
232 }
233
234 #endif /* __ASM_CPU_TYPE_H */