Lines Matching full:c

5  * Copyright (C) xxxx  the Anonymous
6 * Copyright (C) 1994 - 2006 Ralf Baechle
7 * Copyright (C) 2003, 2004 Maciej W. Rozycki
8 * Copyright (C) 2001, 2004, 2011, 2012 MIPS Technologies, Inc.
86 static int set_ftlb_enable(struct cpuinfo_mips *c, enum ftlb_flags flags);
143 static inline void cpu_set_mt_per_tc_perf(struct cpuinfo_mips *c) in cpu_set_mt_per_tc_perf() argument
146 c->options |= MIPS_CPU_MT_PER_TC_PERF_COUNTERS; in cpu_set_mt_per_tc_perf()
151 struct cpuinfo_mips *c = &current_cpu_data; in check_errata() local
160 if ((c->processor_id & PRID_REV_MASK) <= PRID_REV_34K_V1_0_2) in check_errata()
208 static inline void cpu_probe_vmbits(struct cpuinfo_mips *c) in cpu_probe_vmbits() argument
213 c->vmbits = fls64(read_c0_entryhi() & 0x3fffffffffffe000ULL); in cpu_probe_vmbits()
217 static void set_isa(struct cpuinfo_mips *c, unsigned int isa) in set_isa() argument
221 c->isa_level |= MIPS_CPU_ISA_M32R5 | MIPS_CPU_ISA_M64R5; in set_isa()
225 c->isa_level |= MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M64R2; in set_isa()
229 c->isa_level |= MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M64R1; in set_isa()
233 c->isa_level |= MIPS_CPU_ISA_V; in set_isa()
237 c->isa_level |= MIPS_CPU_ISA_IV; in set_isa()
241 c->isa_level |= MIPS_CPU_ISA_II | MIPS_CPU_ISA_III; in set_isa()
247 c->isa_level |= MIPS_CPU_ISA_M32R6 | MIPS_CPU_ISA_M64R6; in set_isa()
251 c->isa_level |= MIPS_CPU_ISA_M32R6; in set_isa()
256 c->isa_level |= MIPS_CPU_ISA_M32R5; in set_isa()
260 c->isa_level |= MIPS_CPU_ISA_M32R2; in set_isa()
264 c->isa_level |= MIPS_CPU_ISA_M32R1; in set_isa()
268 c->isa_level |= MIPS_CPU_ISA_II; in set_isa()
277 static unsigned int calculate_ftlb_probability(struct cpuinfo_mips *c) in calculate_ftlb_probability() argument
280 unsigned int probability = c->tlbsize / c->tlbsizevtlb; in calculate_ftlb_probability()
303 static int set_ftlb_enable(struct cpuinfo_mips *c, enum ftlb_flags flags) in set_ftlb_enable() argument
308 switch (c->cputype) { in set_ftlb_enable()
322 config |= calculate_ftlb_probability(c) in set_ftlb_enable()
355 static int mm_config(struct cpuinfo_mips *c) in mm_config() argument
369 switch (c->cputype) { in mm_config()
375 c->options |= MIPS_CPU_MM_FULL; in mm_config()
393 c->options |= MIPS_CPU_MM_SYSAD; in mm_config()
395 c->options |= MIPS_CPU_MM_FULL; in mm_config()
401 static inline unsigned int decode_config0(struct cpuinfo_mips *c) in decode_config0() argument
413 c->options |= MIPS_CPU_TLB; in decode_config0()
415 c->options |= MIPS_CPU_TLB | MIPS_CPU_FTLB; in decode_config0()
422 set_isa(c, MIPS_CPU_ISA_M32R1); in decode_config0()
425 set_isa(c, MIPS_CPU_ISA_M32R2); in decode_config0()
428 set_isa(c, MIPS_CPU_ISA_M32R6); in decode_config0()
437 set_isa(c, MIPS_CPU_ISA_M64R1); in decode_config0()
440 set_isa(c, MIPS_CPU_ISA_M64R2); in decode_config0()
443 set_isa(c, MIPS_CPU_ISA_M64R6); in decode_config0()
459 static inline unsigned int decode_config1(struct cpuinfo_mips *c) in decode_config1() argument
466 c->ases |= MIPS_ASE_MDMX; in decode_config1()
468 c->options |= MIPS_CPU_PERF; in decode_config1()
470 c->options |= MIPS_CPU_WATCH; in decode_config1()
472 c->ases |= MIPS_ASE_MIPS16; in decode_config1()
474 c->options |= MIPS_CPU_EJTAG; in decode_config1()
476 c->options |= MIPS_CPU_FPU; in decode_config1()
477 c->options |= MIPS_CPU_32FPR; in decode_config1()
480 c->tlbsize = ((config1 & MIPS_CONF1_TLBS) >> 25) + 1; in decode_config1()
481 c->tlbsizevtlb = c->tlbsize; in decode_config1()
482 c->tlbsizeftlbsets = 0; in decode_config1()
488 static inline unsigned int decode_config2(struct cpuinfo_mips *c) in decode_config2() argument
495 c->scache.flags &= ~MIPS_CACHE_NOT_PRESENT; in decode_config2()
500 static inline unsigned int decode_config3(struct cpuinfo_mips *c) in decode_config3() argument
507 c->ases |= MIPS_ASE_SMARTMIPS; in decode_config3()
508 c->options |= MIPS_CPU_RIXI | MIPS_CPU_CTXTC; in decode_config3()
511 c->options |= MIPS_CPU_RIXI; in decode_config3()
513 c->options |= MIPS_CPU_CTXTC; in decode_config3()
515 c->ases |= MIPS_ASE_DSP; in decode_config3()
517 c->ases |= MIPS_ASE_DSP2P; in decode_config3()
519 c->ases |= MIPS_ASE_DSP3; in decode_config3()
522 c->options |= MIPS_CPU_VINT; in decode_config3()
524 c->options |= MIPS_CPU_VEIC; in decode_config3()
526 c->options |= MIPS_CPU_LPA; in decode_config3()
528 c->ases |= MIPS_ASE_MIPSMT; in decode_config3()
530 c->options |= MIPS_CPU_ULRI; in decode_config3()
532 c->options |= MIPS_CPU_MICROMIPS; in decode_config3()
534 c->ases |= MIPS_ASE_VZ; in decode_config3()
536 c->options |= MIPS_CPU_SEGMENTS; in decode_config3()
538 c->options |= MIPS_CPU_BADINSTR; in decode_config3()
540 c->options |= MIPS_CPU_BADINSTRP; in decode_config3()
542 c->ases |= MIPS_ASE_MSA; in decode_config3()
544 c->htw_seq = 0; in decode_config3()
545 c->options |= MIPS_CPU_HTW; in decode_config3()
548 c->options |= MIPS_CPU_CDMM; in decode_config3()
550 c->options |= MIPS_CPU_SP; in decode_config3()
555 static inline unsigned int decode_config4(struct cpuinfo_mips *c) in decode_config4() argument
567 c->options |= MIPS_CPU_TLBINV; in decode_config4()
583 c->tlbsize += (config4 & MIPS_CONF4_MMUSIZEEXT) * 0x40; in decode_config4()
584 c->tlbsizevtlb = c->tlbsize; in decode_config4()
587 c->tlbsizevtlb += in decode_config4()
590 c->tlbsize = c->tlbsizevtlb; in decode_config4()
606 set_ftlb_enable(c, 0); in decode_config4()
610 c->tlbsizeftlbsets = 1 << in decode_config4()
613 c->tlbsizeftlbways = ((config4 & MIPS_CONF4_FTLBWAYS) >> in decode_config4()
615 c->tlbsize += c->tlbsizeftlbways * c->tlbsizeftlbsets; in decode_config4()
621 c->kscratch_mask = (config4 & MIPS_CONF4_KSCREXIST) in decode_config4()
627 set_cpu_asid_mask(c, asid_mask); in decode_config4()
634 WARN_ON(asid_mask != cpu_asid_mask(c)); in decode_config4()
639 static inline unsigned int decode_config5(struct cpuinfo_mips *c) in decode_config5() argument
657 c->options |= MIPS_CPU_EVA; in decode_config5()
659 c->options |= MIPS_CPU_MAAR; in decode_config5()
661 c->options |= MIPS_CPU_RW_LLB; in decode_config5()
663 c->options |= MIPS_CPU_MVH; in decode_config5()
665 c->options |= MIPS_CPU_VP; in decode_config5()
667 c->ases |= MIPS_ASE_MIPS16E2; in decode_config5()
679 c->options |= MIPS_CPU_MMID; in decode_config5()
712 set_cpu_asid_mask(c, asid_mask); in decode_config5()
719 static void decode_configs(struct cpuinfo_mips *c) in decode_configs() argument
724 c->options = MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE | MIPS_CPU_COUNTER | in decode_configs()
727 c->scache.flags = MIPS_CACHE_NOT_PRESENT; in decode_configs()
730 set_ftlb_enable(c, mips_ftlb_disabled ? 0 : FTLB_EN); in decode_configs()
732 ok = decode_config0(c); /* Read Config registers. */ in decode_configs()
735 ok = decode_config1(c); in decode_configs()
737 ok = decode_config2(c); in decode_configs()
739 ok = decode_config3(c); in decode_configs()
741 ok = decode_config4(c); in decode_configs()
743 ok = decode_config5(c); in decode_configs()
755 c->options |= MIPS_CPU_EBASE_WG; in decode_configs()
774 c->options |= MIPS_CPU_EBASE_WG; in decode_configs()
781 set_ftlb_enable(c, (mips_ftlb_disabled ? 0 : FTLB_EN) | FTLB_SET_PROB); in decode_configs()
783 mips_probe_watch_registers(c); in decode_configs()
792 cpu_set_core(c, core); in decode_configs()
825 static inline unsigned int decode_guest_config0(struct cpuinfo_mips *c) in decode_guest_config0() argument
832 c->guest.conf |= BIT(1); in decode_guest_config0()
836 static inline unsigned int decode_guest_config1(struct cpuinfo_mips *c) in decode_guest_config1() argument
845 c->guest.options |= MIPS_CPU_FPU; in decode_guest_config1()
847 c->guest.options_dyn |= MIPS_CPU_FPU; in decode_guest_config1()
850 c->guest.options |= MIPS_CPU_WATCH; in decode_guest_config1()
852 c->guest.options_dyn |= MIPS_CPU_WATCH; in decode_guest_config1()
855 c->guest.options |= MIPS_CPU_PERF; in decode_guest_config1()
857 c->guest.options_dyn |= MIPS_CPU_PERF; in decode_guest_config1()
860 c->guest.conf |= BIT(2); in decode_guest_config1()
864 static inline unsigned int decode_guest_config2(struct cpuinfo_mips *c) in decode_guest_config2() argument
871 c->guest.conf |= BIT(3); in decode_guest_config2()
875 static inline unsigned int decode_guest_config3(struct cpuinfo_mips *c) in decode_guest_config3() argument
884 c->guest.options |= MIPS_CPU_CTXTC; in decode_guest_config3()
886 c->guest.options_dyn |= MIPS_CPU_CTXTC; in decode_guest_config3()
889 c->guest.options |= MIPS_CPU_HTW; in decode_guest_config3()
892 c->guest.options |= MIPS_CPU_ULRI; in decode_guest_config3()
895 c->guest.options |= MIPS_CPU_SEGMENTS; in decode_guest_config3()
898 c->guest.options |= MIPS_CPU_BADINSTR; in decode_guest_config3()
900 c->guest.options |= MIPS_CPU_BADINSTRP; in decode_guest_config3()
903 c->guest.ases |= MIPS_ASE_MSA; in decode_guest_config3()
905 c->guest.ases_dyn |= MIPS_ASE_MSA; in decode_guest_config3()
908 c->guest.conf |= BIT(4); in decode_guest_config3()
912 static inline unsigned int decode_guest_config4(struct cpuinfo_mips *c) in decode_guest_config4() argument
919 c->guest.kscratch_mask = (config4 & MIPS_CONF4_KSCREXIST) in decode_guest_config4()
923 c->guest.conf |= BIT(5); in decode_guest_config4()
927 static inline unsigned int decode_guest_config5(struct cpuinfo_mips *c) in decode_guest_config5() argument
935 c->guest.options |= MIPS_CPU_MAAR; in decode_guest_config5()
937 c->guest.options_dyn |= MIPS_CPU_MAAR; in decode_guest_config5()
940 c->guest.options |= MIPS_CPU_RW_LLB; in decode_guest_config5()
943 c->guest.options |= MIPS_CPU_MVH; in decode_guest_config5()
946 c->guest.conf |= BIT(6); in decode_guest_config5()
950 static inline void decode_guest_configs(struct cpuinfo_mips *c) in decode_guest_configs() argument
954 ok = decode_guest_config0(c); in decode_guest_configs()
956 ok = decode_guest_config1(c); in decode_guest_configs()
958 ok = decode_guest_config2(c); in decode_guest_configs()
960 ok = decode_guest_config3(c); in decode_guest_configs()
962 ok = decode_guest_config4(c); in decode_guest_configs()
964 decode_guest_config5(c); in decode_guest_configs()
967 static inline void cpu_probe_guestctl0(struct cpuinfo_mips *c) in cpu_probe_guestctl0() argument
974 c->options |= MIPS_CPU_GUESTCTL0EXT; in cpu_probe_guestctl0()
976 c->options |= MIPS_CPU_GUESTCTL1; in cpu_probe_guestctl0()
978 c->options |= MIPS_CPU_GUESTCTL2; in cpu_probe_guestctl0()
980 c->options |= MIPS_CPU_GUESTID; in cpu_probe_guestctl0()
996 c->options |= MIPS_CPU_DRG; in cpu_probe_guestctl0()
1001 static inline void cpu_probe_guestctl1(struct cpuinfo_mips *c) in cpu_probe_guestctl1() argument
1007 c->guestid_mask = (read_c0_guestctl1() & MIPS_GCTL1_ID) in cpu_probe_guestctl1()
1013 static inline void cpu_probe_gtoffset(struct cpuinfo_mips *c) in cpu_probe_gtoffset() argument
1018 c->gtoffset_mask = read_c0_gtoffset(); in cpu_probe_gtoffset()
1022 static inline void cpu_probe_vz(struct cpuinfo_mips *c) in cpu_probe_vz() argument
1024 cpu_probe_guestctl0(c); in cpu_probe_vz()
1026 cpu_probe_guestctl1(c); in cpu_probe_vz()
1028 cpu_probe_gtoffset(c); in cpu_probe_vz()
1030 decode_guest_configs(c); in cpu_probe_vz()
1036 static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu) in cpu_probe_legacy() argument
1038 switch (c->processor_id & PRID_IMP_MASK) { in cpu_probe_legacy()
1040 c->cputype = CPU_R2000; in cpu_probe_legacy()
1042 c->fpu_msk31 |= FPU_CSR_CONDX | FPU_CSR_FS; in cpu_probe_legacy()
1043 c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE | in cpu_probe_legacy()
1046 c->options |= MIPS_CPU_FPU; in cpu_probe_legacy()
1047 c->tlbsize = 64; in cpu_probe_legacy()
1050 if ((c->processor_id & PRID_REV_MASK) == PRID_REV_R3000A) { in cpu_probe_legacy()
1052 c->cputype = CPU_R3081E; in cpu_probe_legacy()
1055 c->cputype = CPU_R3000A; in cpu_probe_legacy()
1059 c->cputype = CPU_R3000; in cpu_probe_legacy()
1062 c->fpu_msk31 |= FPU_CSR_CONDX | FPU_CSR_FS; in cpu_probe_legacy()
1063 c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE | in cpu_probe_legacy()
1066 c->options |= MIPS_CPU_FPU; in cpu_probe_legacy()
1067 c->tlbsize = 64; in cpu_probe_legacy()
1071 if ((c->processor_id & PRID_REV_MASK) >= in cpu_probe_legacy()
1073 c->cputype = CPU_R4400PC; in cpu_probe_legacy()
1076 c->cputype = CPU_R4000PC; in cpu_probe_legacy()
1100 if ((c->processor_id & PRID_REV_MASK) >= in cpu_probe_legacy()
1102 c->cputype = mc ? CPU_R4400MC : CPU_R4400SC; in cpu_probe_legacy()
1105 c->cputype = mc ? CPU_R4000MC : CPU_R4000SC; in cpu_probe_legacy()
1110 set_isa(c, MIPS_CPU_ISA_III); in cpu_probe_legacy()
1111 c->fpu_msk31 |= FPU_CSR_CONDX; in cpu_probe_legacy()
1112 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | in cpu_probe_legacy()
1115 c->tlbsize = 48; in cpu_probe_legacy()
1118 set_isa(c, MIPS_CPU_ISA_III); in cpu_probe_legacy()
1119 c->fpu_msk31 |= FPU_CSR_CONDX; in cpu_probe_legacy()
1120 c->options = R4K_OPTS; in cpu_probe_legacy()
1121 c->tlbsize = 32; in cpu_probe_legacy()
1122 switch (c->processor_id & 0xf0) { in cpu_probe_legacy()
1124 c->cputype = CPU_VR4111; in cpu_probe_legacy()
1128 c->cputype = CPU_VR4121; in cpu_probe_legacy()
1132 if ((c->processor_id & 0xf) < 0x3) { in cpu_probe_legacy()
1133 c->cputype = CPU_VR4122; in cpu_probe_legacy()
1136 c->cputype = CPU_VR4181A; in cpu_probe_legacy()
1141 if ((c->processor_id & 0xf) < 0x4) { in cpu_probe_legacy()
1142 c->cputype = CPU_VR4131; in cpu_probe_legacy()
1145 c->cputype = CPU_VR4133; in cpu_probe_legacy()
1146 c->options |= MIPS_CPU_LLSC; in cpu_probe_legacy()
1152 c->cputype = CPU_VR41XX; in cpu_probe_legacy()
1158 c->cputype = CPU_R4600; in cpu_probe_legacy()
1160 set_isa(c, MIPS_CPU_ISA_III); in cpu_probe_legacy()
1161 c->fpu_msk31 |= FPU_CSR_CONDX; in cpu_probe_legacy()
1162 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | in cpu_probe_legacy()
1164 c->tlbsize = 48; in cpu_probe_legacy()
1174 c->cputype = CPU_R4650; in cpu_probe_legacy()
1176 set_isa(c, MIPS_CPU_ISA_III); in cpu_probe_legacy()
1177 c->fpu_msk31 |= FPU_CSR_CONDX; in cpu_probe_legacy()
1178 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_LLSC; in cpu_probe_legacy()
1179 c->tlbsize = 48; in cpu_probe_legacy()
1183 c->fpu_msk31 |= FPU_CSR_CONDX | FPU_CSR_FS; in cpu_probe_legacy()
1184 c->options = MIPS_CPU_TLB | MIPS_CPU_TX39_CACHE; in cpu_probe_legacy()
1186 if ((c->processor_id & 0xf0) == (PRID_REV_TX3927 & 0xf0)) { in cpu_probe_legacy()
1187 c->cputype = CPU_TX3927; in cpu_probe_legacy()
1189 c->tlbsize = 64; in cpu_probe_legacy()
1191 switch (c->processor_id & PRID_REV_MASK) { in cpu_probe_legacy()
1193 c->cputype = CPU_TX3912; in cpu_probe_legacy()
1195 c->tlbsize = 32; in cpu_probe_legacy()
1198 c->cputype = CPU_TX3922; in cpu_probe_legacy()
1200 c->tlbsize = 64; in cpu_probe_legacy()
1206 c->cputype = CPU_R4700; in cpu_probe_legacy()
1208 set_isa(c, MIPS_CPU_ISA_III); in cpu_probe_legacy()
1209 c->fpu_msk31 |= FPU_CSR_CONDX; in cpu_probe_legacy()
1210 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | in cpu_probe_legacy()
1212 c->tlbsize = 48; in cpu_probe_legacy()
1215 c->cputype = CPU_TX49XX; in cpu_probe_legacy()
1217 set_isa(c, MIPS_CPU_ISA_III); in cpu_probe_legacy()
1218 c->fpu_msk31 |= FPU_CSR_CONDX; in cpu_probe_legacy()
1219 c->options = R4K_OPTS | MIPS_CPU_LLSC; in cpu_probe_legacy()
1220 if (!(c->processor_id & 0x08)) in cpu_probe_legacy()
1221 c->options |= MIPS_CPU_FPU | MIPS_CPU_32FPR; in cpu_probe_legacy()
1222 c->tlbsize = 48; in cpu_probe_legacy()
1225 c->cputype = CPU_R5000; in cpu_probe_legacy()
1227 set_isa(c, MIPS_CPU_ISA_IV); in cpu_probe_legacy()
1228 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | in cpu_probe_legacy()
1230 c->tlbsize = 48; in cpu_probe_legacy()
1233 c->cputype = CPU_R5500; in cpu_probe_legacy()
1235 set_isa(c, MIPS_CPU_ISA_IV); in cpu_probe_legacy()
1236 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | in cpu_probe_legacy()
1238 c->tlbsize = 48; in cpu_probe_legacy()
1241 c->cputype = CPU_NEVADA; in cpu_probe_legacy()
1243 set_isa(c, MIPS_CPU_ISA_IV); in cpu_probe_legacy()
1244 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | in cpu_probe_legacy()
1246 c->tlbsize = 48; in cpu_probe_legacy()
1249 c->cputype = CPU_RM7000; in cpu_probe_legacy()
1251 set_isa(c, MIPS_CPU_ISA_IV); in cpu_probe_legacy()
1252 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | in cpu_probe_legacy()
1262 c->tlbsize = (read_c0_info() & (1 << 29)) ? 64 : 48; in cpu_probe_legacy()
1265 c->cputype = CPU_R10000; in cpu_probe_legacy()
1267 set_isa(c, MIPS_CPU_ISA_IV); in cpu_probe_legacy()
1268 c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX | in cpu_probe_legacy()
1272 c->tlbsize = 64; in cpu_probe_legacy()
1275 c->cputype = CPU_R12000; in cpu_probe_legacy()
1277 set_isa(c, MIPS_CPU_ISA_IV); in cpu_probe_legacy()
1278 c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX | in cpu_probe_legacy()
1282 c->tlbsize = 64; in cpu_probe_legacy()
1286 if (((c->processor_id >> 4) & 0x0f) > 2) { in cpu_probe_legacy()
1287 c->cputype = CPU_R16000; in cpu_probe_legacy()
1290 c->cputype = CPU_R14000; in cpu_probe_legacy()
1293 set_isa(c, MIPS_CPU_ISA_IV); in cpu_probe_legacy()
1294 c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX | in cpu_probe_legacy()
1298 c->tlbsize = 64; in cpu_probe_legacy()
1302 switch (c->processor_id & PRID_REV_MASK) { in cpu_probe_legacy()
1304 c->cputype = CPU_LOONGSON2EF; in cpu_probe_legacy()
1307 set_isa(c, MIPS_CPU_ISA_III); in cpu_probe_legacy()
1308 c->fpu_msk31 |= FPU_CSR_CONDX; in cpu_probe_legacy()
1311 c->cputype = CPU_LOONGSON2EF; in cpu_probe_legacy()
1314 set_isa(c, MIPS_CPU_ISA_III); in cpu_probe_legacy()
1315 c->fpu_msk31 |= FPU_CSR_CONDX; in cpu_probe_legacy()
1318 c->cputype = CPU_LOONGSON64; in cpu_probe_legacy()
1321 set_isa(c, MIPS_CPU_ISA_M64R1); in cpu_probe_legacy()
1322 c->ases |= (MIPS_ASE_LOONGSON_MMI | MIPS_ASE_LOONGSON_CAM | in cpu_probe_legacy()
1327 c->cputype = CPU_LOONGSON64; in cpu_probe_legacy()
1330 set_isa(c, MIPS_CPU_ISA_M64R1); in cpu_probe_legacy()
1331 c->ases |= (MIPS_ASE_LOONGSON_MMI | MIPS_ASE_LOONGSON_CAM | in cpu_probe_legacy()
1336 c->options = R4K_OPTS | in cpu_probe_legacy()
1339 c->tlbsize = 64; in cpu_probe_legacy()
1340 set_cpu_asid_mask(c, MIPS_ENTRYHI_ASID); in cpu_probe_legacy()
1341 c->writecombine = _CACHE_UNCACHED_ACCELERATED; in cpu_probe_legacy()
1344 decode_configs(c); in cpu_probe_legacy()
1346 c->cputype = CPU_LOONGSON32; in cpu_probe_legacy()
1348 switch (c->processor_id & PRID_REV_MASK) { in cpu_probe_legacy()
1358 static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu) in cpu_probe_mips() argument
1360 c->writecombine = _CACHE_UNCACHED_ACCELERATED; in cpu_probe_mips()
1361 switch (c->processor_id & PRID_IMP_MASK) { in cpu_probe_mips()
1363 c->writecombine = _CACHE_UNCACHED; in cpu_probe_mips()
1364 c->cputype = CPU_QEMU_GENERIC; in cpu_probe_mips()
1368 c->cputype = CPU_4KC; in cpu_probe_mips()
1369 c->writecombine = _CACHE_UNCACHED; in cpu_probe_mips()
1374 c->cputype = CPU_4KEC; in cpu_probe_mips()
1375 c->writecombine = _CACHE_UNCACHED; in cpu_probe_mips()
1380 c->cputype = CPU_4KSC; in cpu_probe_mips()
1381 c->writecombine = _CACHE_UNCACHED; in cpu_probe_mips()
1385 c->cputype = CPU_5KC; in cpu_probe_mips()
1386 c->writecombine = _CACHE_UNCACHED; in cpu_probe_mips()
1390 c->cputype = CPU_5KE; in cpu_probe_mips()
1391 c->writecombine = _CACHE_UNCACHED; in cpu_probe_mips()
1395 c->cputype = CPU_20KC; in cpu_probe_mips()
1396 c->writecombine = _CACHE_UNCACHED; in cpu_probe_mips()
1400 c->cputype = CPU_24K; in cpu_probe_mips()
1401 c->writecombine = _CACHE_UNCACHED; in cpu_probe_mips()
1405 c->cputype = CPU_24K; in cpu_probe_mips()
1406 c->writecombine = _CACHE_UNCACHED; in cpu_probe_mips()
1410 c->cputype = CPU_25KF; in cpu_probe_mips()
1411 c->writecombine = _CACHE_UNCACHED; in cpu_probe_mips()
1415 c->cputype = CPU_34K; in cpu_probe_mips()
1416 c->writecombine = _CACHE_UNCACHED; in cpu_probe_mips()
1418 cpu_set_mt_per_tc_perf(c); in cpu_probe_mips()
1421 c->cputype = CPU_74K; in cpu_probe_mips()
1422 c->writecombine = _CACHE_UNCACHED; in cpu_probe_mips()
1426 c->cputype = CPU_M14KC; in cpu_probe_mips()
1427 c->writecombine = _CACHE_UNCACHED; in cpu_probe_mips()
1431 c->cputype = CPU_M14KEC; in cpu_probe_mips()
1432 c->writecombine = _CACHE_UNCACHED; in cpu_probe_mips()
1436 c->cputype = CPU_1004K; in cpu_probe_mips()
1437 c->writecombine = _CACHE_UNCACHED; in cpu_probe_mips()
1439 cpu_set_mt_per_tc_perf(c); in cpu_probe_mips()
1442 c->cputype = CPU_1074K; in cpu_probe_mips()
1443 c->writecombine = _CACHE_UNCACHED; in cpu_probe_mips()
1447 c->cputype = CPU_INTERAPTIV; in cpu_probe_mips()
1449 cpu_set_mt_per_tc_perf(c); in cpu_probe_mips()
1452 c->cputype = CPU_INTERAPTIV; in cpu_probe_mips()
1454 cpu_set_mt_per_tc_perf(c); in cpu_probe_mips()
1457 c->cputype = CPU_PROAPTIV; in cpu_probe_mips()
1461 c->cputype = CPU_PROAPTIV; in cpu_probe_mips()
1465 c->cputype = CPU_P5600; in cpu_probe_mips()
1469 c->cputype = CPU_P6600; in cpu_probe_mips()
1473 c->cputype = CPU_I6400; in cpu_probe_mips()
1477 c->cputype = CPU_I6500; in cpu_probe_mips()
1481 c->cputype = CPU_M5150; in cpu_probe_mips()
1485 c->cputype = CPU_M6250; in cpu_probe_mips()
1490 decode_configs(c); in cpu_probe_mips()
1494 mm_config(c); in cpu_probe_mips()
1496 switch (__get_cpu_type(c->cputype)) { in cpu_probe_mips()
1499 set_isa(c, MIPS_CPU_ISA_M32R5); in cpu_probe_mips()
1502 c->options |= MIPS_CPU_SHARED_FTLB_ENTRIES; in cpu_probe_mips()
1505 c->options |= MIPS_CPU_SHARED_FTLB_RAM; in cpu_probe_mips()
1514 switch (__get_cpu_type(c->cputype)) { in cpu_probe_mips()
1520 c->options |= MIPS_CPU_FTLBPAREX; in cpu_probe_mips()
1525 static inline void cpu_probe_alchemy(struct cpuinfo_mips *c, unsigned int cpu) in cpu_probe_alchemy() argument
1527 decode_configs(c); in cpu_probe_alchemy()
1528 switch (c->processor_id & PRID_IMP_MASK) { in cpu_probe_alchemy()
1531 c->cputype = CPU_ALCHEMY; in cpu_probe_alchemy()
1532 switch ((c->processor_id >> 24) & 0xff) { in cpu_probe_alchemy()
1547 if ((c->processor_id & PRID_REV_MASK) == 2) in cpu_probe_alchemy()
1561 static inline void cpu_probe_sibyte(struct cpuinfo_mips *c, unsigned int cpu) in cpu_probe_sibyte() argument
1563 decode_configs(c); in cpu_probe_sibyte()
1565 c->writecombine = _CACHE_UNCACHED_ACCELERATED; in cpu_probe_sibyte()
1566 switch (c->processor_id & PRID_IMP_MASK) { in cpu_probe_sibyte()
1568 c->cputype = CPU_SB1; in cpu_probe_sibyte()
1571 if ((c->processor_id & PRID_REV_MASK) < 0x02) in cpu_probe_sibyte()
1572 c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR); in cpu_probe_sibyte()
1575 c->cputype = CPU_SB1A; in cpu_probe_sibyte()
1581 static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c, unsigned int cpu) in cpu_probe_sandcraft() argument
1583 decode_configs(c); in cpu_probe_sandcraft()
1584 switch (c->processor_id & PRID_IMP_MASK) { in cpu_probe_sandcraft()
1586 c->cputype = CPU_SR71000; in cpu_probe_sandcraft()
1588 c->scache.ways = 8; in cpu_probe_sandcraft()
1589 c->tlbsize = 64; in cpu_probe_sandcraft()
1594 static inline void cpu_probe_nxp(struct cpuinfo_mips *c, unsigned int cpu) in cpu_probe_nxp() argument
1596 decode_configs(c); in cpu_probe_nxp()
1597 switch (c->processor_id & PRID_IMP_MASK) { in cpu_probe_nxp()
1599 c->cputype = CPU_PR4450; in cpu_probe_nxp()
1601 set_isa(c, MIPS_CPU_ISA_M32R1); in cpu_probe_nxp()
1606 static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu) in cpu_probe_broadcom() argument
1608 decode_configs(c); in cpu_probe_broadcom()
1609 switch (c->processor_id & PRID_IMP_MASK) { in cpu_probe_broadcom()
1612 c->cputype = CPU_BMIPS32; in cpu_probe_broadcom()
1619 c->cputype = CPU_BMIPS3300; in cpu_probe_broadcom()
1624 int rev = c->processor_id & PRID_REV_MASK; in cpu_probe_broadcom()
1628 c->cputype = CPU_BMIPS4380; in cpu_probe_broadcom()
1631 c->options |= MIPS_CPU_RIXI; in cpu_probe_broadcom()
1633 c->cputype = CPU_BMIPS4350; in cpu_probe_broadcom()
1641 c->cputype = CPU_BMIPS5000; in cpu_probe_broadcom()
1642 if ((c->processor_id & PRID_IMP_MASK) == PRID_IMP_BMIPS5200) in cpu_probe_broadcom()
1647 c->options |= MIPS_CPU_ULRI | MIPS_CPU_RIXI; in cpu_probe_broadcom()
1652 static inline void cpu_probe_cavium(struct cpuinfo_mips *c, unsigned int cpu) in cpu_probe_cavium() argument
1654 decode_configs(c); in cpu_probe_cavium()
1655 switch (c->processor_id & PRID_IMP_MASK) { in cpu_probe_cavium()
1659 c->cputype = CPU_CAVIUM_OCTEON; in cpu_probe_cavium()
1666 c->cputype = CPU_CAVIUM_OCTEON_PLUS; in cpu_probe_cavium()
1676 c->cputype = CPU_CAVIUM_OCTEON2; in cpu_probe_cavium()
1684 c->cputype = CPU_CAVIUM_OCTEON3; in cpu_probe_cavium()
1690 c->cputype = CPU_UNKNOWN; in cpu_probe_cavium()
1698 static inline void decode_cpucfg(struct cpuinfo_mips *c) in decode_cpucfg() argument
1705 c->ases |= MIPS_ASE_LOONGSON_MMI; in decode_cpucfg()
1708 c->ases |= MIPS_ASE_LOONGSON_EXT; in decode_cpucfg()
1711 c->ases |= MIPS_ASE_LOONGSON_EXT2; in decode_cpucfg()
1714 c->options |= MIPS_CPU_LDPTE; in decode_cpucfg()
1715 c->guest.options |= MIPS_CPU_LDPTE; in decode_cpucfg()
1719 c->ases |= MIPS_ASE_LOONGSON_CAM; in decode_cpucfg()
1722 static inline void cpu_probe_loongson(struct cpuinfo_mips *c, unsigned int cpu) in cpu_probe_loongson() argument
1724 decode_configs(c); in cpu_probe_loongson()
1727 c->options |= MIPS_CPU_GSEXCEX; in cpu_probe_loongson()
1729 switch (c->processor_id & PRID_IMP_MASK) { in cpu_probe_loongson()
1731 switch (c->processor_id & PRID_REV_MASK) { in cpu_probe_loongson()
1736 c->cputype = CPU_LOONGSON64; in cpu_probe_loongson()
1739 set_isa(c, MIPS_CPU_ISA_M64R2); in cpu_probe_loongson()
1742 c->writecombine = _CACHE_UNCACHED_ACCELERATED; in cpu_probe_loongson()
1743 c->ases |= (MIPS_ASE_LOONGSON_MMI | MIPS_ASE_LOONGSON_EXT | in cpu_probe_loongson()
1747 switch (c->processor_id & PRID_REV_MASK) { in cpu_probe_loongson()
1750 c->cputype = CPU_LOONGSON64; in cpu_probe_loongson()
1753 set_isa(c, MIPS_CPU_ISA_M64R2); in cpu_probe_loongson()
1757 c->cputype = CPU_LOONGSON64; in cpu_probe_loongson()
1760 set_isa(c, MIPS_CPU_ISA_M64R2); in cpu_probe_loongson()
1771 c->options |= MIPS_CPU_FTLB | MIPS_CPU_TLBINV | MIPS_CPU_LDPTE; in cpu_probe_loongson()
1772 c->writecombine = _CACHE_UNCACHED_ACCELERATED; in cpu_probe_loongson()
1773 c->ases |= (MIPS_ASE_LOONGSON_MMI | MIPS_ASE_LOONGSON_CAM | in cpu_probe_loongson()
1775 c->ases &= ~MIPS_ASE_VZ; /* VZ of Loongson-3A2000/3000 is incomplete */ in cpu_probe_loongson()
1778 c->cputype = CPU_LOONGSON64; in cpu_probe_loongson()
1781 set_isa(c, MIPS_CPU_ISA_M64R2); in cpu_probe_loongson()
1782 decode_cpucfg(c); in cpu_probe_loongson()
1783 c->writecombine = _CACHE_UNCACHED_ACCELERATED; in cpu_probe_loongson()
1791 static inline void cpu_probe_loongson(struct cpuinfo_mips *c, unsigned int cpu) { } in cpu_probe_loongson() argument
1794 static inline void cpu_probe_ingenic(struct cpuinfo_mips *c, unsigned int cpu) in cpu_probe_ingenic() argument
1796 decode_configs(c); in cpu_probe_ingenic()
1802 decode_config3(c); in cpu_probe_ingenic()
1805 c->options &= ~MIPS_CPU_COUNTER; in cpu_probe_ingenic()
1809 c->icache.flags |= MIPS_CACHE_VTAG; in cpu_probe_ingenic()
1811 switch (c->processor_id & PRID_IMP_MASK) { in cpu_probe_ingenic()
1824 switch (c->processor_id & PRID_COMP_MASK) { in cpu_probe_ingenic()
1832 c->isa_level &= ~MIPS_CPU_ISA_M32R2; in cpu_probe_ingenic()
1856 c->writecombine = _CACHE_CACHABLE_WA; in cpu_probe_ingenic()
1857 c->cputype = CPU_XBURST; in cpu_probe_ingenic()
1863 c->cputype = CPU_XBURST; in cpu_probe_ingenic()
1873 static inline void cpu_probe_netlogic(struct cpuinfo_mips *c, int cpu) in cpu_probe_netlogic() argument
1875 decode_configs(c); in cpu_probe_netlogic()
1877 if ((c->processor_id & PRID_IMP_MASK) == PRID_IMP_NETLOGIC_AU13XX) { in cpu_probe_netlogic()
1878 c->cputype = CPU_ALCHEMY; in cpu_probe_netlogic()
1884 c->options = (MIPS_CPU_TLB | in cpu_probe_netlogic()
1892 switch (c->processor_id & PRID_IMP_MASK) { in cpu_probe_netlogic()
1896 c->cputype = CPU_XLP; in cpu_probe_netlogic()
1902 c->cputype = CPU_XLP; in cpu_probe_netlogic()
1914 c->cputype = CPU_XLR; in cpu_probe_netlogic()
1931 c->cputype = CPU_XLR; in cpu_probe_netlogic()
1937 c->processor_id); in cpu_probe_netlogic()
1938 c->cputype = CPU_XLR; in cpu_probe_netlogic()
1942 if (c->cputype == CPU_XLP) { in cpu_probe_netlogic()
1943 set_isa(c, MIPS_CPU_ISA_M64R2); in cpu_probe_netlogic()
1944 c->options |= (MIPS_CPU_FPU | MIPS_CPU_ULRI | MIPS_CPU_MCHECK); in cpu_probe_netlogic()
1946 c->tlbsize = ((read_c0_config6() >> 16) & 0xffff) + 1; in cpu_probe_netlogic()
1948 set_isa(c, MIPS_CPU_ISA_M64R1); in cpu_probe_netlogic()
1949 c->tlbsize = ((read_c0_config1() >> 25) & 0x3f) + 1; in cpu_probe_netlogic()
1951 c->kscratch_mask = 0xf; in cpu_probe_netlogic()
1966 struct cpuinfo_mips *c = &current_cpu_data; in cpu_probe() local
1975 c->processor_id = PRID_IMP_UNKNOWN; in cpu_probe()
1976 c->fpu_id = FPIR_IMP_NONE; in cpu_probe()
1977 c->cputype = CPU_UNKNOWN; in cpu_probe()
1978 c->writecombine = _CACHE_UNCACHED; in cpu_probe()
1980 c->fpu_csr31 = FPU_CSR_RN; in cpu_probe()
1981 c->fpu_msk31 = FPU_CSR_RSVD | FPU_CSR_ABS2008 | FPU_CSR_NAN2008; in cpu_probe()
1983 c->processor_id = read_c0_prid(); in cpu_probe()
1984 switch (c->processor_id & PRID_COMP_MASK) { in cpu_probe()
1986 cpu_probe_legacy(c, cpu); in cpu_probe()
1989 cpu_probe_mips(c, cpu); in cpu_probe()
1992 cpu_probe_alchemy(c, cpu); in cpu_probe()
1995 cpu_probe_sibyte(c, cpu); in cpu_probe()
1998 cpu_probe_broadcom(c, cpu); in cpu_probe()
2001 cpu_probe_sandcraft(c, cpu); in cpu_probe()
2004 cpu_probe_nxp(c, cpu); in cpu_probe()
2007 cpu_probe_cavium(c, cpu); in cpu_probe()
2010 cpu_probe_loongson(c, cpu); in cpu_probe()
2016 cpu_probe_ingenic(c, cpu); in cpu_probe()
2019 cpu_probe_netlogic(c, cpu); in cpu_probe()
2024 BUG_ON(c->cputype == CPU_UNKNOWN); in cpu_probe()
2031 BUG_ON(current_cpu_type() != c->cputype); in cpu_probe()
2039 c->options |= MIPS_CPU_RIXIEX; in cpu_probe()
2043 c->options &= ~MIPS_CPU_FPU; in cpu_probe()
2046 c->ases &= ~(MIPS_ASE_DSP | MIPS_ASE_DSP2P); in cpu_probe()
2049 c->options &= ~MIPS_CPU_HTW; in cpu_probe()
2054 if (c->options & MIPS_CPU_FPU) in cpu_probe()
2055 cpu_set_fpu_opts(c); in cpu_probe()
2057 cpu_set_nofpu_opts(c); in cpu_probe()
2060 c->srsets = ((read_c0_srsctl() >> 26) & 0x0f) + 1; in cpu_probe()
2062 c->options |= MIPS_CPU_PCI; in cpu_probe()
2065 c->srsets = 1; in cpu_probe()
2071 c->msa_id = cpu_get_msa_id(); in cpu_probe()
2072 WARN(c->msa_id & MSA_IR_WRPF, in cpu_probe()
2111 cpu_probe_vz(c); in cpu_probe()
2113 cpu_probe_vmbits(c); in cpu_probe()
2120 loongson3_cpucfg_synthesize_data(c); in cpu_probe()
2130 struct cpuinfo_mips *c = &current_cpu_data; in cpu_report() local
2133 smp_processor_id(), c->processor_id, cpu_name_string()); in cpu_report()
2134 if (c->options & MIPS_CPU_FPU) in cpu_report()
2135 printk(KERN_INFO "FPU revision is: %08x\n", c->fpu_id); in cpu_report()
2137 pr_info("MSA revision is: %08x\n", c->msa_id); in cpu_report()