diff options
author | Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> | 2009-04-06 14:26:07 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-04-07 18:15:05 -0400 |
commit | e4f6937222dbb61b8b8e62caca3d32e648b3b14b (patch) | |
tree | c84a8ff21a3b307a3115f1085ec631b0cf2a9fe5 /arch | |
parent | 577c9c456f0e1371cbade38eaf91ae8e8a308555 (diff) |
ACPI x86: Cleanup acpi_cpufreq structures related to aperf/mperf
Change structure name to make the code cleaner and simpler. No
functionality change in this patch.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c index 19f6b9d27e83..340bdbebba07 100644 --- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
@@ -241,23 +241,23 @@ static u32 get_cur_val(const struct cpumask *mask) | |||
241 | return cmd.val; | 241 | return cmd.val; |
242 | } | 242 | } |
243 | 243 | ||
244 | struct perf_cur { | 244 | struct perf_pair { |
245 | union { | 245 | union { |
246 | struct { | 246 | struct { |
247 | u32 lo; | 247 | u32 lo; |
248 | u32 hi; | 248 | u32 hi; |
249 | } split; | 249 | } split; |
250 | u64 whole; | 250 | u64 whole; |
251 | } aperf_cur, mperf_cur; | 251 | } aperf, mperf; |
252 | }; | 252 | }; |
253 | 253 | ||
254 | 254 | ||
255 | static long read_measured_perf_ctrs(void *_cur) | 255 | static long read_measured_perf_ctrs(void *_cur) |
256 | { | 256 | { |
257 | struct perf_cur *cur = _cur; | 257 | struct perf_pair *cur = _cur; |
258 | 258 | ||
259 | rdmsr(MSR_IA32_APERF, cur->aperf_cur.split.lo, cur->aperf_cur.split.hi); | 259 | rdmsr(MSR_IA32_APERF, cur->aperf.split.lo, cur->aperf.split.hi); |
260 | rdmsr(MSR_IA32_MPERF, cur->mperf_cur.split.lo, cur->mperf_cur.split.hi); | 260 | rdmsr(MSR_IA32_MPERF, cur->mperf.split.lo, cur->mperf.split.hi); |
261 | 261 | ||
262 | wrmsr(MSR_IA32_APERF, 0, 0); | 262 | wrmsr(MSR_IA32_APERF, 0, 0); |
263 | wrmsr(MSR_IA32_MPERF, 0, 0); | 263 | wrmsr(MSR_IA32_MPERF, 0, 0); |
@@ -281,7 +281,7 @@ static long read_measured_perf_ctrs(void *_cur) | |||
281 | static unsigned int get_measured_perf(struct cpufreq_policy *policy, | 281 | static unsigned int get_measured_perf(struct cpufreq_policy *policy, |
282 | unsigned int cpu) | 282 | unsigned int cpu) |
283 | { | 283 | { |
284 | struct perf_cur cur; | 284 | struct perf_pair cur; |
285 | unsigned int perf_percent; | 285 | unsigned int perf_percent; |
286 | unsigned int retval; | 286 | unsigned int retval; |
287 | 287 | ||
@@ -294,39 +294,37 @@ static unsigned int get_measured_perf(struct cpufreq_policy *policy, | |||
294 | * Get an approximate value. Return failure in case we cannot get | 294 | * Get an approximate value. Return failure in case we cannot get |
295 | * an approximate value. | 295 | * an approximate value. |
296 | */ | 296 | */ |
297 | if (unlikely(cur.aperf_cur.split.hi || cur.mperf_cur.split.hi)) { | 297 | if (unlikely(cur.aperf.split.hi || cur.mperf.split.hi)) { |
298 | int shift_count; | 298 | int shift_count; |
299 | u32 h; | 299 | u32 h; |
300 | 300 | ||
301 | h = max_t(u32, cur.aperf_cur.split.hi, cur.mperf_cur.split.hi); | 301 | h = max_t(u32, cur.aperf.split.hi, cur.mperf.split.hi); |
302 | shift_count = fls(h); | 302 | shift_count = fls(h); |
303 | 303 | ||
304 | cur.aperf_cur.whole >>= shift_count; | 304 | cur.aperf.whole >>= shift_count; |
305 | cur.mperf_cur.whole >>= shift_count; | 305 | cur.mperf.whole >>= shift_count; |
306 | } | 306 | } |
307 | 307 | ||
308 | if (((unsigned long)(-1) / 100) < cur.aperf_cur.split.lo) { | 308 | if (((unsigned long)(-1) / 100) < cur.aperf.split.lo) { |
309 | int shift_count = 7; | 309 | int shift_count = 7; |
310 | cur.aperf_cur.split.lo >>= shift_count; | 310 | cur.aperf.split.lo >>= shift_count; |
311 | cur.mperf_cur.split.lo >>= shift_count; | 311 | cur.mperf.split.lo >>= shift_count; |
312 | } | 312 | } |
313 | 313 | ||
314 | if (cur.aperf_cur.split.lo && cur.mperf_cur.split.lo) | 314 | if (cur.aperf.split.lo && cur.mperf.split.lo) |
315 | perf_percent = (cur.aperf_cur.split.lo * 100) / | 315 | perf_percent = (cur.aperf.split.lo * 100) / cur.mperf.split.lo; |
316 | cur.mperf_cur.split.lo; | ||
317 | else | 316 | else |
318 | perf_percent = 0; | 317 | perf_percent = 0; |
319 | 318 | ||
320 | #else | 319 | #else |
321 | if (unlikely(((unsigned long)(-1) / 100) < cur.aperf_cur.whole)) { | 320 | if (unlikely(((unsigned long)(-1) / 100) < cur.aperf.whole)) { |
322 | int shift_count = 7; | 321 | int shift_count = 7; |
323 | cur.aperf_cur.whole >>= shift_count; | 322 | cur.aperf.whole >>= shift_count; |
324 | cur.mperf_cur.whole >>= shift_count; | 323 | cur.mperf.whole >>= shift_count; |
325 | } | 324 | } |
326 | 325 | ||
327 | if (cur.aperf_cur.whole && cur.mperf_cur.whole) | 326 | if (cur.aperf.whole && cur.mperf.whole) |
328 | perf_percent = (cur.aperf_cur.whole * 100) / | 327 | perf_percent = (cur.aperf.whole * 100) / cur.mperf.whole; |
329 | cur.mperf_cur.whole; | ||
330 | else | 328 | else |
331 | perf_percent = 0; | 329 | perf_percent = 0; |
332 | 330 | ||