blob: 5542817c1b498869cef930f4bd09c7ce680fe130 [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.
4 * 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>
13#include <asm/mipsregs.h>
14#include <asm/processor.h>
Gabor Juhos487d70d2010-11-23 16:06:25 +010015#include <asm/mips_machine.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
17unsigned int vced_count, vcei_count;
18
Linus Torvalds1da177e2005-04-16 15:20:36 -070019static int show_cpuinfo(struct seq_file *m, void *v)
20{
Linus Torvalds1da177e2005-04-16 15:20:36 -070021 unsigned long n = (unsigned long) v - 1;
Karl-Johan Karlsson31aa3662006-10-08 01:15:02 +020022 unsigned int version = cpu_data[n].processor_id;
23 unsigned int fp_vers = cpu_data[n].fpu_id;
Linus Torvalds1da177e2005-04-16 15:20:36 -070024 char fmt [64];
David Daney654f57b2008-09-23 00:07:16 -070025 int i;
Linus Torvalds1da177e2005-04-16 15:20:36 -070026
27#ifdef CONFIG_SMP
Rusty Russell0b5f9c02012-03-29 15:38:30 +103028 if (!cpu_online(n))
Linus Torvalds1da177e2005-04-16 15:20:36 -070029 return 0;
30#endif
31
32 /*
33 * For the first processor also print the system type
34 */
Gabor Juhos487d70d2010-11-23 16:06:25 +010035 if (n == 0) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070036 seq_printf(m, "system type\t\t: %s\n", get_system_type());
Gabor Juhos487d70d2010-11-23 16:06:25 +010037 if (mips_get_machine_name())
38 seq_printf(m, "machine\t\t\t: %s\n",
39 mips_get_machine_name());
40 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
42 seq_printf(m, "processor\t\t: %ld\n", n);
43 sprintf(fmt, "cpu model\t\t: %%s V%%d.%%d%s\n",
Steven J. Hill03751e72012-05-10 23:21:18 -050044 cpu_data[n].options & MIPS_CPU_FPU ? " FPU V%d.%d" : "");
Johannes Dickgrebere47c6592008-10-13 19:36:21 +020045 seq_printf(m, fmt, __cpu_name[n],
Steven J. Hill03751e72012-05-10 23:21:18 -050046 (version >> 4) & 0x0f, version & 0x0f,
47 (fp_vers >> 4) & 0x0f, fp_vers & 0x0f);
Ralf Baechle56369192009-02-28 09:44:28 +000048 seq_printf(m, "BogoMIPS\t\t: %u.%02u\n",
Steven J. Hill03751e72012-05-10 23:21:18 -050049 cpu_data[n].udelay_val / (500000/HZ),
50 (cpu_data[n].udelay_val / (5000/HZ)) % 100);
Linus Torvalds1da177e2005-04-16 15:20:36 -070051 seq_printf(m, "wait instruction\t: %s\n", cpu_wait ? "yes" : "no");
52 seq_printf(m, "microsecond timers\t: %s\n",
Steven J. Hill03751e72012-05-10 23:21:18 -050053 cpu_has_counter ? "yes" : "no");
Karl-Johan Karlsson31aa3662006-10-08 01:15:02 +020054 seq_printf(m, "tlb_entries\t\t: %d\n", cpu_data[n].tlbsize);
Linus Torvalds1da177e2005-04-16 15:20:36 -070055 seq_printf(m, "extra interrupt vector\t: %s\n",
Steven J. Hill03751e72012-05-10 23:21:18 -050056 cpu_has_divec ? "yes" : "no");
David Daney654f57b2008-09-23 00:07:16 -070057 seq_printf(m, "hardware watchpoint\t: %s",
Steven J. Hill03751e72012-05-10 23:21:18 -050058 cpu_has_watch ? "yes, " : "no\n");
David Daney654f57b2008-09-23 00:07:16 -070059 if (cpu_has_watch) {
60 seq_printf(m, "count: %d, address/irw mask: [",
Steven J. Hill03751e72012-05-10 23:21:18 -050061 cpu_data[n].watch_reg_count);
David Daney654f57b2008-09-23 00:07:16 -070062 for (i = 0; i < cpu_data[n].watch_reg_count; i++)
63 seq_printf(m, "%s0x%04x", i ? ", " : "" ,
Steven J. Hill03751e72012-05-10 23:21:18 -050064 cpu_data[n].watch_reg_masks[i]);
David Daney654f57b2008-09-23 00:07:16 -070065 seq_printf(m, "]\n");
66 }
Ralf Baechlee0278022005-08-16 16:39:15 +000067 seq_printf(m, "ASEs implemented\t:%s%s%s%s%s%s\n",
Ralf Baechle41943182005-05-05 16:45:59 +000068 cpu_has_mips16 ? " mips16" : "",
69 cpu_has_mdmx ? " mdmx" : "",
70 cpu_has_mips3d ? " mips3d" : "",
Ralf Baechlee0278022005-08-16 16:39:15 +000071 cpu_has_smartmips ? " smartmips" : "",
72 cpu_has_dsp ? " dsp" : "",
73 cpu_has_mipsmt ? " mt" : ""
74 );
Ralf Baechlef6771db2007-11-08 18:02:29 +000075 seq_printf(m, "shadow register sets\t: %d\n",
Steven J. Hill03751e72012-05-10 23:21:18 -050076 cpu_data[n].srsets);
David Daneye77c32f2010-12-21 14:19:09 -080077 seq_printf(m, "kscratch registers\t: %d\n",
Steven J. Hill03751e72012-05-10 23:21:18 -050078 hweight8(cpu_data[n].kscratch_mask));
Ralf Baechle0ab7aef2007-03-02 20:42:04 +000079 seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core);
Linus Torvalds1da177e2005-04-16 15:20:36 -070080
81 sprintf(fmt, "VCE%%c exceptions\t\t: %s\n",
Steven J. Hill03751e72012-05-10 23:21:18 -050082 cpu_has_vce ? "%u" : "not available");
Linus Torvalds1da177e2005-04-16 15:20:36 -070083 seq_printf(m, fmt, 'D', vced_count);
84 seq_printf(m, fmt, 'I', vcei_count);
Martin Michlmayr17256052006-03-20 02:51:20 +000085 seq_printf(m, "\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -070086
87 return 0;
88}
89
90static void *c_start(struct seq_file *m, loff_t *pos)
91{
92 unsigned long i = *pos;
93
94 return i < NR_CPUS ? (void *) (i + 1) : NULL;
95}
96
97static void *c_next(struct seq_file *m, void *v, loff_t *pos)
98{
99 ++*pos;
100 return c_start(m, pos);
101}
102
103static void c_stop(struct seq_file *m, void *v)
104{
105}
106
Jan Engelhardt12323ca2008-01-22 20:42:33 +0100107const struct seq_operations cpuinfo_op = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108 .start = c_start,
109 .next = c_next,
110 .stop = c_stop,
111 .show = show_cpuinfo,
112};