Commit bbf70132 authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq

* master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq:
  [CPUFREQ] sets nforce2 minimum PLL divider to 2.
  [CPUFREQ] Make powernow-k7 work on SMP kernels.
  [CPUFREQ] cpufreq core {d,}printk adjustments
  [CPUFREQ] dprintk adjustments to cpufreq-speedstep-centrino
  [CPUFREQ] dprintk adjustments to cpufreq-nforce2
  [CPUFREQ] Prepare powernow-k8 for future CPUs.
  [CPUFREQ] Make acpi-cpufreq 'sticky'.
  [CPUFREQ] Remove strange No-op from longrun.c
  [CPUFREQ] Remove more freq_table reinitialisations.
  [CPUFREQ] Fix another redundant initialisation in freq_table
  [CPUFREQ] Remove duplicate assignment in freq_table
  [CPUFREQ] CodingStyle nits in cpufreq_stats.c
  [CPUFREQ] Remove duplicate assignment from cpufreq-nforce2
  [CPUFREQ] Remove pointless reinitialisations in acpi-cpufreq
  [CPUFREQ] Remove pointless reinitialisation from powernow-k8
  [CPUFREQ] Remove redundant initialisation from longhaul.
  [CPUFREQ] Clean up longhaul's speed pretty-printer
  [CPUFREQ] Disambiguate loop indexes in powernow-k7
  [CPUFREQ] Typo in powernow-k8
parents 2090af71 6ccf58ab
...@@ -104,7 +104,7 @@ acpi_processor_set_performance ( ...@@ -104,7 +104,7 @@ acpi_processor_set_performance (
{ {
u16 port = 0; u16 port = 0;
u8 bit_width = 0; u8 bit_width = 0;
int ret = 0; int ret;
u32 value = 0; u32 value = 0;
int i = 0; int i = 0;
struct cpufreq_freqs cpufreq_freqs; struct cpufreq_freqs cpufreq_freqs;
...@@ -195,7 +195,6 @@ acpi_processor_set_performance ( ...@@ -195,7 +195,6 @@ acpi_processor_set_performance (
udelay(10); udelay(10);
} }
} else { } else {
i = 0;
value = (u32) data->acpi_data.states[state].status; value = (u32) data->acpi_data.states[state].status;
} }
...@@ -452,6 +451,7 @@ static struct cpufreq_driver acpi_cpufreq_driver = { ...@@ -452,6 +451,7 @@ static struct cpufreq_driver acpi_cpufreq_driver = {
.name = "acpi-cpufreq", .name = "acpi-cpufreq",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.attr = acpi_cpufreq_attr, .attr = acpi_cpufreq_attr,
.flags = CPUFREQ_STICKY,
}; };
......
/* /*
* (C) 2004 Sebastian Witt <se.witt@gmx.net> * (C) 2004-2006 Sebastian Witt <se.witt@gmx.net>
* *
* Licensed under the terms of the GNU GPL License version 2. * Licensed under the terms of the GNU GPL License version 2.
* Based upon reverse engineered information * Based upon reverse engineered information
...@@ -90,7 +90,7 @@ static int nforce2_calc_pll(unsigned int fsb) ...@@ -90,7 +90,7 @@ static int nforce2_calc_pll(unsigned int fsb)
/* Try to calculate multiplier and divider up to 4 times */ /* Try to calculate multiplier and divider up to 4 times */
while (((mul == 0) || (div == 0)) && (tried <= 3)) { while (((mul == 0) || (div == 0)) && (tried <= 3)) {
for (xdiv = 1; xdiv <= 0x80; xdiv++) for (xdiv = 2; xdiv <= 0x80; xdiv++)
for (xmul = 1; xmul <= 0xfe; xmul++) for (xmul = 1; xmul <= 0xfe; xmul++)
if (nforce2_calc_fsb(NFORCE2_PLL(xmul, xdiv)) == if (nforce2_calc_fsb(NFORCE2_PLL(xmul, xdiv)) ==
fsb + tried) { fsb + tried) {
...@@ -117,8 +117,7 @@ static void nforce2_write_pll(int pll) ...@@ -117,8 +117,7 @@ static void nforce2_write_pll(int pll)
int temp; int temp;
/* Set the pll addr. to 0x00 */ /* Set the pll addr. to 0x00 */
temp = 0x00; pci_write_config_dword(nforce2_chipset_dev, NFORCE2_PLLADR, 0);
pci_write_config_dword(nforce2_chipset_dev, NFORCE2_PLLADR, temp);
/* Now write the value in all 64 registers */ /* Now write the value in all 64 registers */
for (temp = 0; temp <= 0x3f; temp++) for (temp = 0; temp <= 0x3f; temp++)
...@@ -266,7 +265,7 @@ static int nforce2_target(struct cpufreq_policy *policy, ...@@ -266,7 +265,7 @@ static int nforce2_target(struct cpufreq_policy *policy,
if (freqs.old == freqs.new) if (freqs.old == freqs.new)
return 0; return 0;
dprintk(KERN_INFO "cpufreq: Old CPU frequency %d kHz, new %d kHz\n", dprintk("Old CPU frequency %d kHz, new %d kHz\n",
freqs.old, freqs.new); freqs.old, freqs.new);
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
...@@ -278,7 +277,7 @@ static int nforce2_target(struct cpufreq_policy *policy, ...@@ -278,7 +277,7 @@ static int nforce2_target(struct cpufreq_policy *policy,
printk(KERN_ERR "cpufreq: Changing FSB to %d failed\n", printk(KERN_ERR "cpufreq: Changing FSB to %d failed\n",
target_fsb); target_fsb);
else else
dprintk(KERN_INFO "cpufreq: Changed FSB successfully to %d\n", dprintk("Changed FSB successfully to %d\n",
target_fsb); target_fsb);
/* Enable IRQs */ /* Enable IRQs */
......
...@@ -77,13 +77,17 @@ static char speedbuffer[8]; ...@@ -77,13 +77,17 @@ static char speedbuffer[8];
static char *print_speed(int speed) static char *print_speed(int speed)
{ {
if (speed > 1000) { if (speed < 1000) {
snprintf(speedbuffer, sizeof(speedbuffer),"%dMHz", speed);
return speedbuffer;
}
if (speed%1000 == 0) if (speed%1000 == 0)
sprintf (speedbuffer, "%dGHz", speed/1000); snprintf(speedbuffer, sizeof(speedbuffer),
"%dGHz", speed/1000);
else else
sprintf (speedbuffer, "%d.%dGHz", speed/1000, (speed%1000)/100); snprintf(speedbuffer, sizeof(speedbuffer),
} else "%d.%dGHz", speed/1000, (speed%1000)/100);
sprintf (speedbuffer, "%dMHz", speed);
return speedbuffer; return speedbuffer;
} }
...@@ -675,7 +679,7 @@ static int __init longhaul_init(void) ...@@ -675,7 +679,7 @@ static int __init longhaul_init(void)
static void __exit longhaul_exit(void) static void __exit longhaul_exit(void)
{ {
int i=0; int i;
for (i=0; i < numscales; i++) { for (i=0; i < numscales; i++) {
if (clock_ratio[i] == maxmult) { if (clock_ratio[i] == maxmult) {
......
...@@ -223,7 +223,6 @@ static unsigned int __init longrun_determine_freqs(unsigned int *low_freq, ...@@ -223,7 +223,6 @@ static unsigned int __init longrun_determine_freqs(unsigned int *low_freq,
/* set to 0 to try_hi perf_pctg */ /* set to 0 to try_hi perf_pctg */
msr_lo &= 0xFFFFFF80; msr_lo &= 0xFFFFFF80;
msr_hi &= 0xFFFFFF80; msr_hi &= 0xFFFFFF80;
msr_lo |= 0;
msr_hi |= try_hi; msr_hi |= try_hi;
wrmsr(MSR_TMTA_LONGRUN_CTRL, msr_lo, msr_hi); wrmsr(MSR_TMTA_LONGRUN_CTRL, msr_lo, msr_hi);
......
...@@ -452,23 +452,23 @@ static int powernow_decode_bios (int maxfid, int startvid) ...@@ -452,23 +452,23 @@ static int powernow_decode_bios (int maxfid, int startvid)
pst = (struct pst_s *) p; pst = (struct pst_s *) p;
for (i = 0 ; i <psb->numpst; i++) { for (j=0; j<psb->numpst; j++) {
pst = (struct pst_s *) p; pst = (struct pst_s *) p;
number_scales = pst->numpstates; number_scales = pst->numpstates;
if ((etuple == pst->cpuid) && check_fsb(pst->fsbspeed) && if ((etuple == pst->cpuid) && check_fsb(pst->fsbspeed) &&
(maxfid==pst->maxfid) && (startvid==pst->startvid)) (maxfid==pst->maxfid) && (startvid==pst->startvid))
{ {
dprintk ("PST:%d (@%p)\n", i, pst); dprintk ("PST:%d (@%p)\n", j, pst);
dprintk (" cpuid: 0x%x fsb: %d maxFID: 0x%x startvid: 0x%x\n", dprintk (" cpuid: 0x%x fsb: %d maxFID: 0x%x startvid: 0x%x\n",
pst->cpuid, pst->fsbspeed, pst->maxfid, pst->startvid); pst->cpuid, pst->fsbspeed, pst->maxfid, pst->startvid);
ret = get_ranges ((char *) pst + sizeof (struct pst_s)); ret = get_ranges ((char *) pst + sizeof (struct pst_s));
return ret; return ret;
} else { } else {
unsigned int k;
p = (char *) pst + sizeof (struct pst_s); p = (char *) pst + sizeof (struct pst_s);
for (j=0 ; j < number_scales; j++) for (k=0; k<number_scales; k++)
p+=2; p+=2;
} }
} }
...@@ -581,10 +581,7 @@ static int __init powernow_cpu_init (struct cpufreq_policy *policy) ...@@ -581,10 +581,7 @@ static int __init powernow_cpu_init (struct cpufreq_policy *policy)
rdmsrl (MSR_K7_FID_VID_STATUS, fidvidstatus.val); rdmsrl (MSR_K7_FID_VID_STATUS, fidvidstatus.val);
/* recalibrate cpu_khz */ recalibrate_cpu_khz();
result = recalibrate_cpu_khz();
if (result)
return result;
fsb = (10 * cpu_khz) / fid_codes[fidvidstatus.bits.CFID]; fsb = (10 * cpu_khz) / fid_codes[fidvidstatus.bits.CFID];
if (!fsb) { if (!fsb) {
......
/* /*
* (c) 2003, 2004, 2005 Advanced Micro Devices, Inc. * (c) 2003-2006 Advanced Micro Devices, Inc.
* Your use of this code is subject to the terms and conditions of the * Your use of this code is subject to the terms and conditions of the
* GNU general public license version 2. See "COPYING" or * GNU general public license version 2. See "COPYING" or
* http://www.gnu.org/licenses/gpl.html * http://www.gnu.org/licenses/gpl.html
...@@ -14,13 +14,13 @@ ...@@ -14,13 +14,13 @@
* Based upon datasheets & sample CPUs kindly provided by AMD. * Based upon datasheets & sample CPUs kindly provided by AMD.
* *
* Valuable input gratefully received from Dave Jones, Pavel Machek, * Valuable input gratefully received from Dave Jones, Pavel Machek,
* Dominik Brodowski, and others. * Dominik Brodowski, Jacob Shin, and others.
* Originally developed by Paul Devriendt. * Originally developed by Paul Devriendt.
* Processor information obtained from Chapter 9 (Power and Thermal Management) * Processor information obtained from Chapter 9 (Power and Thermal Management)
* of the "BIOS and Kernel Developer's Guide for the AMD Athlon 64 and AMD * of the "BIOS and Kernel Developer's Guide for the AMD Athlon 64 and AMD
* Opteron Processors" available for download from www.amd.com * Opteron Processors" available for download from www.amd.com
* *
* Tables for specific CPUs can be infrerred from * Tables for specific CPUs can be inferred from
* http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/30430.pdf * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/30430.pdf
*/ */
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
#define PFX "powernow-k8: " #define PFX "powernow-k8: "
#define BFX PFX "BIOS error: " #define BFX PFX "BIOS error: "
#define VERSION "version 1.60.2" #define VERSION "version 2.00.00"
#include "powernow-k8.h" #include "powernow-k8.h"
/* serialize freq changes */ /* serialize freq changes */
...@@ -54,6 +54,8 @@ static DEFINE_MUTEX(fidvid_mutex); ...@@ -54,6 +54,8 @@ static DEFINE_MUTEX(fidvid_mutex);
static struct powernow_k8_data *powernow_data[NR_CPUS]; static struct powernow_k8_data *powernow_data[NR_CPUS];
static int cpu_family = CPU_OPTERON;
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
static cpumask_t cpu_core_map[1]; static cpumask_t cpu_core_map[1];
#endif #endif
...@@ -64,16 +66,36 @@ static u32 find_freq_from_fid(u32 fid) ...@@ -64,16 +66,36 @@ static u32 find_freq_from_fid(u32 fid)
return 800 + (fid * 100); return 800 + (fid * 100);
} }
/* Return a frequency in KHz, given an input fid */ /* Return a frequency in KHz, given an input fid */
static u32 find_khz_freq_from_fid(u32 fid) static u32 find_khz_freq_from_fid(u32 fid)
{ {
return 1000 * find_freq_from_fid(fid); return 1000 * find_freq_from_fid(fid);
} }
/* Return a voltage in miliVolts, given an input vid */ /* Return a frequency in MHz, given an input fid and did */
static u32 find_millivolts_from_vid(struct powernow_k8_data *data, u32 vid) static u32 find_freq_from_fiddid(u32 fid, u32 did)
{
return 100 * (fid + 0x10) >> did;
}
static u32 find_khz_freq_from_fiddid(u32 fid, u32 did)
{ {
return 1550-vid*25; return 1000 * find_freq_from_fiddid(fid, did);
}
static u32 find_fid_from_pstate(u32 pstate)
{
u32 hi, lo;
rdmsr(MSR_PSTATE_DEF_BASE + pstate, lo, hi);
return lo & HW_PSTATE_FID_MASK;
}
static u32 find_did_from_pstate(u32 pstate)
{
u32 hi, lo;
rdmsr(MSR_PSTATE_DEF_BASE + pstate, lo, hi);
return (lo & HW_PSTATE_DID_MASK) >> HW_PSTATE_DID_SHIFT;
} }
/* Return the vco fid for an input fid /* Return the vco fid for an input fid
...@@ -98,6 +120,9 @@ static int pending_bit_stuck(void) ...@@ -98,6 +120,9 @@ static int pending_bit_stuck(void)
{ {
u32 lo, hi; u32 lo, hi;
if (cpu_family)
return 0;
rdmsr(MSR_FIDVID_STATUS, lo, hi); rdmsr(MSR_FIDVID_STATUS, lo, hi);
return lo & MSR_S_LO_CHANGE_PENDING ? 1 : 0; return lo & MSR_S_LO_CHANGE_PENDING ? 1 : 0;
} }
...@@ -111,6 +136,14 @@ static int query_current_values_with_pending_wait(struct powernow_k8_data *data) ...@@ -111,6 +136,14 @@ static int query_current_values_with_pending_wait(struct powernow_k8_data *data)
u32 lo, hi; u32 lo, hi;
u32 i = 0; u32 i = 0;
if (cpu_family) {
rdmsr(MSR_PSTATE_STATUS, lo, hi);
i = lo & HW_PSTATE_MASK;
rdmsr(MSR_PSTATE_DEF_BASE + i, lo, hi);
data->currfid = lo & HW_PSTATE_FID_MASK;
data->currdid = (lo & HW_PSTATE_DID_MASK) >> HW_PSTATE_DID_SHIFT;
return 0;
}
do { do {
if (i++ > 10000) { if (i++ > 10000) {
dprintk("detected change pending stuck\n"); dprintk("detected change pending stuck\n");
...@@ -175,7 +208,7 @@ static int write_new_fid(struct powernow_k8_data *data, u32 fid) ...@@ -175,7 +208,7 @@ static int write_new_fid(struct powernow_k8_data *data, u32 fid)
do { do {
wrmsr(MSR_FIDVID_CTL, lo, data->plllock * PLL_LOCK_CONVERSION); wrmsr(MSR_FIDVID_CTL, lo, data->plllock * PLL_LOCK_CONVERSION);
if (i++ > 100) { if (i++ > 100) {
printk(KERN_ERR PFX "internal error - pending bit very stuck - no further pstate changes possible\n"); printk(KERN_ERR PFX "Hardware error - pending bit very stuck - no further pstate changes possible\n");
return 1; return 1;
} }
} while (query_current_values_with_pending_wait(data)); } while (query_current_values_with_pending_wait(data));
...@@ -255,7 +288,15 @@ static int decrease_vid_code_by_step(struct powernow_k8_data *data, u32 reqvid, ...@@ -255,7 +288,15 @@ static int decrease_vid_code_by_step(struct powernow_k8_data *data, u32 reqvid,
return 0; return 0;
} }
/* Change the fid and vid, by the 3 phases. */ /* Change hardware pstate by single MSR write */
static int transition_pstate(struct powernow_k8_data *data, u32 pstate)
{
wrmsr(MSR_PSTATE_CTRL, pstate, 0);
data->currfid = find_fid_from_pstate(pstate);
return 0;
}
/* Change Opteron/Athlon64 fid and vid, by the 3 phases. */
static int transition_fid_vid(struct powernow_k8_data *data, u32 reqfid, u32 reqvid) static int transition_fid_vid(struct powernow_k8_data *data, u32 reqfid, u32 reqvid)
{ {
if (core_voltage_pre_transition(data, reqvid)) if (core_voltage_pre_transition(data, reqvid))
...@@ -474,9 +515,11 @@ static int check_supported_cpu(unsigned int cpu) ...@@ -474,9 +515,11 @@ static int check_supported_cpu(unsigned int cpu)
goto out; goto out;
eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE); eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE);
if ((eax & CPUID_XFAM) != CPUID_XFAM_K8) if (((eax & CPUID_XFAM) != CPUID_XFAM_K8) &&
((eax & CPUID_XFAM) < CPUID_XFAM_10H))
goto out; goto out;
if ((eax & CPUID_XFAM) == CPUID_XFAM_K8) {
if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) || if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) ||
((eax & CPUID_XMOD) > CPUID_XMOD_REV_G)) { ((eax & CPUID_XMOD) > CPUID_XMOD_REV_G)) {
printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax); printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax);
...@@ -495,6 +538,13 @@ static int check_supported_cpu(unsigned int cpu) ...@@ -495,6 +538,13 @@ static int check_supported_cpu(unsigned int cpu)
printk(KERN_INFO PFX "Power state transitions not supported\n"); printk(KERN_INFO PFX "Power state transitions not supported\n");
goto out; goto out;
} }
} else { /* must be a HW Pstate capable processor */
cpuid(CPUID_FREQ_VOLT_CAPABILITIES, &eax, &ebx, &ecx, &edx);
if ((edx & USE_HW_PSTATE) == USE_HW_PSTATE)
cpu_family = CPU_HW_PSTATE;
else
goto out;
}
rc = 1; rc = 1;
...@@ -547,12 +597,18 @@ static void print_basics(struct powernow_k8_data *data) ...@@ -547,12 +597,18 @@ static void print_basics(struct powernow_k8_data *data)
{ {
int j; int j;
for (j = 0; j < data->numps; j++) { for (j = 0; j < data->numps; j++) {
if (data->powernow_table[j].frequency != CPUFREQ_ENTRY_INVALID) if (data->powernow_table[j].frequency != CPUFREQ_ENTRY_INVALID) {
printk(KERN_INFO PFX " %d : fid 0x%x (%d MHz), vid 0x%x (%d mV)\n", j, if (cpu_family) {
printk(KERN_INFO PFX " %d : fid 0x%x gid 0x%x (%d MHz)\n", j, (data->powernow_table[j].index & 0xff00) >> 8,
(data->powernow_table[j].index & 0xff0000) >> 16,
data->powernow_table[j].frequency/1000);
} else {
printk(KERN_INFO PFX " %d : fid 0x%x (%d MHz), vid 0x%x\n", j,
data->powernow_table[j].index & 0xff, data->powernow_table[j].index & 0xff,
data->powernow_table[j].frequency/1000, data->powernow_table[j].frequency/1000,
data->powernow_table[j].index >> 8, data->powernow_table[j].index >> 8);
find_millivolts_from_vid(data, data->powernow_table[j].index >> 8)); }
}
} }
if (data->batps) if (data->batps)
printk(KERN_INFO PFX "Only %d pstates on battery\n", data->batps); printk(KERN_INFO PFX "Only %d pstates on battery\n", data->batps);
...@@ -702,7 +758,7 @@ static int find_psb_table(struct powernow_k8_data *data) ...@@ -702,7 +758,7 @@ static int find_psb_table(struct powernow_k8_data *data)
#ifdef CONFIG_X86_POWERNOW_K8_ACPI #ifdef CONFIG_X86_POWERNOW_K8_ACPI
static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index) static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index)
{ {
if (!data->acpi_data.state_count) if (!data->acpi_data.state_count || cpu_family)
return; return;
data->irt = (data->acpi_data.states[index].control >> IRT_SHIFT) & IRT_MASK; data->irt = (data->acpi_data.states[index].control >> IRT_SHIFT) & IRT_MASK;
...@@ -715,9 +771,8 @@ static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned ...@@ -715,9 +771,8 @@ static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned
static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data) static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
{ {
int i;
int cntlofreq = 0;
struct cpufreq_frequency_table *powernow_table; struct cpufreq_frequency_table *powernow_table;
int ret_val;
if (acpi_processor_register_performance(&data->acpi_data, data->cpu)) { if (acpi_processor_register_performance(&data->acpi_data, data->cpu)) {
dprintk("register performance failed: bad ACPI data\n"); dprintk("register performance failed: bad ACPI data\n");
...@@ -746,6 +801,85 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data) ...@@ -746,6 +801,85 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
goto err_out; goto err_out;
} }
if (cpu_family)
ret_val = fill_powernow_table_pstate(data, powernow_table);
else
ret_val = fill_powernow_table_fidvid(data, powernow_table);
if (ret_val)
goto err_out_mem;
powernow_table[data->acpi_data.state_count].frequency = CPUFREQ_TABLE_END;
powernow_table[data->acpi_data.state_count].index = 0;
data->powernow_table = powernow_table;
/* fill in data */
data->numps = data->acpi_data.state_count;
print_basics(data);
powernow_k8_acpi_pst_values(data, 0);
/* notify BIOS that we exist */
acpi_processor_notify_smm(THIS_MODULE);
return 0;
err_out_mem:
kfree(powernow_table);
err_out:
acpi_processor_unregister_performance(&data->acpi_data, data->cpu);
/* data->acpi_data.state_count informs us at ->exit() whether ACPI was used */
data->acpi_data.state_count = 0;
return -ENODEV;
}
static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table)
{
int i;
for (i = 0; i < data->acpi_data.state_count; i++) {
u32 index;
u32 hi = 0, lo = 0;
u32 fid;
u32 did;
index = data->acpi_data.states[i].control & HW_PSTATE_MASK;
if (index > MAX_HW_PSTATE) {
printk(KERN_ERR PFX "invalid pstate %d - bad value %d.\n", i, index);
printk(KERN_ERR PFX "Please report to BIOS manufacturer\n");
}
rdmsr(MSR_PSTATE_DEF_BASE + index, lo, hi);
if (!(hi & HW_PSTATE_VALID_MASK)) {
dprintk("invalid pstate %d, ignoring\n", index);
powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID;
continue;
}
fid = lo & HW_PSTATE_FID_MASK;
did = (lo & HW_PSTATE_DID_MASK) >> HW_PSTATE_DID_SHIFT;
dprintk(" %d : fid 0x%x, did 0x%x\n", index, fid, did);
powernow_table[i].index = index | (fid << HW_FID_INDEX_SHIFT) | (did << HW_DID_INDEX_SHIFT);
powernow_table[i].frequency = find_khz_freq_from_fiddid(fid, did);
if (powernow_table[i].frequency != (data->acpi_data.states[i].core_frequency * 1000)) {
printk(KERN_INFO PFX "invalid freq entries %u kHz vs. %u kHz\n",
powernow_table[i].frequency,
(unsigned int) (data->acpi_data.states[i].core_frequency * 1000));
powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID;
continue;
}
}
return 0;
}
static int fill_powernow_table_fidvid(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table)
{
int i;
int cntlofreq = 0;
for (i = 0; i < data->acpi_data.state_count; i++) { for (i = 0; i < data->acpi_data.state_count; i++) {
u32 fid; u32 fid;
u32 vid; u32 vid;
...@@ -786,7 +920,7 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data) ...@@ -786,7 +920,7 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
if ((powernow_table[i].frequency != powernow_table[cntlofreq].frequency) || if ((powernow_table[i].frequency != powernow_table[cntlofreq].frequency) ||
(powernow_table[i].index != powernow_table[cntlofreq].index)) { (powernow_table[i].index != powernow_table[cntlofreq].index)) {
printk(KERN_ERR PFX "Too many lo freq table entries\n"); printk(KERN_ERR PFX "Too many lo freq table entries\n");
goto err_out_mem; return 1;
} }
dprintk("double low frequency table entry, ignoring it.\n"); dprintk("double low frequency table entry, ignoring it.\n");
...@@ -804,31 +938,7 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data) ...@@ -804,31 +938,7 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
continue; continue;
} }
} }
powernow_table[data->acpi_data.state_count].frequency = CPUFREQ_TABLE_END;
powernow_table[data->acpi_data.state_count].index = 0;
data->powernow_table = powernow_table;
/* fill in data */
data->numps = data->acpi_data.state_count;
print_basics(data);
powernow_k8_acpi_pst_values(data, 0);
/* notify BIOS that we exist */
acpi_processor_notify_smm(THIS_MODULE);
return 0; return 0;
err_out_mem:
kfree(powernow_table);
err_out:
acpi_processor_unregister_performance(&data->acpi_data, data->cpu);
/* data->acpi_data.state_count informs us at ->exit() whether ACPI was used */
data->acpi_data.state_count = 0;
return -ENODEV;
} }
static void powernow_k8_cpu_exit_acpi(struct powernow_k8_data *data) static void powernow_k8_cpu_exit_acpi(struct powernow_k8_data *data)
...@@ -844,20 +954,20 @@ static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned ...@@ -844,20 +954,20 @@ static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned
#endif /* CONFIG_X86_POWERNOW_K8_ACPI */ #endif /* CONFIG_X86_POWERNOW_K8_ACPI */
/* Take a frequency, and issue the fid/vid transition command */ /* Take a frequency, and issue the fid/vid transition command */
static int transition_frequency(struct powernow_k8_data *data, unsigned int index) static int transition_frequency_fidvid(struct powernow_k8_data *data, unsigned int index)
{ {
u32 fid; u32 fid = 0;
u32 vid; u32 vid = 0;
int res, i; int res, i;
struct cpufreq_freqs freqs; struct cpufreq_freqs freqs;
dprintk("cpu %d transition to index %u\n", smp_processor_id(), index); dprintk("cpu %d transition to index %u\n", smp_processor_id(), index);
/* fid/vid correctness check for k8 */
/* fid are the lower 8 bits of the index we stored into /* fid are the lower 8 bits of the index we stored into
* the cpufreq frequency table in find_psb_table, vid are * the cpufreq frequency table in find_psb_table, vid
* the upper 8 bits. * are the upper 8 bits.
*/ */
fid = data->powernow_table[index].index & 0xFF; fid = data->powernow_table[index].index & 0xFF;
vid = (data->powernow_table[index].index & 0xFF00) >> 8; vid = (data->powernow_table[index].index & 0xFF00) >> 8;
...@@ -881,19 +991,55 @@ static int transition_frequency(struct powernow_k8_data *data, unsigned int inde ...@@ -881,19 +991,55 @@ static int transition_frequency(struct powernow_k8_data *data, unsigned int inde
dprintk("cpu %d, changing to fid 0x%x, vid 0x%x\n", dprintk("cpu %d, changing to fid 0x%x, vid 0x%x\n",
smp_processor_id(), fid, vid); smp_processor_id(), fid, vid);
freqs.cpu = data->cpu;
freqs.old = find_khz_freq_from_fid(data->currfid); freqs.old = find_khz_freq_from_fid(data->currfid);
freqs.new = find_khz_freq_from_fid(fid); freqs.new = find_khz_freq_from_fid(fid);
for_each_cpu_mask(i, cpu_core_map[data->cpu]) {
for_each_cpu_mask(i, *(data->available_cores)) {
freqs.cpu = i; freqs.cpu = i;
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
} }
res = transition_fid_vid(data, fid, vid); res = transition_fid_vid(data, fid, vid);
freqs.new = find_khz_freq_from_fid(data->currfid); freqs.new = find_khz_freq_from_fid(data->currfid);
for_each_cpu_mask(i, cpu_core_map[data->cpu]) {
for_each_cpu_mask(i, *(data->available_cores)) {
freqs.cpu = i;
cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
}
return res;
}
/* Take a frequency, and issue the hardware pstate transition command */
static int transition_frequency_pstate(struct powernow_k8_data *data, unsigned int index)
{
u32 fid = 0;
u32 did = 0;
u32 pstate = 0;
int res, i;
struct cpufreq_freqs freqs;
dprintk("cpu %d transition to index %u\n", smp_processor_id(), index);
/* get fid did for hardware pstate transition */
pstate = index & HW_PSTATE_MASK;
if (pstate > MAX_HW_PSTATE)
return 0;
fid = (index & HW_FID_INDEX_MASK) >> HW_FID_INDEX_SHIFT;
did = (index & HW_DID_INDEX_MASK) >> HW_DID_INDEX_SHIFT;
freqs.old = find_khz_freq_from_fiddid(data->currfid, data->currdid);
freqs.new = find_khz_freq_from_fiddid(fid, did);
for_each_cpu_mask(i, *(data->available_cores)) {
freqs.cpu = i;
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
}
res = transition_pstate(data, pstate);
data->currfid = find_fid_from_pstate(pstate);
data->currdid = find_did_from_pstate(pstate);
freqs.new = find_khz_freq_from_fiddid(data->currfid, data->currdid);
for_each_cpu_mask(i, *(data->available_cores)) {
freqs.cpu = i; freqs.cpu = i;
cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
} }
...@@ -933,11 +1079,13 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi ...@@ -933,11 +1079,13 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
dprintk("targ: cpu %d, %d kHz, min %d, max %d, relation %d\n", dprintk("targ: cpu %d, %d kHz, min %d, max %d, relation %d\n",
pol->cpu, targfreq, pol->min, pol->max, relation); pol->cpu, targfreq, pol->min, pol->max, relation);
if (query_current_values_with_pending_wait(data)) { if (query_current_values_with_pending_wait(data))
ret = -EIO;
goto err_out; goto err_out;
}
if (cpu_family)
dprintk("targ: curr fid 0x%x, did 0x%x\n",
data->currfid, data->currvid);
else {
dprintk("targ: curr fid 0x%x, vid 0x%x\n", dprintk("targ: curr fid 0x%x, vid 0x%x\n",
data->currfid, data->currvid); data->currfid, data->currvid);
...@@ -946,6 +1094,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi ...@@ -946,6 +1094,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
"error - out of sync, fix 0x%x 0x%x, vid 0x%x 0x%x\n", "error - out of sync, fix 0x%x 0x%x, vid 0x%x 0x%x\n",
checkfid, data->currfid, checkvid, data->currvid); checkfid, data->currfid, checkvid, data->currvid);
} }
}
if (cpufreq_frequency_table_target(pol, data->powernow_table, targfreq, relation, &newstate)) if (cpufreq_frequency_table_target(pol, data->powernow_table, targfreq, relation, &newstate))
goto err_out; goto err_out;
...@@ -954,7 +1103,11 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi ...@@ -954,7 +1103,11 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
powernow_k8_acpi_pst_values(data, newstate); powernow_k8_acpi_pst_values(data, newstate);
if (transition_frequency(data, newstate)) { if (cpu_family)
ret = transition_frequency_pstate(data, newstate);
else
ret = transition_frequency_fidvid(data, newstate);
if (ret) {
printk(KERN_ERR PFX "transition frequency failed\n"); printk(KERN_ERR PFX "transition frequency failed\n");
ret = 1; ret = 1;
mutex_unlock(&fidvid_mutex); mutex_unlock(&fidvid_mutex);
...@@ -962,6 +1115,9 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi ...@@ -962,6 +1115,9 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
} }
mutex_unlock(&fidvid_mutex); mutex_unlock(&fidvid_mutex);
if (cpu_family)
pol->cur = find_khz_freq_from_fiddid(data->currfid, data->currdid);
else
pol->cur = find_khz_freq_from_fid(data->currfid); pol->cur = find_khz_freq_from_fid(data->currfid);
ret = 0; ret = 0;
...@@ -1007,14 +1163,13 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) ...@@ -1007,14 +1163,13 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
* Use the PSB BIOS structure. This is only availabe on * Use the PSB BIOS structure. This is only availabe on
* an UP version, and is deprecated by AMD. * an UP version, and is deprecated by AMD.
*/ */
if ((num_online_cpus() != 1) || (num_possible_cpus() != 1)) { if ((num_online_cpus() != 1) || (num_possible_cpus() != 1)) {
printk(KERN_ERR PFX "MP systems not supported by PSB BIOS structure\n"); printk(KERN_ERR PFX "MP systems not supported by PSB BIOS structure\n");
kfree(data); kfree(data);
return -ENODEV; return -ENODEV;
} }
if (pol->cpu != 0) { if (pol->cpu != 0) {
printk(KERN_ERR PFX "init not cpu 0\n"); printk(KERN_ERR PFX "No _PSS objects for CPU other than CPU0\n");
kfree(data); kfree(data);
return -ENODEV; return -ENODEV;
} }
...@@ -1042,19 +1197,27 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) ...@@ -1042,19 +1197,27 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
if (query_current_values_with_pending_wait(data)) if (query_current_values_with_pending_wait(data))
goto err_out; goto err_out;
if (!cpu_family)
fidvid_msr_init(); fidvid_msr_init();
/* run on any CPU again */ /* run on any CPU again */
set_cpus_allowed(current, oldmask); set_cpus_allowed(current, oldmask);
pol->governor = CPUFREQ_DEFAULT_GOVERNOR; pol->governor = CPUFREQ_DEFAULT_GOVERNOR;
if (cpu_family)
pol->cpus = cpumask_of_cpu(pol->cpu);
else
pol->cpus = cpu_core_map[pol->cpu]; pol->cpus = cpu_core_map[pol->cpu];
data->available_cores = &(pol->cpus);
/* Take a crude guess here. /* Take a crude guess here.
* That guess was in microseconds, so multiply with 1000 */ * That guess was in microseconds, so multiply with 1000 */
pol->cpuinfo.transition_latency = (((data->rvo + 8) * data->vstable * VST_UNITS_20US) pol->cpuinfo.transition_latency = (((data->rvo + 8) * data->vstable * VST_UNITS_20US)
+ (3 * (1 << data->irt) * 10)) * 1000; + (3 * (1 << data->irt) * 10)) * 1000;
if (cpu_family)
pol->cur = find_khz_freq_from_fiddid(data->currfid, data->currdid);
else
pol->cur = find_khz_freq_from_fid(data->currfid); pol->cur = find_khz_freq_from_fid(data->currfid);
dprintk("policy current frequency %d kHz\n", pol->cur); dprintk("policy current frequency %d kHz\n", pol->cur);
...@@ -1069,7 +1232,11 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) ...@@ -1069,7 +1232,11 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
cpufreq_frequency_table_get_attr(data->powernow_table, pol->cpu); cpufreq_frequency_table_get_attr(data->powernow_table, pol->cpu);
printk("cpu_init done, current fid 0x%x, vid 0x%x\n", if (cpu_family)
dprintk("cpu_init done, current fid 0x%x, did 0x%x\n",
data->currfid, data->currdid);
else
dprintk("cpu_init done, current fid 0x%x, vid 0x%x\n",
data->currfid, data->currvid); data->currfid, data->currvid);
powernow_data[pol->cpu] = data; powernow_data[pol->cpu] = data;
...@@ -1156,8 +1323,9 @@ static int __cpuinit powernowk8_init(void) ...@@ -1156,8 +1323,9 @@ static int __cpuinit powernowk8_init(void)
} }
if (supported_cpus == num_online_cpus()) { if (supported_cpus == num_online_cpus()) {
printk(KERN_INFO PFX "Found %d AMD Athlon 64 / Opteron " printk(KERN_INFO PFX "Found %d %s "
"processors (" VERSION ")\n", supported_cpus); "processors (" VERSION ")\n", supported_cpus,
boot_cpu_data.x86_model_id);
return cpufreq_register_driver(&cpufreq_amd64_driver); return cpufreq_register_driver(&cpufreq_amd64_driver);
} }
......
/* /*
* (c) 2003, 2004, 2005 Advanced Micro Devices, Inc. * (c) 2003-2006 Advanced Micro Devices, Inc.
* Your use of this code is subject to the terms and conditions of the * Your use of this code is subject to the terms and conditions of the
* GNU general public license version 2. See "COPYING" or * GNU general public license version 2. See "COPYING" or
* http://www.gnu.org/licenses/gpl.html * http://www.gnu.org/licenses/gpl.html
...@@ -21,8 +21,8 @@ struct powernow_k8_data { ...@@ -21,8 +21,8 @@ struct powernow_k8_data {
u32 plllock; /* pll lock time, units 1 us */ u32 plllock; /* pll lock time, units 1 us */
u32 exttype; /* extended interface = 1 */ u32 exttype; /* extended interface = 1 */
/* keep track of the current fid / vid */ /* keep track of the current fid / vid or did */
u32 currvid, currfid; u32 currvid, currfid, currdid;
/* the powernow_table includes all frequency and vid/fid pairings: /* the powernow_table includes all frequency and vid/fid pairings:
* fid are the lower 8 bits of the index, vid are the upper 8 bits. * fid are the lower 8 bits of the index, vid are the upper 8 bits.
...@@ -34,6 +34,10 @@ struct powernow_k8_data { ...@@ -34,6 +34,10 @@ struct powernow_k8_data {
* used to determine valid frequency/vid/fid states */ * used to determine valid frequency/vid/fid states */
struct acpi_processor_performance acpi_data; struct acpi_processor_performance acpi_data;
#endif #endif
/* we need to keep track of associated cores, but let cpufreq
* handle hotplug events - so just point at cpufreq pol->cpus
* structure */
cpumask_t *available_cores;
}; };
...@@ -43,6 +47,7 @@ struct powernow_k8_data { ...@@ -43,6 +47,7 @@ struct powernow_k8_data {
#define CPUID_XFAM_K8 0 #define CPUID_XFAM_K8 0
#define CPUID_XMOD 0x000f0000 /* extended model */ #define CPUID_XMOD 0x000f0000 /* extended model */
#define CPUID_XMOD_REV_G 0x00060000 #define CPUID_XMOD_REV_G 0x00060000
#define CPUID_XFAM_10H 0x00100000 /* family 0x10 */
#define CPUID_USE_XFAM_XMOD 0x00000f00 #define CPUID_USE_XFAM_XMOD 0x00000f00
#define CPUID_GET_MAX_CAPABILITIES 0x80000000 #define CPUID_GET_MAX_CAPABILITIES 0x80000000
#define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007 #define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007
...@@ -79,6 +84,32 @@ struct powernow_k8_data { ...@@ -79,6 +84,32 @@ struct powernow_k8_data {
#define MSR_S_HI_CURRENT_VID 0x0000003f #define MSR_S_HI_CURRENT_VID 0x0000003f
#define MSR_C_HI_STP_GNT_BENIGN 0x00000001 #define MSR_C_HI_STP_GNT_BENIGN 0x00000001
/* Hardware Pstate _PSS and MSR definitions */
#define USE_HW_PSTATE 0x00000080
#define HW_PSTATE_FID_MASK 0x0000003f
#define HW_PSTATE_DID_MASK 0x000001c0
#define HW_PSTATE_DID_SHIFT 6
#define HW_PSTATE_MASK 0x00000007
#define HW_PSTATE_VALID_MASK 0x80000000
#define HW_FID_INDEX_SHIFT 8
#define HW_FID_INDEX_MASK 0x0000ff00
#define HW_DID_INDEX_SHIFT 16
#define HW_DID_INDEX_MASK 0x00ff0000
#define HW_WATTS_MASK 0xff
#define HW_PWR_DVR_MASK 0x300
#define HW_PWR_DVR_SHIFT 8
#define HW_PWR_MAX_MULT 3
#define MAX_HW_PSTATE 8 /* hw pstate supports up to 8 */
#define MSR_PSTATE_DEF_BASE 0xc0010064 /* base of Pstate MSRs */
#define MSR_PSTATE_STATUS 0xc0010063 /* Pstate Status MSR */
#define MSR_PSTATE_CTRL 0xc0010062 /* Pstate control MSR */
/* define the two driver architectures */
#define CPU_OPTERON 0
#define CPU_HW_PSTATE 1
/* /*
* There are restrictions frequencies have to follow: * There are restrictions frequencies have to follow:
* - only 1 entry in the low fid table ( <=1.4GHz ) * - only 1 entry in the low fid table ( <=1.4GHz )
...@@ -182,6 +213,9 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid); ...@@ -182,6 +213,9 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid);
static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index); static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index);
static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table);
static int fill_powernow_table_fidvid(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table);
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
static inline void define_siblings(int cpu, cpumask_t cpu_sharedcore_mask[]) static inline void define_siblings(int cpu, cpumask_t cpu_sharedcore_mask[])
{ {
......
...@@ -250,7 +250,7 @@ static int centrino_cpu_init_table(struct cpufreq_policy *policy) ...@@ -250,7 +250,7 @@ static int centrino_cpu_init_table(struct cpufreq_policy *policy)
if (model->cpu_id == NULL) { if (model->cpu_id == NULL) {
/* No match at all */ /* No match at all */
dprintk(KERN_INFO PFX "no support for CPU model \"%s\": " dprintk("no support for CPU model \"%s\": "
"send /proc/cpuinfo to " MAINTAINER "\n", "send /proc/cpuinfo to " MAINTAINER "\n",
cpu->x86_model_id); cpu->x86_model_id);
return -ENOENT; return -ENOENT;
...@@ -258,10 +258,10 @@ static int centrino_cpu_init_table(struct cpufreq_policy *policy) ...@@ -258,10 +258,10 @@ static int centrino_cpu_init_table(struct cpufreq_policy *policy)
if (model->op_points == NULL) { if (model->op_points == NULL) {
/* Matched a non-match */ /* Matched a non-match */
dprintk(KERN_INFO PFX "no table support for CPU model \"%s\"\n", dprintk("no table support for CPU model \"%s\"\n",
cpu->x86_model_id); cpu->x86_model_id);
#ifndef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI #ifndef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI
dprintk(KERN_INFO PFX "try compiling with CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI enabled\n"); dprintk("try compiling with CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI enabled\n");
#endif #endif
return -ENOENT; return -ENOENT;
} }
...@@ -368,7 +368,7 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy) ...@@ -368,7 +368,7 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
/* register with ACPI core */ /* register with ACPI core */
if (acpi_processor_register_performance(&p, cpu)) { if (acpi_processor_register_performance(&p, cpu)) {
dprintk(KERN_INFO PFX "obtaining ACPI data failed\n"); dprintk("obtaining ACPI data failed\n");
return -EIO; return -EIO;
} }
...@@ -465,7 +465,7 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy) ...@@ -465,7 +465,7 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
kfree(centrino_model[cpu]); kfree(centrino_model[cpu]);
err_unreg: err_unreg:
acpi_processor_unregister_performance(&p, cpu); acpi_processor_unregister_performance(&p, cpu);
dprintk(KERN_INFO PFX "invalid ACPI data\n"); dprintk("invalid ACPI data\n");
return (result); return (result);
} }
#else #else
...@@ -499,7 +499,7 @@ static int centrino_cpu_init(struct cpufreq_policy *policy) ...@@ -499,7 +499,7 @@ static int centrino_cpu_init(struct cpufreq_policy *policy)
centrino_cpu[policy->cpu] = &cpu_ids[i]; centrino_cpu[policy->cpu] = &cpu_ids[i];
if (!centrino_cpu[policy->cpu]) { if (!centrino_cpu[policy->cpu]) {
dprintk(KERN_INFO PFX "found unsupported CPU with " dprintk("found unsupported CPU with "
"Enhanced SpeedStep: send /proc/cpuinfo to " "Enhanced SpeedStep: send /proc/cpuinfo to "
MAINTAINER "\n"); MAINTAINER "\n");
return -ENODEV; return -ENODEV;
......
...@@ -257,7 +257,7 @@ void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state) ...@@ -257,7 +257,7 @@ void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state)
if (!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) { if (!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) {
if ((policy) && (policy->cpu == freqs->cpu) && if ((policy) && (policy->cpu == freqs->cpu) &&
(policy->cur) && (policy->cur != freqs->old)) { (policy->cur) && (policy->cur != freqs->old)) {
dprintk(KERN_WARNING "Warning: CPU frequency is" dprintk("Warning: CPU frequency is"
" %u, cpufreq assumed %u kHz.\n", " %u, cpufreq assumed %u kHz.\n",
freqs->old, policy->cur); freqs->old, policy->cur);
freqs->old = policy->cur; freqs->old = policy->cur;
...@@ -874,7 +874,7 @@ static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, unsigne ...@@ -874,7 +874,7 @@ static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, unsigne
{ {
struct cpufreq_freqs freqs; struct cpufreq_freqs freqs;
dprintk(KERN_WARNING "Warning: CPU frequency out of sync: cpufreq and timing " dprintk("Warning: CPU frequency out of sync: cpufreq and timing "
"core thinks of %u, is %u kHz.\n", old_freq, new_freq); "core thinks of %u, is %u kHz.\n", old_freq, new_freq);
freqs.cpu = cpu; freqs.cpu = cpu;
...@@ -1006,7 +1006,7 @@ static int cpufreq_suspend(struct sys_device * sysdev, pm_message_t pmsg) ...@@ -1006,7 +1006,7 @@ static int cpufreq_suspend(struct sys_device * sysdev, pm_message_t pmsg)
struct cpufreq_freqs freqs; struct cpufreq_freqs freqs;
if (!(cpufreq_driver->flags & CPUFREQ_PM_NO_WARN)) if (!(cpufreq_driver->flags & CPUFREQ_PM_NO_WARN))
dprintk(KERN_DEBUG "Warning: CPU frequency is %u, " dprintk("Warning: CPU frequency is %u, "
"cpufreq assumed %u kHz.\n", "cpufreq assumed %u kHz.\n",
cur_freq, cpu_policy->cur); cur_freq, cpu_policy->cur);
...@@ -1087,7 +1087,7 @@ static int cpufreq_resume(struct sys_device * sysdev) ...@@ -1087,7 +1087,7 @@ static int cpufreq_resume(struct sys_device * sysdev)
struct cpufreq_freqs freqs; struct cpufreq_freqs freqs;
if (!(cpufreq_driver->flags & CPUFREQ_PM_NO_WARN)) if (!(cpufreq_driver->flags & CPUFREQ_PM_NO_WARN))
dprintk(KERN_WARNING "Warning: CPU frequency" dprintk("Warning: CPU frequency"
"is %u, cpufreq assumed %u kHz.\n", "is %u, cpufreq assumed %u kHz.\n",
cur_freq, cpu_policy->cur); cur_freq, cpu_policy->cur);
......
...@@ -74,7 +74,7 @@ static ssize_t ...@@ -74,7 +74,7 @@ static ssize_t
show_total_trans(struct cpufreq_policy *policy, char *buf) show_total_trans(struct cpufreq_policy *policy, char *buf)
{ {
struct cpufreq_stats *stat = cpufreq_stats_table[policy->cpu]; struct cpufreq_stats *stat = cpufreq_stats_table[policy->cpu];
if(!stat) if (!stat)
return 0; return 0;
return sprintf(buf, "%d\n", return sprintf(buf, "%d\n",
cpufreq_stats_table[stat->cpu]->total_trans); cpufreq_stats_table[stat->cpu]->total_trans);
...@@ -86,7 +86,7 @@ show_time_in_state(struct cpufreq_policy *policy, char *buf) ...@@ -86,7 +86,7 @@ show_time_in_state(struct cpufreq_policy *policy, char *buf)
ssize_t len = 0; ssize_t len = 0;
int i; int i;
struct cpufreq_stats *stat = cpufreq_stats_table[policy->cpu]; struct cpufreq_stats *stat = cpufreq_stats_table[policy->cpu];
if(!stat) if (!stat)
return 0; return 0;
cpufreq_stats_update(stat->cpu); cpufreq_stats_update(stat->cpu);
for (i = 0; i < stat->state_num; i++) { for (i = 0; i < stat->state_num; i++) {
...@@ -104,7 +104,7 @@ show_trans_table(struct cpufreq_policy *policy, char *buf) ...@@ -104,7 +104,7 @@ show_trans_table(struct cpufreq_policy *policy, char *buf)
int i, j; int i, j;
struct cpufreq_stats *stat = cpufreq_stats_table[policy->cpu]; struct cpufreq_stats *stat = cpufreq_stats_table[policy->cpu];
if(!stat) if (!stat)
return 0; return 0;
cpufreq_stats_update(stat->cpu); cpufreq_stats_update(stat->cpu);
len += snprintf(buf + len, PAGE_SIZE - len, " From : To\n"); len += snprintf(buf + len, PAGE_SIZE - len, " From : To\n");
......
...@@ -20,7 +20,7 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, ...@@ -20,7 +20,7 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
{ {
unsigned int min_freq = ~0; unsigned int min_freq = ~0;
unsigned int max_freq = 0; unsigned int max_freq = 0;
unsigned int i = 0; unsigned int i;
for (i=0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { for (i=0; (table[i].frequency != CPUFREQ_TABLE_END); i++) {
unsigned int freq = table[i].frequency; unsigned int freq = table[i].frequency;
...@@ -51,7 +51,7 @@ int cpufreq_frequency_table_verify(struct cpufreq_policy *policy, ...@@ -51,7 +51,7 @@ int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
struct cpufreq_frequency_table *table) struct cpufreq_frequency_table *table)
{ {
unsigned int next_larger = ~0; unsigned int next_larger = ~0;
unsigned int i = 0; unsigned int i;
unsigned int count = 0; unsigned int count = 0;
dprintk("request for verification of policy (%u - %u kHz) for cpu %u\n", policy->min, policy->max, policy->cpu); dprintk("request for verification of policy (%u - %u kHz) for cpu %u\n", policy->min, policy->max, policy->cpu);
...@@ -91,20 +91,24 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy, ...@@ -91,20 +91,24 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
unsigned int relation, unsigned int relation,
unsigned int *index) unsigned int *index)
{ {
struct cpufreq_frequency_table optimal = { .index = ~0, }; struct cpufreq_frequency_table optimal = {
struct cpufreq_frequency_table suboptimal = { .index = ~0, }; .index = ~0,
.frequency = 0,
};
struct cpufreq_frequency_table suboptimal = {
.index = ~0,
.frequency = 0,
};
unsigned int i; unsigned int i;
dprintk("request for target %u kHz (relation: %u) for cpu %u\n", target_freq, relation, policy->cpu); dprintk("request for target %u kHz (relation: %u) for cpu %u\n", target_freq, relation, policy->cpu);
switch (relation) { switch (relation) {
case CPUFREQ_RELATION_H: case CPUFREQ_RELATION_H:
optimal.frequency = 0;
suboptimal.frequency = ~0; suboptimal.frequency = ~0;
break; break;
case CPUFREQ_RELATION_L: case CPUFREQ_RELATION_L:
optimal.frequency = ~0; optimal.frequency = ~0;
suboptimal.frequency = 0;
break; break;
} }
......
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