diff options
Diffstat (limited to 'arch/mips/oprofile/op_model_mipsxx.c')
-rw-r--r-- | arch/mips/oprofile/op_model_mipsxx.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/arch/mips/oprofile/op_model_mipsxx.c b/arch/mips/oprofile/op_model_mipsxx.c index d36b64dfcb2..1d1eee407fa 100644 --- a/arch/mips/oprofile/op_model_mipsxx.c +++ b/arch/mips/oprofile/op_model_mipsxx.c | |||
@@ -114,11 +114,12 @@ static void mipsxx_cpu_stop(void *args) | |||
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | static void mipsxx_perfcount_handler(struct pt_regs *regs) | 117 | static int mipsxx_perfcount_handler(struct pt_regs *regs) |
118 | { | 118 | { |
119 | unsigned int counters = op_model_mipsxx.num_counters; | 119 | unsigned int counters = op_model_mipsxx.num_counters; |
120 | unsigned int control; | 120 | unsigned int control; |
121 | unsigned int counter; | 121 | unsigned int counter; |
122 | int handled = 0; | ||
122 | 123 | ||
123 | switch (counters) { | 124 | switch (counters) { |
124 | #define HANDLE_COUNTER(n) \ | 125 | #define HANDLE_COUNTER(n) \ |
@@ -129,12 +130,15 @@ static void mipsxx_perfcount_handler(struct pt_regs *regs) | |||
129 | (counter & M_COUNTER_OVERFLOW)) { \ | 130 | (counter & M_COUNTER_OVERFLOW)) { \ |
130 | oprofile_add_sample(regs, n); \ | 131 | oprofile_add_sample(regs, n); \ |
131 | write_c0_perfcntr ## n(reg.counter[n]); \ | 132 | write_c0_perfcntr ## n(reg.counter[n]); \ |
133 | handled = 1; \ | ||
132 | } | 134 | } |
133 | HANDLE_COUNTER(3) | 135 | HANDLE_COUNTER(3) |
134 | HANDLE_COUNTER(2) | 136 | HANDLE_COUNTER(2) |
135 | HANDLE_COUNTER(1) | 137 | HANDLE_COUNTER(1) |
136 | HANDLE_COUNTER(0) | 138 | HANDLE_COUNTER(0) |
137 | } | 139 | } |
140 | |||
141 | return handled; | ||
138 | } | 142 | } |
139 | 143 | ||
140 | #define M_CONFIG1_PC (1 << 4) | 144 | #define M_CONFIG1_PC (1 << 4) |
@@ -176,17 +180,31 @@ static int __init mipsxx_init(void) | |||
176 | int counters; | 180 | int counters; |
177 | 181 | ||
178 | counters = n_counters(); | 182 | counters = n_counters(); |
179 | if (counters == 0) | 183 | if (counters == 0) { |
184 | printk(KERN_ERR "Oprofile: CPU has no performance counters\n"); | ||
180 | return -ENODEV; | 185 | return -ENODEV; |
186 | } | ||
181 | 187 | ||
182 | reset_counters(counters); | 188 | reset_counters(counters); |
183 | 189 | ||
184 | op_model_mipsxx.num_counters = counters; | 190 | op_model_mipsxx.num_counters = counters; |
185 | switch (current_cpu_data.cputype) { | 191 | switch (current_cpu_data.cputype) { |
192 | case CPU_20KC: | ||
193 | op_model_mipsxx.cpu_type = "mips/20K"; | ||
194 | break; | ||
195 | |||
186 | case CPU_24K: | 196 | case CPU_24K: |
187 | op_model_mipsxx.cpu_type = "mips/24K"; | 197 | op_model_mipsxx.cpu_type = "mips/24K"; |
188 | break; | 198 | break; |
189 | 199 | ||
200 | case CPU_25KF: | ||
201 | op_model_mipsxx.cpu_type = "mips/25K"; | ||
202 | break; | ||
203 | |||
204 | case CPU_5KC: | ||
205 | op_model_mipsxx.cpu_type = "mips/5K"; | ||
206 | break; | ||
207 | |||
190 | default: | 208 | default: |
191 | printk(KERN_ERR "Profiling unsupported for this CPU\n"); | 209 | printk(KERN_ERR "Profiling unsupported for this CPU\n"); |
192 | 210 | ||