blob: a18aa383f1202cf50c8695600d09c87c66560365 [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 Blanchard1a410d82005-09-06 14:53:57 +100064 .oprofile_cpu_type = "ppc64/power3",
Anton Blanchard8fef0302005-09-06 14:57:52 +100065 .oprofile_model = &op_model_rs64,
Anton Blanchard315a6992005-07-07 17:56:11 -070066 },
67 { /* Power3+ */
68 .pvr_mask = 0xffff0000,
69 .pvr_value = 0x00410000,
70 .cpu_name = "POWER3 (630+)",
71 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
Anton Blanchard85309352005-09-06 14:50:48 +100072 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR,
Anton Blanchard315a6992005-07-07 17:56:11 -070073 .cpu_user_features = COMMON_USER_PPC64,
74 .icache_bsize = 128,
75 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +100076 .num_pmcs = 8,
Anton Blanchard315a6992005-07-07 17:56:11 -070077 .cpu_setup = __setup_cpu_power3,
Anton Blanchard1a410d82005-09-06 14:53:57 +100078 .oprofile_cpu_type = "ppc64/power3",
Anton Blanchard8fef0302005-09-06 14:57:52 +100079 .oprofile_model = &op_model_rs64,
Anton Blanchard315a6992005-07-07 17:56:11 -070080 },
81 { /* Northstar */
82 .pvr_mask = 0xffff0000,
83 .pvr_value = 0x00330000,
84 .cpu_name = "RS64-II (northstar)",
85 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
86 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR |
Anton Blanchard85309352005-09-06 14:50:48 +100087 CPU_FTR_MMCRA | CPU_FTR_CTRL,
Anton Blanchard315a6992005-07-07 17:56:11 -070088 .cpu_user_features = COMMON_USER_PPC64,
89 .icache_bsize = 128,
90 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +100091 .num_pmcs = 8,
Anton Blanchard315a6992005-07-07 17:56:11 -070092 .cpu_setup = __setup_cpu_power3,
Anton Blanchard1a410d82005-09-06 14:53:57 +100093 .oprofile_cpu_type = "ppc64/rs64",
Anton Blanchard8fef0302005-09-06 14:57:52 +100094 .oprofile_model = &op_model_rs64,
Anton Blanchard315a6992005-07-07 17:56:11 -070095 },
96 { /* Pulsar */
97 .pvr_mask = 0xffff0000,
98 .pvr_value = 0x00340000,
99 .cpu_name = "RS64-III (pulsar)",
100 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
101 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR |
Anton Blanchard85309352005-09-06 14:50:48 +1000102 CPU_FTR_MMCRA | CPU_FTR_CTRL,
Anton Blanchard315a6992005-07-07 17:56:11 -0700103 .cpu_user_features = COMMON_USER_PPC64,
104 .icache_bsize = 128,
105 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +1000106 .num_pmcs = 8,
Anton Blanchard315a6992005-07-07 17:56:11 -0700107 .cpu_setup = __setup_cpu_power3,
Anton Blanchard1a410d82005-09-06 14:53:57 +1000108 .oprofile_cpu_type = "ppc64/rs64",
Anton Blanchard8fef0302005-09-06 14:57:52 +1000109 .oprofile_model = &op_model_rs64,
Anton Blanchard315a6992005-07-07 17:56:11 -0700110 },
111 { /* I-star */
112 .pvr_mask = 0xffff0000,
113 .pvr_value = 0x00360000,
114 .cpu_name = "RS64-III (icestar)",
115 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
116 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR |
Anton Blanchard85309352005-09-06 14:50:48 +1000117 CPU_FTR_MMCRA | CPU_FTR_CTRL,
Anton Blanchard315a6992005-07-07 17:56:11 -0700118 .cpu_user_features = COMMON_USER_PPC64,
119 .icache_bsize = 128,
120 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +1000121 .num_pmcs = 8,
Anton Blanchard315a6992005-07-07 17:56:11 -0700122 .cpu_setup = __setup_cpu_power3,
Anton Blanchard1a410d82005-09-06 14:53:57 +1000123 .oprofile_cpu_type = "ppc64/rs64",
Anton Blanchard8fef0302005-09-06 14:57:52 +1000124 .oprofile_model = &op_model_rs64,
Anton Blanchard315a6992005-07-07 17:56:11 -0700125 },
126 { /* S-star */
127 .pvr_mask = 0xffff0000,
128 .pvr_value = 0x00370000,
129 .cpu_name = "RS64-IV (sstar)",
130 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
131 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR |
Anton Blanchard85309352005-09-06 14:50:48 +1000132 CPU_FTR_MMCRA | CPU_FTR_CTRL,
Anton Blanchard315a6992005-07-07 17:56:11 -0700133 .cpu_user_features = COMMON_USER_PPC64,
134 .icache_bsize = 128,
135 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +1000136 .num_pmcs = 8,
Anton Blanchard315a6992005-07-07 17:56:11 -0700137 .cpu_setup = __setup_cpu_power3,
Anton Blanchard1a410d82005-09-06 14:53:57 +1000138 .oprofile_cpu_type = "ppc64/rs64",
Anton Blanchard8fef0302005-09-06 14:57:52 +1000139 .oprofile_model = &op_model_rs64,
Anton Blanchard315a6992005-07-07 17:56:11 -0700140 },
141 { /* Power4 */
142 .pvr_mask = 0xffff0000,
143 .pvr_value = 0x00350000,
144 .cpu_name = "POWER4 (gp)",
145 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
146 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
Anton Blanchard85309352005-09-06 14:50:48 +1000147 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_MMCRA,
Anton Blanchard315a6992005-07-07 17:56:11 -0700148 .cpu_user_features = COMMON_USER_PPC64,
149 .icache_bsize = 128,
150 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +1000151 .num_pmcs = 8,
Anton Blanchard315a6992005-07-07 17:56:11 -0700152 .cpu_setup = __setup_cpu_power4,
Anton Blanchard1a410d82005-09-06 14:53:57 +1000153 .oprofile_cpu_type = "ppc64/power4",
Anton Blanchard8fef0302005-09-06 14:57:52 +1000154 .oprofile_model = &op_model_rs64,
Anton Blanchard315a6992005-07-07 17:56:11 -0700155 },
156 { /* Power4+ */
157 .pvr_mask = 0xffff0000,
158 .pvr_value = 0x00380000,
159 .cpu_name = "POWER4+ (gq)",
160 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
161 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
Anton Blanchard85309352005-09-06 14:50:48 +1000162 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_MMCRA,
Anton Blanchard315a6992005-07-07 17:56:11 -0700163 .cpu_user_features = COMMON_USER_PPC64,
164 .icache_bsize = 128,
165 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +1000166 .num_pmcs = 8,
Anton Blanchard315a6992005-07-07 17:56:11 -0700167 .cpu_setup = __setup_cpu_power4,
Anton Blanchard1a410d82005-09-06 14:53:57 +1000168 .oprofile_cpu_type = "ppc64/power4",
Anton Blanchard8fef0302005-09-06 14:57:52 +1000169 .oprofile_model = &op_model_power4,
Anton Blanchard315a6992005-07-07 17:56:11 -0700170 },
171 { /* PPC970 */
172 .pvr_mask = 0xffff0000,
173 .pvr_value = 0x00390000,
174 .cpu_name = "PPC970",
175 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
176 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
177 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP |
Anton Blanchard85309352005-09-06 14:50:48 +1000178 CPU_FTR_CAN_NAP | CPU_FTR_MMCRA,
Anton Blanchard315a6992005-07-07 17:56:11 -0700179 .cpu_user_features = COMMON_USER_PPC64 |
180 PPC_FEATURE_HAS_ALTIVEC_COMP,
181 .icache_bsize = 128,
182 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +1000183 .num_pmcs = 8,
Anton Blanchard315a6992005-07-07 17:56:11 -0700184 .cpu_setup = __setup_cpu_ppc970,
Anton Blanchard1a410d82005-09-06 14:53:57 +1000185 .oprofile_cpu_type = "ppc64/970",
Anton Blanchard8fef0302005-09-06 14:57:52 +1000186 .oprofile_model = &op_model_power4,
Anton Blanchard315a6992005-07-07 17:56:11 -0700187 },
188 { /* PPC970FX */
189 .pvr_mask = 0xffff0000,
190 .pvr_value = 0x003c0000,
191 .cpu_name = "PPC970FX",
192 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
193 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
194 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP |
Anton Blanchard85309352005-09-06 14:50:48 +1000195 CPU_FTR_CAN_NAP | CPU_FTR_MMCRA,
Anton Blanchard315a6992005-07-07 17:56:11 -0700196 .cpu_user_features = COMMON_USER_PPC64 |
197 PPC_FEATURE_HAS_ALTIVEC_COMP,
198 .icache_bsize = 128,
199 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +1000200 .num_pmcs = 8,
Anton Blanchard315a6992005-07-07 17:56:11 -0700201 .cpu_setup = __setup_cpu_ppc970,
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 Blanchard315a6992005-07-07 17:56:11 -0700204 },
Olof Johanssonf264cc22005-07-13 01:11:44 -0700205 { /* PPC970MP */
206 .pvr_mask = 0xffff0000,
207 .pvr_value = 0x00440000,
208 .cpu_name = "PPC970MP",
209 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
210 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
211 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP |
Anton Blanchard85309352005-09-06 14:50:48 +1000212 CPU_FTR_CAN_NAP | CPU_FTR_MMCRA,
Olof Johanssonf264cc22005-07-13 01:11:44 -0700213 .cpu_user_features = COMMON_USER_PPC64 |
214 PPC_FEATURE_HAS_ALTIVEC_COMP,
215 .icache_bsize = 128,
216 .dcache_bsize = 128,
217 .cpu_setup = __setup_cpu_ppc970,
Anton Blanchard1a410d82005-09-06 14:53:57 +1000218 .oprofile_cpu_type = "ppc64/970",
Anton Blanchard8fef0302005-09-06 14:57:52 +1000219 .oprofile_model = &op_model_power4,
Olof Johanssonf264cc22005-07-13 01:11:44 -0700220 },
Anton Blanchard315a6992005-07-07 17:56:11 -0700221 { /* Power5 */
222 .pvr_mask = 0xffff0000,
223 .pvr_value = 0x003a0000,
224 .cpu_name = "POWER5 (gr)",
225 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
226 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
227 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_MMCRA | CPU_FTR_SMT |
228 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE |
229 CPU_FTR_MMCRA_SIHV,
230 .cpu_user_features = COMMON_USER_PPC64,
231 .icache_bsize = 128,
232 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +1000233 .num_pmcs = 6,
Anton Blanchard315a6992005-07-07 17:56:11 -0700234 .cpu_setup = __setup_cpu_power4,
Anton Blanchard1a410d82005-09-06 14:53:57 +1000235 .oprofile_cpu_type = "ppc64/power5",
Anton Blanchard8fef0302005-09-06 14:57:52 +1000236 .oprofile_model = &op_model_power4,
Anton Blanchard315a6992005-07-07 17:56:11 -0700237 },
238 { /* Power5 */
239 .pvr_mask = 0xffff0000,
240 .pvr_value = 0x003b0000,
241 .cpu_name = "POWER5 (gs)",
242 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
243 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
244 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_MMCRA | CPU_FTR_SMT |
245 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE |
246 CPU_FTR_MMCRA_SIHV,
247 .cpu_user_features = COMMON_USER_PPC64,
248 .icache_bsize = 128,
249 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +1000250 .num_pmcs = 6,
Anton Blanchard315a6992005-07-07 17:56:11 -0700251 .cpu_setup = __setup_cpu_power4,
Anton Blanchard1a410d82005-09-06 14:53:57 +1000252 .oprofile_cpu_type = "ppc64/power5",
Anton Blanchard8fef0302005-09-06 14:57:52 +1000253 .oprofile_model = &op_model_power4,
Anton Blanchard315a6992005-07-07 17:56:11 -0700254 },
255 { /* BE DD1.x */
256 .pvr_mask = 0xffff0000,
257 .pvr_value = 0x00700000,
258 .cpu_name = "Broadband Engine",
259 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
260 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
261 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP |
262 CPU_FTR_SMT,
263 .cpu_user_features = COMMON_USER_PPC64 |
264 PPC_FEATURE_HAS_ALTIVEC_COMP,
265 .icache_bsize = 128,
266 .dcache_bsize = 128,
267 .cpu_setup = __setup_cpu_be,
Anton Blanchard315a6992005-07-07 17:56:11 -0700268 },
269 { /* default match */
270 .pvr_mask = 0x00000000,
271 .pvr_value = 0x00000000,
272 .cpu_name = "POWER4 (compatible)",
273 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
274 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
275 CPU_FTR_PPCAS_ARCH_V2,
276 .cpu_user_features = COMMON_USER_PPC64,
277 .icache_bsize = 128,
278 .dcache_bsize = 128,
Anton Blanchardfd5b4372005-09-06 14:47:49 +1000279 .num_pmcs = 6,
Anton Blanchard315a6992005-07-07 17:56:11 -0700280 .cpu_setup = __setup_cpu_power4,
Anton Blanchard315a6992005-07-07 17:56:11 -0700281 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700282};