2 * Copyright (C) 2001 Ben. Herrenschmidt (benh@kernel.crashing.org)
4 * Modifications for ppc64:
5 * Copyright (C) 2003 Dave Engebretsen <engebret@us.ibm.com>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
13 #include <linux/string.h>
14 #include <linux/sched.h>
15 #include <linux/threads.h>
16 #include <linux/init.h>
17 #include <linux/module.h>
19 #include <asm/oprofile_impl.h>
20 #include <asm/cputable.h>
21 #include <asm/prom.h> /* for PTRRELOC on ARCH=ppc */
23 struct cpu_spec* cur_cpu_spec = NULL;
24 EXPORT_SYMBOL(cur_cpu_spec);
27 * Unlike ppc32, ppc64 will only call this once for the boot CPU, it's
28 * the responsibility of the appropriate CPU save/restore functions to
29 * eventually copy these settings over. Those save/restore aren't yet
30 * part of the cputable though. That has to be fixed for both ppc32
34 extern void __setup_cpu_603(unsigned long offset, struct cpu_spec* spec);
35 extern void __setup_cpu_604(unsigned long offset, struct cpu_spec* spec);
36 extern void __setup_cpu_750(unsigned long offset, struct cpu_spec* spec);
37 extern void __setup_cpu_750cx(unsigned long offset, struct cpu_spec* spec);
38 extern void __setup_cpu_750fx(unsigned long offset, struct cpu_spec* spec);
39 extern void __setup_cpu_7400(unsigned long offset, struct cpu_spec* spec);
40 extern void __setup_cpu_7410(unsigned long offset, struct cpu_spec* spec);
41 extern void __setup_cpu_745x(unsigned long offset, struct cpu_spec* spec);
42 #endif /* CONFIG_PPC32 */
44 extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec);
45 extern void __setup_cpu_ppc970MP(unsigned long offset, struct cpu_spec* spec);
46 extern void __setup_cpu_pa6t(unsigned long offset, struct cpu_spec* spec);
47 extern void __restore_cpu_pa6t(void);
48 extern void __restore_cpu_ppc970(void);
49 #endif /* CONFIG_PPC64 */
51 /* This table only contains "desktop" CPUs, it need to be filled with embedded
54 #define COMMON_USER (PPC_FEATURE_32 | PPC_FEATURE_HAS_FPU | \
56 #define COMMON_USER_PPC64 (COMMON_USER | PPC_FEATURE_64)
57 #define COMMON_USER_POWER4 (COMMON_USER_PPC64 | PPC_FEATURE_POWER4)
58 #define COMMON_USER_POWER5 (COMMON_USER_PPC64 | PPC_FEATURE_POWER5 |\
59 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP)
60 #define COMMON_USER_POWER5_PLUS (COMMON_USER_PPC64 | PPC_FEATURE_POWER5_PLUS|\
61 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP)
62 #define COMMON_USER_POWER6 (COMMON_USER_PPC64 | PPC_FEATURE_ARCH_2_05 |\
63 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | \
65 #define COMMON_USER_PA6T (COMMON_USER_PPC64 | PPC_FEATURE_PA6T |\
66 PPC_FEATURE_TRUE_LE | \
67 PPC_FEATURE_HAS_ALTIVEC_COMP)
68 #define COMMON_USER_BOOKE (PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \
71 /* We only set the spe features if the kernel was compiled with
75 #define PPC_FEATURE_SPE_COMP PPC_FEATURE_HAS_SPE
77 #define PPC_FEATURE_SPE_COMP 0
80 static struct cpu_spec cpu_specs[] = {
83 .pvr_mask = 0xffff0000,
84 .pvr_value = 0x00400000,
85 .cpu_name = "POWER3 (630)",
86 .cpu_features = CPU_FTRS_POWER3,
87 .cpu_user_features = COMMON_USER_PPC64|PPC_FEATURE_PPC_LE,
91 .pmc_type = PPC_PMC_IBM,
92 .oprofile_cpu_type = "ppc64/power3",
93 .oprofile_type = PPC_OPROFILE_RS64,
97 .pvr_mask = 0xffff0000,
98 .pvr_value = 0x00410000,
99 .cpu_name = "POWER3 (630+)",
100 .cpu_features = CPU_FTRS_POWER3,
101 .cpu_user_features = COMMON_USER_PPC64|PPC_FEATURE_PPC_LE,
105 .pmc_type = PPC_PMC_IBM,
106 .oprofile_cpu_type = "ppc64/power3",
107 .oprofile_type = PPC_OPROFILE_RS64,
108 .platform = "power3",
111 .pvr_mask = 0xffff0000,
112 .pvr_value = 0x00330000,
113 .cpu_name = "RS64-II (northstar)",
114 .cpu_features = CPU_FTRS_RS64,
115 .cpu_user_features = COMMON_USER_PPC64,
119 .pmc_type = PPC_PMC_IBM,
120 .oprofile_cpu_type = "ppc64/rs64",
121 .oprofile_type = PPC_OPROFILE_RS64,
125 .pvr_mask = 0xffff0000,
126 .pvr_value = 0x00340000,
127 .cpu_name = "RS64-III (pulsar)",
128 .cpu_features = CPU_FTRS_RS64,
129 .cpu_user_features = COMMON_USER_PPC64,
133 .pmc_type = PPC_PMC_IBM,
134 .oprofile_cpu_type = "ppc64/rs64",
135 .oprofile_type = PPC_OPROFILE_RS64,
139 .pvr_mask = 0xffff0000,
140 .pvr_value = 0x00360000,
141 .cpu_name = "RS64-III (icestar)",
142 .cpu_features = CPU_FTRS_RS64,
143 .cpu_user_features = COMMON_USER_PPC64,
147 .pmc_type = PPC_PMC_IBM,
148 .oprofile_cpu_type = "ppc64/rs64",
149 .oprofile_type = PPC_OPROFILE_RS64,
153 .pvr_mask = 0xffff0000,
154 .pvr_value = 0x00370000,
155 .cpu_name = "RS64-IV (sstar)",
156 .cpu_features = CPU_FTRS_RS64,
157 .cpu_user_features = COMMON_USER_PPC64,
161 .pmc_type = PPC_PMC_IBM,
162 .oprofile_cpu_type = "ppc64/rs64",
163 .oprofile_type = PPC_OPROFILE_RS64,
167 .pvr_mask = 0xffff0000,
168 .pvr_value = 0x00350000,
169 .cpu_name = "POWER4 (gp)",
170 .cpu_features = CPU_FTRS_POWER4,
171 .cpu_user_features = COMMON_USER_POWER4,
175 .pmc_type = PPC_PMC_IBM,
176 .oprofile_cpu_type = "ppc64/power4",
177 .oprofile_type = PPC_OPROFILE_POWER4,
178 .platform = "power4",
181 .pvr_mask = 0xffff0000,
182 .pvr_value = 0x00380000,
183 .cpu_name = "POWER4+ (gq)",
184 .cpu_features = CPU_FTRS_POWER4,
185 .cpu_user_features = COMMON_USER_POWER4,
189 .pmc_type = PPC_PMC_IBM,
190 .oprofile_cpu_type = "ppc64/power4",
191 .oprofile_type = PPC_OPROFILE_POWER4,
192 .platform = "power4",
195 .pvr_mask = 0xffff0000,
196 .pvr_value = 0x00390000,
197 .cpu_name = "PPC970",
198 .cpu_features = CPU_FTRS_PPC970,
199 .cpu_user_features = COMMON_USER_POWER4 |
200 PPC_FEATURE_HAS_ALTIVEC_COMP,
204 .pmc_type = PPC_PMC_IBM,
205 .cpu_setup = __setup_cpu_ppc970,
206 .cpu_restore = __restore_cpu_ppc970,
207 .oprofile_cpu_type = "ppc64/970",
208 .oprofile_type = PPC_OPROFILE_POWER4,
209 .platform = "ppc970",
212 .pvr_mask = 0xffff0000,
213 .pvr_value = 0x003c0000,
214 .cpu_name = "PPC970FX",
215 .cpu_features = CPU_FTRS_PPC970,
216 .cpu_user_features = COMMON_USER_POWER4 |
217 PPC_FEATURE_HAS_ALTIVEC_COMP,
221 .pmc_type = PPC_PMC_IBM,
222 .cpu_setup = __setup_cpu_ppc970,
223 .cpu_restore = __restore_cpu_ppc970,
224 .oprofile_cpu_type = "ppc64/970",
225 .oprofile_type = PPC_OPROFILE_POWER4,
226 .platform = "ppc970",
228 { /* PPC970MP DD1.0 - no DEEPNAP, use regular 970 init */
229 .pvr_mask = 0xffffffff,
230 .pvr_value = 0x00440100,
231 .cpu_name = "PPC970MP",
232 .cpu_features = CPU_FTRS_PPC970,
233 .cpu_user_features = COMMON_USER_POWER4 |
234 PPC_FEATURE_HAS_ALTIVEC_COMP,
238 .pmc_type = PPC_PMC_IBM,
239 .cpu_setup = __setup_cpu_ppc970,
240 .cpu_restore = __restore_cpu_ppc970,
241 .oprofile_cpu_type = "ppc64/970MP",
242 .oprofile_type = PPC_OPROFILE_POWER4,
243 .platform = "ppc970",
246 .pvr_mask = 0xffff0000,
247 .pvr_value = 0x00440000,
248 .cpu_name = "PPC970MP",
249 .cpu_features = CPU_FTRS_PPC970,
250 .cpu_user_features = COMMON_USER_POWER4 |
251 PPC_FEATURE_HAS_ALTIVEC_COMP,
255 .pmc_type = PPC_PMC_IBM,
256 .cpu_setup = __setup_cpu_ppc970MP,
257 .cpu_restore = __restore_cpu_ppc970,
258 .oprofile_cpu_type = "ppc64/970MP",
259 .oprofile_type = PPC_OPROFILE_POWER4,
260 .platform = "ppc970",
263 .pvr_mask = 0xffff0000,
264 .pvr_value = 0x00450000,
265 .cpu_name = "PPC970GX",
266 .cpu_features = CPU_FTRS_PPC970,
267 .cpu_user_features = COMMON_USER_POWER4 |
268 PPC_FEATURE_HAS_ALTIVEC_COMP,
272 .pmc_type = PPC_PMC_IBM,
273 .cpu_setup = __setup_cpu_ppc970,
274 .oprofile_cpu_type = "ppc64/970",
275 .oprofile_type = PPC_OPROFILE_POWER4,
276 .platform = "ppc970",
279 .pvr_mask = 0xffff0000,
280 .pvr_value = 0x003a0000,
281 .cpu_name = "POWER5 (gr)",
282 .cpu_features = CPU_FTRS_POWER5,
283 .cpu_user_features = COMMON_USER_POWER5,
287 .pmc_type = PPC_PMC_IBM,
288 .oprofile_cpu_type = "ppc64/power5",
289 .oprofile_type = PPC_OPROFILE_POWER4,
290 /* SIHV / SIPR bits are implemented on POWER4+ (GQ)
291 * and above but only works on POWER5 and above
293 .oprofile_mmcra_sihv = MMCRA_SIHV,
294 .oprofile_mmcra_sipr = MMCRA_SIPR,
295 .platform = "power5",
298 .pvr_mask = 0xffff0000,
299 .pvr_value = 0x003b0000,
300 .cpu_name = "POWER5+ (gs)",
301 .cpu_features = CPU_FTRS_POWER5,
302 .cpu_user_features = COMMON_USER_POWER5_PLUS,
306 .pmc_type = PPC_PMC_IBM,
307 .oprofile_cpu_type = "ppc64/power5+",
308 .oprofile_type = PPC_OPROFILE_POWER4,
309 .oprofile_mmcra_sihv = MMCRA_SIHV,
310 .oprofile_mmcra_sipr = MMCRA_SIPR,
311 .platform = "power5+",
313 { /* POWER6 in P5+ mode; 2.04-compliant processor */
314 .pvr_mask = 0xffffffff,
315 .pvr_value = 0x0f000001,
316 .cpu_name = "POWER5+",
317 .cpu_features = CPU_FTRS_POWER5,
318 .cpu_user_features = COMMON_USER_POWER5_PLUS,
322 .pmc_type = PPC_PMC_IBM,
323 .oprofile_cpu_type = "ppc64/power6",
324 .oprofile_type = PPC_OPROFILE_POWER4,
325 .oprofile_mmcra_sihv = POWER6_MMCRA_SIHV,
326 .oprofile_mmcra_sipr = POWER6_MMCRA_SIPR,
327 .oprofile_mmcra_clear = POWER6_MMCRA_THRM |
329 .platform = "power5+",
332 .pvr_mask = 0xffff0000,
333 .pvr_value = 0x003e0000,
334 .cpu_name = "POWER6 (raw)",
335 .cpu_features = CPU_FTRS_POWER6,
336 .cpu_user_features = COMMON_USER_POWER6 |
337 PPC_FEATURE_POWER6_EXT,
341 .pmc_type = PPC_PMC_IBM,
342 .oprofile_cpu_type = "ppc64/power6",
343 .oprofile_type = PPC_OPROFILE_POWER4,
344 .oprofile_mmcra_sihv = POWER6_MMCRA_SIHV,
345 .oprofile_mmcra_sipr = POWER6_MMCRA_SIPR,
346 .oprofile_mmcra_clear = POWER6_MMCRA_THRM |
348 .platform = "power6x",
350 { /* 2.05-compliant processor, i.e. Power6 "architected" mode */
351 .pvr_mask = 0xffffffff,
352 .pvr_value = 0x0f000002,
353 .cpu_name = "POWER6 (architected)",
354 .cpu_features = CPU_FTRS_POWER6,
355 .cpu_user_features = COMMON_USER_POWER6,
359 .pmc_type = PPC_PMC_IBM,
360 .oprofile_cpu_type = "ppc64/power6",
361 .oprofile_type = PPC_OPROFILE_POWER4,
362 .oprofile_mmcra_sihv = POWER6_MMCRA_SIHV,
363 .oprofile_mmcra_sipr = POWER6_MMCRA_SIPR,
364 .oprofile_mmcra_clear = POWER6_MMCRA_THRM |
366 .platform = "power6",
368 { /* Cell Broadband Engine */
369 .pvr_mask = 0xffff0000,
370 .pvr_value = 0x00700000,
371 .cpu_name = "Cell Broadband Engine",
372 .cpu_features = CPU_FTRS_CELL,
373 .cpu_user_features = COMMON_USER_PPC64 |
374 PPC_FEATURE_CELL | PPC_FEATURE_HAS_ALTIVEC_COMP |
379 .pmc_type = PPC_PMC_IBM,
380 .oprofile_cpu_type = "ppc64/cell-be",
381 .oprofile_type = PPC_OPROFILE_CELL,
382 .platform = "ppc-cell-be",
385 .pvr_mask = 0x7fff0000,
386 .pvr_value = 0x00900000,
388 .cpu_features = CPU_FTRS_PA6T,
389 .cpu_user_features = COMMON_USER_PA6T,
393 .pmc_type = PPC_PMC_PA6T,
394 .cpu_setup = __setup_cpu_pa6t,
395 .cpu_restore = __restore_cpu_pa6t,
396 .oprofile_cpu_type = "ppc64/pa6t",
397 .oprofile_type = PPC_OPROFILE_PA6T,
400 { /* default match */
401 .pvr_mask = 0x00000000,
402 .pvr_value = 0x00000000,
403 .cpu_name = "POWER4 (compatible)",
404 .cpu_features = CPU_FTRS_COMPATIBLE,
405 .cpu_user_features = COMMON_USER_PPC64,
409 .pmc_type = PPC_PMC_IBM,
410 .platform = "power4",
412 #endif /* CONFIG_PPC64 */
416 .pvr_mask = 0xffff0000,
417 .pvr_value = 0x00010000,
419 .cpu_features = CPU_FTRS_PPC601,
420 .cpu_user_features = COMMON_USER | PPC_FEATURE_601_INSTR |
421 PPC_FEATURE_UNIFIED_CACHE | PPC_FEATURE_NO_TB,
424 .platform = "ppc601",
427 .pvr_mask = 0xffff0000,
428 .pvr_value = 0x00030000,
430 .cpu_features = CPU_FTRS_603,
431 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
434 .cpu_setup = __setup_cpu_603,
435 .platform = "ppc603",
438 .pvr_mask = 0xffff0000,
439 .pvr_value = 0x00060000,
441 .cpu_features = CPU_FTRS_603,
442 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
445 .cpu_setup = __setup_cpu_603,
446 .platform = "ppc603",
449 .pvr_mask = 0xffff0000,
450 .pvr_value = 0x00070000,
452 .cpu_features = CPU_FTRS_603,
453 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
456 .cpu_setup = __setup_cpu_603,
457 .platform = "ppc603",
460 .pvr_mask = 0xffff0000,
461 .pvr_value = 0x00040000,
463 .cpu_features = CPU_FTRS_604,
464 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
468 .cpu_setup = __setup_cpu_604,
469 .platform = "ppc604",
472 .pvr_mask = 0xfffff000,
473 .pvr_value = 0x00090000,
475 .cpu_features = CPU_FTRS_604,
476 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
480 .cpu_setup = __setup_cpu_604,
481 .platform = "ppc604",
484 .pvr_mask = 0xffff0000,
485 .pvr_value = 0x00090000,
487 .cpu_features = CPU_FTRS_604,
488 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
492 .cpu_setup = __setup_cpu_604,
493 .platform = "ppc604",
496 .pvr_mask = 0xffff0000,
497 .pvr_value = 0x000a0000,
499 .cpu_features = CPU_FTRS_604,
500 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
504 .cpu_setup = __setup_cpu_604,
505 .platform = "ppc604",
507 { /* 740/750 (0x4202, don't support TAU ?) */
508 .pvr_mask = 0xffffffff,
509 .pvr_value = 0x00084202,
510 .cpu_name = "740/750",
511 .cpu_features = CPU_FTRS_740_NOTAU,
512 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
516 .cpu_setup = __setup_cpu_750,
517 .platform = "ppc750",
519 { /* 750CX (80100 and 8010x?) */
520 .pvr_mask = 0xfffffff0,
521 .pvr_value = 0x00080100,
523 .cpu_features = CPU_FTRS_750,
524 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
528 .cpu_setup = __setup_cpu_750cx,
529 .platform = "ppc750",
531 { /* 750CX (82201 and 82202) */
532 .pvr_mask = 0xfffffff0,
533 .pvr_value = 0x00082200,
535 .cpu_features = CPU_FTRS_750,
536 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
540 .cpu_setup = __setup_cpu_750cx,
541 .platform = "ppc750",
543 { /* 750CXe (82214) */
544 .pvr_mask = 0xfffffff0,
545 .pvr_value = 0x00082210,
546 .cpu_name = "750CXe",
547 .cpu_features = CPU_FTRS_750,
548 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
552 .cpu_setup = __setup_cpu_750cx,
553 .platform = "ppc750",
555 { /* 750CXe "Gekko" (83214) */
556 .pvr_mask = 0xffffffff,
557 .pvr_value = 0x00083214,
558 .cpu_name = "750CXe",
559 .cpu_features = CPU_FTRS_750,
560 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
564 .cpu_setup = __setup_cpu_750cx,
565 .platform = "ppc750",
568 .pvr_mask = 0xfffff0f0,
569 .pvr_value = 0x00087010,
571 .cpu_features = CPU_FTRS_750CL,
572 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
576 .cpu_setup = __setup_cpu_750,
577 .platform = "ppc750",
580 .pvr_mask = 0xfffff000,
581 .pvr_value = 0x00083000,
582 .cpu_name = "745/755",
583 .cpu_features = CPU_FTRS_750,
584 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
588 .cpu_setup = __setup_cpu_750,
589 .platform = "ppc750",
591 { /* 750FX rev 1.x */
592 .pvr_mask = 0xffffff00,
593 .pvr_value = 0x70000100,
595 .cpu_features = CPU_FTRS_750FX1,
596 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
600 .cpu_setup = __setup_cpu_750,
601 .platform = "ppc750",
603 { /* 750FX rev 2.0 must disable HID0[DPM] */
604 .pvr_mask = 0xffffffff,
605 .pvr_value = 0x70000200,
607 .cpu_features = CPU_FTRS_750FX2,
608 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
612 .cpu_setup = __setup_cpu_750,
613 .platform = "ppc750",
615 { /* 750FX (All revs except 2.0) */
616 .pvr_mask = 0xffff0000,
617 .pvr_value = 0x70000000,
619 .cpu_features = CPU_FTRS_750FX,
620 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
624 .cpu_setup = __setup_cpu_750fx,
625 .platform = "ppc750",
628 .pvr_mask = 0xffff0000,
629 .pvr_value = 0x70020000,
631 .cpu_features = CPU_FTRS_750GX,
632 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
636 .cpu_setup = __setup_cpu_750fx,
637 .platform = "ppc750",
639 { /* 740/750 (L2CR bit need fixup for 740) */
640 .pvr_mask = 0xffff0000,
641 .pvr_value = 0x00080000,
642 .cpu_name = "740/750",
643 .cpu_features = CPU_FTRS_740,
644 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
648 .cpu_setup = __setup_cpu_750,
649 .platform = "ppc750",
651 { /* 7400 rev 1.1 ? (no TAU) */
652 .pvr_mask = 0xffffffff,
653 .pvr_value = 0x000c1101,
654 .cpu_name = "7400 (1.1)",
655 .cpu_features = CPU_FTRS_7400_NOTAU,
656 .cpu_user_features = COMMON_USER |
657 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
661 .cpu_setup = __setup_cpu_7400,
662 .platform = "ppc7400",
665 .pvr_mask = 0xffff0000,
666 .pvr_value = 0x000c0000,
668 .cpu_features = CPU_FTRS_7400,
669 .cpu_user_features = COMMON_USER |
670 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
674 .cpu_setup = __setup_cpu_7400,
675 .platform = "ppc7400",
678 .pvr_mask = 0xffff0000,
679 .pvr_value = 0x800c0000,
681 .cpu_features = CPU_FTRS_7400,
682 .cpu_user_features = COMMON_USER |
683 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
687 .cpu_setup = __setup_cpu_7410,
688 .platform = "ppc7400",
690 { /* 7450 2.0 - no doze/nap */
691 .pvr_mask = 0xffffffff,
692 .pvr_value = 0x80000200,
694 .cpu_features = CPU_FTRS_7450_20,
695 .cpu_user_features = COMMON_USER |
696 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
700 .cpu_setup = __setup_cpu_745x,
701 .oprofile_cpu_type = "ppc/7450",
702 .oprofile_type = PPC_OPROFILE_G4,
703 .platform = "ppc7450",
706 .pvr_mask = 0xffffffff,
707 .pvr_value = 0x80000201,
709 .cpu_features = CPU_FTRS_7450_21,
710 .cpu_user_features = COMMON_USER |
711 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
715 .cpu_setup = __setup_cpu_745x,
716 .oprofile_cpu_type = "ppc/7450",
717 .oprofile_type = PPC_OPROFILE_G4,
718 .platform = "ppc7450",
720 { /* 7450 2.3 and newer */
721 .pvr_mask = 0xffff0000,
722 .pvr_value = 0x80000000,
724 .cpu_features = CPU_FTRS_7450_23,
725 .cpu_user_features = COMMON_USER |
726 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
730 .cpu_setup = __setup_cpu_745x,
731 .oprofile_cpu_type = "ppc/7450",
732 .oprofile_type = PPC_OPROFILE_G4,
733 .platform = "ppc7450",
736 .pvr_mask = 0xffffff00,
737 .pvr_value = 0x80010100,
739 .cpu_features = CPU_FTRS_7455_1,
740 .cpu_user_features = COMMON_USER |
741 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
745 .cpu_setup = __setup_cpu_745x,
746 .oprofile_cpu_type = "ppc/7450",
747 .oprofile_type = PPC_OPROFILE_G4,
748 .platform = "ppc7450",
751 .pvr_mask = 0xffffffff,
752 .pvr_value = 0x80010200,
754 .cpu_features = CPU_FTRS_7455_20,
755 .cpu_user_features = COMMON_USER |
756 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
760 .cpu_setup = __setup_cpu_745x,
761 .oprofile_cpu_type = "ppc/7450",
762 .oprofile_type = PPC_OPROFILE_G4,
763 .platform = "ppc7450",
766 .pvr_mask = 0xffff0000,
767 .pvr_value = 0x80010000,
769 .cpu_features = CPU_FTRS_7455,
770 .cpu_user_features = COMMON_USER |
771 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
775 .cpu_setup = __setup_cpu_745x,
776 .oprofile_cpu_type = "ppc/7450",
777 .oprofile_type = PPC_OPROFILE_G4,
778 .platform = "ppc7450",
780 { /* 7447/7457 Rev 1.0 */
781 .pvr_mask = 0xffffffff,
782 .pvr_value = 0x80020100,
783 .cpu_name = "7447/7457",
784 .cpu_features = CPU_FTRS_7447_10,
785 .cpu_user_features = COMMON_USER |
786 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
790 .cpu_setup = __setup_cpu_745x,
791 .oprofile_cpu_type = "ppc/7450",
792 .oprofile_type = PPC_OPROFILE_G4,
793 .platform = "ppc7450",
795 { /* 7447/7457 Rev 1.1 */
796 .pvr_mask = 0xffffffff,
797 .pvr_value = 0x80020101,
798 .cpu_name = "7447/7457",
799 .cpu_features = CPU_FTRS_7447_10,
800 .cpu_user_features = COMMON_USER |
801 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
805 .cpu_setup = __setup_cpu_745x,
806 .oprofile_cpu_type = "ppc/7450",
807 .oprofile_type = PPC_OPROFILE_G4,
808 .platform = "ppc7450",
810 { /* 7447/7457 Rev 1.2 and later */
811 .pvr_mask = 0xffff0000,
812 .pvr_value = 0x80020000,
813 .cpu_name = "7447/7457",
814 .cpu_features = CPU_FTRS_7447,
815 .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
819 .cpu_setup = __setup_cpu_745x,
820 .oprofile_cpu_type = "ppc/7450",
821 .oprofile_type = PPC_OPROFILE_G4,
822 .platform = "ppc7450",
825 .pvr_mask = 0xffff0000,
826 .pvr_value = 0x80030000,
828 .cpu_features = CPU_FTRS_7447A,
829 .cpu_user_features = COMMON_USER |
830 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
834 .cpu_setup = __setup_cpu_745x,
835 .oprofile_cpu_type = "ppc/7450",
836 .oprofile_type = PPC_OPROFILE_G4,
837 .platform = "ppc7450",
840 .pvr_mask = 0xffff0000,
841 .pvr_value = 0x80040000,
843 .cpu_features = CPU_FTRS_7448,
844 .cpu_user_features = COMMON_USER |
845 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
849 .cpu_setup = __setup_cpu_745x,
850 .oprofile_cpu_type = "ppc/7450",
851 .oprofile_type = PPC_OPROFILE_G4,
852 .platform = "ppc7450",
854 { /* 82xx (8240, 8245, 8260 are all 603e cores) */
855 .pvr_mask = 0x7fff0000,
856 .pvr_value = 0x00810000,
858 .cpu_features = CPU_FTRS_82XX,
859 .cpu_user_features = COMMON_USER,
862 .cpu_setup = __setup_cpu_603,
863 .platform = "ppc603",
865 { /* All G2_LE (603e core, plus some) have the same pvr */
866 .pvr_mask = 0x7fff0000,
867 .pvr_value = 0x00820000,
869 .cpu_features = CPU_FTRS_G2_LE,
870 .cpu_user_features = COMMON_USER,
873 .cpu_setup = __setup_cpu_603,
874 .platform = "ppc603",
876 { /* e300c1 (a 603e core, plus some) on 83xx */
877 .pvr_mask = 0x7fff0000,
878 .pvr_value = 0x00830000,
879 .cpu_name = "e300c1",
880 .cpu_features = CPU_FTRS_E300,
881 .cpu_user_features = COMMON_USER,
884 .cpu_setup = __setup_cpu_603,
885 .platform = "ppc603",
887 { /* e300c2 (an e300c1 core, plus some, minus FPU) on 83xx */
888 .pvr_mask = 0x7fff0000,
889 .pvr_value = 0x00840000,
890 .cpu_name = "e300c2",
891 .cpu_features = CPU_FTRS_E300C2,
892 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
895 .cpu_setup = __setup_cpu_603,
896 .platform = "ppc603",
898 { /* e300c3 on 83xx */
899 .pvr_mask = 0x7fff0000,
900 .pvr_value = 0x00850000,
901 .cpu_name = "e300c3",
902 .cpu_features = CPU_FTRS_E300,
903 .cpu_user_features = COMMON_USER,
906 .cpu_setup = __setup_cpu_603,
907 .platform = "ppc603",
909 { /* default match, we assume split I/D cache & TB (non-601)... */
910 .pvr_mask = 0x00000000,
911 .pvr_value = 0x00000000,
912 .cpu_name = "(generic PPC)",
913 .cpu_features = CPU_FTRS_CLASSIC32,
914 .cpu_user_features = COMMON_USER,
917 .platform = "ppc603",
919 #endif /* CLASSIC_PPC */
922 .pvr_mask = 0xffff0000,
923 .pvr_value = 0x00500000,
925 /* CPU_FTR_MAYBE_CAN_DOZE is possible,
926 * if the 8xx code is there.... */
927 .cpu_features = CPU_FTRS_8XX,
928 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
931 .platform = "ppc823",
933 #endif /* CONFIG_8xx */
936 .pvr_mask = 0xffffff00,
937 .pvr_value = 0x00200200,
939 .cpu_features = CPU_FTRS_40X,
940 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
943 .platform = "ppc403",
946 .pvr_mask = 0xffffff00,
947 .pvr_value = 0x00201400,
948 .cpu_name = "403GCX",
949 .cpu_features = CPU_FTRS_40X,
950 .cpu_user_features = PPC_FEATURE_32 |
951 PPC_FEATURE_HAS_MMU | PPC_FEATURE_NO_TB,
954 .platform = "ppc403",
957 .pvr_mask = 0xffff0000,
958 .pvr_value = 0x00200000,
959 .cpu_name = "403G ??",
960 .cpu_features = CPU_FTRS_40X,
961 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
964 .platform = "ppc403",
967 .pvr_mask = 0xffff0000,
968 .pvr_value = 0x40110000,
970 .cpu_features = CPU_FTRS_40X,
971 .cpu_user_features = PPC_FEATURE_32 |
972 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
975 .platform = "ppc405",
978 .pvr_mask = 0xffff0000,
979 .pvr_value = 0x40130000,
980 .cpu_name = "STB03xxx",
981 .cpu_features = CPU_FTRS_40X,
982 .cpu_user_features = PPC_FEATURE_32 |
983 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
986 .platform = "ppc405",
989 .pvr_mask = 0xffff0000,
990 .pvr_value = 0x41810000,
991 .cpu_name = "STB04xxx",
992 .cpu_features = CPU_FTRS_40X,
993 .cpu_user_features = PPC_FEATURE_32 |
994 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
997 .platform = "ppc405",
1000 .pvr_mask = 0xffff0000,
1001 .pvr_value = 0x41610000,
1002 .cpu_name = "NP405L",
1003 .cpu_features = CPU_FTRS_40X,
1004 .cpu_user_features = PPC_FEATURE_32 |
1005 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1008 .platform = "ppc405",
1011 .pvr_mask = 0xffff0000,
1012 .pvr_value = 0x40B10000,
1013 .cpu_name = "NP4GS3",
1014 .cpu_features = CPU_FTRS_40X,
1015 .cpu_user_features = PPC_FEATURE_32 |
1016 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1019 .platform = "ppc405",
1022 .pvr_mask = 0xffff0000,
1023 .pvr_value = 0x41410000,
1024 .cpu_name = "NP405H",
1025 .cpu_features = CPU_FTRS_40X,
1026 .cpu_user_features = PPC_FEATURE_32 |
1027 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1030 .platform = "ppc405",
1033 .pvr_mask = 0xffff0000,
1034 .pvr_value = 0x50910000,
1035 .cpu_name = "405GPr",
1036 .cpu_features = CPU_FTRS_40X,
1037 .cpu_user_features = PPC_FEATURE_32 |
1038 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1041 .platform = "ppc405",
1044 .pvr_mask = 0xffff0000,
1045 .pvr_value = 0x51510000,
1046 .cpu_name = "STBx25xx",
1047 .cpu_features = CPU_FTRS_40X,
1048 .cpu_user_features = PPC_FEATURE_32 |
1049 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1052 .platform = "ppc405",
1055 .pvr_mask = 0xffff0000,
1056 .pvr_value = 0x41F10000,
1057 .cpu_name = "405LP",
1058 .cpu_features = CPU_FTRS_40X,
1059 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
1062 .platform = "ppc405",
1064 { /* Xilinx Virtex-II Pro */
1065 .pvr_mask = 0xfffff000,
1066 .pvr_value = 0x20010000,
1067 .cpu_name = "Virtex-II Pro",
1068 .cpu_features = CPU_FTRS_40X,
1069 .cpu_user_features = PPC_FEATURE_32 |
1070 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1073 .platform = "ppc405",
1075 { /* Xilinx Virtex-4 FX */
1076 .pvr_mask = 0xfffff000,
1077 .pvr_value = 0x20011000,
1078 .cpu_name = "Virtex-4 FX",
1079 .cpu_features = CPU_FTRS_40X,
1080 .cpu_user_features = PPC_FEATURE_32 |
1081 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1084 .platform = "ppc405",
1087 .pvr_mask = 0xffff0000,
1088 .pvr_value = 0x51210000,
1089 .cpu_name = "405EP",
1090 .cpu_features = CPU_FTRS_40X,
1091 .cpu_user_features = PPC_FEATURE_32 |
1092 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1095 .platform = "ppc405",
1098 #endif /* CONFIG_40x */
1101 .pvr_mask = 0xf0000fff,
1102 .pvr_value = 0x40000850,
1103 .cpu_name = "440EP Rev. A",
1104 .cpu_features = CPU_FTRS_44X,
1105 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
1108 .platform = "ppc440",
1111 .pvr_mask = 0xf0000fff,
1112 .pvr_value = 0x400008d3,
1113 .cpu_name = "440EP Rev. B",
1114 .cpu_features = CPU_FTRS_44X,
1115 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
1118 .platform = "ppc440",
1120 { /* 440GP Rev. B */
1121 .pvr_mask = 0xf0000fff,
1122 .pvr_value = 0x40000440,
1123 .cpu_name = "440GP Rev. B",
1124 .cpu_features = CPU_FTRS_44X,
1125 .cpu_user_features = COMMON_USER_BOOKE,
1128 .platform = "ppc440gp",
1130 { /* 440GP Rev. C */
1131 .pvr_mask = 0xf0000fff,
1132 .pvr_value = 0x40000481,
1133 .cpu_name = "440GP Rev. C",
1134 .cpu_features = CPU_FTRS_44X,
1135 .cpu_user_features = COMMON_USER_BOOKE,
1138 .platform = "ppc440gp",
1140 { /* 440GX Rev. A */
1141 .pvr_mask = 0xf0000fff,
1142 .pvr_value = 0x50000850,
1143 .cpu_name = "440GX Rev. A",
1144 .cpu_features = CPU_FTRS_44X,
1145 .cpu_user_features = COMMON_USER_BOOKE,
1148 .platform = "ppc440",
1150 { /* 440GX Rev. B */
1151 .pvr_mask = 0xf0000fff,
1152 .pvr_value = 0x50000851,
1153 .cpu_name = "440GX Rev. B",
1154 .cpu_features = CPU_FTRS_44X,
1155 .cpu_user_features = COMMON_USER_BOOKE,
1158 .platform = "ppc440",
1160 { /* 440GX Rev. C */
1161 .pvr_mask = 0xf0000fff,
1162 .pvr_value = 0x50000892,
1163 .cpu_name = "440GX Rev. C",
1164 .cpu_features = CPU_FTRS_44X,
1165 .cpu_user_features = COMMON_USER_BOOKE,
1168 .platform = "ppc440",
1170 { /* 440GX Rev. F */
1171 .pvr_mask = 0xf0000fff,
1172 .pvr_value = 0x50000894,
1173 .cpu_name = "440GX Rev. F",
1174 .cpu_features = CPU_FTRS_44X,
1175 .cpu_user_features = COMMON_USER_BOOKE,
1178 .platform = "ppc440",
1180 { /* 440SP Rev. A */
1181 .pvr_mask = 0xff000fff,
1182 .pvr_value = 0x53000891,
1183 .cpu_name = "440SP Rev. A",
1184 .cpu_features = CPU_FTRS_44X,
1185 .cpu_user_features = COMMON_USER_BOOKE,
1188 .platform = "ppc440",
1190 { /* 440SPe Rev. A */
1191 .pvr_mask = 0xff000fff,
1192 .pvr_value = 0x53000890,
1193 .cpu_name = "440SPe Rev. A",
1194 .cpu_features = CPU_FTRS_44X,
1195 .cpu_user_features = COMMON_USER_BOOKE,
1198 .platform = "ppc440",
1200 #endif /* CONFIG_44x */
1201 #ifdef CONFIG_FSL_BOOKE
1203 .pvr_mask = 0xfff00000,
1204 .pvr_value = 0x81000000,
1205 .cpu_name = "e200z5",
1206 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
1207 .cpu_features = CPU_FTRS_E200,
1208 .cpu_user_features = COMMON_USER_BOOKE |
1209 PPC_FEATURE_HAS_EFP_SINGLE |
1210 PPC_FEATURE_UNIFIED_CACHE,
1212 .platform = "ppc5554",
1215 .pvr_mask = 0xfff00000,
1216 .pvr_value = 0x81100000,
1217 .cpu_name = "e200z6",
1218 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
1219 .cpu_features = CPU_FTRS_E200,
1220 .cpu_user_features = COMMON_USER_BOOKE |
1221 PPC_FEATURE_SPE_COMP |
1222 PPC_FEATURE_HAS_EFP_SINGLE |
1223 PPC_FEATURE_UNIFIED_CACHE,
1225 .platform = "ppc5554",
1228 .pvr_mask = 0xffff0000,
1229 .pvr_value = 0x80200000,
1231 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
1232 .cpu_features = CPU_FTRS_E500,
1233 .cpu_user_features = COMMON_USER_BOOKE |
1234 PPC_FEATURE_SPE_COMP |
1235 PPC_FEATURE_HAS_EFP_SINGLE,
1239 .oprofile_cpu_type = "ppc/e500",
1240 .oprofile_type = PPC_OPROFILE_BOOKE,
1241 .platform = "ppc8540",
1244 .pvr_mask = 0xffff0000,
1245 .pvr_value = 0x80210000,
1246 .cpu_name = "e500v2",
1247 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
1248 .cpu_features = CPU_FTRS_E500_2,
1249 .cpu_user_features = COMMON_USER_BOOKE |
1250 PPC_FEATURE_SPE_COMP |
1251 PPC_FEATURE_HAS_EFP_SINGLE |
1252 PPC_FEATURE_HAS_EFP_DOUBLE,
1256 .oprofile_cpu_type = "ppc/e500",
1257 .oprofile_type = PPC_OPROFILE_BOOKE,
1258 .platform = "ppc8548",
1262 { /* default match */
1263 .pvr_mask = 0x00000000,
1264 .pvr_value = 0x00000000,
1265 .cpu_name = "(generic PPC)",
1266 .cpu_features = CPU_FTRS_GENERIC_32,
1267 .cpu_user_features = PPC_FEATURE_32,
1270 .platform = "powerpc",
1272 #endif /* !CLASSIC_PPC */
1273 #endif /* CONFIG_PPC32 */
1276 struct cpu_spec *identify_cpu(unsigned long offset, unsigned int pvr)
1278 struct cpu_spec *s = cpu_specs;
1279 struct cpu_spec **cur = &cur_cpu_spec;
1283 cur = PTRRELOC(cur);
1285 for (i = 0; i < ARRAY_SIZE(cpu_specs); i++,s++)
1286 if ((pvr & s->pvr_mask) == s->pvr_value) {
1287 *cur = cpu_specs + i;
1289 /* ppc64 expects identify_cpu to also call setup_cpu
1290 * for that processor. I will consolidate that at a
1291 * later time, for now, just use our friend #ifdef.
1292 * we also don't need to PTRRELOC the function pointer
1293 * on ppc64 as we are running at 0 in real mode.
1296 s->cpu_setup(offset, s);
1298 #endif /* CONFIG_PPC64 */
1305 void do_feature_fixups(unsigned long value, void *fixup_start, void *fixup_end)
1307 struct fixup_entry {
1309 unsigned long value;
1317 for (; fcur < fend; fcur++) {
1318 unsigned int *pstart, *pend, *p;
1320 if ((value & fcur->mask) == fcur->value)
1323 /* These PTRRELOCs will disappear once the new scheme for
1324 * modules and vdso is implemented
1326 pstart = ((unsigned int *)fcur) + (fcur->start_off / 4);
1327 pend = ((unsigned int *)fcur) + (fcur->end_off / 4);
1329 for (p = pstart; p < pend; p++) {
1331 asm volatile ("dcbst 0, %0" : : "r" (p));
1333 asm volatile ("sync" : : : "memory");
1334 for (p = pstart; p < pend; p++)
1335 asm volatile ("icbi 0,%0" : : "r" (p));
1336 asm volatile ("sync; isync" : : : "memory");