diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2011-03-27 09:04:46 -0400 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2011-05-04 11:50:57 -0400 |
commit | 2d06d8c49afdcc9bb35a85039fa50f0fe35bd40e (patch) | |
tree | d933a68fc71f6e2c3b95b744a87fa1d817bea3d6 /arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c | |
parent | 27ecddc2a9f99ce4ac9a59a0acd77f7100b6d034 (diff) |
[CPUFREQ] use dynamic debug instead of custom infrastructure
With dynamic debug having gained the capability to report debug messages
also during the boot process, it offers a far superior interface for
debug messages than the custom cpufreq infrastructure. As a first step,
remove the old cpufreq_debug_printk() function and replace it with a call
to the generic pr_debug() function.
How can dynamic debug be used on cpufreq? You need a kernel which has
CONFIG_DYNAMIC_DEBUG enabled.
To enabled debugging during runtime, mount debugfs and
$ echo -n 'module cpufreq +p' > /sys/kernel/debug/dynamic_debug/control
for debugging the complete "cpufreq" module. To achieve the same goal during
boot, append
ddebug_query="module cpufreq +p"
as a boot parameter to the kernel of your choice.
For more detailled instructions, please see
Documentation/dynamic-debug-howto.txt
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c')
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c index 907c8e637ef5..7b0603eb0129 100644 --- a/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c +++ b/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c | |||
@@ -48,9 +48,6 @@ | |||
48 | 48 | ||
49 | #define BUF_SZ 4 | 49 | #define BUF_SZ 4 |
50 | 50 | ||
51 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, \ | ||
52 | "pcc-cpufreq", msg) | ||
53 | |||
54 | struct pcc_register_resource { | 51 | struct pcc_register_resource { |
55 | u8 descriptor; | 52 | u8 descriptor; |
56 | u16 length; | 53 | u16 length; |
@@ -152,7 +149,7 @@ static unsigned int pcc_get_freq(unsigned int cpu) | |||
152 | 149 | ||
153 | spin_lock(&pcc_lock); | 150 | spin_lock(&pcc_lock); |
154 | 151 | ||
155 | dprintk("get: get_freq for CPU %d\n", cpu); | 152 | pr_debug("get: get_freq for CPU %d\n", cpu); |
156 | pcc_cpu_data = per_cpu_ptr(pcc_cpu_info, cpu); | 153 | pcc_cpu_data = per_cpu_ptr(pcc_cpu_info, cpu); |
157 | 154 | ||
158 | input_buffer = 0x1; | 155 | input_buffer = 0x1; |
@@ -170,7 +167,7 @@ static unsigned int pcc_get_freq(unsigned int cpu) | |||
170 | 167 | ||
171 | status = ioread16(&pcch_hdr->status); | 168 | status = ioread16(&pcch_hdr->status); |
172 | if (status != CMD_COMPLETE) { | 169 | if (status != CMD_COMPLETE) { |
173 | dprintk("get: FAILED: for CPU %d, status is %d\n", | 170 | pr_debug("get: FAILED: for CPU %d, status is %d\n", |
174 | cpu, status); | 171 | cpu, status); |
175 | goto cmd_incomplete; | 172 | goto cmd_incomplete; |
176 | } | 173 | } |
@@ -178,14 +175,14 @@ static unsigned int pcc_get_freq(unsigned int cpu) | |||
178 | curr_freq = (((ioread32(&pcch_hdr->nominal) * (output_buffer & 0xff)) | 175 | curr_freq = (((ioread32(&pcch_hdr->nominal) * (output_buffer & 0xff)) |
179 | / 100) * 1000); | 176 | / 100) * 1000); |
180 | 177 | ||
181 | dprintk("get: SUCCESS: (virtual) output_offset for cpu %d is " | 178 | pr_debug("get: SUCCESS: (virtual) output_offset for cpu %d is " |
182 | "0x%x, contains a value of: 0x%x. Speed is: %d MHz\n", | 179 | "0x%p, contains a value of: 0x%x. Speed is: %d MHz\n", |
183 | cpu, (pcch_virt_addr + pcc_cpu_data->output_offset), | 180 | cpu, (pcch_virt_addr + pcc_cpu_data->output_offset), |
184 | output_buffer, curr_freq); | 181 | output_buffer, curr_freq); |
185 | 182 | ||
186 | freq_limit = (output_buffer >> 8) & 0xff; | 183 | freq_limit = (output_buffer >> 8) & 0xff; |
187 | if (freq_limit != 0xff) { | 184 | if (freq_limit != 0xff) { |
188 | dprintk("get: frequency for cpu %d is being temporarily" | 185 | pr_debug("get: frequency for cpu %d is being temporarily" |
189 | " capped at %d\n", cpu, curr_freq); | 186 | " capped at %d\n", cpu, curr_freq); |
190 | } | 187 | } |
191 | 188 | ||
@@ -212,8 +209,8 @@ static int pcc_cpufreq_target(struct cpufreq_policy *policy, | |||
212 | cpu = policy->cpu; | 209 | cpu = policy->cpu; |
213 | pcc_cpu_data = per_cpu_ptr(pcc_cpu_info, cpu); | 210 | pcc_cpu_data = per_cpu_ptr(pcc_cpu_info, cpu); |
214 | 211 | ||
215 | dprintk("target: CPU %d should go to target freq: %d " | 212 | pr_debug("target: CPU %d should go to target freq: %d " |
216 | "(virtual) input_offset is 0x%x\n", | 213 | "(virtual) input_offset is 0x%p\n", |
217 | cpu, target_freq, | 214 | cpu, target_freq, |
218 | (pcch_virt_addr + pcc_cpu_data->input_offset)); | 215 | (pcch_virt_addr + pcc_cpu_data->input_offset)); |
219 | 216 | ||
@@ -234,14 +231,14 @@ static int pcc_cpufreq_target(struct cpufreq_policy *policy, | |||
234 | 231 | ||
235 | status = ioread16(&pcch_hdr->status); | 232 | status = ioread16(&pcch_hdr->status); |
236 | if (status != CMD_COMPLETE) { | 233 | if (status != CMD_COMPLETE) { |
237 | dprintk("target: FAILED for cpu %d, with status: 0x%x\n", | 234 | pr_debug("target: FAILED for cpu %d, with status: 0x%x\n", |
238 | cpu, status); | 235 | cpu, status); |
239 | goto cmd_incomplete; | 236 | goto cmd_incomplete; |
240 | } | 237 | } |
241 | iowrite16(0, &pcch_hdr->status); | 238 | iowrite16(0, &pcch_hdr->status); |
242 | 239 | ||
243 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 240 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); |
244 | dprintk("target: was SUCCESSFUL for cpu %d\n", cpu); | 241 | pr_debug("target: was SUCCESSFUL for cpu %d\n", cpu); |
245 | spin_unlock(&pcc_lock); | 242 | spin_unlock(&pcc_lock); |
246 | 243 | ||
247 | return 0; | 244 | return 0; |
@@ -293,7 +290,7 @@ static int pcc_get_offset(int cpu) | |||
293 | memset_io((pcch_virt_addr + pcc_cpu_data->input_offset), 0, BUF_SZ); | 290 | memset_io((pcch_virt_addr + pcc_cpu_data->input_offset), 0, BUF_SZ); |
294 | memset_io((pcch_virt_addr + pcc_cpu_data->output_offset), 0, BUF_SZ); | 291 | memset_io((pcch_virt_addr + pcc_cpu_data->output_offset), 0, BUF_SZ); |
295 | 292 | ||
296 | dprintk("pcc_get_offset: for CPU %d: pcc_cpu_data " | 293 | pr_debug("pcc_get_offset: for CPU %d: pcc_cpu_data " |
297 | "input_offset: 0x%x, pcc_cpu_data output_offset: 0x%x\n", | 294 | "input_offset: 0x%x, pcc_cpu_data output_offset: 0x%x\n", |
298 | cpu, pcc_cpu_data->input_offset, pcc_cpu_data->output_offset); | 295 | cpu, pcc_cpu_data->input_offset, pcc_cpu_data->output_offset); |
299 | out_free: | 296 | out_free: |
@@ -410,7 +407,7 @@ static int __init pcc_cpufreq_probe(void) | |||
410 | if (ACPI_SUCCESS(status)) { | 407 | if (ACPI_SUCCESS(status)) { |
411 | ret = pcc_cpufreq_do_osc(&osc_handle); | 408 | ret = pcc_cpufreq_do_osc(&osc_handle); |
412 | if (ret) | 409 | if (ret) |
413 | dprintk("probe: _OSC evaluation did not succeed\n"); | 410 | pr_debug("probe: _OSC evaluation did not succeed\n"); |
414 | /* Firmware's use of _OSC is optional */ | 411 | /* Firmware's use of _OSC is optional */ |
415 | ret = 0; | 412 | ret = 0; |
416 | } | 413 | } |
@@ -433,7 +430,7 @@ static int __init pcc_cpufreq_probe(void) | |||
433 | 430 | ||
434 | mem_resource = (struct pcc_memory_resource *)member->buffer.pointer; | 431 | mem_resource = (struct pcc_memory_resource *)member->buffer.pointer; |
435 | 432 | ||
436 | dprintk("probe: mem_resource descriptor: 0x%x," | 433 | pr_debug("probe: mem_resource descriptor: 0x%x," |
437 | " length: %d, space_id: %d, resource_usage: %d," | 434 | " length: %d, space_id: %d, resource_usage: %d," |
438 | " type_specific: %d, granularity: 0x%llx," | 435 | " type_specific: %d, granularity: 0x%llx," |
439 | " minimum: 0x%llx, maximum: 0x%llx," | 436 | " minimum: 0x%llx, maximum: 0x%llx," |
@@ -453,13 +450,13 @@ static int __init pcc_cpufreq_probe(void) | |||
453 | pcch_virt_addr = ioremap_nocache(mem_resource->minimum, | 450 | pcch_virt_addr = ioremap_nocache(mem_resource->minimum, |
454 | mem_resource->address_length); | 451 | mem_resource->address_length); |
455 | if (pcch_virt_addr == NULL) { | 452 | if (pcch_virt_addr == NULL) { |
456 | dprintk("probe: could not map shared mem region\n"); | 453 | pr_debug("probe: could not map shared mem region\n"); |
457 | goto out_free; | 454 | goto out_free; |
458 | } | 455 | } |
459 | pcch_hdr = pcch_virt_addr; | 456 | pcch_hdr = pcch_virt_addr; |
460 | 457 | ||
461 | dprintk("probe: PCCH header (virtual) addr: 0x%p\n", pcch_hdr); | 458 | pr_debug("probe: PCCH header (virtual) addr: 0x%p\n", pcch_hdr); |
462 | dprintk("probe: PCCH header is at physical address: 0x%llx," | 459 | pr_debug("probe: PCCH header is at physical address: 0x%llx," |
463 | " signature: 0x%x, length: %d bytes, major: %d, minor: %d," | 460 | " signature: 0x%x, length: %d bytes, major: %d, minor: %d," |
464 | " supported features: 0x%x, command field: 0x%x," | 461 | " supported features: 0x%x, command field: 0x%x," |
465 | " status field: 0x%x, nominal latency: %d us\n", | 462 | " status field: 0x%x, nominal latency: %d us\n", |
@@ -469,7 +466,7 @@ static int __init pcc_cpufreq_probe(void) | |||
469 | ioread16(&pcch_hdr->command), ioread16(&pcch_hdr->status), | 466 | ioread16(&pcch_hdr->command), ioread16(&pcch_hdr->status), |
470 | ioread32(&pcch_hdr->latency)); | 467 | ioread32(&pcch_hdr->latency)); |
471 | 468 | ||
472 | dprintk("probe: min time between commands: %d us," | 469 | pr_debug("probe: min time between commands: %d us," |
473 | " max time between commands: %d us," | 470 | " max time between commands: %d us," |
474 | " nominal CPU frequency: %d MHz," | 471 | " nominal CPU frequency: %d MHz," |
475 | " minimum CPU frequency: %d MHz," | 472 | " minimum CPU frequency: %d MHz," |
@@ -494,7 +491,7 @@ static int __init pcc_cpufreq_probe(void) | |||
494 | doorbell.access_width = 64; | 491 | doorbell.access_width = 64; |
495 | doorbell.address = reg_resource->address; | 492 | doorbell.address = reg_resource->address; |
496 | 493 | ||
497 | dprintk("probe: doorbell: space_id is %d, bit_width is %d, " | 494 | pr_debug("probe: doorbell: space_id is %d, bit_width is %d, " |
498 | "bit_offset is %d, access_width is %d, address is 0x%llx\n", | 495 | "bit_offset is %d, access_width is %d, address is 0x%llx\n", |
499 | doorbell.space_id, doorbell.bit_width, doorbell.bit_offset, | 496 | doorbell.space_id, doorbell.bit_width, doorbell.bit_offset, |
500 | doorbell.access_width, reg_resource->address); | 497 | doorbell.access_width, reg_resource->address); |
@@ -515,7 +512,7 @@ static int __init pcc_cpufreq_probe(void) | |||
515 | 512 | ||
516 | doorbell_write = member->integer.value; | 513 | doorbell_write = member->integer.value; |
517 | 514 | ||
518 | dprintk("probe: doorbell_preserve: 0x%llx," | 515 | pr_debug("probe: doorbell_preserve: 0x%llx," |
519 | " doorbell_write: 0x%llx\n", | 516 | " doorbell_write: 0x%llx\n", |
520 | doorbell_preserve, doorbell_write); | 517 | doorbell_preserve, doorbell_write); |
521 | 518 | ||
@@ -550,7 +547,7 @@ static int pcc_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
550 | 547 | ||
551 | result = pcc_get_offset(cpu); | 548 | result = pcc_get_offset(cpu); |
552 | if (result) { | 549 | if (result) { |
553 | dprintk("init: PCCP evaluation failed\n"); | 550 | pr_debug("init: PCCP evaluation failed\n"); |
554 | goto out; | 551 | goto out; |
555 | } | 552 | } |
556 | 553 | ||
@@ -561,12 +558,12 @@ static int pcc_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
561 | policy->cur = pcc_get_freq(cpu); | 558 | policy->cur = pcc_get_freq(cpu); |
562 | 559 | ||
563 | if (!policy->cur) { | 560 | if (!policy->cur) { |
564 | dprintk("init: Unable to get current CPU frequency\n"); | 561 | pr_debug("init: Unable to get current CPU frequency\n"); |
565 | result = -EINVAL; | 562 | result = -EINVAL; |
566 | goto out; | 563 | goto out; |
567 | } | 564 | } |
568 | 565 | ||
569 | dprintk("init: policy->max is %d, policy->min is %d\n", | 566 | pr_debug("init: policy->max is %d, policy->min is %d\n", |
570 | policy->max, policy->min); | 567 | policy->max, policy->min); |
571 | out: | 568 | out: |
572 | return result; | 569 | return result; |
@@ -597,7 +594,7 @@ static int __init pcc_cpufreq_init(void) | |||
597 | 594 | ||
598 | ret = pcc_cpufreq_probe(); | 595 | ret = pcc_cpufreq_probe(); |
599 | if (ret) { | 596 | if (ret) { |
600 | dprintk("pcc_cpufreq_init: PCCH evaluation failed\n"); | 597 | pr_debug("pcc_cpufreq_init: PCCH evaluation failed\n"); |
601 | return ret; | 598 | return ret; |
602 | } | 599 | } |
603 | 600 | ||