aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2013-06-26 11:06:34 -0400
committerRalf Baechle <ralf@linux-mips.org>2013-07-01 09:10:56 -0400
commit1990e5429c2149a30a81ff634215c1aa76560a89 (patch)
tree5362bc3d4fb96b32c43d01104968428487e7e685
parent0dad5d262278d24babbd62241fd238a3a3a0a39a (diff)
MIPS: Get rid of MIPS I flag and test macros.
MIPS I is the ancestor of all MIPS ISA and architecture variants. Anything ever build in the MIPS empire is either MIPS I or at least contains MIPS I. If it's running Linux, that is. So there is little point in having cpu_has_mips_1 because it will always evaluate as true - though usually only at runtime. Thus there is no point in having the MIPS_CPU_ISA_I ISA flag, so get rid of it. Little complication: traps.c was using a test for a pure MIPS I ISA as a test for an R3000-style cp0. To deal with that, use a check for cpu_has_3kex or cpu_has_4kex instead. cpu_has_3kex is a new macro. At the moment its default implementation is !cpu_has_4kex but this may eventually change if Linux is ever going to support the oddball MIPS processors R6000 and R8000 so users of either of these macros should not make any assumptions. Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Patchwork: https://patchwork.linux-mips.org/patch/5551/
-rw-r--r--arch/mips/include/asm/cpu-features.h11
-rw-r--r--arch/mips/include/asm/cpu.h23
-rw-r--r--arch/mips/kernel/cpu-probe.c8
-rw-r--r--arch/mips/kernel/proc.c4
-rw-r--r--arch/mips/kernel/traps.c4
5 files changed, 25 insertions, 25 deletions
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
index e5ec8fcd8afa..9609812bc8f2 100644
--- a/arch/mips/include/asm/cpu-features.h
+++ b/arch/mips/include/asm/cpu-features.h
@@ -24,6 +24,16 @@
24#ifndef cpu_has_tlb 24#ifndef cpu_has_tlb
25#define cpu_has_tlb (cpu_data[0].options & MIPS_CPU_TLB) 25#define cpu_has_tlb (cpu_data[0].options & MIPS_CPU_TLB)
26#endif 26#endif
27
28/*
29 * For the moment we don't consider R6000 and R8000 so we can assume that
30 * anything that doesn't support R4000-style exceptions and interrupts is
31 * R3000-like. Users should still treat these two macro definitions as
32 * opaque.
33 */
34#ifndef cpu_has_3kex
35#define cpu_has_3kex (!cpu_has_4kex)
36#endif
27#ifndef cpu_has_4kex 37#ifndef cpu_has_4kex
28#define cpu_has_4kex (cpu_data[0].options & MIPS_CPU_4KEX) 38#define cpu_has_4kex (cpu_data[0].options & MIPS_CPU_4KEX)
29#endif 39#endif
@@ -136,7 +146,6 @@
136#endif 146#endif
137#endif 147#endif
138 148
139# define cpu_has_mips_1 (cpu_data[0].isa_level & MIPS_CPU_ISA_I)
140#ifndef cpu_has_mips_2 149#ifndef cpu_has_mips_2
141# define cpu_has_mips_2 (cpu_data[0].isa_level & MIPS_CPU_ISA_II) 150# define cpu_has_mips_2 (cpu_data[0].isa_level & MIPS_CPU_ISA_II)
142#endif 151#endif
diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h
index dd86ab205483..632bbe5a79ea 100644
--- a/arch/mips/include/asm/cpu.h
+++ b/arch/mips/include/asm/cpu.h
@@ -282,18 +282,17 @@ enum cpu_type_enum {
282 * ISA Level encodings 282 * ISA Level encodings
283 * 283 *
284 */ 284 */
285#define MIPS_CPU_ISA_I 0x00000001 285#define MIPS_CPU_ISA_II 0x00000001
286#define MIPS_CPU_ISA_II 0x00000002 286#define MIPS_CPU_ISA_III 0x00000002
287#define MIPS_CPU_ISA_III 0x00000004 287#define MIPS_CPU_ISA_IV 0x00000004
288#define MIPS_CPU_ISA_IV 0x00000008 288#define MIPS_CPU_ISA_V 0x00000008
289#define MIPS_CPU_ISA_V 0x00000010 289#define MIPS_CPU_ISA_M32R1 0x00000010
290#define MIPS_CPU_ISA_M32R1 0x00000020 290#define MIPS_CPU_ISA_M32R2 0x00000020
291#define MIPS_CPU_ISA_M32R2 0x00000040 291#define MIPS_CPU_ISA_M64R1 0x00000040
292#define MIPS_CPU_ISA_M64R1 0x00000080 292#define MIPS_CPU_ISA_M64R2 0x00000080
293#define MIPS_CPU_ISA_M64R2 0x00000100 293
294 294#define MIPS_CPU_ISA_32BIT (MIPS_CPU_ISA_II | MIPS_CPU_ISA_M32R1 | \
295#define MIPS_CPU_ISA_32BIT (MIPS_CPU_ISA_I | MIPS_CPU_ISA_II | \ 295 MIPS_CPU_ISA_M32R2)
296 MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2)
297#define MIPS_CPU_ISA_64BIT (MIPS_CPU_ISA_III | MIPS_CPU_ISA_IV | \ 296#define MIPS_CPU_ISA_64BIT (MIPS_CPU_ISA_III | MIPS_CPU_ISA_IV | \
298 MIPS_CPU_ISA_V | MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2) 297 MIPS_CPU_ISA_V | MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2)
299 298
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 265c97da6619..f87039dbefe9 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -146,8 +146,7 @@ static void __cpuinit set_isa(struct cpuinfo_mips *c, unsigned int isa)
146 case MIPS_CPU_ISA_IV: 146 case MIPS_CPU_ISA_IV:
147 c->isa_level |= MIPS_CPU_ISA_IV; 147 c->isa_level |= MIPS_CPU_ISA_IV;
148 case MIPS_CPU_ISA_III: 148 case MIPS_CPU_ISA_III:
149 c->isa_level |= MIPS_CPU_ISA_I | MIPS_CPU_ISA_II | 149 c->isa_level |= MIPS_CPU_ISA_II | MIPS_CPU_ISA_III;
150 MIPS_CPU_ISA_III;
151 break; 150 break;
152 151
153 case MIPS_CPU_ISA_M32R2: 152 case MIPS_CPU_ISA_M32R2:
@@ -156,8 +155,6 @@ static void __cpuinit set_isa(struct cpuinfo_mips *c, unsigned int isa)
156 c->isa_level |= MIPS_CPU_ISA_M32R1; 155 c->isa_level |= MIPS_CPU_ISA_M32R1;
157 case MIPS_CPU_ISA_II: 156 case MIPS_CPU_ISA_II:
158 c->isa_level |= MIPS_CPU_ISA_II; 157 c->isa_level |= MIPS_CPU_ISA_II;
159 case MIPS_CPU_ISA_I:
160 c->isa_level |= MIPS_CPU_ISA_I;
161 break; 158 break;
162 } 159 }
163} 160}
@@ -332,7 +329,6 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
332 case PRID_IMP_R2000: 329 case PRID_IMP_R2000:
333 c->cputype = CPU_R2000; 330 c->cputype = CPU_R2000;
334 __cpu_name[cpu] = "R2000"; 331 __cpu_name[cpu] = "R2000";
335 set_isa(c, MIPS_CPU_ISA_I);
336 c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE | 332 c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE |
337 MIPS_CPU_NOFPUEX; 333 MIPS_CPU_NOFPUEX;
338 if (__cpu_has_fpu()) 334 if (__cpu_has_fpu())
@@ -352,7 +348,6 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
352 c->cputype = CPU_R3000; 348 c->cputype = CPU_R3000;
353 __cpu_name[cpu] = "R3000"; 349 __cpu_name[cpu] = "R3000";
354 } 350 }
355 set_isa(c, MIPS_CPU_ISA_I);
356 c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE | 351 c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE |
357 MIPS_CPU_NOFPUEX; 352 MIPS_CPU_NOFPUEX;
358 if (__cpu_has_fpu()) 353 if (__cpu_has_fpu())
@@ -455,7 +450,6 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
455 break; 450 break;
456 #endif 451 #endif
457 case PRID_IMP_TX39: 452 case PRID_IMP_TX39:
458 set_isa(c, MIPS_CPU_ISA_I);
459 c->options = MIPS_CPU_TLB | MIPS_CPU_TX39_CACHE; 453 c->options = MIPS_CPU_TLB | MIPS_CPU_TX39_CACHE;
460 454
461 if ((c->processor_id & 0xf0) == (PRID_REV_TX3927 & 0xf0)) { 455 if ((c->processor_id & 0xf0) == (PRID_REV_TX3927 & 0xf0)) {
diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
index acb34373679e..8c58d8a84bf3 100644
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -66,9 +66,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
66 seq_printf(m, "]\n"); 66 seq_printf(m, "]\n");
67 } 67 }
68 if (cpu_has_mips_r) { 68 if (cpu_has_mips_r) {
69 seq_printf(m, "isa\t\t\t:"); 69 seq_printf(m, "isa\t\t\t: mips1");
70 if (cpu_has_mips_1)
71 seq_printf(m, "%s", " mips1");
72 if (cpu_has_mips_2) 70 if (cpu_has_mips_2)
73 seq_printf(m, "%s", " mips2"); 71 seq_printf(m, "%s", " mips2");
74 if (cpu_has_mips_3) 72 if (cpu_has_mips_3)
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 142d2bede024..d97ea234e2d3 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -265,7 +265,7 @@ static void __show_regs(const struct pt_regs *regs)
265 265
266 printk("Status: %08x ", (uint32_t) regs->cp0_status); 266 printk("Status: %08x ", (uint32_t) regs->cp0_status);
267 267
268 if (current_cpu_data.isa_level == MIPS_CPU_ISA_I) { 268 if (cpu_has_3kex) {
269 if (regs->cp0_status & ST0_KUO) 269 if (regs->cp0_status & ST0_KUO)
270 printk("KUo "); 270 printk("KUo ");
271 if (regs->cp0_status & ST0_IEO) 271 if (regs->cp0_status & ST0_IEO)
@@ -278,7 +278,7 @@ static void __show_regs(const struct pt_regs *regs)
278 printk("KUc "); 278 printk("KUc ");
279 if (regs->cp0_status & ST0_IEC) 279 if (regs->cp0_status & ST0_IEC)
280 printk("IEc "); 280 printk("IEc ");
281 } else { 281 } else if (cpu_has_4kex) {
282 if (regs->cp0_status & ST0_KX) 282 if (regs->cp0_status & ST0_KX)
283 printk("KX "); 283 printk("KX ");
284 if (regs->cp0_status & ST0_SX) 284 if (regs->cp0_status & ST0_SX)