proc.c 4.3 KB
Newer Older
L
Linus Torvalds 已提交
1 2
/*
 *  Copyright (C) 1995, 1996, 2001  Ralf Baechle
3
 *  Copyright (C) 2001, 2004  MIPS Technologies, Inc.
R
Ralf Baechle 已提交
4
 *  Copyright (C) 2004	Maciej W. Rozycki
L
Linus Torvalds 已提交
5 6 7 8 9 10 11 12
 */
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/seq_file.h>
#include <asm/bootinfo.h>
#include <asm/cpu.h>
#include <asm/cpu-features.h>
13
#include <asm/idle.h>
L
Linus Torvalds 已提交
14 15
#include <asm/mipsregs.h>
#include <asm/processor.h>
16
#include <asm/prom.h>
L
Linus Torvalds 已提交
17 18 19 20 21 22

unsigned int vced_count, vcei_count;

static int show_cpuinfo(struct seq_file *m, void *v)
{
	unsigned long n = (unsigned long) v - 1;
23 24
	unsigned int version = cpu_data[n].processor_id;
	unsigned int fp_vers = cpu_data[n].fpu_id;
L
Linus Torvalds 已提交
25
	char fmt [64];
26
	int i;
L
Linus Torvalds 已提交
27 28

#ifdef CONFIG_SMP
29
	if (!cpu_online(n))
L
Linus Torvalds 已提交
30 31 32 33 34 35
		return 0;
#endif

	/*
	 * For the first processor also print the system type
	 */
36
	if (n == 0) {
L
Linus Torvalds 已提交
37
		seq_printf(m, "system type\t\t: %s\n", get_system_type());
38 39 40 41
		if (mips_get_machine_name())
			seq_printf(m, "machine\t\t\t: %s\n",
				   mips_get_machine_name());
	}
L
Linus Torvalds 已提交
42 43 44

	seq_printf(m, "processor\t\t: %ld\n", n);
	sprintf(fmt, "cpu model\t\t: %%s V%%d.%%d%s\n",
S
Steven J. Hill 已提交
45
		      cpu_data[n].options & MIPS_CPU_FPU ? "  FPU V%d.%d" : "");
46
	seq_printf(m, fmt, __cpu_name[n],
S
Steven J. Hill 已提交
47 48
		      (version >> 4) & 0x0f, version & 0x0f,
		      (fp_vers >> 4) & 0x0f, fp_vers & 0x0f);
49
	seq_printf(m, "BogoMIPS\t\t: %u.%02u\n",
S
Steven J. Hill 已提交
50 51
		      cpu_data[n].udelay_val / (500000/HZ),
		      (cpu_data[n].udelay_val / (5000/HZ)) % 100);
L
Linus Torvalds 已提交
52 53
	seq_printf(m, "wait instruction\t: %s\n", cpu_wait ? "yes" : "no");
	seq_printf(m, "microsecond timers\t: %s\n",
S
Steven J. Hill 已提交
54
		      cpu_has_counter ? "yes" : "no");
55
	seq_printf(m, "tlb_entries\t\t: %d\n", cpu_data[n].tlbsize);
L
Linus Torvalds 已提交
56
	seq_printf(m, "extra interrupt vector\t: %s\n",
S
Steven J. Hill 已提交
57
		      cpu_has_divec ? "yes" : "no");
58
	seq_printf(m, "hardware watchpoint\t: %s",
S
Steven J. Hill 已提交
59
		      cpu_has_watch ? "yes, " : "no\n");
60 61
	if (cpu_has_watch) {
		seq_printf(m, "count: %d, address/irw mask: [",
S
Steven J. Hill 已提交
62
		      cpu_data[n].watch_reg_count);
63 64
		for (i = 0; i < cpu_data[n].watch_reg_count; i++)
			seq_printf(m, "%s0x%04x", i ? ", " : "" ,
S
Steven J. Hill 已提交
65
				cpu_data[n].watch_reg_masks[i]);
66 67
		seq_printf(m, "]\n");
	}
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86

	seq_printf(m, "isa\t\t\t: mips1");
	if (cpu_has_mips_2)
		seq_printf(m, "%s", " mips2");
	if (cpu_has_mips_3)
		seq_printf(m, "%s", " mips3");
	if (cpu_has_mips_4)
		seq_printf(m, "%s", " mips4");
	if (cpu_has_mips_5)
		seq_printf(m, "%s", " mips5");
	if (cpu_has_mips32r1)
		seq_printf(m, "%s", " mips32r1");
	if (cpu_has_mips32r2)
		seq_printf(m, "%s", " mips32r2");
	if (cpu_has_mips64r1)
		seq_printf(m, "%s", " mips64r1");
	if (cpu_has_mips64r2)
		seq_printf(m, "%s", " mips64r2");
	seq_printf(m, "\n");
87 88 89 90 91 92 93 94 95

	seq_printf(m, "ASEs implemented\t:");
	if (cpu_has_mips16)	seq_printf(m, "%s", " mips16");
	if (cpu_has_mdmx)	seq_printf(m, "%s", " mdmx");
	if (cpu_has_mips3d)	seq_printf(m, "%s", " mips3d");
	if (cpu_has_smartmips)	seq_printf(m, "%s", " smartmips");
	if (cpu_has_dsp)	seq_printf(m, "%s", " dsp");
	if (cpu_has_dsp2)	seq_printf(m, "%s", " dsp2");
	if (cpu_has_mipsmt)	seq_printf(m, "%s", " mt");
96
	if (cpu_has_mmips)	seq_printf(m, "%s", " micromips");
97
	if (cpu_has_vz)		seq_printf(m, "%s", " vz");
P
Paul Burton 已提交
98
	if (cpu_has_msa)	seq_printf(m, "%s", " msa");
99 100
	seq_printf(m, "\n");

101 102 103 104
	if (cpu_has_mmips) {
		seq_printf(m, "micromips kernel\t: %s\n",
		      (read_c0_config3() & MIPS_CONF3_ISA_OE) ?  "yes" : "no");
	}
R
Ralf Baechle 已提交
105
	seq_printf(m, "shadow register sets\t: %d\n",
S
Steven J. Hill 已提交
106
		      cpu_data[n].srsets);
107
	seq_printf(m, "kscratch registers\t: %d\n",
S
Steven J. Hill 已提交
108
		      hweight8(cpu_data[n].kscratch_mask));
109
	seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core);
110 111 112 113 114 115 116 117
#if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_MIPS_MT_SMTC)
	if (cpu_has_mipsmt) {
		seq_printf(m, "VPE\t\t\t: %d\n", cpu_data[n].vpe_id);
#if defined(CONFIG_MIPS_MT_SMTC)
		seq_printf(m, "TC\t\t\t: %d\n", cpu_data[n].tc_id);
#endif
	}
#endif
L
Linus Torvalds 已提交
118
	sprintf(fmt, "VCE%%c exceptions\t\t: %s\n",
S
Steven J. Hill 已提交
119
		      cpu_has_vce ? "%u" : "not available");
L
Linus Torvalds 已提交
120 121
	seq_printf(m, fmt, 'D', vced_count);
	seq_printf(m, fmt, 'I', vcei_count);
122
	seq_printf(m, "\n");
L
Linus Torvalds 已提交
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143

	return 0;
}

static void *c_start(struct seq_file *m, loff_t *pos)
{
	unsigned long i = *pos;

	return i < NR_CPUS ? (void *) (i + 1) : NULL;
}

static void *c_next(struct seq_file *m, void *v, loff_t *pos)
{
	++*pos;
	return c_start(m, pos);
}

static void c_stop(struct seq_file *m, void *v)
{
}

144
const struct seq_operations cpuinfo_op = {
L
Linus Torvalds 已提交
145 146 147 148 149
	.start	= c_start,
	.next	= c_next,
	.stop	= c_stop,
	.show	= show_cpuinfo,
};