blob: 79d4b8edbd761f8d77fd55f00ef05f087f57332f [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>
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 }
Steven J. Hilla96102b2012-12-07 04:31:36 +000067 if (cpu_has_mips_r) {
68 seq_printf(m, "isa\t\t\t:");
69 if (cpu_has_mips_1)
70 seq_printf(m, "%s", "mips1");
71 if (cpu_has_mips_2)
72 seq_printf(m, "%s", " mips2");
73 if (cpu_has_mips_3)
74 seq_printf(m, "%s", " mips3");
75 if (cpu_has_mips_4)
76 seq_printf(m, "%s", " mips4");
77 if (cpu_has_mips_5)
78 seq_printf(m, "%s", " mips5");
79 if (cpu_has_mips32r1)
80 seq_printf(m, "%s", " mips32r1");
81 if (cpu_has_mips32r2)
82 seq_printf(m, "%s", " mips32r2");
83 if (cpu_has_mips64r1)
84 seq_printf(m, "%s", " mips64r1");
85 if (cpu_has_mips64r2)
86 seq_printf(m, "%s", " mips64r2");
87 seq_printf(m, "\n");
88 }
Ralf Baechle981ef0d2012-08-20 16:39:11 +020089
90 seq_printf(m, "ASEs implemented\t:");
91 if (cpu_has_mips16) seq_printf(m, "%s", " mips16");
92 if (cpu_has_mdmx) seq_printf(m, "%s", " mdmx");
93 if (cpu_has_mips3d) seq_printf(m, "%s", " mips3d");
94 if (cpu_has_smartmips) seq_printf(m, "%s", " smartmips");
95 if (cpu_has_dsp) seq_printf(m, "%s", " dsp");
96 if (cpu_has_dsp2) seq_printf(m, "%s", " dsp2");
97 if (cpu_has_mipsmt) seq_printf(m, "%s", " mt");
98 seq_printf(m, "\n");
99
Ralf Baechlef6771db2007-11-08 18:02:29 +0000100 seq_printf(m, "shadow register sets\t: %d\n",
Steven J. Hill03751e72012-05-10 23:21:18 -0500101 cpu_data[n].srsets);
David Daneye77c32f2010-12-21 14:19:09 -0800102 seq_printf(m, "kscratch registers\t: %d\n",
Steven J. Hill03751e72012-05-10 23:21:18 -0500103 hweight8(cpu_data[n].kscratch_mask));
Ralf Baechle0ab7aef2007-03-02 20:42:04 +0000104 seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105
106 sprintf(fmt, "VCE%%c exceptions\t\t: %s\n",
Steven J. Hill03751e72012-05-10 23:21:18 -0500107 cpu_has_vce ? "%u" : "not available");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108 seq_printf(m, fmt, 'D', vced_count);
109 seq_printf(m, fmt, 'I', vcei_count);
Martin Michlmayr17256052006-03-20 02:51:20 +0000110 seq_printf(m, "\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111
112 return 0;
113}
114
115static void *c_start(struct seq_file *m, loff_t *pos)
116{
117 unsigned long i = *pos;
118
119 return i < NR_CPUS ? (void *) (i + 1) : NULL;
120}
121
122static void *c_next(struct seq_file *m, void *v, loff_t *pos)
123{
124 ++*pos;
125 return c_start(m, pos);
126}
127
128static void c_stop(struct seq_file *m, void *v)
129{
130}
131
Jan Engelhardt12323ca2008-01-22 20:42:33 +0100132const struct seq_operations cpuinfo_op = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133 .start = c_start,
134 .next = c_next,
135 .stop = c_stop,
136 .show = show_cpuinfo,
137};