2 * /proc hooks for SMTC kernel
3 * Copyright (C) 2005 Mips Technologies, Inc
6 #include <linux/kernel.h>
7 #include <linux/sched.h>
8 #include <linux/cpumask.h>
9 #include <linux/interrupt.h>
12 #include <asm/processor.h>
13 #include <linux/atomic.h>
14 #include <asm/hardirq.h>
15 #include <asm/mmu_context.h>
16 #include <asm/mipsregs.h>
17 #include <asm/cacheflush.h>
18 #include <linux/proc_fs.h>
20 #include <asm/smtc_proc.h>
23 * /proc diagnostic and statistics hooks
29 unsigned long selfipis[NR_CPUS];
31 struct smtc_cpu_proc smtc_cpu_stats[NR_CPUS];
33 static struct proc_dir_entry *smtc_stats;
35 atomic_t smtc_fpu_recoveries;
37 static int proc_read_smtc(char *page, char **start, off_t off,
38 int count, int *eof, void *data)
43 extern unsigned long ebase;
45 len = sprintf(page, "SMTC Status Word: 0x%08x\n", smtc_status);
48 len = sprintf(page, "Config7: 0x%08x\n", read_c0_config7());
51 len = sprintf(page, "EBASE: 0x%08lx\n", ebase);
54 len = sprintf(page, "Counter Interrupts taken per CPU (TC)\n");
57 for (i=0; i < NR_CPUS; i++) {
58 len = sprintf(page, "%d: %ld\n", i, smtc_cpu_stats[i].timerints);
62 len = sprintf(page, "Self-IPIs by CPU:\n");
65 for(i = 0; i < NR_CPUS; i++) {
66 len = sprintf(page, "%d: %ld\n", i, smtc_cpu_stats[i].selfipis);
70 len = sprintf(page, "%d Recoveries of \"stolen\" FPU\n",
71 atomic_read(&smtc_fpu_recoveries));
78 void init_smtc_stats(void)
82 for (i=0; i<NR_CPUS; i++) {
83 smtc_cpu_stats[i].timerints = 0;
84 smtc_cpu_stats[i].selfipis = 0;
87 atomic_set(&smtc_fpu_recoveries, 0);
89 smtc_stats = create_proc_read_entry("smtc", 0444, NULL,
90 proc_read_smtc, NULL);