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 __restore_cpu_ppc970(void);
47 #endif /* CONFIG_PPC64 */
49 /* This table only contains "desktop" CPUs, it need to be filled with embedded
52 #define COMMON_USER (PPC_FEATURE_32 | PPC_FEATURE_HAS_FPU | \
54 #define COMMON_USER_PPC64 (COMMON_USER | PPC_FEATURE_64)
55 #define COMMON_USER_POWER4 (COMMON_USER_PPC64 | PPC_FEATURE_POWER4)
56 #define COMMON_USER_POWER5 (COMMON_USER_PPC64 | PPC_FEATURE_POWER5 |\
57 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP)
58 #define COMMON_USER_POWER5_PLUS (COMMON_USER_PPC64 | PPC_FEATURE_POWER5_PLUS|\
59 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP)
60 #define COMMON_USER_POWER6 (COMMON_USER_PPC64 | PPC_FEATURE_ARCH_2_05 |\
61 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | \
63 #define COMMON_USER_PA6T (COMMON_USER_PPC64 | PPC_FEATURE_PA6T |\
64 PPC_FEATURE_TRUE_LE | \
65 PPC_FEATURE_HAS_ALTIVEC_COMP)
66 #define COMMON_USER_BOOKE (PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \
69 /* We only set the spe features if the kernel was compiled with
73 #define PPC_FEATURE_SPE_COMP PPC_FEATURE_HAS_SPE
75 #define PPC_FEATURE_SPE_COMP 0
78 static struct cpu_spec cpu_specs[] = {
81 .pvr_mask = 0xffff0000,
82 .pvr_value = 0x00400000,
83 .cpu_name = "POWER3 (630)",
84 .cpu_features = CPU_FTRS_POWER3,
85 .cpu_user_features = COMMON_USER_PPC64|PPC_FEATURE_PPC_LE,
89 .oprofile_cpu_type = "ppc64/power3",
90 .oprofile_type = PPC_OPROFILE_RS64,
94 .pvr_mask = 0xffff0000,
95 .pvr_value = 0x00410000,
96 .cpu_name = "POWER3 (630+)",
97 .cpu_features = CPU_FTRS_POWER3,
98 .cpu_user_features = COMMON_USER_PPC64|PPC_FEATURE_PPC_LE,
102 .oprofile_cpu_type = "ppc64/power3",
103 .oprofile_type = PPC_OPROFILE_RS64,
104 .platform = "power3",
107 .pvr_mask = 0xffff0000,
108 .pvr_value = 0x00330000,
109 .cpu_name = "RS64-II (northstar)",
110 .cpu_features = CPU_FTRS_RS64,
111 .cpu_user_features = COMMON_USER_PPC64,
115 .oprofile_cpu_type = "ppc64/rs64",
116 .oprofile_type = PPC_OPROFILE_RS64,
120 .pvr_mask = 0xffff0000,
121 .pvr_value = 0x00340000,
122 .cpu_name = "RS64-III (pulsar)",
123 .cpu_features = CPU_FTRS_RS64,
124 .cpu_user_features = COMMON_USER_PPC64,
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 .oprofile_cpu_type = "ppc64/rs64",
142 .oprofile_type = PPC_OPROFILE_RS64,
146 .pvr_mask = 0xffff0000,
147 .pvr_value = 0x00370000,
148 .cpu_name = "RS64-IV (sstar)",
149 .cpu_features = CPU_FTRS_RS64,
150 .cpu_user_features = COMMON_USER_PPC64,
154 .oprofile_cpu_type = "ppc64/rs64",
155 .oprofile_type = PPC_OPROFILE_RS64,
159 .pvr_mask = 0xffff0000,
160 .pvr_value = 0x00350000,
161 .cpu_name = "POWER4 (gp)",
162 .cpu_features = CPU_FTRS_POWER4,
163 .cpu_user_features = COMMON_USER_POWER4,
167 .oprofile_cpu_type = "ppc64/power4",
168 .oprofile_type = PPC_OPROFILE_POWER4,
169 .platform = "power4",
172 .pvr_mask = 0xffff0000,
173 .pvr_value = 0x00380000,
174 .cpu_name = "POWER4+ (gq)",
175 .cpu_features = CPU_FTRS_POWER4,
176 .cpu_user_features = COMMON_USER_POWER4,
180 .oprofile_cpu_type = "ppc64/power4",
181 .oprofile_type = PPC_OPROFILE_POWER4,
182 .platform = "power4",
185 .pvr_mask = 0xffff0000,
186 .pvr_value = 0x00390000,
187 .cpu_name = "PPC970",
188 .cpu_features = CPU_FTRS_PPC970,
189 .cpu_user_features = COMMON_USER_POWER4 |
190 PPC_FEATURE_HAS_ALTIVEC_COMP,
194 .cpu_setup = __setup_cpu_ppc970,
195 .cpu_restore = __restore_cpu_ppc970,
196 .oprofile_cpu_type = "ppc64/970",
197 .oprofile_type = PPC_OPROFILE_POWER4,
198 .platform = "ppc970",
201 .pvr_mask = 0xffff0000,
202 .pvr_value = 0x003c0000,
203 .cpu_name = "PPC970FX",
204 .cpu_features = CPU_FTRS_PPC970,
205 .cpu_user_features = COMMON_USER_POWER4 |
206 PPC_FEATURE_HAS_ALTIVEC_COMP,
210 .cpu_setup = __setup_cpu_ppc970,
211 .cpu_restore = __restore_cpu_ppc970,
212 .oprofile_cpu_type = "ppc64/970",
213 .oprofile_type = PPC_OPROFILE_POWER4,
214 .platform = "ppc970",
217 .pvr_mask = 0xffff0000,
218 .pvr_value = 0x00440000,
219 .cpu_name = "PPC970MP",
220 .cpu_features = CPU_FTRS_PPC970,
221 .cpu_user_features = COMMON_USER_POWER4 |
222 PPC_FEATURE_HAS_ALTIVEC_COMP,
226 .cpu_setup = __setup_cpu_ppc970MP,
227 .cpu_restore = __restore_cpu_ppc970,
228 .oprofile_cpu_type = "ppc64/970MP",
229 .oprofile_type = PPC_OPROFILE_POWER4,
230 .platform = "ppc970",
233 .pvr_mask = 0xffff0000,
234 .pvr_value = 0x00450000,
235 .cpu_name = "PPC970GX",
236 .cpu_features = CPU_FTRS_PPC970,
237 .cpu_user_features = COMMON_USER_POWER4 |
238 PPC_FEATURE_HAS_ALTIVEC_COMP,
242 .cpu_setup = __setup_cpu_ppc970,
243 .oprofile_cpu_type = "ppc64/970",
244 .oprofile_type = PPC_OPROFILE_POWER4,
245 .platform = "ppc970",
248 .pvr_mask = 0xffff0000,
249 .pvr_value = 0x003a0000,
250 .cpu_name = "POWER5 (gr)",
251 .cpu_features = CPU_FTRS_POWER5,
252 .cpu_user_features = COMMON_USER_POWER5,
256 .oprofile_cpu_type = "ppc64/power5",
257 .oprofile_type = PPC_OPROFILE_POWER4,
258 /* SIHV / SIPR bits are implemented on POWER4+ (GQ)
259 * and above but only works on POWER5 and above
261 .oprofile_mmcra_sihv = MMCRA_SIHV,
262 .oprofile_mmcra_sipr = MMCRA_SIPR,
263 .platform = "power5",
266 .pvr_mask = 0xffff0000,
267 .pvr_value = 0x003b0000,
268 .cpu_name = "POWER5+ (gs)",
269 .cpu_features = CPU_FTRS_POWER5,
270 .cpu_user_features = COMMON_USER_POWER5_PLUS,
274 .oprofile_cpu_type = "ppc64/power5+",
275 .oprofile_type = PPC_OPROFILE_POWER4,
276 .oprofile_mmcra_sihv = MMCRA_SIHV,
277 .oprofile_mmcra_sipr = MMCRA_SIPR,
278 .platform = "power5+",
280 { /* POWER6 in P5+ mode; 2.04-compliant processor */
281 .pvr_mask = 0xffffffff,
282 .pvr_value = 0x0f000001,
283 .cpu_name = "POWER5+",
284 .cpu_features = CPU_FTRS_POWER5,
285 .cpu_user_features = COMMON_USER_POWER5_PLUS,
289 .oprofile_cpu_type = "ppc64/power6",
290 .oprofile_type = PPC_OPROFILE_POWER4,
291 .oprofile_mmcra_sihv = POWER6_MMCRA_SIHV,
292 .oprofile_mmcra_sipr = POWER6_MMCRA_SIPR,
293 .oprofile_mmcra_clear = POWER6_MMCRA_THRM |
295 .platform = "power5+",
298 .pvr_mask = 0xffff0000,
299 .pvr_value = 0x003e0000,
300 .cpu_name = "POWER6 (raw)",
301 .cpu_features = CPU_FTRS_POWER6,
302 .cpu_user_features = COMMON_USER_POWER6 |
303 PPC_FEATURE_POWER6_EXT,
307 .oprofile_cpu_type = "ppc64/power6",
308 .oprofile_type = PPC_OPROFILE_POWER4,
309 .oprofile_mmcra_sihv = POWER6_MMCRA_SIHV,
310 .oprofile_mmcra_sipr = POWER6_MMCRA_SIPR,
311 .oprofile_mmcra_clear = POWER6_MMCRA_THRM |
313 .platform = "power6x",
315 { /* 2.05-compliant processor, i.e. Power6 "architected" mode */
316 .pvr_mask = 0xffffffff,
317 .pvr_value = 0x0f000002,
318 .cpu_name = "POWER6 (architected)",
319 .cpu_features = CPU_FTRS_POWER6,
320 .cpu_user_features = COMMON_USER_POWER6,
324 .oprofile_cpu_type = "ppc64/power6",
325 .oprofile_type = PPC_OPROFILE_POWER4,
326 .oprofile_mmcra_sihv = POWER6_MMCRA_SIHV,
327 .oprofile_mmcra_sipr = POWER6_MMCRA_SIPR,
328 .oprofile_mmcra_clear = POWER6_MMCRA_THRM |
330 .platform = "power6",
332 { /* Cell Broadband Engine */
333 .pvr_mask = 0xffff0000,
334 .pvr_value = 0x00700000,
335 .cpu_name = "Cell Broadband Engine",
336 .cpu_features = CPU_FTRS_CELL,
337 .cpu_user_features = COMMON_USER_PPC64 |
338 PPC_FEATURE_CELL | PPC_FEATURE_HAS_ALTIVEC_COMP |
343 .oprofile_cpu_type = "ppc64/cell-be",
344 .oprofile_type = PPC_OPROFILE_CELL,
345 .platform = "ppc-cell-be",
348 .pvr_mask = 0x7fff0000,
349 .pvr_value = 0x00900000,
351 .cpu_features = CPU_FTRS_PA6T,
352 .cpu_user_features = COMMON_USER_PA6T,
358 { /* default match */
359 .pvr_mask = 0x00000000,
360 .pvr_value = 0x00000000,
361 .cpu_name = "POWER4 (compatible)",
362 .cpu_features = CPU_FTRS_COMPATIBLE,
363 .cpu_user_features = COMMON_USER_PPC64,
367 .platform = "power4",
369 #endif /* CONFIG_PPC64 */
373 .pvr_mask = 0xffff0000,
374 .pvr_value = 0x00010000,
376 .cpu_features = CPU_FTRS_PPC601,
377 .cpu_user_features = COMMON_USER | PPC_FEATURE_601_INSTR |
378 PPC_FEATURE_UNIFIED_CACHE | PPC_FEATURE_NO_TB,
381 .platform = "ppc601",
384 .pvr_mask = 0xffff0000,
385 .pvr_value = 0x00030000,
387 .cpu_features = CPU_FTRS_603,
388 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
391 .cpu_setup = __setup_cpu_603,
392 .platform = "ppc603",
395 .pvr_mask = 0xffff0000,
396 .pvr_value = 0x00060000,
398 .cpu_features = CPU_FTRS_603,
399 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
402 .cpu_setup = __setup_cpu_603,
403 .platform = "ppc603",
406 .pvr_mask = 0xffff0000,
407 .pvr_value = 0x00070000,
409 .cpu_features = CPU_FTRS_603,
410 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
413 .cpu_setup = __setup_cpu_603,
414 .platform = "ppc603",
417 .pvr_mask = 0xffff0000,
418 .pvr_value = 0x00040000,
420 .cpu_features = CPU_FTRS_604,
421 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
425 .cpu_setup = __setup_cpu_604,
426 .platform = "ppc604",
429 .pvr_mask = 0xfffff000,
430 .pvr_value = 0x00090000,
432 .cpu_features = CPU_FTRS_604,
433 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
437 .cpu_setup = __setup_cpu_604,
438 .platform = "ppc604",
441 .pvr_mask = 0xffff0000,
442 .pvr_value = 0x00090000,
444 .cpu_features = CPU_FTRS_604,
445 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
449 .cpu_setup = __setup_cpu_604,
450 .platform = "ppc604",
453 .pvr_mask = 0xffff0000,
454 .pvr_value = 0x000a0000,
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",
464 { /* 740/750 (0x4202, don't support TAU ?) */
465 .pvr_mask = 0xffffffff,
466 .pvr_value = 0x00084202,
467 .cpu_name = "740/750",
468 .cpu_features = CPU_FTRS_740_NOTAU,
469 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
473 .cpu_setup = __setup_cpu_750,
474 .platform = "ppc750",
476 { /* 750CX (80100 and 8010x?) */
477 .pvr_mask = 0xfffffff0,
478 .pvr_value = 0x00080100,
480 .cpu_features = CPU_FTRS_750,
481 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
485 .cpu_setup = __setup_cpu_750cx,
486 .platform = "ppc750",
488 { /* 750CX (82201 and 82202) */
489 .pvr_mask = 0xfffffff0,
490 .pvr_value = 0x00082200,
492 .cpu_features = CPU_FTRS_750,
493 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
497 .cpu_setup = __setup_cpu_750cx,
498 .platform = "ppc750",
500 { /* 750CXe (82214) */
501 .pvr_mask = 0xfffffff0,
502 .pvr_value = 0x00082210,
503 .cpu_name = "750CXe",
504 .cpu_features = CPU_FTRS_750,
505 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
509 .cpu_setup = __setup_cpu_750cx,
510 .platform = "ppc750",
512 { /* 750CXe "Gekko" (83214) */
513 .pvr_mask = 0xffffffff,
514 .pvr_value = 0x00083214,
515 .cpu_name = "750CXe",
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",
525 .pvr_mask = 0xfffff000,
526 .pvr_value = 0x00083000,
527 .cpu_name = "745/755",
528 .cpu_features = CPU_FTRS_750,
529 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
533 .cpu_setup = __setup_cpu_750,
534 .platform = "ppc750",
536 { /* 750FX rev 1.x */
537 .pvr_mask = 0xffffff00,
538 .pvr_value = 0x70000100,
540 .cpu_features = CPU_FTRS_750FX1,
541 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
545 .cpu_setup = __setup_cpu_750,
546 .platform = "ppc750",
548 { /* 750FX rev 2.0 must disable HID0[DPM] */
549 .pvr_mask = 0xffffffff,
550 .pvr_value = 0x70000200,
552 .cpu_features = CPU_FTRS_750FX2,
553 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
557 .cpu_setup = __setup_cpu_750,
558 .platform = "ppc750",
560 { /* 750FX (All revs except 2.0) */
561 .pvr_mask = 0xffff0000,
562 .pvr_value = 0x70000000,
564 .cpu_features = CPU_FTRS_750FX,
565 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
569 .cpu_setup = __setup_cpu_750fx,
570 .platform = "ppc750",
573 .pvr_mask = 0xffff0000,
574 .pvr_value = 0x70020000,
576 .cpu_features = CPU_FTRS_750GX,
577 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
581 .cpu_setup = __setup_cpu_750fx,
582 .platform = "ppc750",
584 { /* 740/750 (L2CR bit need fixup for 740) */
585 .pvr_mask = 0xffff0000,
586 .pvr_value = 0x00080000,
587 .cpu_name = "740/750",
588 .cpu_features = CPU_FTRS_740,
589 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
593 .cpu_setup = __setup_cpu_750,
594 .platform = "ppc750",
596 { /* 7400 rev 1.1 ? (no TAU) */
597 .pvr_mask = 0xffffffff,
598 .pvr_value = 0x000c1101,
599 .cpu_name = "7400 (1.1)",
600 .cpu_features = CPU_FTRS_7400_NOTAU,
601 .cpu_user_features = COMMON_USER |
602 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
606 .cpu_setup = __setup_cpu_7400,
607 .platform = "ppc7400",
610 .pvr_mask = 0xffff0000,
611 .pvr_value = 0x000c0000,
613 .cpu_features = CPU_FTRS_7400,
614 .cpu_user_features = COMMON_USER |
615 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
619 .cpu_setup = __setup_cpu_7400,
620 .platform = "ppc7400",
623 .pvr_mask = 0xffff0000,
624 .pvr_value = 0x800c0000,
626 .cpu_features = CPU_FTRS_7400,
627 .cpu_user_features = COMMON_USER |
628 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
632 .cpu_setup = __setup_cpu_7410,
633 .platform = "ppc7400",
635 { /* 7450 2.0 - no doze/nap */
636 .pvr_mask = 0xffffffff,
637 .pvr_value = 0x80000200,
639 .cpu_features = CPU_FTRS_7450_20,
640 .cpu_user_features = COMMON_USER |
641 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
645 .cpu_setup = __setup_cpu_745x,
646 .oprofile_cpu_type = "ppc/7450",
647 .oprofile_type = PPC_OPROFILE_G4,
648 .platform = "ppc7450",
651 .pvr_mask = 0xffffffff,
652 .pvr_value = 0x80000201,
654 .cpu_features = CPU_FTRS_7450_21,
655 .cpu_user_features = COMMON_USER |
656 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
660 .cpu_setup = __setup_cpu_745x,
661 .oprofile_cpu_type = "ppc/7450",
662 .oprofile_type = PPC_OPROFILE_G4,
663 .platform = "ppc7450",
665 { /* 7450 2.3 and newer */
666 .pvr_mask = 0xffff0000,
667 .pvr_value = 0x80000000,
669 .cpu_features = CPU_FTRS_7450_23,
670 .cpu_user_features = COMMON_USER |
671 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
675 .cpu_setup = __setup_cpu_745x,
676 .oprofile_cpu_type = "ppc/7450",
677 .oprofile_type = PPC_OPROFILE_G4,
678 .platform = "ppc7450",
681 .pvr_mask = 0xffffff00,
682 .pvr_value = 0x80010100,
684 .cpu_features = CPU_FTRS_7455_1,
685 .cpu_user_features = COMMON_USER |
686 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
690 .cpu_setup = __setup_cpu_745x,
691 .oprofile_cpu_type = "ppc/7450",
692 .oprofile_type = PPC_OPROFILE_G4,
693 .platform = "ppc7450",
696 .pvr_mask = 0xffffffff,
697 .pvr_value = 0x80010200,
699 .cpu_features = CPU_FTRS_7455_20,
700 .cpu_user_features = COMMON_USER |
701 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
705 .cpu_setup = __setup_cpu_745x,
706 .oprofile_cpu_type = "ppc/7450",
707 .oprofile_type = PPC_OPROFILE_G4,
708 .platform = "ppc7450",
711 .pvr_mask = 0xffff0000,
712 .pvr_value = 0x80010000,
714 .cpu_features = CPU_FTRS_7455,
715 .cpu_user_features = COMMON_USER |
716 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
720 .cpu_setup = __setup_cpu_745x,
721 .oprofile_cpu_type = "ppc/7450",
722 .oprofile_type = PPC_OPROFILE_G4,
723 .platform = "ppc7450",
725 { /* 7447/7457 Rev 1.0 */
726 .pvr_mask = 0xffffffff,
727 .pvr_value = 0x80020100,
728 .cpu_name = "7447/7457",
729 .cpu_features = CPU_FTRS_7447_10,
730 .cpu_user_features = COMMON_USER |
731 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
735 .cpu_setup = __setup_cpu_745x,
736 .oprofile_cpu_type = "ppc/7450",
737 .oprofile_type = PPC_OPROFILE_G4,
738 .platform = "ppc7450",
740 { /* 7447/7457 Rev 1.1 */
741 .pvr_mask = 0xffffffff,
742 .pvr_value = 0x80020101,
743 .cpu_name = "7447/7457",
744 .cpu_features = CPU_FTRS_7447_10,
745 .cpu_user_features = COMMON_USER |
746 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
750 .cpu_setup = __setup_cpu_745x,
751 .oprofile_cpu_type = "ppc/7450",
752 .oprofile_type = PPC_OPROFILE_G4,
753 .platform = "ppc7450",
755 { /* 7447/7457 Rev 1.2 and later */
756 .pvr_mask = 0xffff0000,
757 .pvr_value = 0x80020000,
758 .cpu_name = "7447/7457",
759 .cpu_features = CPU_FTRS_7447,
760 .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
764 .cpu_setup = __setup_cpu_745x,
765 .oprofile_cpu_type = "ppc/7450",
766 .oprofile_type = PPC_OPROFILE_G4,
767 .platform = "ppc7450",
770 .pvr_mask = 0xffff0000,
771 .pvr_value = 0x80030000,
773 .cpu_features = CPU_FTRS_7447A,
774 .cpu_user_features = COMMON_USER |
775 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
779 .cpu_setup = __setup_cpu_745x,
780 .oprofile_cpu_type = "ppc/7450",
781 .oprofile_type = PPC_OPROFILE_G4,
782 .platform = "ppc7450",
785 .pvr_mask = 0xffff0000,
786 .pvr_value = 0x80040000,
788 .cpu_features = CPU_FTRS_7447A,
789 .cpu_user_features = COMMON_USER |
790 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
794 .cpu_setup = __setup_cpu_745x,
795 .oprofile_cpu_type = "ppc/7450",
796 .oprofile_type = PPC_OPROFILE_G4,
797 .platform = "ppc7450",
799 { /* 82xx (8240, 8245, 8260 are all 603e cores) */
800 .pvr_mask = 0x7fff0000,
801 .pvr_value = 0x00810000,
803 .cpu_features = CPU_FTRS_82XX,
804 .cpu_user_features = COMMON_USER,
807 .cpu_setup = __setup_cpu_603,
808 .platform = "ppc603",
810 { /* All G2_LE (603e core, plus some) have the same pvr */
811 .pvr_mask = 0x7fff0000,
812 .pvr_value = 0x00820000,
814 .cpu_features = CPU_FTRS_G2_LE,
815 .cpu_user_features = COMMON_USER,
818 .cpu_setup = __setup_cpu_603,
819 .platform = "ppc603",
821 { /* e300c1 (a 603e core, plus some) on 83xx */
822 .pvr_mask = 0x7fff0000,
823 .pvr_value = 0x00830000,
824 .cpu_name = "e300c1",
825 .cpu_features = CPU_FTRS_E300,
826 .cpu_user_features = COMMON_USER,
829 .cpu_setup = __setup_cpu_603,
830 .platform = "ppc603",
832 { /* e300c2 (an e300c1 core, plus some, minus FPU) on 83xx */
833 .pvr_mask = 0x7fff0000,
834 .pvr_value = 0x00840000,
835 .cpu_name = "e300c2",
836 .cpu_features = CPU_FTRS_E300C2,
837 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
840 .cpu_setup = __setup_cpu_603,
841 .platform = "ppc603",
843 { /* e300c3 on 83xx */
844 .pvr_mask = 0x7fff0000,
845 .pvr_value = 0x00850000,
846 .cpu_name = "e300c3",
847 .cpu_features = CPU_FTRS_E300,
848 .cpu_user_features = COMMON_USER,
851 .cpu_setup = __setup_cpu_603,
852 .platform = "ppc603",
854 { /* default match, we assume split I/D cache & TB (non-601)... */
855 .pvr_mask = 0x00000000,
856 .pvr_value = 0x00000000,
857 .cpu_name = "(generic PPC)",
858 .cpu_features = CPU_FTRS_CLASSIC32,
859 .cpu_user_features = COMMON_USER,
862 .platform = "ppc603",
864 #endif /* CLASSIC_PPC */
867 .pvr_mask = 0xffff0000,
868 .pvr_value = 0x00500000,
870 /* CPU_FTR_MAYBE_CAN_DOZE is possible,
871 * if the 8xx code is there.... */
872 .cpu_features = CPU_FTRS_8XX,
873 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
876 .platform = "ppc823",
878 #endif /* CONFIG_8xx */
881 .pvr_mask = 0xffffff00,
882 .pvr_value = 0x00200200,
884 .cpu_features = CPU_FTRS_40X,
885 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
888 .platform = "ppc403",
891 .pvr_mask = 0xffffff00,
892 .pvr_value = 0x00201400,
893 .cpu_name = "403GCX",
894 .cpu_features = CPU_FTRS_40X,
895 .cpu_user_features = PPC_FEATURE_32 |
896 PPC_FEATURE_HAS_MMU | PPC_FEATURE_NO_TB,
899 .platform = "ppc403",
902 .pvr_mask = 0xffff0000,
903 .pvr_value = 0x00200000,
904 .cpu_name = "403G ??",
905 .cpu_features = CPU_FTRS_40X,
906 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
909 .platform = "ppc403",
912 .pvr_mask = 0xffff0000,
913 .pvr_value = 0x40110000,
915 .cpu_features = CPU_FTRS_40X,
916 .cpu_user_features = PPC_FEATURE_32 |
917 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
920 .platform = "ppc405",
923 .pvr_mask = 0xffff0000,
924 .pvr_value = 0x40130000,
925 .cpu_name = "STB03xxx",
926 .cpu_features = CPU_FTRS_40X,
927 .cpu_user_features = PPC_FEATURE_32 |
928 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
931 .platform = "ppc405",
934 .pvr_mask = 0xffff0000,
935 .pvr_value = 0x41810000,
936 .cpu_name = "STB04xxx",
937 .cpu_features = CPU_FTRS_40X,
938 .cpu_user_features = PPC_FEATURE_32 |
939 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
942 .platform = "ppc405",
945 .pvr_mask = 0xffff0000,
946 .pvr_value = 0x41610000,
947 .cpu_name = "NP405L",
948 .cpu_features = CPU_FTRS_40X,
949 .cpu_user_features = PPC_FEATURE_32 |
950 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
953 .platform = "ppc405",
956 .pvr_mask = 0xffff0000,
957 .pvr_value = 0x40B10000,
958 .cpu_name = "NP4GS3",
959 .cpu_features = CPU_FTRS_40X,
960 .cpu_user_features = PPC_FEATURE_32 |
961 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
964 .platform = "ppc405",
967 .pvr_mask = 0xffff0000,
968 .pvr_value = 0x41410000,
969 .cpu_name = "NP405H",
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 = 0x50910000,
980 .cpu_name = "405GPr",
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 = 0x51510000,
991 .cpu_name = "STBx25xx",
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 = 0x41F10000,
1002 .cpu_name = "405LP",
1003 .cpu_features = CPU_FTRS_40X,
1004 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
1007 .platform = "ppc405",
1009 { /* Xilinx Virtex-II Pro */
1010 .pvr_mask = 0xfffff000,
1011 .pvr_value = 0x20010000,
1012 .cpu_name = "Virtex-II Pro",
1013 .cpu_features = CPU_FTRS_40X,
1014 .cpu_user_features = PPC_FEATURE_32 |
1015 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1018 .platform = "ppc405",
1020 { /* Xilinx Virtex-4 FX */
1021 .pvr_mask = 0xfffff000,
1022 .pvr_value = 0x20011000,
1023 .cpu_name = "Virtex-4 FX",
1024 .cpu_features = CPU_FTRS_40X,
1025 .cpu_user_features = PPC_FEATURE_32 |
1026 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1029 .platform = "ppc405",
1032 .pvr_mask = 0xffff0000,
1033 .pvr_value = 0x51210000,
1034 .cpu_name = "405EP",
1035 .cpu_features = CPU_FTRS_40X,
1036 .cpu_user_features = PPC_FEATURE_32 |
1037 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1040 .platform = "ppc405",
1043 #endif /* CONFIG_40x */
1046 .pvr_mask = 0xf0000fff,
1047 .pvr_value = 0x40000850,
1048 .cpu_name = "440EP Rev. A",
1049 .cpu_features = CPU_FTRS_44X,
1050 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
1053 .platform = "ppc440",
1056 .pvr_mask = 0xf0000fff,
1057 .pvr_value = 0x400008d3,
1058 .cpu_name = "440EP Rev. B",
1059 .cpu_features = CPU_FTRS_44X,
1060 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
1063 .platform = "ppc440",
1065 { /* 440GP Rev. B */
1066 .pvr_mask = 0xf0000fff,
1067 .pvr_value = 0x40000440,
1068 .cpu_name = "440GP Rev. B",
1069 .cpu_features = CPU_FTRS_44X,
1070 .cpu_user_features = COMMON_USER_BOOKE,
1073 .platform = "ppc440gp",
1075 { /* 440GP Rev. C */
1076 .pvr_mask = 0xf0000fff,
1077 .pvr_value = 0x40000481,
1078 .cpu_name = "440GP Rev. C",
1079 .cpu_features = CPU_FTRS_44X,
1080 .cpu_user_features = COMMON_USER_BOOKE,
1083 .platform = "ppc440gp",
1085 { /* 440GX Rev. A */
1086 .pvr_mask = 0xf0000fff,
1087 .pvr_value = 0x50000850,
1088 .cpu_name = "440GX Rev. A",
1089 .cpu_features = CPU_FTRS_44X,
1090 .cpu_user_features = COMMON_USER_BOOKE,
1093 .platform = "ppc440",
1095 { /* 440GX Rev. B */
1096 .pvr_mask = 0xf0000fff,
1097 .pvr_value = 0x50000851,
1098 .cpu_name = "440GX Rev. B",
1099 .cpu_features = CPU_FTRS_44X,
1100 .cpu_user_features = COMMON_USER_BOOKE,
1103 .platform = "ppc440",
1105 { /* 440GX Rev. C */
1106 .pvr_mask = 0xf0000fff,
1107 .pvr_value = 0x50000892,
1108 .cpu_name = "440GX Rev. C",
1109 .cpu_features = CPU_FTRS_44X,
1110 .cpu_user_features = COMMON_USER_BOOKE,
1113 .platform = "ppc440",
1115 { /* 440GX Rev. F */
1116 .pvr_mask = 0xf0000fff,
1117 .pvr_value = 0x50000894,
1118 .cpu_name = "440GX Rev. F",
1119 .cpu_features = CPU_FTRS_44X,
1120 .cpu_user_features = COMMON_USER_BOOKE,
1123 .platform = "ppc440",
1125 { /* 440SP Rev. A */
1126 .pvr_mask = 0xff000fff,
1127 .pvr_value = 0x53000891,
1128 .cpu_name = "440SP Rev. A",
1129 .cpu_features = CPU_FTRS_44X,
1130 .cpu_user_features = COMMON_USER_BOOKE,
1133 .platform = "ppc440",
1135 { /* 440SPe Rev. A */
1136 .pvr_mask = 0xff000fff,
1137 .pvr_value = 0x53000890,
1138 .cpu_name = "440SPe Rev. A",
1139 .cpu_features = CPU_FTRS_44X,
1140 .cpu_user_features = COMMON_USER_BOOKE,
1143 .platform = "ppc440",
1145 #endif /* CONFIG_44x */
1146 #ifdef CONFIG_FSL_BOOKE
1148 .pvr_mask = 0xfff00000,
1149 .pvr_value = 0x81000000,
1150 .cpu_name = "e200z5",
1151 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
1152 .cpu_features = CPU_FTRS_E200,
1153 .cpu_user_features = COMMON_USER_BOOKE |
1154 PPC_FEATURE_HAS_EFP_SINGLE |
1155 PPC_FEATURE_UNIFIED_CACHE,
1157 .platform = "ppc5554",
1160 .pvr_mask = 0xfff00000,
1161 .pvr_value = 0x81100000,
1162 .cpu_name = "e200z6",
1163 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
1164 .cpu_features = CPU_FTRS_E200,
1165 .cpu_user_features = COMMON_USER_BOOKE |
1166 PPC_FEATURE_SPE_COMP |
1167 PPC_FEATURE_HAS_EFP_SINGLE |
1168 PPC_FEATURE_UNIFIED_CACHE,
1170 .platform = "ppc5554",
1173 .pvr_mask = 0xffff0000,
1174 .pvr_value = 0x80200000,
1176 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
1177 .cpu_features = CPU_FTRS_E500,
1178 .cpu_user_features = COMMON_USER_BOOKE |
1179 PPC_FEATURE_SPE_COMP |
1180 PPC_FEATURE_HAS_EFP_SINGLE,
1184 .oprofile_cpu_type = "ppc/e500",
1185 .oprofile_type = PPC_OPROFILE_BOOKE,
1186 .platform = "ppc8540",
1189 .pvr_mask = 0xffff0000,
1190 .pvr_value = 0x80210000,
1191 .cpu_name = "e500v2",
1192 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
1193 .cpu_features = CPU_FTRS_E500_2,
1194 .cpu_user_features = COMMON_USER_BOOKE |
1195 PPC_FEATURE_SPE_COMP |
1196 PPC_FEATURE_HAS_EFP_SINGLE |
1197 PPC_FEATURE_HAS_EFP_DOUBLE,
1201 .oprofile_cpu_type = "ppc/e500",
1202 .oprofile_type = PPC_OPROFILE_BOOKE,
1203 .platform = "ppc8548",
1207 { /* default match */
1208 .pvr_mask = 0x00000000,
1209 .pvr_value = 0x00000000,
1210 .cpu_name = "(generic PPC)",
1211 .cpu_features = CPU_FTRS_GENERIC_32,
1212 .cpu_user_features = PPC_FEATURE_32,
1215 .platform = "powerpc",
1217 #endif /* !CLASSIC_PPC */
1218 #endif /* CONFIG_PPC32 */
1221 struct cpu_spec *identify_cpu(unsigned long offset, unsigned int pvr)
1223 struct cpu_spec *s = cpu_specs;
1224 struct cpu_spec **cur = &cur_cpu_spec;
1228 cur = PTRRELOC(cur);
1230 for (i = 0; i < ARRAY_SIZE(cpu_specs); i++,s++)
1231 if ((pvr & s->pvr_mask) == s->pvr_value) {
1232 *cur = cpu_specs + i;
1234 /* ppc64 expects identify_cpu to also call setup_cpu
1235 * for that processor. I will consolidate that at a
1236 * later time, for now, just use our friend #ifdef.
1237 * we also don't need to PTRRELOC the function pointer
1238 * on ppc64 as we are running at 0 in real mode.
1241 s->cpu_setup(offset, s);
1243 #endif /* CONFIG_PPC64 */
1250 void do_feature_fixups(unsigned long value, void *fixup_start, void *fixup_end)
1252 struct fixup_entry {
1254 unsigned long value;
1262 for (; fcur < fend; fcur++) {
1263 unsigned int *pstart, *pend, *p;
1265 if ((value & fcur->mask) == fcur->value)
1268 /* These PTRRELOCs will disappear once the new scheme for
1269 * modules and vdso is implemented
1271 pstart = ((unsigned int *)fcur) + (fcur->start_off / 4);
1272 pend = ((unsigned int *)fcur) + (fcur->end_off / 4);
1274 for (p = pstart; p < pend; p++) {
1276 asm volatile ("dcbst 0, %0" : : "r" (p));
1278 asm volatile ("sync" : : : "memory");
1279 for (p = pstart; p < pend; p++)
1280 asm volatile ("icbi 0,%0" : : "r" (p));
1281 asm volatile ("sync; isync" : : : "memory");