blob: 8831a28c3c4ea2f5e28032e4bc3b4bad5d5cce62 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * arch/ppc64/kernel/cputable.c
3 *
4 * Copyright (C) 2001 Ben. Herrenschmidt (benh@kernel.crashing.org)
5 *
6 * Modifications for ppc64:
7 * Copyright (C) 2003 Dave Engebretsen <engebret@us.ibm.com>
Stephen Rothwell8d15a3e2005-08-03 14:40:16 +10008 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14
15#include <linux/config.h>
16#include <linux/string.h>
17#include <linux/sched.h>
18#include <linux/threads.h>
19#include <linux/init.h>
20#include <linux/module.h>
21
Anton Blanchard8fef0302005-09-06 14:57:52 +100022#include <asm/oprofile_impl.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#include <asm/cputable.h>
24
25struct cpu_spec* cur_cpu_spec = NULL;
26EXPORT_SYMBOL(cur_cpu_spec);
27
28/* NOTE:
29 * Unlike ppc32, ppc64 will only call this once for the boot CPU, it's
30 * the responsibility of the appropriate CPU save/restore functions to
31 * eventually copy these settings over. Those save/restore aren't yet
32 * part of the cputable though. That has to be fixed for both ppc32
33 * and ppc64
34 */
35extern void __setup_cpu_power3(unsigned long offset, struct cpu_spec* spec);
36extern void __setup_cpu_power4(unsigned long offset, struct cpu_spec* spec);
37extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec);
Arnd Bergmannfef1c772005-06-23 09:43:37 +100038extern void __setup_cpu_be(unsigned long offset, struct cpu_spec* spec);
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
40
41/* We only set the altivec features if the kernel was compiled with altivec
42 * support
43 */
44#ifdef CONFIG_ALTIVEC
45#define CPU_FTR_ALTIVEC_COMP CPU_FTR_ALTIVEC
46#define PPC_FEATURE_HAS_ALTIVEC_COMP PPC_FEATURE_HAS_ALTIVEC
47#else
48#define CPU_FTR_ALTIVEC_COMP 0
49#define PPC_FEATURE_HAS_ALTIVEC_COMP 0
50#endif
51
52struct cpu_spec cpu_specs[] = {
Anton Blanchard315a6992005-07-07 17:56:11 -070053 { /* Power3 */
54 .pvr_mask = 0xffff0000,
55 .pvr_value = 0x00400000,
56 .cpu_name = "POWER3 (630)",
57 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
Anton Blanchard85309352005-09-06 14:50:48 +100058 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR,
Anton Blanchard315a6992005-07-07 17:56:11 -070059 .cpu_user_features = COMMON_USER_PPC64,
60 .icache_bsize = 128,
61 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +100062 .num_pmcs = 8,
Anton Blanchard315a6992005-07-07 17:56:11 -070063 .cpu_setup = __setup_cpu_power3,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +100064#ifdef CONFIG_OPROFILE
Anton Blanchard1a410d82005-09-06 14:53:57 +100065 .oprofile_cpu_type = "ppc64/power3",
Anton Blanchard8fef0302005-09-06 14:57:52 +100066 .oprofile_model = &op_model_rs64,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +100067#endif
Anton Blanchard315a6992005-07-07 17:56:11 -070068 },
69 { /* Power3+ */
70 .pvr_mask = 0xffff0000,
71 .pvr_value = 0x00410000,
72 .cpu_name = "POWER3 (630+)",
73 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
Anton Blanchard85309352005-09-06 14:50:48 +100074 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR,
Anton Blanchard315a6992005-07-07 17:56:11 -070075 .cpu_user_features = COMMON_USER_PPC64,
76 .icache_bsize = 128,
77 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +100078 .num_pmcs = 8,
Anton Blanchard315a6992005-07-07 17:56:11 -070079 .cpu_setup = __setup_cpu_power3,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +100080#ifdef CONFIG_OPROFILE
Anton Blanchard1a410d82005-09-06 14:53:57 +100081 .oprofile_cpu_type = "ppc64/power3",
Anton Blanchard8fef0302005-09-06 14:57:52 +100082 .oprofile_model = &op_model_rs64,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +100083#endif
Anton Blanchard315a6992005-07-07 17:56:11 -070084 },
85 { /* Northstar */
86 .pvr_mask = 0xffff0000,
87 .pvr_value = 0x00330000,
88 .cpu_name = "RS64-II (northstar)",
89 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
90 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR |
Anton Blanchard85309352005-09-06 14:50:48 +100091 CPU_FTR_MMCRA | CPU_FTR_CTRL,
Anton Blanchard315a6992005-07-07 17:56:11 -070092 .cpu_user_features = COMMON_USER_PPC64,
93 .icache_bsize = 128,
94 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +100095 .num_pmcs = 8,
Anton Blanchard315a6992005-07-07 17:56:11 -070096 .cpu_setup = __setup_cpu_power3,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +100097#ifdef CONFIG_OPROFILE
Anton Blanchard1a410d82005-09-06 14:53:57 +100098 .oprofile_cpu_type = "ppc64/rs64",
Anton Blanchard8fef0302005-09-06 14:57:52 +100099 .oprofile_model = &op_model_rs64,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +1000100#endif
Anton Blanchard315a6992005-07-07 17:56:11 -0700101 },
102 { /* Pulsar */
103 .pvr_mask = 0xffff0000,
104 .pvr_value = 0x00340000,
105 .cpu_name = "RS64-III (pulsar)",
106 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
107 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR |
Anton Blanchard85309352005-09-06 14:50:48 +1000108 CPU_FTR_MMCRA | CPU_FTR_CTRL,
Anton Blanchard315a6992005-07-07 17:56:11 -0700109 .cpu_user_features = COMMON_USER_PPC64,
110 .icache_bsize = 128,
111 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +1000112 .num_pmcs = 8,
Anton Blanchard315a6992005-07-07 17:56:11 -0700113 .cpu_setup = __setup_cpu_power3,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +1000114#ifdef CONFIG_OPROFILE
Anton Blanchard1a410d82005-09-06 14:53:57 +1000115 .oprofile_cpu_type = "ppc64/rs64",
Anton Blanchard8fef0302005-09-06 14:57:52 +1000116 .oprofile_model = &op_model_rs64,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +1000117#endif
Anton Blanchard315a6992005-07-07 17:56:11 -0700118 },
119 { /* I-star */
120 .pvr_mask = 0xffff0000,
121 .pvr_value = 0x00360000,
122 .cpu_name = "RS64-III (icestar)",
123 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
124 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR |
Anton Blanchard85309352005-09-06 14:50:48 +1000125 CPU_FTR_MMCRA | CPU_FTR_CTRL,
Anton Blanchard315a6992005-07-07 17:56:11 -0700126 .cpu_user_features = COMMON_USER_PPC64,
127 .icache_bsize = 128,
128 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +1000129 .num_pmcs = 8,
Anton Blanchard315a6992005-07-07 17:56:11 -0700130 .cpu_setup = __setup_cpu_power3,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +1000131#ifdef CONFIG_OPROFILE
Anton Blanchard1a410d82005-09-06 14:53:57 +1000132 .oprofile_cpu_type = "ppc64/rs64",
Anton Blanchard8fef0302005-09-06 14:57:52 +1000133 .oprofile_model = &op_model_rs64,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +1000134#endif
Anton Blanchard315a6992005-07-07 17:56:11 -0700135 },
136 { /* S-star */
137 .pvr_mask = 0xffff0000,
138 .pvr_value = 0x00370000,
139 .cpu_name = "RS64-IV (sstar)",
140 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
141 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR |
Anton Blanchard85309352005-09-06 14:50:48 +1000142 CPU_FTR_MMCRA | CPU_FTR_CTRL,
Anton Blanchard315a6992005-07-07 17:56:11 -0700143 .cpu_user_features = COMMON_USER_PPC64,
144 .icache_bsize = 128,
145 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +1000146 .num_pmcs = 8,
Anton Blanchard315a6992005-07-07 17:56:11 -0700147 .cpu_setup = __setup_cpu_power3,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +1000148#ifdef CONFIG_OPROFILE
Anton Blanchard1a410d82005-09-06 14:53:57 +1000149 .oprofile_cpu_type = "ppc64/rs64",
Anton Blanchard8fef0302005-09-06 14:57:52 +1000150 .oprofile_model = &op_model_rs64,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +1000151#endif
Anton Blanchard315a6992005-07-07 17:56:11 -0700152 },
153 { /* Power4 */
154 .pvr_mask = 0xffff0000,
155 .pvr_value = 0x00350000,
156 .cpu_name = "POWER4 (gp)",
157 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
158 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
Anton Blanchard85309352005-09-06 14:50:48 +1000159 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_MMCRA,
Anton Blanchard315a6992005-07-07 17:56:11 -0700160 .cpu_user_features = COMMON_USER_PPC64,
161 .icache_bsize = 128,
162 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +1000163 .num_pmcs = 8,
Anton Blanchard315a6992005-07-07 17:56:11 -0700164 .cpu_setup = __setup_cpu_power4,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +1000165#ifdef CONFIG_OPROFILE
Anton Blanchard1a410d82005-09-06 14:53:57 +1000166 .oprofile_cpu_type = "ppc64/power4",
Anton Blanchard8fef0302005-09-06 14:57:52 +1000167 .oprofile_model = &op_model_rs64,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +1000168#endif
Anton Blanchard315a6992005-07-07 17:56:11 -0700169 },
170 { /* Power4+ */
171 .pvr_mask = 0xffff0000,
172 .pvr_value = 0x00380000,
173 .cpu_name = "POWER4+ (gq)",
174 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
175 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
Anton Blanchard85309352005-09-06 14:50:48 +1000176 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_MMCRA,
Anton Blanchard315a6992005-07-07 17:56:11 -0700177 .cpu_user_features = COMMON_USER_PPC64,
178 .icache_bsize = 128,
179 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +1000180 .num_pmcs = 8,
Anton Blanchard315a6992005-07-07 17:56:11 -0700181 .cpu_setup = __setup_cpu_power4,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +1000182#ifdef CONFIG_OPROFILE
Anton Blanchard1a410d82005-09-06 14:53:57 +1000183 .oprofile_cpu_type = "ppc64/power4",
Anton Blanchard8fef0302005-09-06 14:57:52 +1000184 .oprofile_model = &op_model_power4,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +1000185#endif
Anton Blanchard315a6992005-07-07 17:56:11 -0700186 },
187 { /* PPC970 */
188 .pvr_mask = 0xffff0000,
189 .pvr_value = 0x00390000,
190 .cpu_name = "PPC970",
191 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
192 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
193 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP |
Anton Blanchard85309352005-09-06 14:50:48 +1000194 CPU_FTR_CAN_NAP | CPU_FTR_MMCRA,
Anton Blanchard315a6992005-07-07 17:56:11 -0700195 .cpu_user_features = COMMON_USER_PPC64 |
196 PPC_FEATURE_HAS_ALTIVEC_COMP,
197 .icache_bsize = 128,
198 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +1000199 .num_pmcs = 8,
Anton Blanchard315a6992005-07-07 17:56:11 -0700200 .cpu_setup = __setup_cpu_ppc970,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +1000201#ifdef CONFIG_OPROFILE
Anton Blanchard1a410d82005-09-06 14:53:57 +1000202 .oprofile_cpu_type = "ppc64/970",
Anton Blanchard8fef0302005-09-06 14:57:52 +1000203 .oprofile_model = &op_model_power4,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +1000204#endif
Anton Blanchard315a6992005-07-07 17:56:11 -0700205 },
206 { /* PPC970FX */
207 .pvr_mask = 0xffff0000,
208 .pvr_value = 0x003c0000,
209 .cpu_name = "PPC970FX",
210 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
211 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
212 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP |
Anton Blanchard85309352005-09-06 14:50:48 +1000213 CPU_FTR_CAN_NAP | CPU_FTR_MMCRA,
Anton Blanchard315a6992005-07-07 17:56:11 -0700214 .cpu_user_features = COMMON_USER_PPC64 |
215 PPC_FEATURE_HAS_ALTIVEC_COMP,
216 .icache_bsize = 128,
217 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +1000218 .num_pmcs = 8,
Anton Blanchard315a6992005-07-07 17:56:11 -0700219 .cpu_setup = __setup_cpu_ppc970,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +1000220#ifdef CONFIG_OPROFILE
Anton Blanchard1a410d82005-09-06 14:53:57 +1000221 .oprofile_cpu_type = "ppc64/970",
Anton Blanchard8fef0302005-09-06 14:57:52 +1000222 .oprofile_model = &op_model_power4,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +1000223#endif
Anton Blanchard315a6992005-07-07 17:56:11 -0700224 },
Olof Johanssonf264cc22005-07-13 01:11:44 -0700225 { /* PPC970MP */
226 .pvr_mask = 0xffff0000,
227 .pvr_value = 0x00440000,
228 .cpu_name = "PPC970MP",
229 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
230 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
231 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP |
Anton Blanchard85309352005-09-06 14:50:48 +1000232 CPU_FTR_CAN_NAP | CPU_FTR_MMCRA,
Olof Johanssonf264cc22005-07-13 01:11:44 -0700233 .cpu_user_features = COMMON_USER_PPC64 |
234 PPC_FEATURE_HAS_ALTIVEC_COMP,
235 .icache_bsize = 128,
236 .dcache_bsize = 128,
237 .cpu_setup = __setup_cpu_ppc970,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +1000238#ifdef CONFIG_OPROFILE
Anton Blanchard1a410d82005-09-06 14:53:57 +1000239 .oprofile_cpu_type = "ppc64/970",
Anton Blanchard8fef0302005-09-06 14:57:52 +1000240 .oprofile_model = &op_model_power4,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +1000241#endif
Olof Johanssonf264cc22005-07-13 01:11:44 -0700242 },
Anton Blanchard315a6992005-07-07 17:56:11 -0700243 { /* Power5 */
244 .pvr_mask = 0xffff0000,
245 .pvr_value = 0x003a0000,
246 .cpu_name = "POWER5 (gr)",
247 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
248 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
249 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_MMCRA | CPU_FTR_SMT |
250 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE |
251 CPU_FTR_MMCRA_SIHV,
252 .cpu_user_features = COMMON_USER_PPC64,
253 .icache_bsize = 128,
254 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +1000255 .num_pmcs = 6,
Anton Blanchard315a6992005-07-07 17:56:11 -0700256 .cpu_setup = __setup_cpu_power4,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +1000257#ifdef CONFIG_OPROFILE
Anton Blanchard1a410d82005-09-06 14:53:57 +1000258 .oprofile_cpu_type = "ppc64/power5",
Anton Blanchard8fef0302005-09-06 14:57:52 +1000259 .oprofile_model = &op_model_power4,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +1000260#endif
Anton Blanchard315a6992005-07-07 17:56:11 -0700261 },
262 { /* Power5 */
263 .pvr_mask = 0xffff0000,
264 .pvr_value = 0x003b0000,
265 .cpu_name = "POWER5 (gs)",
266 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
267 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
268 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_MMCRA | CPU_FTR_SMT |
269 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE |
270 CPU_FTR_MMCRA_SIHV,
271 .cpu_user_features = COMMON_USER_PPC64,
272 .icache_bsize = 128,
273 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +1000274 .num_pmcs = 6,
Anton Blanchard315a6992005-07-07 17:56:11 -0700275 .cpu_setup = __setup_cpu_power4,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +1000276#ifdef CONFIG_OPROFILE
Anton Blanchard1a410d82005-09-06 14:53:57 +1000277 .oprofile_cpu_type = "ppc64/power5",
Anton Blanchard8fef0302005-09-06 14:57:52 +1000278 .oprofile_model = &op_model_power4,
Anton Blanchard0fdf0b82005-09-06 14:59:16 +1000279#endif
Anton Blanchard315a6992005-07-07 17:56:11 -0700280 },
281 { /* BE DD1.x */
282 .pvr_mask = 0xffff0000,
283 .pvr_value = 0x00700000,
284 .cpu_name = "Broadband Engine",
285 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
286 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
287 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP |
288 CPU_FTR_SMT,
289 .cpu_user_features = COMMON_USER_PPC64 |
290 PPC_FEATURE_HAS_ALTIVEC_COMP,
291 .icache_bsize = 128,
292 .dcache_bsize = 128,
293 .cpu_setup = __setup_cpu_be,
Anton Blanchard315a6992005-07-07 17:56:11 -0700294 },
295 { /* default match */
296 .pvr_mask = 0x00000000,
297 .pvr_value = 0x00000000,
298 .cpu_name = "POWER4 (compatible)",
299 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
300 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
301 CPU_FTR_PPCAS_ARCH_V2,
302 .cpu_user_features = COMMON_USER_PPC64,
303 .icache_bsize = 128,
304 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +1000305 .num_pmcs = 6,
Anton Blanchard315a6992005-07-07 17:56:11 -0700306 .cpu_setup = __setup_cpu_power4,
Anton Blanchard315a6992005-07-07 17:56:11 -0700307 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700308};