aboutsummaryrefslogtreecommitdiffstats
path: root/arch
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
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')
-rw-r--r--arch/ppc64/kernel/cputable.c13
-rw-r--r--arch/ppc64/kernel/sysfs.c48
2 files changed, 42 insertions, 19 deletions
diff --git a/arch/ppc64/kernel/cputable.c b/arch/ppc64/kernel/cputable.c
index 4847f2ac8c9f..a20960e47105 100644
--- a/arch/ppc64/kernel/cputable.c
+++ b/arch/ppc64/kernel/cputable.c
@@ -59,6 +59,7 @@ struct cpu_spec cpu_specs[] = {
59 .cpu_user_features = COMMON_USER_PPC64, 59 .cpu_user_features = COMMON_USER_PPC64,
60 .icache_bsize = 128, 60 .icache_bsize = 128,
61 .dcache_bsize = 128, 61 .dcache_bsize = 128,
62 .num_pmcs = 8,
62 .cpu_setup = __setup_cpu_power3, 63 .cpu_setup = __setup_cpu_power3,
63 }, 64 },
64 { /* Power3+ */ 65 { /* Power3+ */
@@ -71,6 +72,7 @@ struct cpu_spec cpu_specs[] = {
71 .cpu_user_features = COMMON_USER_PPC64, 72 .cpu_user_features = COMMON_USER_PPC64,
72 .icache_bsize = 128, 73 .icache_bsize = 128,
73 .dcache_bsize = 128, 74 .dcache_bsize = 128,
75 .num_pmcs = 8,
74 .cpu_setup = __setup_cpu_power3, 76 .cpu_setup = __setup_cpu_power3,
75 }, 77 },
76 { /* Northstar */ 78 { /* Northstar */
@@ -83,6 +85,7 @@ struct cpu_spec cpu_specs[] = {
83 .cpu_user_features = COMMON_USER_PPC64, 85 .cpu_user_features = COMMON_USER_PPC64,
84 .icache_bsize = 128, 86 .icache_bsize = 128,
85 .dcache_bsize = 128, 87 .dcache_bsize = 128,
88 .num_pmcs = 8,
86 .cpu_setup = __setup_cpu_power3, 89 .cpu_setup = __setup_cpu_power3,
87 }, 90 },
88 { /* Pulsar */ 91 { /* Pulsar */
@@ -95,6 +98,7 @@ struct cpu_spec cpu_specs[] = {
95 .cpu_user_features = COMMON_USER_PPC64, 98 .cpu_user_features = COMMON_USER_PPC64,
96 .icache_bsize = 128, 99 .icache_bsize = 128,
97 .dcache_bsize = 128, 100 .dcache_bsize = 128,
101 .num_pmcs = 8,
98 .cpu_setup = __setup_cpu_power3, 102 .cpu_setup = __setup_cpu_power3,
99 }, 103 },
100 { /* I-star */ 104 { /* I-star */
@@ -107,6 +111,7 @@ struct cpu_spec cpu_specs[] = {
107 .cpu_user_features = COMMON_USER_PPC64, 111 .cpu_user_features = COMMON_USER_PPC64,
108 .icache_bsize = 128, 112 .icache_bsize = 128,
109 .dcache_bsize = 128, 113 .dcache_bsize = 128,
114 .num_pmcs = 8,
110 .cpu_setup = __setup_cpu_power3, 115 .cpu_setup = __setup_cpu_power3,
111 }, 116 },
112 { /* S-star */ 117 { /* S-star */
@@ -119,6 +124,7 @@ struct cpu_spec cpu_specs[] = {
119 .cpu_user_features = COMMON_USER_PPC64, 124 .cpu_user_features = COMMON_USER_PPC64,
120 .icache_bsize = 128, 125 .icache_bsize = 128,
121 .dcache_bsize = 128, 126 .dcache_bsize = 128,
127 .num_pmcs = 8,
122 .cpu_setup = __setup_cpu_power3, 128 .cpu_setup = __setup_cpu_power3,
123 }, 129 },
124 { /* Power4 */ 130 { /* Power4 */
@@ -131,6 +137,7 @@ struct cpu_spec cpu_specs[] = {
131 .cpu_user_features = COMMON_USER_PPC64, 137 .cpu_user_features = COMMON_USER_PPC64,
132 .icache_bsize = 128, 138 .icache_bsize = 128,
133 .dcache_bsize = 128, 139 .dcache_bsize = 128,
140 .num_pmcs = 8,
134 .cpu_setup = __setup_cpu_power4, 141 .cpu_setup = __setup_cpu_power4,
135 }, 142 },
136 { /* Power4+ */ 143 { /* Power4+ */
@@ -143,6 +150,7 @@ struct cpu_spec cpu_specs[] = {
143 .cpu_user_features = COMMON_USER_PPC64, 150 .cpu_user_features = COMMON_USER_PPC64,
144 .icache_bsize = 128, 151 .icache_bsize = 128,
145 .dcache_bsize = 128, 152 .dcache_bsize = 128,
153 .num_pmcs = 8,
146 .cpu_setup = __setup_cpu_power4, 154 .cpu_setup = __setup_cpu_power4,
147 }, 155 },
148 { /* PPC970 */ 156 { /* PPC970 */
@@ -157,6 +165,7 @@ struct cpu_spec cpu_specs[] = {
157 PPC_FEATURE_HAS_ALTIVEC_COMP, 165 PPC_FEATURE_HAS_ALTIVEC_COMP,
158 .icache_bsize = 128, 166 .icache_bsize = 128,
159 .dcache_bsize = 128, 167 .dcache_bsize = 128,
168 .num_pmcs = 8,
160 .cpu_setup = __setup_cpu_ppc970, 169 .cpu_setup = __setup_cpu_ppc970,
161 }, 170 },
162 { /* PPC970FX */ 171 { /* PPC970FX */
@@ -171,6 +180,7 @@ struct cpu_spec cpu_specs[] = {
171 PPC_FEATURE_HAS_ALTIVEC_COMP, 180 PPC_FEATURE_HAS_ALTIVEC_COMP,
172 .icache_bsize = 128, 181 .icache_bsize = 128,
173 .dcache_bsize = 128, 182 .dcache_bsize = 128,
183 .num_pmcs = 8,
174 .cpu_setup = __setup_cpu_ppc970, 184 .cpu_setup = __setup_cpu_ppc970,
175 }, 185 },
176 { /* PPC970MP */ 186 { /* PPC970MP */
@@ -199,6 +209,7 @@ struct cpu_spec cpu_specs[] = {
199 .cpu_user_features = COMMON_USER_PPC64, 209 .cpu_user_features = COMMON_USER_PPC64,
200 .icache_bsize = 128, 210 .icache_bsize = 128,
201 .dcache_bsize = 128, 211 .dcache_bsize = 128,
212 .num_pmcs = 6,
202 .cpu_setup = __setup_cpu_power4, 213 .cpu_setup = __setup_cpu_power4,
203 }, 214 },
204 { /* Power5 */ 215 { /* Power5 */
@@ -213,6 +224,7 @@ struct cpu_spec cpu_specs[] = {
213 .cpu_user_features = COMMON_USER_PPC64, 224 .cpu_user_features = COMMON_USER_PPC64,
214 .icache_bsize = 128, 225 .icache_bsize = 128,
215 .dcache_bsize = 128, 226 .dcache_bsize = 128,
227 .num_pmcs = 6,
216 .cpu_setup = __setup_cpu_power4, 228 .cpu_setup = __setup_cpu_power4,
217 }, 229 },
218 { /* BE DD1.x */ 230 { /* BE DD1.x */
@@ -239,6 +251,7 @@ struct cpu_spec cpu_specs[] = {
239 .cpu_user_features = COMMON_USER_PPC64, 251 .cpu_user_features = COMMON_USER_PPC64,
240 .icache_bsize = 128, 252 .icache_bsize = 128,
241 .dcache_bsize = 128, 253 .dcache_bsize = 128,
254 .num_pmcs = 6,
242 .cpu_setup = __setup_cpu_power4, 255 .cpu_setup = __setup_cpu_power4,
243 } 256 }
244}; 257};
diff --git a/arch/ppc64/kernel/sysfs.c b/arch/ppc64/kernel/sysfs.c
index f311ee7c0070..6654b350979c 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);