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_440ep(unsigned long offset, struct cpu_spec* spec);
35 extern void __setup_cpu_440epx(unsigned long offset, struct cpu_spec* spec);
36 extern void __setup_cpu_440grx(unsigned long offset, struct cpu_spec* spec);
37 extern void __setup_cpu_603(unsigned long offset, struct cpu_spec* spec);
38 extern void __setup_cpu_604(unsigned long offset, struct cpu_spec* spec);
39 extern void __setup_cpu_750(unsigned long offset, struct cpu_spec* spec);
40 extern void __setup_cpu_750cx(unsigned long offset, struct cpu_spec* spec);
41 extern void __setup_cpu_750fx(unsigned long offset, struct cpu_spec* spec);
42 extern void __setup_cpu_7400(unsigned long offset, struct cpu_spec* spec);
43 extern void __setup_cpu_7410(unsigned long offset, struct cpu_spec* spec);
44 extern void __setup_cpu_745x(unsigned long offset, struct cpu_spec* spec);
45 #endif /* CONFIG_PPC32 */
47 extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec);
48 extern void __setup_cpu_ppc970MP(unsigned long offset, struct cpu_spec* spec);
49 extern void __setup_cpu_pa6t(unsigned long offset, struct cpu_spec* spec);
50 extern void __restore_cpu_pa6t(void);
51 extern void __restore_cpu_ppc970(void);
52 #endif /* CONFIG_PPC64 */
54 /* This table only contains "desktop" CPUs, it need to be filled with embedded
57 #define COMMON_USER (PPC_FEATURE_32 | PPC_FEATURE_HAS_FPU | \
59 #define COMMON_USER_PPC64 (COMMON_USER | PPC_FEATURE_64)
60 #define COMMON_USER_POWER4 (COMMON_USER_PPC64 | PPC_FEATURE_POWER4)
61 #define COMMON_USER_POWER5 (COMMON_USER_PPC64 | PPC_FEATURE_POWER5 |\
62 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP)
63 #define COMMON_USER_POWER5_PLUS (COMMON_USER_PPC64 | PPC_FEATURE_POWER5_PLUS|\
64 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP)
65 #define COMMON_USER_POWER6 (COMMON_USER_PPC64 | PPC_FEATURE_ARCH_2_05 |\
66 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | \
68 #define COMMON_USER_PA6T (COMMON_USER_PPC64 | PPC_FEATURE_PA6T |\
69 PPC_FEATURE_TRUE_LE | \
70 PPC_FEATURE_HAS_ALTIVEC_COMP)
71 #define COMMON_USER_BOOKE (PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \
74 static struct cpu_spec __initdata cpu_specs[] = {
77 .pvr_mask = 0xffff0000,
78 .pvr_value = 0x00400000,
79 .cpu_name = "POWER3 (630)",
80 .cpu_features = CPU_FTRS_POWER3,
81 .cpu_user_features = COMMON_USER_PPC64|PPC_FEATURE_PPC_LE,
85 .pmc_type = PPC_PMC_IBM,
86 .oprofile_cpu_type = "ppc64/power3",
87 .oprofile_type = PPC_OPROFILE_RS64,
91 .pvr_mask = 0xffff0000,
92 .pvr_value = 0x00410000,
93 .cpu_name = "POWER3 (630+)",
94 .cpu_features = CPU_FTRS_POWER3,
95 .cpu_user_features = COMMON_USER_PPC64|PPC_FEATURE_PPC_LE,
99 .pmc_type = PPC_PMC_IBM,
100 .oprofile_cpu_type = "ppc64/power3",
101 .oprofile_type = PPC_OPROFILE_RS64,
102 .platform = "power3",
105 .pvr_mask = 0xffff0000,
106 .pvr_value = 0x00330000,
107 .cpu_name = "RS64-II (northstar)",
108 .cpu_features = CPU_FTRS_RS64,
109 .cpu_user_features = COMMON_USER_PPC64,
113 .pmc_type = PPC_PMC_IBM,
114 .oprofile_cpu_type = "ppc64/rs64",
115 .oprofile_type = PPC_OPROFILE_RS64,
119 .pvr_mask = 0xffff0000,
120 .pvr_value = 0x00340000,
121 .cpu_name = "RS64-III (pulsar)",
122 .cpu_features = CPU_FTRS_RS64,
123 .cpu_user_features = COMMON_USER_PPC64,
127 .pmc_type = PPC_PMC_IBM,
128 .oprofile_cpu_type = "ppc64/rs64",
129 .oprofile_type = PPC_OPROFILE_RS64,
133 .pvr_mask = 0xffff0000,
134 .pvr_value = 0x00360000,
135 .cpu_name = "RS64-III (icestar)",
136 .cpu_features = CPU_FTRS_RS64,
137 .cpu_user_features = COMMON_USER_PPC64,
141 .pmc_type = PPC_PMC_IBM,
142 .oprofile_cpu_type = "ppc64/rs64",
143 .oprofile_type = PPC_OPROFILE_RS64,
147 .pvr_mask = 0xffff0000,
148 .pvr_value = 0x00370000,
149 .cpu_name = "RS64-IV (sstar)",
150 .cpu_features = CPU_FTRS_RS64,
151 .cpu_user_features = COMMON_USER_PPC64,
155 .pmc_type = PPC_PMC_IBM,
156 .oprofile_cpu_type = "ppc64/rs64",
157 .oprofile_type = PPC_OPROFILE_RS64,
161 .pvr_mask = 0xffff0000,
162 .pvr_value = 0x00350000,
163 .cpu_name = "POWER4 (gp)",
164 .cpu_features = CPU_FTRS_POWER4,
165 .cpu_user_features = COMMON_USER_POWER4,
169 .pmc_type = PPC_PMC_IBM,
170 .oprofile_cpu_type = "ppc64/power4",
171 .oprofile_type = PPC_OPROFILE_POWER4,
172 .platform = "power4",
175 .pvr_mask = 0xffff0000,
176 .pvr_value = 0x00380000,
177 .cpu_name = "POWER4+ (gq)",
178 .cpu_features = CPU_FTRS_POWER4,
179 .cpu_user_features = COMMON_USER_POWER4,
183 .pmc_type = PPC_PMC_IBM,
184 .oprofile_cpu_type = "ppc64/power4",
185 .oprofile_type = PPC_OPROFILE_POWER4,
186 .platform = "power4",
189 .pvr_mask = 0xffff0000,
190 .pvr_value = 0x00390000,
191 .cpu_name = "PPC970",
192 .cpu_features = CPU_FTRS_PPC970,
193 .cpu_user_features = COMMON_USER_POWER4 |
194 PPC_FEATURE_HAS_ALTIVEC_COMP,
198 .pmc_type = PPC_PMC_IBM,
199 .cpu_setup = __setup_cpu_ppc970,
200 .cpu_restore = __restore_cpu_ppc970,
201 .oprofile_cpu_type = "ppc64/970",
202 .oprofile_type = PPC_OPROFILE_POWER4,
203 .platform = "ppc970",
206 .pvr_mask = 0xffff0000,
207 .pvr_value = 0x003c0000,
208 .cpu_name = "PPC970FX",
209 .cpu_features = CPU_FTRS_PPC970,
210 .cpu_user_features = COMMON_USER_POWER4 |
211 PPC_FEATURE_HAS_ALTIVEC_COMP,
215 .pmc_type = PPC_PMC_IBM,
216 .cpu_setup = __setup_cpu_ppc970,
217 .cpu_restore = __restore_cpu_ppc970,
218 .oprofile_cpu_type = "ppc64/970",
219 .oprofile_type = PPC_OPROFILE_POWER4,
220 .platform = "ppc970",
222 { /* PPC970MP DD1.0 - no DEEPNAP, use regular 970 init */
223 .pvr_mask = 0xffffffff,
224 .pvr_value = 0x00440100,
225 .cpu_name = "PPC970MP",
226 .cpu_features = CPU_FTRS_PPC970,
227 .cpu_user_features = COMMON_USER_POWER4 |
228 PPC_FEATURE_HAS_ALTIVEC_COMP,
232 .pmc_type = PPC_PMC_IBM,
233 .cpu_setup = __setup_cpu_ppc970,
234 .cpu_restore = __restore_cpu_ppc970,
235 .oprofile_cpu_type = "ppc64/970MP",
236 .oprofile_type = PPC_OPROFILE_POWER4,
237 .platform = "ppc970",
240 .pvr_mask = 0xffff0000,
241 .pvr_value = 0x00440000,
242 .cpu_name = "PPC970MP",
243 .cpu_features = CPU_FTRS_PPC970,
244 .cpu_user_features = COMMON_USER_POWER4 |
245 PPC_FEATURE_HAS_ALTIVEC_COMP,
249 .pmc_type = PPC_PMC_IBM,
250 .cpu_setup = __setup_cpu_ppc970MP,
251 .cpu_restore = __restore_cpu_ppc970,
252 .oprofile_cpu_type = "ppc64/970MP",
253 .oprofile_type = PPC_OPROFILE_POWER4,
254 .platform = "ppc970",
257 .pvr_mask = 0xffff0000,
258 .pvr_value = 0x00450000,
259 .cpu_name = "PPC970GX",
260 .cpu_features = CPU_FTRS_PPC970,
261 .cpu_user_features = COMMON_USER_POWER4 |
262 PPC_FEATURE_HAS_ALTIVEC_COMP,
266 .pmc_type = PPC_PMC_IBM,
267 .cpu_setup = __setup_cpu_ppc970,
268 .oprofile_cpu_type = "ppc64/970",
269 .oprofile_type = PPC_OPROFILE_POWER4,
270 .platform = "ppc970",
273 .pvr_mask = 0xffff0000,
274 .pvr_value = 0x003a0000,
275 .cpu_name = "POWER5 (gr)",
276 .cpu_features = CPU_FTRS_POWER5,
277 .cpu_user_features = COMMON_USER_POWER5,
281 .pmc_type = PPC_PMC_IBM,
282 .oprofile_cpu_type = "ppc64/power5",
283 .oprofile_type = PPC_OPROFILE_POWER4,
284 /* SIHV / SIPR bits are implemented on POWER4+ (GQ)
285 * and above but only works on POWER5 and above
287 .oprofile_mmcra_sihv = MMCRA_SIHV,
288 .oprofile_mmcra_sipr = MMCRA_SIPR,
289 .platform = "power5",
292 .pvr_mask = 0xffffff00,
293 .pvr_value = 0x003b0300,
294 .cpu_name = "POWER5+ (gs)",
295 .cpu_features = CPU_FTRS_POWER5,
296 .cpu_user_features = COMMON_USER_POWER5_PLUS,
300 .oprofile_cpu_type = "ppc64/power5++",
301 .oprofile_type = PPC_OPROFILE_POWER4,
302 .oprofile_mmcra_sihv = MMCRA_SIHV,
303 .oprofile_mmcra_sipr = MMCRA_SIPR,
304 .platform = "power5+",
307 .pvr_mask = 0xffff0000,
308 .pvr_value = 0x003b0000,
309 .cpu_name = "POWER5+ (gs)",
310 .cpu_features = CPU_FTRS_POWER5,
311 .cpu_user_features = COMMON_USER_POWER5_PLUS,
315 .pmc_type = PPC_PMC_IBM,
316 .oprofile_cpu_type = "ppc64/power5+",
317 .oprofile_type = PPC_OPROFILE_POWER4,
318 .oprofile_mmcra_sihv = MMCRA_SIHV,
319 .oprofile_mmcra_sipr = MMCRA_SIPR,
320 .platform = "power5+",
322 { /* POWER6 in P5+ mode; 2.04-compliant processor */
323 .pvr_mask = 0xffffffff,
324 .pvr_value = 0x0f000001,
325 .cpu_name = "POWER5+",
326 .cpu_features = CPU_FTRS_POWER5,
327 .cpu_user_features = COMMON_USER_POWER5_PLUS,
330 .platform = "power5+",
333 .pvr_mask = 0xffff0000,
334 .pvr_value = 0x003e0000,
335 .cpu_name = "POWER6 (raw)",
336 .cpu_features = CPU_FTRS_POWER6,
337 .cpu_user_features = COMMON_USER_POWER6 |
338 PPC_FEATURE_POWER6_EXT,
342 .pmc_type = PPC_PMC_IBM,
343 .oprofile_cpu_type = "ppc64/power6",
344 .oprofile_type = PPC_OPROFILE_POWER4,
345 .oprofile_mmcra_sihv = POWER6_MMCRA_SIHV,
346 .oprofile_mmcra_sipr = POWER6_MMCRA_SIPR,
347 .oprofile_mmcra_clear = POWER6_MMCRA_THRM |
349 .platform = "power6x",
351 { /* 2.05-compliant processor, i.e. Power6 "architected" mode */
352 .pvr_mask = 0xffffffff,
353 .pvr_value = 0x0f000002,
354 .cpu_name = "POWER6 (architected)",
355 .cpu_features = CPU_FTRS_POWER6,
356 .cpu_user_features = COMMON_USER_POWER6,
359 .platform = "power6",
361 { /* Cell Broadband Engine */
362 .pvr_mask = 0xffff0000,
363 .pvr_value = 0x00700000,
364 .cpu_name = "Cell Broadband Engine",
365 .cpu_features = CPU_FTRS_CELL,
366 .cpu_user_features = COMMON_USER_PPC64 |
367 PPC_FEATURE_CELL | PPC_FEATURE_HAS_ALTIVEC_COMP |
372 .pmc_type = PPC_PMC_IBM,
373 .oprofile_cpu_type = "ppc64/cell-be",
374 .oprofile_type = PPC_OPROFILE_CELL,
375 .platform = "ppc-cell-be",
378 .pvr_mask = 0x7fff0000,
379 .pvr_value = 0x00900000,
381 .cpu_features = CPU_FTRS_PA6T,
382 .cpu_user_features = COMMON_USER_PA6T,
386 .pmc_type = PPC_PMC_PA6T,
387 .cpu_setup = __setup_cpu_pa6t,
388 .cpu_restore = __restore_cpu_pa6t,
389 .oprofile_cpu_type = "ppc64/pa6t",
390 .oprofile_type = PPC_OPROFILE_PA6T,
393 { /* default match */
394 .pvr_mask = 0x00000000,
395 .pvr_value = 0x00000000,
396 .cpu_name = "POWER4 (compatible)",
397 .cpu_features = CPU_FTRS_COMPATIBLE,
398 .cpu_user_features = COMMON_USER_PPC64,
402 .pmc_type = PPC_PMC_IBM,
403 .platform = "power4",
405 #endif /* CONFIG_PPC64 */
409 .pvr_mask = 0xffff0000,
410 .pvr_value = 0x00010000,
412 .cpu_features = CPU_FTRS_PPC601,
413 .cpu_user_features = COMMON_USER | PPC_FEATURE_601_INSTR |
414 PPC_FEATURE_UNIFIED_CACHE | PPC_FEATURE_NO_TB,
417 .platform = "ppc601",
420 .pvr_mask = 0xffff0000,
421 .pvr_value = 0x00030000,
423 .cpu_features = CPU_FTRS_603,
424 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
427 .cpu_setup = __setup_cpu_603,
428 .platform = "ppc603",
431 .pvr_mask = 0xffff0000,
432 .pvr_value = 0x00060000,
434 .cpu_features = CPU_FTRS_603,
435 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
438 .cpu_setup = __setup_cpu_603,
439 .platform = "ppc603",
442 .pvr_mask = 0xffff0000,
443 .pvr_value = 0x00070000,
445 .cpu_features = CPU_FTRS_603,
446 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
449 .cpu_setup = __setup_cpu_603,
450 .platform = "ppc603",
453 .pvr_mask = 0xffff0000,
454 .pvr_value = 0x00040000,
456 .cpu_features = CPU_FTRS_604,
457 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
461 .cpu_setup = __setup_cpu_604,
462 .platform = "ppc604",
465 .pvr_mask = 0xfffff000,
466 .pvr_value = 0x00090000,
468 .cpu_features = CPU_FTRS_604,
469 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
473 .cpu_setup = __setup_cpu_604,
474 .platform = "ppc604",
477 .pvr_mask = 0xffff0000,
478 .pvr_value = 0x00090000,
480 .cpu_features = CPU_FTRS_604,
481 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
485 .cpu_setup = __setup_cpu_604,
486 .platform = "ppc604",
489 .pvr_mask = 0xffff0000,
490 .pvr_value = 0x000a0000,
492 .cpu_features = CPU_FTRS_604,
493 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
497 .cpu_setup = __setup_cpu_604,
498 .platform = "ppc604",
500 { /* 740/750 (0x4202, don't support TAU ?) */
501 .pvr_mask = 0xffffffff,
502 .pvr_value = 0x00084202,
503 .cpu_name = "740/750",
504 .cpu_features = CPU_FTRS_740_NOTAU,
505 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
509 .cpu_setup = __setup_cpu_750,
510 .platform = "ppc750",
512 { /* 750CX (80100 and 8010x?) */
513 .pvr_mask = 0xfffffff0,
514 .pvr_value = 0x00080100,
516 .cpu_features = CPU_FTRS_750,
517 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
521 .cpu_setup = __setup_cpu_750cx,
522 .platform = "ppc750",
524 { /* 750CX (82201 and 82202) */
525 .pvr_mask = 0xfffffff0,
526 .pvr_value = 0x00082200,
528 .cpu_features = CPU_FTRS_750,
529 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
533 .cpu_setup = __setup_cpu_750cx,
534 .platform = "ppc750",
536 { /* 750CXe (82214) */
537 .pvr_mask = 0xfffffff0,
538 .pvr_value = 0x00082210,
539 .cpu_name = "750CXe",
540 .cpu_features = CPU_FTRS_750,
541 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
545 .cpu_setup = __setup_cpu_750cx,
546 .platform = "ppc750",
548 { /* 750CXe "Gekko" (83214) */
549 .pvr_mask = 0xffffffff,
550 .pvr_value = 0x00083214,
551 .cpu_name = "750CXe",
552 .cpu_features = CPU_FTRS_750,
553 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
557 .cpu_setup = __setup_cpu_750cx,
558 .platform = "ppc750",
561 .pvr_mask = 0xfffff0f0,
562 .pvr_value = 0x00087010,
564 .cpu_features = CPU_FTRS_750CL,
565 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
569 .cpu_setup = __setup_cpu_750,
570 .platform = "ppc750",
573 .pvr_mask = 0xfffff000,
574 .pvr_value = 0x00083000,
575 .cpu_name = "745/755",
576 .cpu_features = CPU_FTRS_750,
577 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
581 .cpu_setup = __setup_cpu_750,
582 .platform = "ppc750",
584 { /* 750FX rev 1.x */
585 .pvr_mask = 0xffffff00,
586 .pvr_value = 0x70000100,
588 .cpu_features = CPU_FTRS_750FX1,
589 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
593 .cpu_setup = __setup_cpu_750,
594 .platform = "ppc750",
596 { /* 750FX rev 2.0 must disable HID0[DPM] */
597 .pvr_mask = 0xffffffff,
598 .pvr_value = 0x70000200,
600 .cpu_features = CPU_FTRS_750FX2,
601 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
605 .cpu_setup = __setup_cpu_750,
606 .platform = "ppc750",
608 { /* 750FX (All revs except 2.0) */
609 .pvr_mask = 0xffff0000,
610 .pvr_value = 0x70000000,
612 .cpu_features = CPU_FTRS_750FX,
613 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
617 .cpu_setup = __setup_cpu_750fx,
618 .platform = "ppc750",
621 .pvr_mask = 0xffff0000,
622 .pvr_value = 0x70020000,
624 .cpu_features = CPU_FTRS_750GX,
625 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
629 .cpu_setup = __setup_cpu_750fx,
630 .platform = "ppc750",
632 { /* 740/750 (L2CR bit need fixup for 740) */
633 .pvr_mask = 0xffff0000,
634 .pvr_value = 0x00080000,
635 .cpu_name = "740/750",
636 .cpu_features = CPU_FTRS_740,
637 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
641 .cpu_setup = __setup_cpu_750,
642 .platform = "ppc750",
644 { /* 7400 rev 1.1 ? (no TAU) */
645 .pvr_mask = 0xffffffff,
646 .pvr_value = 0x000c1101,
647 .cpu_name = "7400 (1.1)",
648 .cpu_features = CPU_FTRS_7400_NOTAU,
649 .cpu_user_features = COMMON_USER |
650 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
654 .cpu_setup = __setup_cpu_7400,
655 .platform = "ppc7400",
658 .pvr_mask = 0xffff0000,
659 .pvr_value = 0x000c0000,
661 .cpu_features = CPU_FTRS_7400,
662 .cpu_user_features = COMMON_USER |
663 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
667 .cpu_setup = __setup_cpu_7400,
668 .platform = "ppc7400",
671 .pvr_mask = 0xffff0000,
672 .pvr_value = 0x800c0000,
674 .cpu_features = CPU_FTRS_7400,
675 .cpu_user_features = COMMON_USER |
676 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
680 .cpu_setup = __setup_cpu_7410,
681 .platform = "ppc7400",
683 { /* 7450 2.0 - no doze/nap */
684 .pvr_mask = 0xffffffff,
685 .pvr_value = 0x80000200,
687 .cpu_features = CPU_FTRS_7450_20,
688 .cpu_user_features = COMMON_USER |
689 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
693 .cpu_setup = __setup_cpu_745x,
694 .oprofile_cpu_type = "ppc/7450",
695 .oprofile_type = PPC_OPROFILE_G4,
696 .platform = "ppc7450",
699 .pvr_mask = 0xffffffff,
700 .pvr_value = 0x80000201,
702 .cpu_features = CPU_FTRS_7450_21,
703 .cpu_user_features = COMMON_USER |
704 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
708 .cpu_setup = __setup_cpu_745x,
709 .oprofile_cpu_type = "ppc/7450",
710 .oprofile_type = PPC_OPROFILE_G4,
711 .platform = "ppc7450",
713 { /* 7450 2.3 and newer */
714 .pvr_mask = 0xffff0000,
715 .pvr_value = 0x80000000,
717 .cpu_features = CPU_FTRS_7450_23,
718 .cpu_user_features = COMMON_USER |
719 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
723 .cpu_setup = __setup_cpu_745x,
724 .oprofile_cpu_type = "ppc/7450",
725 .oprofile_type = PPC_OPROFILE_G4,
726 .platform = "ppc7450",
729 .pvr_mask = 0xffffff00,
730 .pvr_value = 0x80010100,
732 .cpu_features = CPU_FTRS_7455_1,
733 .cpu_user_features = COMMON_USER |
734 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
738 .cpu_setup = __setup_cpu_745x,
739 .oprofile_cpu_type = "ppc/7450",
740 .oprofile_type = PPC_OPROFILE_G4,
741 .platform = "ppc7450",
744 .pvr_mask = 0xffffffff,
745 .pvr_value = 0x80010200,
747 .cpu_features = CPU_FTRS_7455_20,
748 .cpu_user_features = COMMON_USER |
749 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
753 .cpu_setup = __setup_cpu_745x,
754 .oprofile_cpu_type = "ppc/7450",
755 .oprofile_type = PPC_OPROFILE_G4,
756 .platform = "ppc7450",
759 .pvr_mask = 0xffff0000,
760 .pvr_value = 0x80010000,
762 .cpu_features = CPU_FTRS_7455,
763 .cpu_user_features = COMMON_USER |
764 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
768 .cpu_setup = __setup_cpu_745x,
769 .oprofile_cpu_type = "ppc/7450",
770 .oprofile_type = PPC_OPROFILE_G4,
771 .platform = "ppc7450",
773 { /* 7447/7457 Rev 1.0 */
774 .pvr_mask = 0xffffffff,
775 .pvr_value = 0x80020100,
776 .cpu_name = "7447/7457",
777 .cpu_features = CPU_FTRS_7447_10,
778 .cpu_user_features = COMMON_USER |
779 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
783 .cpu_setup = __setup_cpu_745x,
784 .oprofile_cpu_type = "ppc/7450",
785 .oprofile_type = PPC_OPROFILE_G4,
786 .platform = "ppc7450",
788 { /* 7447/7457 Rev 1.1 */
789 .pvr_mask = 0xffffffff,
790 .pvr_value = 0x80020101,
791 .cpu_name = "7447/7457",
792 .cpu_features = CPU_FTRS_7447_10,
793 .cpu_user_features = COMMON_USER |
794 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
798 .cpu_setup = __setup_cpu_745x,
799 .oprofile_cpu_type = "ppc/7450",
800 .oprofile_type = PPC_OPROFILE_G4,
801 .platform = "ppc7450",
803 { /* 7447/7457 Rev 1.2 and later */
804 .pvr_mask = 0xffff0000,
805 .pvr_value = 0x80020000,
806 .cpu_name = "7447/7457",
807 .cpu_features = CPU_FTRS_7447,
808 .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
812 .cpu_setup = __setup_cpu_745x,
813 .oprofile_cpu_type = "ppc/7450",
814 .oprofile_type = PPC_OPROFILE_G4,
815 .platform = "ppc7450",
818 .pvr_mask = 0xffff0000,
819 .pvr_value = 0x80030000,
821 .cpu_features = CPU_FTRS_7447A,
822 .cpu_user_features = COMMON_USER |
823 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
827 .cpu_setup = __setup_cpu_745x,
828 .oprofile_cpu_type = "ppc/7450",
829 .oprofile_type = PPC_OPROFILE_G4,
830 .platform = "ppc7450",
833 .pvr_mask = 0xffff0000,
834 .pvr_value = 0x80040000,
836 .cpu_features = CPU_FTRS_7448,
837 .cpu_user_features = COMMON_USER |
838 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
842 .cpu_setup = __setup_cpu_745x,
843 .oprofile_cpu_type = "ppc/7450",
844 .oprofile_type = PPC_OPROFILE_G4,
845 .platform = "ppc7450",
847 { /* 82xx (8240, 8245, 8260 are all 603e cores) */
848 .pvr_mask = 0x7fff0000,
849 .pvr_value = 0x00810000,
851 .cpu_features = CPU_FTRS_82XX,
852 .cpu_user_features = COMMON_USER,
855 .cpu_setup = __setup_cpu_603,
856 .platform = "ppc603",
858 { /* All G2_LE (603e core, plus some) have the same pvr */
859 .pvr_mask = 0x7fff0000,
860 .pvr_value = 0x00820000,
862 .cpu_features = CPU_FTRS_G2_LE,
863 .cpu_user_features = COMMON_USER,
866 .cpu_setup = __setup_cpu_603,
867 .platform = "ppc603",
869 { /* e300c1 (a 603e core, plus some) on 83xx */
870 .pvr_mask = 0x7fff0000,
871 .pvr_value = 0x00830000,
872 .cpu_name = "e300c1",
873 .cpu_features = CPU_FTRS_E300,
874 .cpu_user_features = COMMON_USER,
877 .cpu_setup = __setup_cpu_603,
878 .platform = "ppc603",
880 { /* e300c2 (an e300c1 core, plus some, minus FPU) on 83xx */
881 .pvr_mask = 0x7fff0000,
882 .pvr_value = 0x00840000,
883 .cpu_name = "e300c2",
884 .cpu_features = CPU_FTRS_E300C2,
885 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
888 .cpu_setup = __setup_cpu_603,
889 .platform = "ppc603",
891 { /* e300c3 on 83xx */
892 .pvr_mask = 0x7fff0000,
893 .pvr_value = 0x00850000,
894 .cpu_name = "e300c3",
895 .cpu_features = CPU_FTRS_E300,
896 .cpu_user_features = COMMON_USER,
899 .cpu_setup = __setup_cpu_603,
900 .platform = "ppc603",
902 { /* default match, we assume split I/D cache & TB (non-601)... */
903 .pvr_mask = 0x00000000,
904 .pvr_value = 0x00000000,
905 .cpu_name = "(generic PPC)",
906 .cpu_features = CPU_FTRS_CLASSIC32,
907 .cpu_user_features = COMMON_USER,
910 .platform = "ppc603",
912 #endif /* CLASSIC_PPC */
915 .pvr_mask = 0xffff0000,
916 .pvr_value = 0x00500000,
918 /* CPU_FTR_MAYBE_CAN_DOZE is possible,
919 * if the 8xx code is there.... */
920 .cpu_features = CPU_FTRS_8XX,
921 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
924 .platform = "ppc823",
926 #endif /* CONFIG_8xx */
929 .pvr_mask = 0xffffff00,
930 .pvr_value = 0x00200200,
932 .cpu_features = CPU_FTRS_40X,
933 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
936 .platform = "ppc403",
939 .pvr_mask = 0xffffff00,
940 .pvr_value = 0x00201400,
941 .cpu_name = "403GCX",
942 .cpu_features = CPU_FTRS_40X,
943 .cpu_user_features = PPC_FEATURE_32 |
944 PPC_FEATURE_HAS_MMU | PPC_FEATURE_NO_TB,
947 .platform = "ppc403",
950 .pvr_mask = 0xffff0000,
951 .pvr_value = 0x00200000,
952 .cpu_name = "403G ??",
953 .cpu_features = CPU_FTRS_40X,
954 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
957 .platform = "ppc403",
960 .pvr_mask = 0xffff0000,
961 .pvr_value = 0x40110000,
963 .cpu_features = CPU_FTRS_40X,
964 .cpu_user_features = PPC_FEATURE_32 |
965 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
968 .platform = "ppc405",
971 .pvr_mask = 0xffff0000,
972 .pvr_value = 0x40130000,
973 .cpu_name = "STB03xxx",
974 .cpu_features = CPU_FTRS_40X,
975 .cpu_user_features = PPC_FEATURE_32 |
976 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
979 .platform = "ppc405",
982 .pvr_mask = 0xffff0000,
983 .pvr_value = 0x41810000,
984 .cpu_name = "STB04xxx",
985 .cpu_features = CPU_FTRS_40X,
986 .cpu_user_features = PPC_FEATURE_32 |
987 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
990 .platform = "ppc405",
993 .pvr_mask = 0xffff0000,
994 .pvr_value = 0x41610000,
995 .cpu_name = "NP405L",
996 .cpu_features = CPU_FTRS_40X,
997 .cpu_user_features = PPC_FEATURE_32 |
998 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1001 .platform = "ppc405",
1004 .pvr_mask = 0xffff0000,
1005 .pvr_value = 0x40B10000,
1006 .cpu_name = "NP4GS3",
1007 .cpu_features = CPU_FTRS_40X,
1008 .cpu_user_features = PPC_FEATURE_32 |
1009 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1012 .platform = "ppc405",
1015 .pvr_mask = 0xffff0000,
1016 .pvr_value = 0x41410000,
1017 .cpu_name = "NP405H",
1018 .cpu_features = CPU_FTRS_40X,
1019 .cpu_user_features = PPC_FEATURE_32 |
1020 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1023 .platform = "ppc405",
1026 .pvr_mask = 0xffff0000,
1027 .pvr_value = 0x50910000,
1028 .cpu_name = "405GPr",
1029 .cpu_features = CPU_FTRS_40X,
1030 .cpu_user_features = PPC_FEATURE_32 |
1031 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1034 .platform = "ppc405",
1037 .pvr_mask = 0xffff0000,
1038 .pvr_value = 0x51510000,
1039 .cpu_name = "STBx25xx",
1040 .cpu_features = CPU_FTRS_40X,
1041 .cpu_user_features = PPC_FEATURE_32 |
1042 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1045 .platform = "ppc405",
1048 .pvr_mask = 0xffff0000,
1049 .pvr_value = 0x41F10000,
1050 .cpu_name = "405LP",
1051 .cpu_features = CPU_FTRS_40X,
1052 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
1055 .platform = "ppc405",
1057 { /* Xilinx Virtex-II Pro */
1058 .pvr_mask = 0xfffff000,
1059 .pvr_value = 0x20010000,
1060 .cpu_name = "Virtex-II Pro",
1061 .cpu_features = CPU_FTRS_40X,
1062 .cpu_user_features = PPC_FEATURE_32 |
1063 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1066 .platform = "ppc405",
1068 { /* Xilinx Virtex-4 FX */
1069 .pvr_mask = 0xfffff000,
1070 .pvr_value = 0x20011000,
1071 .cpu_name = "Virtex-4 FX",
1072 .cpu_features = CPU_FTRS_40X,
1073 .cpu_user_features = PPC_FEATURE_32 |
1074 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1077 .platform = "ppc405",
1080 .pvr_mask = 0xffff0000,
1081 .pvr_value = 0x51210000,
1082 .cpu_name = "405EP",
1083 .cpu_features = CPU_FTRS_40X,
1084 .cpu_user_features = PPC_FEATURE_32 |
1085 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1088 .platform = "ppc405",
1091 .pvr_mask = 0xffff0000,
1092 .pvr_value = 0x12910000,
1093 .cpu_name = "405EX",
1094 .cpu_features = CPU_FTRS_40X,
1095 .cpu_user_features = PPC_FEATURE_32 |
1096 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1099 .platform = "ppc405",
1102 #endif /* CONFIG_40x */
1105 .pvr_mask = 0xf0000fff,
1106 .pvr_value = 0x40000850,
1107 .cpu_name = "440EP Rev. A",
1108 .cpu_features = CPU_FTRS_44X,
1109 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
1112 .cpu_setup = __setup_cpu_440ep,
1113 .platform = "ppc440",
1116 .pvr_mask = 0xf0000fff,
1117 .pvr_value = 0x400008d3,
1118 .cpu_name = "440EP Rev. B",
1119 .cpu_features = CPU_FTRS_44X,
1120 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
1123 .cpu_setup = __setup_cpu_440ep,
1124 .platform = "ppc440",
1127 .pvr_mask = 0xf0000ffb,
1128 .pvr_value = 0x200008D0,
1129 .cpu_name = "440EPX",
1130 .cpu_features = CPU_FTRS_44X,
1131 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
1134 .cpu_setup = __setup_cpu_440epx,
1135 .platform = "ppc440",
1138 .pvr_mask = 0xf0000ffb,
1139 .pvr_value = 0x200008D8,
1140 .cpu_name = "440GRX",
1141 .cpu_features = CPU_FTRS_44X,
1142 .cpu_user_features = COMMON_USER_BOOKE,
1145 .cpu_setup = __setup_cpu_440grx,
1146 .platform = "ppc440",
1148 { /* 440GP Rev. B */
1149 .pvr_mask = 0xf0000fff,
1150 .pvr_value = 0x40000440,
1151 .cpu_name = "440GP Rev. B",
1152 .cpu_features = CPU_FTRS_44X,
1153 .cpu_user_features = COMMON_USER_BOOKE,
1156 .platform = "ppc440gp",
1158 { /* 440GP Rev. C */
1159 .pvr_mask = 0xf0000fff,
1160 .pvr_value = 0x40000481,
1161 .cpu_name = "440GP Rev. C",
1162 .cpu_features = CPU_FTRS_44X,
1163 .cpu_user_features = COMMON_USER_BOOKE,
1166 .platform = "ppc440gp",
1168 { /* 440GX Rev. A */
1169 .pvr_mask = 0xf0000fff,
1170 .pvr_value = 0x50000850,
1171 .cpu_name = "440GX Rev. A",
1172 .cpu_features = CPU_FTRS_44X,
1173 .cpu_user_features = COMMON_USER_BOOKE,
1176 .platform = "ppc440",
1178 { /* 440GX Rev. B */
1179 .pvr_mask = 0xf0000fff,
1180 .pvr_value = 0x50000851,
1181 .cpu_name = "440GX Rev. B",
1182 .cpu_features = CPU_FTRS_44X,
1183 .cpu_user_features = COMMON_USER_BOOKE,
1186 .platform = "ppc440",
1188 { /* 440GX Rev. C */
1189 .pvr_mask = 0xf0000fff,
1190 .pvr_value = 0x50000892,
1191 .cpu_name = "440GX Rev. C",
1192 .cpu_features = CPU_FTRS_44X,
1193 .cpu_user_features = COMMON_USER_BOOKE,
1196 .platform = "ppc440",
1198 { /* 440GX Rev. F */
1199 .pvr_mask = 0xf0000fff,
1200 .pvr_value = 0x50000894,
1201 .cpu_name = "440GX Rev. F",
1202 .cpu_features = CPU_FTRS_44X,
1203 .cpu_user_features = COMMON_USER_BOOKE,
1206 .platform = "ppc440",
1208 { /* 440SP Rev. A */
1209 .pvr_mask = 0xfff00fff,
1210 .pvr_value = 0x53200891,
1211 .cpu_name = "440SP Rev. A",
1212 .cpu_features = CPU_FTRS_44X,
1213 .cpu_user_features = COMMON_USER_BOOKE,
1216 .platform = "ppc440",
1218 { /* 440SPe Rev. A */
1219 .pvr_mask = 0xfff00fff,
1220 .pvr_value = 0x53400890,
1221 .cpu_name = "440SPe Rev. A",
1222 .cpu_features = CPU_FTRS_44X,
1223 .cpu_user_features = COMMON_USER_BOOKE,
1226 .platform = "ppc440",
1228 { /* 440SPe Rev. B */
1229 .pvr_mask = 0xfff00fff,
1230 .pvr_value = 0x53400891,
1231 .cpu_name = "440SPe Rev. B",
1232 .cpu_features = CPU_FTRS_44X,
1233 .cpu_user_features = COMMON_USER_BOOKE,
1236 .platform = "ppc440",
1238 #endif /* CONFIG_44x */
1239 #ifdef CONFIG_FSL_BOOKE
1241 .pvr_mask = 0xfff00000,
1242 .pvr_value = 0x81000000,
1243 .cpu_name = "e200z5",
1244 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
1245 .cpu_features = CPU_FTRS_E200,
1246 .cpu_user_features = COMMON_USER_BOOKE |
1247 PPC_FEATURE_HAS_EFP_SINGLE |
1248 PPC_FEATURE_UNIFIED_CACHE,
1250 .platform = "ppc5554",
1253 .pvr_mask = 0xfff00000,
1254 .pvr_value = 0x81100000,
1255 .cpu_name = "e200z6",
1256 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
1257 .cpu_features = CPU_FTRS_E200,
1258 .cpu_user_features = COMMON_USER_BOOKE |
1259 PPC_FEATURE_HAS_SPE_COMP |
1260 PPC_FEATURE_HAS_EFP_SINGLE_COMP |
1261 PPC_FEATURE_UNIFIED_CACHE,
1263 .platform = "ppc5554",
1266 .pvr_mask = 0xffff0000,
1267 .pvr_value = 0x80200000,
1269 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
1270 .cpu_features = CPU_FTRS_E500,
1271 .cpu_user_features = COMMON_USER_BOOKE |
1272 PPC_FEATURE_HAS_SPE_COMP |
1273 PPC_FEATURE_HAS_EFP_SINGLE_COMP,
1277 .oprofile_cpu_type = "ppc/e500",
1278 .oprofile_type = PPC_OPROFILE_BOOKE,
1279 .platform = "ppc8540",
1282 .pvr_mask = 0xffff0000,
1283 .pvr_value = 0x80210000,
1284 .cpu_name = "e500v2",
1285 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
1286 .cpu_features = CPU_FTRS_E500_2,
1287 .cpu_user_features = COMMON_USER_BOOKE |
1288 PPC_FEATURE_HAS_SPE_COMP |
1289 PPC_FEATURE_HAS_EFP_SINGLE_COMP |
1290 PPC_FEATURE_HAS_EFP_DOUBLE_COMP,
1294 .oprofile_cpu_type = "ppc/e500",
1295 .oprofile_type = PPC_OPROFILE_BOOKE,
1296 .platform = "ppc8548",
1300 { /* default match */
1301 .pvr_mask = 0x00000000,
1302 .pvr_value = 0x00000000,
1303 .cpu_name = "(generic PPC)",
1304 .cpu_features = CPU_FTRS_GENERIC_32,
1305 .cpu_user_features = PPC_FEATURE_32,
1308 .platform = "powerpc",
1310 #endif /* !CLASSIC_PPC */
1311 #endif /* CONFIG_PPC32 */
1314 static struct cpu_spec the_cpu_spec;
1316 struct cpu_spec * __init identify_cpu(unsigned long offset, unsigned int pvr)
1318 struct cpu_spec *s = cpu_specs;
1319 struct cpu_spec *t = &the_cpu_spec;
1325 for (i = 0; i < ARRAY_SIZE(cpu_specs); i++,s++)
1326 if ((pvr & s->pvr_mask) == s->pvr_value) {
1328 * If we are overriding a previous value derived
1329 * from the real PVR with a new value obtained
1330 * using a logical PVR value, don't modify the
1331 * performance monitor fields.
1333 if (t->num_pmcs && !s->num_pmcs) {
1334 t->cpu_name = s->cpu_name;
1335 t->cpu_features = s->cpu_features;
1336 t->cpu_user_features = s->cpu_user_features;
1337 t->icache_bsize = s->icache_bsize;
1338 t->dcache_bsize = s->dcache_bsize;
1339 t->cpu_setup = s->cpu_setup;
1340 t->cpu_restore = s->cpu_restore;
1341 t->platform = s->platform;
1344 *PTRRELOC(&cur_cpu_spec) = &the_cpu_spec;
1345 #if defined(CONFIG_PPC64) || defined(CONFIG_BOOKE)
1346 /* ppc64 and booke expect identify_cpu to also call
1347 * setup_cpu for that processor. I will consolidate
1348 * that at a later time, for now, just use #ifdef.
1349 * we also don't need to PTRRELOC the function pointer
1350 * on ppc64 and booke as we are running at 0 in real
1351 * mode on ppc64 and reloc_offset is always 0 on booke.
1354 s->cpu_setup(offset, s);
1356 #endif /* CONFIG_PPC64 || CONFIG_BOOKE */
1363 void do_feature_fixups(unsigned long value, void *fixup_start, void *fixup_end)
1365 struct fixup_entry {
1367 unsigned long value;
1375 for (; fcur < fend; fcur++) {
1376 unsigned int *pstart, *pend, *p;
1378 if ((value & fcur->mask) == fcur->value)
1381 /* These PTRRELOCs will disappear once the new scheme for
1382 * modules and vdso is implemented
1384 pstart = ((unsigned int *)fcur) + (fcur->start_off / 4);
1385 pend = ((unsigned int *)fcur) + (fcur->end_off / 4);
1387 for (p = pstart; p < pend; p++) {
1389 asm volatile ("dcbst 0, %0" : : "r" (p));
1391 asm volatile ("sync" : : : "memory");
1392 for (p = pstart; p < pend; p++)
1393 asm volatile ("icbi 0,%0" : : "r" (p));
1394 asm volatile ("sync; isync" : : : "memory");