Commit 4cd78871 authored by Dave Jones's avatar Dave Jones

[CPUFREQ] Use the unified cpufreq debug infrastructure in the speedstep-ich driver.

Modified existing dprintks and added a few which might be / have been
of interest.
Signed-off-by: default avatarDominik Brodowski <linux@brodo.de>
Signed-off-by: default avatarDave Jones <davej@redhat.com>
parent 12e65e5c
...@@ -52,16 +52,7 @@ static struct cpufreq_frequency_table speedstep_freqs[] = { ...@@ -52,16 +52,7 @@ static struct cpufreq_frequency_table speedstep_freqs[] = {
}; };
/* DEBUG #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "speedstep-ich", msg)
* Define it if you want verbose debug output, e.g. for bug reporting
*/
//#define SPEEDSTEP_DEBUG
#ifdef SPEEDSTEP_DEBUG
#define dprintk(msg...) printk(msg)
#else
#define dprintk(msg...) do { } while(0)
#endif
/** /**
...@@ -83,13 +74,13 @@ static void speedstep_set_state (unsigned int state) ...@@ -83,13 +74,13 @@ static void speedstep_set_state (unsigned int state)
/* get PMBASE */ /* get PMBASE */
pci_read_config_dword(speedstep_chipset_dev, 0x40, &pmbase); pci_read_config_dword(speedstep_chipset_dev, 0x40, &pmbase);
if (!(pmbase & 0x01)) { if (!(pmbase & 0x01)) {
printk(KERN_ERR "cpufreq: could not find speedstep register\n"); printk(KERN_ERR "speedstep-ich: could not find speedstep register\n");
return; return;
} }
pmbase &= 0xFFFFFFFE; pmbase &= 0xFFFFFFFE;
if (!pmbase) { if (!pmbase) {
printk(KERN_ERR "cpufreq: could not find speedstep register\n"); printk(KERN_ERR "speedstep-ich: could not find speedstep register\n");
return; return;
} }
...@@ -99,13 +90,13 @@ static void speedstep_set_state (unsigned int state) ...@@ -99,13 +90,13 @@ static void speedstep_set_state (unsigned int state)
/* read state */ /* read state */
value = inb(pmbase + 0x50); value = inb(pmbase + 0x50);
dprintk(KERN_DEBUG "cpufreq: read at pmbase 0x%x + 0x50 returned 0x%x\n", pmbase, value); dprintk("read at pmbase 0x%x + 0x50 returned 0x%x\n", pmbase, value);
/* write new state */ /* write new state */
value &= 0xFE; value &= 0xFE;
value |= state; value |= state;
dprintk(KERN_DEBUG "cpufreq: writing 0x%x to pmbase 0x%x + 0x50\n", value, pmbase); dprintk("writing 0x%x to pmbase 0x%x + 0x50\n", value, pmbase);
/* Disable bus master arbitration */ /* Disable bus master arbitration */
pm2_blk = inb(pmbase + 0x20); pm2_blk = inb(pmbase + 0x20);
...@@ -125,10 +116,10 @@ static void speedstep_set_state (unsigned int state) ...@@ -125,10 +116,10 @@ static void speedstep_set_state (unsigned int state)
/* Enable IRQs */ /* Enable IRQs */
local_irq_restore(flags); local_irq_restore(flags);
dprintk(KERN_DEBUG "cpufreq: read at pmbase 0x%x + 0x50 returned 0x%x\n", pmbase, value); dprintk("read at pmbase 0x%x + 0x50 returned 0x%x\n", pmbase, value);
if (state == (value & 0x1)) { if (state == (value & 0x1)) {
dprintk (KERN_INFO "cpufreq: change to %u MHz succeeded\n", (speedstep_get_processor_frequency(speedstep_processor) / 1000)); dprintk("change to %u MHz succeeded\n", (speedstep_get_processor_frequency(speedstep_processor) / 1000));
} else { } else {
printk (KERN_ERR "cpufreq: change failed - I/O error\n"); printk (KERN_ERR "cpufreq: change failed - I/O error\n");
} }
...@@ -153,7 +144,7 @@ static int speedstep_activate (void) ...@@ -153,7 +144,7 @@ static int speedstep_activate (void)
pci_read_config_word(speedstep_chipset_dev, 0x00A0, &value); pci_read_config_word(speedstep_chipset_dev, 0x00A0, &value);
if (!(value & 0x08)) { if (!(value & 0x08)) {
value |= 0x08; value |= 0x08;
dprintk(KERN_DEBUG "cpufreq: activating SpeedStep (TM) registers\n"); dprintk("activating SpeedStep (TM) registers\n");
pci_write_config_word(speedstep_chipset_dev, 0x00A0, value); pci_write_config_word(speedstep_chipset_dev, 0x00A0, value);
} }
...@@ -212,7 +203,7 @@ static unsigned int speedstep_detect_chipset (void) ...@@ -212,7 +203,7 @@ static unsigned int speedstep_detect_chipset (void)
pci_read_config_byte(hostbridge, PCI_REVISION_ID, &rev); pci_read_config_byte(hostbridge, PCI_REVISION_ID, &rev);
if (rev < 5) { if (rev < 5) {
dprintk(KERN_INFO "cpufreq: hostbridge does not support speedstep\n"); dprintk("hostbridge does not support speedstep\n");
speedstep_chipset_dev = NULL; speedstep_chipset_dev = NULL;
pci_dev_put(hostbridge); pci_dev_put(hostbridge);
return 0; return 0;
...@@ -234,6 +225,7 @@ static unsigned int _speedstep_get(cpumask_t cpus) ...@@ -234,6 +225,7 @@ static unsigned int _speedstep_get(cpumask_t cpus)
set_cpus_allowed(current, cpus); set_cpus_allowed(current, cpus);
speed = speedstep_get_processor_frequency(speedstep_processor); speed = speedstep_get_processor_frequency(speedstep_processor);
set_cpus_allowed(current, cpus_allowed); set_cpus_allowed(current, cpus_allowed);
dprintk("detected %u kHz as current frequency\n", speed);
return speed; return speed;
} }
...@@ -266,6 +258,8 @@ static int speedstep_target (struct cpufreq_policy *policy, ...@@ -266,6 +258,8 @@ static int speedstep_target (struct cpufreq_policy *policy,
freqs.new = speedstep_freqs[newstate].frequency; freqs.new = speedstep_freqs[newstate].frequency;
freqs.cpu = policy->cpu; freqs.cpu = policy->cpu;
dprintk("transiting from %u to %u kHz\n", freqs.old, freqs.new);
/* no transition necessary */ /* no transition necessary */
if (freqs.old == freqs.new) if (freqs.old == freqs.new)
return 0; return 0;
...@@ -335,7 +329,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) ...@@ -335,7 +329,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
if (!speed) if (!speed)
return -EIO; return -EIO;
dprintk(KERN_INFO "cpufreq: currently at %s speed setting - %i MHz\n", dprintk("currently at %s speed setting - %i MHz\n",
(speed == speedstep_freqs[SPEEDSTEP_LOW].frequency) ? "low" : "high", (speed == speedstep_freqs[SPEEDSTEP_LOW].frequency) ? "low" : "high",
(speed / 1000)); (speed / 1000));
...@@ -389,12 +383,14 @@ static int __init speedstep_init(void) ...@@ -389,12 +383,14 @@ static int __init speedstep_init(void)
{ {
/* detect processor */ /* detect processor */
speedstep_processor = speedstep_detect_processor(); speedstep_processor = speedstep_detect_processor();
if (!speedstep_processor) if (!speedstep_processor) {
dprintk("Intel(R) SpeedStep(TM) capable processor not found\n");
return -ENODEV; return -ENODEV;
}
/* detect chipset */ /* detect chipset */
if (!speedstep_detect_chipset()) { if (!speedstep_detect_chipset()) {
printk(KERN_INFO "cpufreq: Intel(R) SpeedStep(TM) for this chipset not (yet) available.\n"); dprintk("Intel(R) SpeedStep(TM) for this chipset not (yet) available.\n");
return -ENODEV; return -ENODEV;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment