• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #if defined(CONFIG_SYS_HAS_CPU_LOONGSON1B) || \
28     defined(CONFIG_SYS_HAS_CPU_LOONGSON1C)
29 	case CPU_LOONGSON32:
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_XBURST:
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_1074K:
51 	case CPU_M14KC:
52 	case CPU_M14KEC:
53 	case CPU_INTERAPTIV:
54 	case CPU_PROAPTIV:
55 #endif
56 
57 #ifdef CONFIG_SYS_HAS_CPU_MIPS32_R5
58 	case CPU_M5150:
59 	case CPU_P5600:
60 #endif
61 
62 #if defined(CONFIG_SYS_HAS_CPU_MIPS32_R2) || \
63     defined(CONFIG_SYS_HAS_CPU_MIPS32_R5) || \
64     defined(CONFIG_SYS_HAS_CPU_MIPS32_R6) || \
65     defined(CONFIG_SYS_HAS_CPU_MIPS64_R2) || \
66     defined(CONFIG_SYS_HAS_CPU_MIPS64_R5) || \
67     defined(CONFIG_SYS_HAS_CPU_MIPS64_R6)
68 	case CPU_QEMU_GENERIC:
69 #endif
70 
71 #ifdef CONFIG_SYS_HAS_CPU_MIPS64_R1
72 	case CPU_5KC:
73 	case CPU_5KE:
74 	case CPU_20KC:
75 	case CPU_25KF:
76 	case CPU_SB1:
77 	case CPU_SB1A:
78 #endif
79 
80 #ifdef CONFIG_SYS_HAS_CPU_MIPS64_R2
81 	/*
82 	 * All MIPS64 R2 processors have their own special symbols.  That is,
83 	 * there currently is no pure R2 core
84 	 */
85 #endif
86 
87 #ifdef CONFIG_SYS_HAS_CPU_MIPS32_R6
88 	case CPU_M6250:
89 #endif
90 
91 #ifdef CONFIG_SYS_HAS_CPU_MIPS64_R6
92 	case CPU_I6400:
93 	case CPU_I6500:
94 	case CPU_P6600:
95 #endif
96 
97 #ifdef CONFIG_SYS_HAS_CPU_R3000
98 	case CPU_R2000:
99 	case CPU_R3000:
100 	case CPU_R3000A:
101 	case CPU_R3041:
102 	case CPU_R3051:
103 	case CPU_R3052:
104 	case CPU_R3081:
105 	case CPU_R3081E:
106 #endif
107 
108 #ifdef CONFIG_SYS_HAS_CPU_TX39XX
109 	case CPU_TX3912:
110 	case CPU_TX3922:
111 	case CPU_TX3927:
112 #endif
113 
114 #ifdef CONFIG_SYS_HAS_CPU_VR41XX
115 	case CPU_VR41XX:
116 	case CPU_VR4111:
117 	case CPU_VR4121:
118 	case CPU_VR4122:
119 	case CPU_VR4131:
120 	case CPU_VR4133:
121 	case CPU_VR4181:
122 	case CPU_VR4181A:
123 #endif
124 
125 #ifdef CONFIG_SYS_HAS_CPU_R4X00
126 	case CPU_R4000PC:
127 	case CPU_R4000SC:
128 	case CPU_R4000MC:
129 	case CPU_R4200:
130 	case CPU_R4400PC:
131 	case CPU_R4400SC:
132 	case CPU_R4400MC:
133 	case CPU_R4600:
134 	case CPU_R4700:
135 	case CPU_R4640:
136 	case CPU_R4650:
137 #endif
138 
139 #ifdef CONFIG_SYS_HAS_CPU_TX49XX
140 	case CPU_TX49XX:
141 #endif
142 
143 #ifdef CONFIG_SYS_HAS_CPU_R5000
144 	case CPU_R5000:
145 #endif
146 
147 #ifdef CONFIG_SYS_HAS_CPU_R5500
148 	case CPU_R5500:
149 #endif
150 
151 #ifdef CONFIG_SYS_HAS_CPU_NEVADA
152 	case CPU_NEVADA:
153 #endif
154 
155 #ifdef CONFIG_SYS_HAS_CPU_R10000
156 	case CPU_R10000:
157 	case CPU_R12000:
158 	case CPU_R14000:
159 	case CPU_R16000:
160 #endif
161 #ifdef CONFIG_SYS_HAS_CPU_RM7000
162 	case CPU_RM7000:
163 	case CPU_SR71000:
164 #endif
165 #ifdef CONFIG_SYS_HAS_CPU_SB1
166 	case CPU_SB1:
167 	case CPU_SB1A:
168 #endif
169 #ifdef CONFIG_SYS_HAS_CPU_CAVIUM_OCTEON
170 	case CPU_CAVIUM_OCTEON:
171 	case CPU_CAVIUM_OCTEON_PLUS:
172 	case CPU_CAVIUM_OCTEON2:
173 	case CPU_CAVIUM_OCTEON3:
174 #endif
175 
176 #if defined(CONFIG_SYS_HAS_CPU_BMIPS32_3300) || \
177 	defined (CONFIG_SYS_HAS_CPU_MIPS32_R1)
178 	case CPU_BMIPS32:
179 	case CPU_BMIPS3300:
180 #endif
181 
182 #ifdef CONFIG_SYS_HAS_CPU_BMIPS4350
183 	case CPU_BMIPS4350:
184 #endif
185 
186 #ifdef CONFIG_SYS_HAS_CPU_BMIPS4380
187 	case CPU_BMIPS4380:
188 #endif
189 
190 #ifdef CONFIG_SYS_HAS_CPU_BMIPS5000
191 	case CPU_BMIPS5000:
192 #endif
193 
194 #ifdef CONFIG_SYS_HAS_CPU_XLP
195 	case CPU_XLP:
196 #endif
197 
198 #ifdef CONFIG_SYS_HAS_CPU_XLR
199 	case CPU_XLR:
200 #endif
201 		break;
202 	default:
203 		unreachable();
204 	}
205 
206 	return cpu_type;
207 }
208 
current_cpu_type(void)209 static inline int __pure current_cpu_type(void)
210 {
211 	const int cpu_type = current_cpu_data.cputype;
212 
213 	return __get_cpu_type(cpu_type);
214 }
215 
boot_cpu_type(void)216 static inline int __pure boot_cpu_type(void)
217 {
218 	const int cpu_type = cpu_data[0].cputype;
219 
220 	return __get_cpu_type(cpu_type);
221 }
222 
223 #endif /* __ASM_CPU_TYPE_H */
224