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