xref: /linux/arch/mips/include/asm/cpu-type.h (revision 6a74422b9710e987c7d6b85a1ade7330b1e61626)
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 
__get_cpu_type(const int cpu_type)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_LOONGSON2EF:
21 #endif
22 
23 #ifdef CONFIG_SYS_HAS_CPU_LOONGSON64
24 	case CPU_LOONGSON64:
25 #endif
26 
27 #ifdef CONFIG_SYS_HAS_CPU_LOONGSON32
28 	case CPU_LOONGSON32:
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_XBURST:
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 #endif
55 
56 #ifdef CONFIG_SYS_HAS_CPU_MIPS32_R5
57 	case CPU_M5150:
58 	case CPU_P5600:
59 #endif
60 
61 #if defined(CONFIG_SYS_HAS_CPU_MIPS32_R2) || \
62     defined(CONFIG_SYS_HAS_CPU_MIPS32_R5) || \
63     defined(CONFIG_SYS_HAS_CPU_MIPS32_R6) || \
64     defined(CONFIG_SYS_HAS_CPU_MIPS64_R2) || \
65     defined(CONFIG_SYS_HAS_CPU_MIPS64_R5) || \
66     defined(CONFIG_SYS_HAS_CPU_MIPS64_R6)
67 	case CPU_QEMU_GENERIC:
68 #endif
69 
70 #ifdef CONFIG_SYS_HAS_CPU_MIPS64_R1
71 	case CPU_5KC:
72 	case CPU_5KE:
73 	case CPU_20KC:
74 	case CPU_25KF:
75 	case CPU_SB1:
76 	case CPU_SB1A:
77 #endif
78 
79 #ifdef CONFIG_SYS_HAS_CPU_MIPS64_R2
80 	/*
81 	 * All MIPS64 R2 processors have their own special symbols.  That is,
82 	 * there currently is no pure R2 core
83 	 */
84 #endif
85 
86 #ifdef CONFIG_SYS_HAS_CPU_MIPS32_R6
87 	case CPU_M6250:
88 #endif
89 
90 #ifdef CONFIG_SYS_HAS_CPU_MIPS64_R6
91 	case CPU_I6400:
92 	case CPU_I6500:
93 	case CPU_P6600:
94 #endif
95 
96 #ifdef CONFIG_SYS_HAS_CPU_R3000
97 	case CPU_R2000:
98 	case CPU_R3000:
99 	case CPU_R3000A:
100 	case CPU_R3041:
101 	case CPU_R3051:
102 	case CPU_R3052:
103 	case CPU_R3081:
104 	case CPU_R3081E:
105 #endif
106 
107 #ifdef CONFIG_SYS_HAS_CPU_R4300
108 	case CPU_R4300:
109 	case CPU_R4310:
110 #endif
111 
112 #ifdef CONFIG_SYS_HAS_CPU_R4X00
113 	case CPU_R4000PC:
114 	case CPU_R4000SC:
115 	case CPU_R4000MC:
116 	case CPU_R4200:
117 	case CPU_R4400PC:
118 	case CPU_R4400SC:
119 	case CPU_R4400MC:
120 	case CPU_R4600:
121 	case CPU_R4700:
122 	case CPU_R4640:
123 	case CPU_R4650:
124 #endif
125 
126 #ifdef CONFIG_SYS_HAS_CPU_TX49XX
127 	case CPU_TX49XX:
128 #endif
129 
130 #ifdef CONFIG_SYS_HAS_CPU_R5000
131 	case CPU_R5000:
132 #endif
133 
134 #ifdef CONFIG_SYS_HAS_CPU_R5500
135 	case CPU_R5500:
136 #endif
137 
138 #ifdef CONFIG_SYS_HAS_CPU_NEVADA
139 	case CPU_NEVADA:
140 #endif
141 
142 #ifdef CONFIG_SYS_HAS_CPU_R10000
143 	case CPU_R10000:
144 	case CPU_R12000:
145 	case CPU_R14000:
146 	case CPU_R16000:
147 #endif
148 #ifdef CONFIG_SYS_HAS_CPU_RM7000
149 	case CPU_RM7000:
150 	case CPU_SR71000:
151 #endif
152 #ifdef CONFIG_SYS_HAS_CPU_SB1
153 	case CPU_SB1:
154 	case CPU_SB1A:
155 #endif
156 #ifdef CONFIG_SYS_HAS_CPU_CAVIUM_OCTEON
157 	case CPU_CAVIUM_OCTEON:
158 	case CPU_CAVIUM_OCTEON_PLUS:
159 	case CPU_CAVIUM_OCTEON2:
160 	case CPU_CAVIUM_OCTEON3:
161 #endif
162 
163 #if defined(CONFIG_SYS_HAS_CPU_BMIPS32_3300) || \
164 	defined (CONFIG_SYS_HAS_CPU_MIPS32_R1)
165 	case CPU_BMIPS32:
166 	case CPU_BMIPS3300:
167 #endif
168 
169 #ifdef CONFIG_SYS_HAS_CPU_BMIPS4350
170 	case CPU_BMIPS4350:
171 #endif
172 
173 #ifdef CONFIG_SYS_HAS_CPU_BMIPS4380
174 	case CPU_BMIPS4380:
175 #endif
176 
177 #ifdef CONFIG_SYS_HAS_CPU_BMIPS5000
178 	case CPU_BMIPS5000:
179 #endif
180 		break;
181 	default:
182 		unreachable();
183 	}
184 
185 	return cpu_type;
186 }
187 
current_cpu_type(void)188 static inline int __pure current_cpu_type(void)
189 {
190 	const int cpu_type = current_cpu_data.cputype;
191 
192 	return __get_cpu_type(cpu_type);
193 }
194 
boot_cpu_type(void)195 static inline int __pure boot_cpu_type(void)
196 {
197 	const int cpu_type = cpu_data[0].cputype;
198 
199 	return __get_cpu_type(cpu_type);
200 }
201 
202 #endif /* __ASM_CPU_TYPE_H */
203