aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64/kernel/sysfs.c
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2005-09-06 00:47:49 -0400
committerPaul Mackerras <paulus@samba.org>2005-09-06 02:09:20 -0400
commitfd5b4377eacac42293b1a349dbb0f9892bf7f74a (patch)
tree7496a659e59ca45bbe841e10eaf5666faf2e1499 /arch/ppc64/kernel/sysfs.c
parent71839267f2554d76bb0862cdd0181a60bd0f4970 (diff)
[PATCH] ppc64: add number of PMCs to cputable
Add a field in the cputable struct to store the number of PMCs. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/ppc64/kernel/sysfs.c')
-rw-r--r--arch/ppc64/kernel/sysfs.c48
1 files changed, 29 insertions, 19 deletions
diff --git a/arch/ppc64/kernel/sysfs.c b/arch/ppc64/kernel/sysfs.c
index f311ee7c007..6654b350979 100644
--- a/arch/ppc64/kernel/sysfs.c
+++ b/arch/ppc64/kernel/sysfs.c
@@ -215,18 +215,23 @@ static void register_cpu_online(unsigned int cpu)
215 if (cpu_has_feature(CPU_FTR_MMCRA)) 215 if (cpu_has_feature(CPU_FTR_MMCRA))
216 sysdev_create_file(s, &attr_mmcra); 216 sysdev_create_file(s, &attr_mmcra);
217 217
218 sysdev_create_file(s, &attr_pmc1); 218 if (cur_cpu_spec->num_pmcs >= 1)
219 sysdev_create_file(s, &attr_pmc2); 219 sysdev_create_file(s, &attr_pmc1);
220 sysdev_create_file(s, &attr_pmc3); 220 if (cur_cpu_spec->num_pmcs >= 2)
221 sysdev_create_file(s, &attr_pmc4); 221 sysdev_create_file(s, &attr_pmc2);
222 sysdev_create_file(s, &attr_pmc5); 222 if (cur_cpu_spec->num_pmcs >= 3)
223 sysdev_create_file(s, &attr_pmc6); 223 sysdev_create_file(s, &attr_pmc3);
224 224 if (cur_cpu_spec->num_pmcs >= 4)
225 if (cpu_has_feature(CPU_FTR_PMC8)) { 225 sysdev_create_file(s, &attr_pmc4);
226 if (cur_cpu_spec->num_pmcs >= 5)
227 sysdev_create_file(s, &attr_pmc5);
228 if (cur_cpu_spec->num_pmcs >= 6)
229 sysdev_create_file(s, &attr_pmc6);
230 if (cur_cpu_spec->num_pmcs >= 7)
226 sysdev_create_file(s, &attr_pmc7); 231 sysdev_create_file(s, &attr_pmc7);
232 if (cur_cpu_spec->num_pmcs >= 8)
227 sysdev_create_file(s, &attr_pmc8); 233 sysdev_create_file(s, &attr_pmc8);
228 } 234
229
230 if (cpu_has_feature(CPU_FTR_SMT)) 235 if (cpu_has_feature(CPU_FTR_SMT))
231 sysdev_create_file(s, &attr_purr); 236 sysdev_create_file(s, &attr_purr);
232} 237}
@@ -252,17 +257,22 @@ static void unregister_cpu_online(unsigned int cpu)
252 if (cpu_has_feature(CPU_FTR_MMCRA)) 257 if (cpu_has_feature(CPU_FTR_MMCRA))
253 sysdev_remove_file(s, &attr_mmcra); 258 sysdev_remove_file(s, &attr_mmcra);
254 259
255 sysdev_remove_file(s, &attr_pmc1); 260 if (cur_cpu_spec->num_pmcs >= 1)
256 sysdev_remove_file(s, &attr_pmc2); 261 sysdev_remove_file(s, &attr_pmc1);
257 sysdev_remove_file(s, &attr_pmc3); 262 if (cur_cpu_spec->num_pmcs >= 2)
258 sysdev_remove_file(s, &attr_pmc4); 263 sysdev_remove_file(s, &attr_pmc2);
259 sysdev_remove_file(s, &attr_pmc5); 264 if (cur_cpu_spec->num_pmcs >= 3)
260 sysdev_remove_file(s, &attr_pmc6); 265 sysdev_remove_file(s, &attr_pmc3);
261 266 if (cur_cpu_spec->num_pmcs >= 4)
262 if (cpu_has_feature(CPU_FTR_PMC8)) { 267 sysdev_remove_file(s, &attr_pmc4);
268 if (cur_cpu_spec->num_pmcs >= 5)
269 sysdev_remove_file(s, &attr_pmc5);
270 if (cur_cpu_spec->num_pmcs >= 6)
271 sysdev_remove_file(s, &attr_pmc6);
272 if (cur_cpu_spec->num_pmcs >= 7)
263 sysdev_remove_file(s, &attr_pmc7); 273 sysdev_remove_file(s, &attr_pmc7);
274 if (cur_cpu_spec->num_pmcs >= 8)
264 sysdev_remove_file(s, &attr_pmc8); 275 sysdev_remove_file(s, &attr_pmc8);
265 }
266 276
267 if (cpu_has_feature(CPU_FTR_SMT)) 277 if (cpu_has_feature(CPU_FTR_SMT))
268 sysdev_remove_file(s, &attr_purr); 278 sysdev_remove_file(s, &attr_purr);