blob: acb34373679e21f9940f62f251e64dc1e32e5f17 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * Copyright (C) 1995, 1996, 2001 Ralf Baechle
Ralf Baechle41943182005-05-05 16:45:59 +00003 * Copyright (C) 2001, 2004 MIPS Technologies, Inc.
Ralf Baechle70342282013-01-22 12:59:30 +01004 * Copyright (C) 2004 Maciej W. Rozycki
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07006#include <linux/delay.h>
7#include <linux/kernel.h>
8#include <linux/sched.h>
9#include <linux/seq_file.h>
10#include <asm/bootinfo.h>
11#include <asm/cpu.h>
12#include <asm/cpu-features.h>
Ralf Baechlebdc92d742013-05-21 16:59:19 +020013#include <asm/idle.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#include <asm/mipsregs.h>
15#include <asm/processor.h>
John Crispin9169a5d2013-04-11 05:34:59 +000016#include <asm/prom.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070017
18unsigned int vced_count, vcei_count;
19
Linus Torvalds1da177e2005-04-16 15:20:36 -070020static int show_cpuinfo(struct seq_file *m, void *v)
21{
Linus Torvalds1da177e2005-04-16 15:20:36 -070022 unsigned long n = (unsigned long) v - 1;
Karl-Johan Karlsson31aa3662006-10-08 01:15:02 +020023 unsigned int version = cpu_data[n].processor_id;
24 unsigned int fp_vers = cpu_data[n].fpu_id;
Linus Torvalds1da177e2005-04-16 15:20:36 -070025 char fmt [64];
David Daney654f57b2008-09-23 00:07:16 -070026 int i;
Linus Torvalds1da177e2005-04-16 15:20:36 -070027
28#ifdef CONFIG_SMP
Rusty Russell0b5f9c02012-03-29 15:38:30 +103029 if (!cpu_online(n))
Linus Torvalds1da177e2005-04-16 15:20:36 -070030 return 0;
31#endif
32
33 /*
34 * For the first processor also print the system type
35 */
Gabor Juhos487d70d2010-11-23 16:06:25 +010036 if (n == 0) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070037 seq_printf(m, "system type\t\t: %s\n", get_system_type());
Gabor Juhos487d70d2010-11-23 16:06:25 +010038 if (mips_get_machine_name())
39 seq_printf(m, "machine\t\t\t: %s\n",
40 mips_get_machine_name());
41 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070042
43 seq_printf(m, "processor\t\t: %ld\n", n);
44 sprintf(fmt, "cpu model\t\t: %%s V%%d.%%d%s\n",
Steven J. Hill03751e72012-05-10 23:21:18 -050045 cpu_data[n].options & MIPS_CPU_FPU ? " FPU V%d.%d" : "");
Johannes Dickgrebere47c6592008-10-13 19:36:21 +020046 seq_printf(m, fmt, __cpu_name[n],
Steven J. Hill03751e72012-05-10 23:21:18 -050047 (version >> 4) & 0x0f, version & 0x0f,
48 (fp_vers >> 4) & 0x0f, fp_vers & 0x0f);
Ralf Baechle56369192009-02-28 09:44:28 +000049 seq_printf(m, "BogoMIPS\t\t: %u.%02u\n",
Steven J. Hill03751e72012-05-10 23:21:18 -050050 cpu_data[n].udelay_val / (500000/HZ),
51 (cpu_data[n].udelay_val / (5000/HZ)) % 100);
Linus Torvalds1da177e2005-04-16 15:20:36 -070052 seq_printf(m, "wait instruction\t: %s\n", cpu_wait ? "yes" : "no");
53 seq_printf(m, "microsecond timers\t: %s\n",
Steven J. Hill03751e72012-05-10 23:21:18 -050054 cpu_has_counter ? "yes" : "no");
Karl-Johan Karlsson31aa3662006-10-08 01:15:02 +020055 seq_printf(m, "tlb_entries\t\t: %d\n", cpu_data[n].tlbsize);
Linus Torvalds1da177e2005-04-16 15:20:36 -070056 seq_printf(m, "extra interrupt vector\t: %s\n",
Steven J. Hill03751e72012-05-10 23:21:18 -050057 cpu_has_divec ? "yes" : "no");
David Daney654f57b2008-09-23 00:07:16 -070058 seq_printf(m, "hardware watchpoint\t: %s",
Steven J. Hill03751e72012-05-10 23:21:18 -050059 cpu_has_watch ? "yes, " : "no\n");
David Daney654f57b2008-09-23 00:07:16 -070060 if (cpu_has_watch) {
61 seq_printf(m, "count: %d, address/irw mask: [",
Steven J. Hill03751e72012-05-10 23:21:18 -050062 cpu_data[n].watch_reg_count);
David Daney654f57b2008-09-23 00:07:16 -070063 for (i = 0; i < cpu_data[n].watch_reg_count; i++)
64 seq_printf(m, "%s0x%04x", i ? ", " : "" ,
Steven J. Hill03751e72012-05-10 23:21:18 -050065 cpu_data[n].watch_reg_masks[i]);
David Daney654f57b2008-09-23 00:07:16 -070066 seq_printf(m, "]\n");
67 }
Steven J. Hilla96102b2012-12-07 04:31:36 +000068 if (cpu_has_mips_r) {
69 seq_printf(m, "isa\t\t\t:");
70 if (cpu_has_mips_1)
John Crispina4285b92013-03-13 20:54:34 +010071 seq_printf(m, "%s", " mips1");
Steven J. Hilla96102b2012-12-07 04:31:36 +000072 if (cpu_has_mips_2)
73 seq_printf(m, "%s", " mips2");
74 if (cpu_has_mips_3)
75 seq_printf(m, "%s", " mips3");
76 if (cpu_has_mips_4)
77 seq_printf(m, "%s", " mips4");
78 if (cpu_has_mips_5)
79 seq_printf(m, "%s", " mips5");
80 if (cpu_has_mips32r1)
81 seq_printf(m, "%s", " mips32r1");
82 if (cpu_has_mips32r2)
83 seq_printf(m, "%s", " mips32r2");
84 if (cpu_has_mips64r1)
85 seq_printf(m, "%s", " mips64r1");
86 if (cpu_has_mips64r2)
87 seq_printf(m, "%s", " mips64r2");
88 seq_printf(m, "\n");
89 }
Ralf Baechle981ef0d2012-08-20 16:39:11 +020090
91 seq_printf(m, "ASEs implemented\t:");
92 if (cpu_has_mips16) seq_printf(m, "%s", " mips16");
93 if (cpu_has_mdmx) seq_printf(m, "%s", " mdmx");
94 if (cpu_has_mips3d) seq_printf(m, "%s", " mips3d");
95 if (cpu_has_smartmips) seq_printf(m, "%s", " smartmips");
96 if (cpu_has_dsp) seq_printf(m, "%s", " dsp");
97 if (cpu_has_dsp2) seq_printf(m, "%s", " dsp2");
98 if (cpu_has_mipsmt) seq_printf(m, "%s", " mt");
Steven J. Hillf8fa4812012-12-07 03:51:35 +000099 if (cpu_has_mmips) seq_printf(m, "%s", " micromips");
David Daney1e7decd2013-02-16 23:42:43 +0100100 if (cpu_has_vz) seq_printf(m, "%s", " vz");
Ralf Baechle981ef0d2012-08-20 16:39:11 +0200101 seq_printf(m, "\n");
102
Steven J. Hillbce86082013-03-25 13:27:11 -0500103 if (cpu_has_mmips) {
104 seq_printf(m, "micromips kernel\t: %s\n",
105 (read_c0_config3() & MIPS_CONF3_ISA_OE) ? "yes" : "no");
106 }
Ralf Baechlef6771db2007-11-08 18:02:29 +0000107 seq_printf(m, "shadow register sets\t: %d\n",
Steven J. Hill03751e72012-05-10 23:21:18 -0500108 cpu_data[n].srsets);
David Daneye77c32f2010-12-21 14:19:09 -0800109 seq_printf(m, "kscratch registers\t: %d\n",
Steven J. Hill03751e72012-05-10 23:21:18 -0500110 hweight8(cpu_data[n].kscratch_mask));
Ralf Baechle0ab7aef2007-03-02 20:42:04 +0000111 seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112
113 sprintf(fmt, "VCE%%c exceptions\t\t: %s\n",
Steven J. Hill03751e72012-05-10 23:21:18 -0500114 cpu_has_vce ? "%u" : "not available");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115 seq_printf(m, fmt, 'D', vced_count);
116 seq_printf(m, fmt, 'I', vcei_count);
Martin Michlmayr17256052006-03-20 02:51:20 +0000117 seq_printf(m, "\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118
119 return 0;
120}
121
122static void *c_start(struct seq_file *m, loff_t *pos)
123{
124 unsigned long i = *pos;
125
126 return i < NR_CPUS ? (void *) (i + 1) : NULL;
127}
128
129static void *c_next(struct seq_file *m, void *v, loff_t *pos)
130{
131 ++*pos;
132 return c_start(m, pos);
133}
134
135static void c_stop(struct seq_file *m, void *v)
136{
137}
138
Jan Engelhardt12323ca2008-01-22 20:42:33 +0100139const struct seq_operations cpuinfo_op = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140 .start = c_start,
141 .next = c_next,
142 .stop = c_stop,
143 .show = show_cpuinfo,
144};