Commit 38522bb5 authored by Dave Jones's avatar Dave Jones

Merge delerium.codemonkey.org.uk:/mnt/nfs/neologic/bar/src/kernel/2.6/trees/bk-linus

into delerium.codemonkey.org.uk:/mnt/nfs/neologic/bar/src/kernel/2.6/trees/cpufreq
parents b670ef77 f6b614e7
......@@ -75,7 +75,6 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/init.h>
#include <linux/smp.h>
#include <linux/cpufreq.h>
......
......@@ -18,7 +18,8 @@
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/cpufreq.h>
#include <linux/slab.h>
......@@ -30,25 +31,25 @@
#include "longhaul.h"
#define DEBUG
#ifdef DEBUG
#define dprintk(msg...) printk(msg)
#else
#define dprintk(msg...) do { } while(0)
#endif
#define PFX "longhaul: "
static unsigned int numscales=16, numvscales;
static unsigned int fsb;
static int minvid, maxvid;
static int can_scale_voltage;
static int vrmrev;
/* Module parameters */
static int dont_scale_voltage;
static unsigned int fsb;
static int debug;
static int debug;
static void dprintk(const char *msg, ...)
{
if (debug == 1)
printk(msg);
}
#define __hlt() __asm__ __volatile__("hlt": : :"memory")
......@@ -118,8 +119,7 @@ static void longhaul_setstate (unsigned int clock_ratio_index)
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
dprintk (KERN_INFO PFX "FSB:%d Mult:%d.%dx\n", fsb,
mult/10, mult%10);
dprintk (KERN_INFO PFX "FSB:%d Mult:%d.%dx\n", fsb, mult/10, mult%10);
switch (longhaul_version) {
case 1:
......@@ -167,16 +167,16 @@ static void longhaul_setstate (unsigned int clock_ratio_index)
longhaul.bits.SoftBusRatio = clock_ratio_index & 0xf;
longhaul.bits.SoftBusRatio4 = (clock_ratio_index & 0x10) >> 4;
longhaul.bits.EnableSoftBusRatio = 1;
longhaul.bits.RevisionKey = 0x0;
wrmsrl(MSR_VIA_LONGHAUL, longhaul.val);
__hlt();
rdmsrl (MSR_VIA_LONGHAUL, longhaul.val);
longhaul.bits.EnableSoftBusRatio = 0;
longhaul.bits.RevisionKey = 0xf;
wrmsrl (MSR_VIA_LONGHAUL, longhaul.val);
wrmsrl (MSR_VIA_LONGHAUL, longhaul.val);
break;
}
......@@ -276,26 +276,26 @@ static int __init longhaul_get_ranges (void)
break;
}
break;
case 4:
rdmsrl (MSR_VIA_LONGHAUL, longhaul.val);
//TODO: Nehemiah may have borken MaxMHzBR.
// need to extrapolate from FSB.
invalue2 = longhaul.bits.MinMHzBR;
invalue = longhaul.bits.MaxMHzBR;
if (longhaul.bits.MaxMHzBR4)
if (longhaul.bits.MaxMHzBR4)
invalue += 16;
maxmult=multipliers[invalue];
maxmult=longhaul_get_cpu_mult();
printk(KERN_INFO PFX " invalue: %ld maxmult: %d \n", invalue, maxmult);
printk(KERN_INFO PFX " invalue2: %ld \n", invalue2);
minmult=50;
switch (longhaul.bits.MaxMHzFSB) {
case 0x0: fsb=133;
break;
......@@ -306,8 +306,8 @@ static int __init longhaul_get_ranges (void)
case 0x3: fsb=66;
break;
}
break;
break;
}
dprintk (KERN_INFO PFX "MinMult=%d.%dx MaxMult=%d.%dx\n",
......@@ -418,13 +418,13 @@ static int longhaul_target (struct cpufreq_policy *policy,
unsigned int relation)
{
unsigned int table_index = 0;
unsigned int new_clock_ratio = 0;
unsigned int new_clock_ratio = 0;
if (cpufreq_frequency_table_target(policy, longhaul_table, target_freq, relation, &table_index))
return -EINVAL;
new_clock_ratio = longhaul_table[table_index].index & 0xFF;
longhaul_setstate(new_clock_ratio);
return 0;
......@@ -500,7 +500,6 @@ static int __init longhaul_cpu_init (struct cpufreq_policy *policy)
break;
}
break;
default:
cpuname = "Unknown";
......@@ -514,11 +513,11 @@ static int __init longhaul_cpu_init (struct cpufreq_policy *policy)
if (ret != 0)
return ret;
if ((longhaul_version==2) && (dont_scale_voltage==0))
if ((longhaul_version==2) && (dont_scale_voltage==0))
longhaul_setup_voltagescaling();
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
policy->cur = calc_speed (longhaul_get_cpu_mult(), fsb);
ret = cpufreq_frequency_table_cpuinfo(policy, longhaul_table);
......@@ -530,7 +529,7 @@ static int __init longhaul_cpu_init (struct cpufreq_policy *policy)
return 0;
}
static int __exit longhaul_cpu_exit(struct cpufreq_policy *policy)
static int __devexit longhaul_cpu_exit(struct cpufreq_policy *policy)
{
cpufreq_frequency_table_put_attr(policy->cpu);
return 0;
......@@ -542,14 +541,14 @@ static struct freq_attr* longhaul_attr[] = {
};
static struct cpufreq_driver longhaul_driver = {
.verify = longhaul_verify,
.target = longhaul_target,
.get = longhaul_get,
.init = longhaul_cpu_init,
.exit = longhaul_cpu_exit,
.name = "longhaul",
.owner = THIS_MODULE,
.attr = longhaul_attr,
.verify = longhaul_verify,
.target = longhaul_target,
.get = longhaul_get,
.init = longhaul_cpu_init,
.exit = __devexit_p(longhaul_cpu_exit),
.name = "longhaul",
.owner = THIS_MODULE,
.attr = longhaul_attr,
};
static int __init longhaul_init (void)
......@@ -560,12 +559,8 @@ static int __init longhaul_init (void)
return -ENODEV;
switch (c->x86_model) {
case 6 ... 8:
case 6 ... 9:
return cpufreq_register_driver(&longhaul_driver);
case 9:
printk (KERN_INFO PFX "Nehemiah unsupported: Waiting on working silicon "
"from VIA before this is usable.\n");
break;
default:
printk (KERN_INFO PFX "Unknown VIA CPU. Contact davej@codemonkey.org.uk\n");
}
......@@ -579,7 +574,11 @@ static void __exit longhaul_exit (void)
kfree(longhaul_table);
}
MODULE_PARM (dont_scale_voltage, "i");
module_param (dont_scale_voltage, int, 0644);
MODULE_PARM_DESC(dont_scale_voltage, "Don't scale voltage of processor");
module_param (debug, int, 0644);
MODULE_PARM_DESC(debug, "Dump debugging information.");
MODULE_AUTHOR ("Dave Jones <davej@codemonkey.org.uk>");
MODULE_DESCRIPTION ("Longhaul driver for VIA Cyrix processors.");
......
......@@ -27,7 +27,6 @@
#include <linux/smp.h>
#include <linux/cpufreq.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <asm/processor.h>
#include <asm/msr.h>
......@@ -35,7 +34,7 @@
#include "speedstep-lib.h"
#define PFX "cpufreq: "
#define PFX "p4-clockmod: "
/*
* Duty Cycle (3bits), note DC_DISABLE is not specified in
......
......@@ -16,7 +16,7 @@
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/cpufreq.h>
......@@ -86,7 +86,7 @@ static int mobile_vid_table[32] = {
/* divide by 10 to get FID. */
static int fid_codes[32] = {
110, 115, 120, 125, 50, 55, 60, 65,
70, 75, 80, 85, 90, 95, 100, 105,
70, 75, 80, 85, 90, 95, 100, 105,
30, 190, 40, 200, 130, 135, 140, 210,
150, 225, 160, 165, 170, 180, -1, -1,
};
......@@ -95,7 +95,7 @@ static int fid_codes[32] = {
* configuration purpose.
*/
static int powernow_acpi_force;
static int acpi_force;
static struct cpufreq_frequency_table *powernow_table;
......@@ -144,6 +144,11 @@ static int check_powernow(void)
}
cpuid(0x80000007, &eax, &ebx, &ecx, &edx);
/* Check we can actually do something before we say anything.*/
if (!(edx & (1 << 1 | 1 << 2)))
return 0;
printk (KERN_INFO PFX "PowerNOW! Technology present. Can scale: ");
if (edx & 1 << 1) {
......@@ -159,11 +164,6 @@ static int check_powernow(void)
can_scale_vid=1;
}
if (!(edx & (1 << 1 | 1 << 2))) {
printk ("nothing.\n");
return 0;
}
printk (".\n");
return 1;
}
......@@ -572,7 +572,7 @@ static int __init powernow_cpu_init (struct cpufreq_policy *policy)
}
dprintk(KERN_INFO PFX "FSB: %3d.%03d MHz\n", fsb/1000, fsb%1000);
if ((dmi_broken & BROKEN_CPUFREQ) || powernow_acpi_force) {
if ((dmi_broken & BROKEN_CPUFREQ) || acpi_force) {
printk (KERN_INFO PFX "PSB/PST known to be broken. Trying ACPI instead\n");
result = powernow_acpi_init();
} else {
......@@ -653,8 +653,7 @@ static void __exit powernow_exit (void)
kfree(powernow_table);
}
module_param(powernow_acpi_force, int, 0444);
module_param(acpi_force, int, 0444);
MODULE_PARM_DESC(acpi_force, "Force ACPI to be used");
MODULE_AUTHOR ("Dave Jones <davej@codemonkey.org.uk>");
......
......@@ -553,7 +553,7 @@ static int fill_powernow_table(struct powernow_k8_data *data, struct pst_s *pst,
printk(KERN_ERR PFX "no p states to transition\n");
return -ENODEV;
}
if (check_pst_table(data, pst, maxvid))
return -EINVAL;
......@@ -736,9 +736,9 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
/* verify only 1 entry from the lo frequency table */
if ((fid < HI_FID_TABLE_BOTTOM) && (cntlofreq++)) {
printk(KERN_ERR PFX "Too many lo freq table entries\n");
goto err_out;
goto err_out_mem;
}
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,
......@@ -757,12 +757,16 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
print_basics(data);
powernow_k8_acpi_pst_values(data, 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;
}
......@@ -945,7 +949,7 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol)
if ((num_online_cpus() != 1) || (num_possible_cpus() != 1)) {
printk(KERN_INFO PFX "MP systems not supported by PSB BIOS structure\n");
kfree(data);
return 0;
return -ENODEV;
}
rc = find_psb_table(data);
if (rc) {
......@@ -1047,7 +1051,7 @@ static unsigned int powernowk8_get (unsigned int cpu)
if (query_current_values_with_pending_wait(data))
goto out;
khz = find_khz_freq_from_fid(data->currfid);
khz = find_khz_freq_from_fid(data->currfid);
out:
preempt_enable_no_resched();
......
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