diff options
Diffstat (limited to 'arch/mips/kernel/smtc-proc.c')
-rw-r--r-- | arch/mips/kernel/smtc-proc.c | 64 |
1 files changed, 26 insertions, 38 deletions
diff --git a/arch/mips/kernel/smtc-proc.c b/arch/mips/kernel/smtc-proc.c index aee7c8177b5d..9fb714450e95 100644 --- a/arch/mips/kernel/smtc-proc.c +++ b/arch/mips/kernel/smtc-proc.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <asm/mipsregs.h> | 16 | #include <asm/mipsregs.h> |
17 | #include <asm/cacheflush.h> | 17 | #include <asm/cacheflush.h> |
18 | #include <linux/proc_fs.h> | 18 | #include <linux/proc_fs.h> |
19 | #include <linux/seq_file.h> | ||
19 | 20 | ||
20 | #include <asm/smtc_proc.h> | 21 | #include <asm/smtc_proc.h> |
21 | 22 | ||
@@ -30,51 +31,39 @@ unsigned long selfipis[NR_CPUS]; | |||
30 | 31 | ||
31 | struct smtc_cpu_proc smtc_cpu_stats[NR_CPUS]; | 32 | struct smtc_cpu_proc smtc_cpu_stats[NR_CPUS]; |
32 | 33 | ||
33 | static struct proc_dir_entry *smtc_stats; | ||
34 | |||
35 | atomic_t smtc_fpu_recoveries; | 34 | atomic_t smtc_fpu_recoveries; |
36 | 35 | ||
37 | static int proc_read_smtc(char *page, char **start, off_t off, | 36 | static int smtc_proc_show(struct seq_file *m, void *v) |
38 | int count, int *eof, void *data) | ||
39 | { | 37 | { |
40 | int totalen = 0; | ||
41 | int len; | ||
42 | int i; | 38 | int i; |
43 | extern unsigned long ebase; | 39 | extern unsigned long ebase; |
44 | 40 | ||
45 | len = sprintf(page, "SMTC Status Word: 0x%08x\n", smtc_status); | 41 | seq_printf(m, "SMTC Status Word: 0x%08x\n", smtc_status); |
46 | totalen += len; | 42 | seq_printf(m, "Config7: 0x%08x\n", read_c0_config7()); |
47 | page += len; | 43 | seq_printf(m, "EBASE: 0x%08lx\n", ebase); |
48 | len = sprintf(page, "Config7: 0x%08x\n", read_c0_config7()); | 44 | seq_printf(m, "Counter Interrupts taken per CPU (TC)\n"); |
49 | totalen += len; | 45 | for (i=0; i < NR_CPUS; i++) |
50 | page += len; | 46 | seq_printf(m, "%d: %ld\n", i, smtc_cpu_stats[i].timerints); |
51 | len = sprintf(page, "EBASE: 0x%08lx\n", ebase); | 47 | seq_printf(m, "Self-IPIs by CPU:\n"); |
52 | totalen += len; | 48 | for(i = 0; i < NR_CPUS; i++) |
53 | page += len; | 49 | seq_printf(m, "%d: %ld\n", i, smtc_cpu_stats[i].selfipis); |
54 | len = sprintf(page, "Counter Interrupts taken per CPU (TC)\n"); | 50 | seq_printf(m, "%d Recoveries of \"stolen\" FPU\n", |
55 | totalen += len; | 51 | atomic_read(&smtc_fpu_recoveries)); |
56 | page += len; | 52 | return 0; |
57 | for (i=0; i < NR_CPUS; i++) { | 53 | } |
58 | len = sprintf(page, "%d: %ld\n", i, smtc_cpu_stats[i].timerints); | ||
59 | totalen += len; | ||
60 | page += len; | ||
61 | } | ||
62 | len = sprintf(page, "Self-IPIs by CPU:\n"); | ||
63 | totalen += len; | ||
64 | page += len; | ||
65 | for(i = 0; i < NR_CPUS; i++) { | ||
66 | len = sprintf(page, "%d: %ld\n", i, smtc_cpu_stats[i].selfipis); | ||
67 | totalen += len; | ||
68 | page += len; | ||
69 | } | ||
70 | len = sprintf(page, "%d Recoveries of \"stolen\" FPU\n", | ||
71 | atomic_read(&smtc_fpu_recoveries)); | ||
72 | totalen += len; | ||
73 | page += len; | ||
74 | 54 | ||
75 | return totalen; | 55 | static int smtc_proc_open(struct inode *inode, struct file *file) |
56 | { | ||
57 | return single_open(file, smtc_proc_show, NULL); | ||
76 | } | 58 | } |
77 | 59 | ||
60 | static const struct file_operations smtc_proc_fops = { | ||
61 | .open = smtc_proc_open, | ||
62 | .read = seq_read, | ||
63 | .llseek = seq_lseek, | ||
64 | .release = seq_release, | ||
65 | }; | ||
66 | |||
78 | void init_smtc_stats(void) | 67 | void init_smtc_stats(void) |
79 | { | 68 | { |
80 | int i; | 69 | int i; |
@@ -86,6 +75,5 @@ void init_smtc_stats(void) | |||
86 | 75 | ||
87 | atomic_set(&smtc_fpu_recoveries, 0); | 76 | atomic_set(&smtc_fpu_recoveries, 0); |
88 | 77 | ||
89 | smtc_stats = create_proc_read_entry("smtc", 0444, NULL, | 78 | proc_create("smtc", 0444, NULL, &smtc_proc_fops); |
90 | proc_read_smtc, NULL); | ||
91 | } | 79 | } |