Commit df127be5 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://linux-dj.bkbits.net/cpufreq

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents 2fd24c2d 1a932f8e
...@@ -42,12 +42,15 @@ static int vrmrev; ...@@ -42,12 +42,15 @@ static int vrmrev;
/* Module parameters */ /* Module parameters */
static int dont_scale_voltage; static int dont_scale_voltage;
static int debug; static int debug;
static int debug;
static void dprintk(const char *msg, ...) static void dprintk(const char *fmt, ...)
{ {
if (debug == 1) va_list args;
printk(msg); if (debug == 0)
return;
va_start(args, fmt);
printk(fmt, args);
va_end(args);
} }
...@@ -79,11 +82,7 @@ static int longhaul_get_cpu_mult (void) ...@@ -79,11 +82,7 @@ static int longhaul_get_cpu_mult (void)
rdmsr (MSR_IA32_EBL_CR_POWERON, lo, hi); rdmsr (MSR_IA32_EBL_CR_POWERON, lo, hi);
invalue = (lo & (1<<22|1<<23|1<<24|1<<25)) >>22; invalue = (lo & (1<<22|1<<23|1<<24|1<<25)) >>22;
if (longhaul_version==2) { if (longhaul_version==2 || longhaul_version==3) {
if (lo & (1<<27))
invalue+=16;
}
if (longhaul_version==4) {
if (lo & (1<<27)) if (lo & (1<<27))
invalue+=16; invalue+=16;
} }
...@@ -162,7 +161,7 @@ static void longhaul_setstate (unsigned int clock_ratio_index) ...@@ -162,7 +161,7 @@ static void longhaul_setstate (unsigned int clock_ratio_index)
longhaul.bits.RevisionKey = 3; longhaul.bits.RevisionKey = 3;
wrmsrl (MSR_VIA_LONGHAUL, longhaul.val); wrmsrl (MSR_VIA_LONGHAUL, longhaul.val);
break; break;
case 4: case 3:
rdmsrl (MSR_VIA_LONGHAUL, longhaul.val); rdmsrl (MSR_VIA_LONGHAUL, longhaul.val);
longhaul.bits.SoftBusRatio = clock_ratio_index & 0xf; longhaul.bits.SoftBusRatio = clock_ratio_index & 0xf;
longhaul.bits.SoftBusRatio4 = (clock_ratio_index & 0x10) >> 4; longhaul.bits.SoftBusRatio4 = (clock_ratio_index & 0x10) >> 4;
...@@ -227,7 +226,7 @@ static int guess_fsb(int maxmult) ...@@ -227,7 +226,7 @@ static int guess_fsb(int maxmult)
static int __init longhaul_get_ranges (void) static int __init longhaul_get_ranges (void)
{ {
struct cpuinfo_x86 *c = cpu_data; struct cpuinfo_x86 *c = cpu_data;
unsigned long invalue,invalue2; unsigned long invalue;
unsigned int minmult=0, maxmult=0; unsigned int minmult=0, maxmult=0;
unsigned int multipliers[32]= { unsigned int multipliers[32]= {
50,30,40,100,55,35,45,95,90,70,80,60,120,75,85,65, 50,30,40,100,55,35,45,95,90,70,80,60,120,75,85,65,
...@@ -235,7 +234,8 @@ static int __init longhaul_get_ranges (void) ...@@ -235,7 +234,8 @@ static int __init longhaul_get_ranges (void)
unsigned int j, k = 0; unsigned int j, k = 0;
union msr_longhaul longhaul; union msr_longhaul longhaul;
unsigned long lo, hi; unsigned long lo, hi;
unsigned int eblcr_fsb_table[] = { 66, 133, 100, -1 }; unsigned int eblcr_fsb_table_v1[] = { 66, 133, 100, -1 };
unsigned int eblcr_fsb_table_v2[] = { 133, 100, -1, 66 };
switch (longhaul_version) { switch (longhaul_version) {
case 1: case 1:
...@@ -246,7 +246,7 @@ static int __init longhaul_get_ranges (void) ...@@ -246,7 +246,7 @@ static int __init longhaul_get_ranges (void)
rdmsr (MSR_IA32_EBL_CR_POWERON, lo, hi); rdmsr (MSR_IA32_EBL_CR_POWERON, lo, hi);
invalue = (lo & (1<<18|1<<19)) >>18; invalue = (lo & (1<<18|1<<19)) >>18;
if (c->x86_model==6) if (c->x86_model==6)
fsb = eblcr_fsb_table[invalue]; fsb = eblcr_fsb_table_v1[invalue];
else else
fsb = guess_fsb(maxmult); fsb = guess_fsb(maxmult);
break; break;
...@@ -265,53 +265,38 @@ static int __init longhaul_get_ranges (void) ...@@ -265,53 +265,38 @@ static int __init longhaul_get_ranges (void)
else else
minmult = multipliers[invalue]; minmult = multipliers[invalue];
switch (longhaul.bits.MaxMHzFSB) { fsb = eblcr_fsb_table_v2[longhaul.bits.MaxMHzFSB];
case 0x0: fsb=133;
break;
case 0x1: fsb=100;
break;
case 0x2: printk (KERN_INFO PFX "Invalid (reserved) FSB!\n");
return -EINVAL;
case 0x3: fsb=66;
break;
}
break; break;
case 4: case 3:
rdmsrl (MSR_VIA_LONGHAUL, longhaul.val); rdmsrl (MSR_VIA_LONGHAUL, longhaul.val);
//TODO: Nehemiah may have borken MaxMHzBR. /*
// need to extrapolate from FSB. * TODO: This code works, but raises a lot of questions.
* - Some Nehemiah's seem to have broken Min/MaxMHzBR's.
invalue2 = longhaul.bits.MinMHzBR; * We get around this by using a hardcoded multiplier of 5.0x
invalue = longhaul.bits.MaxMHzBR; * for the minimimum speed, and the speed we booted up at for the max.
if (longhaul.bits.MaxMHzBR4) * This is done in longhaul_get_cpu_mult() by reading the EBLCR register.
invalue += 16; * - According to some VIA documentation EBLCR is only
maxmult=multipliers[invalue]; * in pre-Nehemiah C3s. How this still works is a mystery.
* We're possibly using something undocumented and unsupported,
maxmult=longhaul_get_cpu_mult(); * But it works, so we don't grumble.
*/
printk(KERN_INFO PFX " invalue: %ld maxmult: %d \n", invalue, maxmult);
printk(KERN_INFO PFX " invalue2: %ld \n", invalue2);
minmult=50; minmult=50;
maxmult=longhaul_get_cpu_mult();
switch (longhaul.bits.MaxMHzFSB) { fsb = eblcr_fsb_table_v2[longhaul.bits.MaxMHzFSB];
case 0x0: fsb=133;
break;
case 0x1: fsb=100;
break;
case 0x2: printk (KERN_INFO PFX "Invalid (reserved) FSB!\n");
return -EINVAL;
case 0x3: fsb=66;
break;
}
break; break;
} }
dprintk (KERN_INFO PFX "MinMult=%d.%dx MaxMult=%d.%dx\n", dprintk (KERN_INFO PFX "MinMult=%d.%dx MaxMult=%d.%dx\n",
minmult/10, minmult%10, maxmult/10, maxmult%10); minmult/10, minmult%10, maxmult/10, maxmult%10);
if (fsb == -1) {
printk (KERN_INFO PFX "Invalid (reserved) FSB!\n");
return -EINVAL;
}
highest_speed = calc_speed (maxmult, fsb); highest_speed = calc_speed (maxmult, fsb);
lowest_speed = calc_speed (minmult,fsb); lowest_speed = calc_speed (minmult,fsb);
dprintk (KERN_INFO PFX "FSB: %dMHz Lowestspeed=%dMHz Highestspeed=%dMHz\n", dprintk (KERN_INFO PFX "FSB: %dMHz Lowestspeed=%dMHz Highestspeed=%dMHz\n",
...@@ -480,7 +465,7 @@ static int __init longhaul_cpu_init (struct cpufreq_policy *policy) ...@@ -480,7 +465,7 @@ static int __init longhaul_cpu_init (struct cpufreq_policy *policy)
break; break;
case 9: case 9:
longhaul_version=4; longhaul_version=3;
numscales=32; numscales=32;
switch (c->x86_mask) { switch (c->x86_mask) {
case 0 ... 1: case 0 ... 1:
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/system.h> #include <asm/system.h>
#ifdef CONFIG_ACPI_PROCESSOR #if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE)
#include <linux/acpi.h> #include <linux/acpi.h>
#include <acpi/processor.h> #include <acpi/processor.h>
#endif #endif
...@@ -63,7 +63,7 @@ struct pst_s { ...@@ -63,7 +63,7 @@ struct pst_s {
u8 numpstates; u8 numpstates;
}; };
#ifdef CONFIG_ACPI_PROCESSOR #if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE)
union powernow_acpi_control_t { union powernow_acpi_control_t {
struct { struct {
unsigned long fid:5, unsigned long fid:5,
...@@ -293,7 +293,7 @@ static void change_speed (unsigned int index) ...@@ -293,7 +293,7 @@ static void change_speed (unsigned int index)
} }
#ifdef CONFIG_ACPI_PROCESSOR #if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE)
struct acpi_processor_performance *acpi_processor_perf; struct acpi_processor_performance *acpi_processor_perf;
...@@ -642,7 +642,7 @@ static int __init powernow_init (void) ...@@ -642,7 +642,7 @@ static int __init powernow_init (void)
static void __exit powernow_exit (void) static void __exit powernow_exit (void)
{ {
#ifdef CONFIG_ACPI_PROCESSOR #if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE)
if (acpi_processor_perf) { if (acpi_processor_perf) {
acpi_processor_unregister_performance(acpi_processor_perf, 0); acpi_processor_unregister_performance(acpi_processor_perf, 0);
kfree(acpi_processor_perf); kfree(acpi_processor_perf);
......
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