diff options
| author | Jesse Ahrens <jahrens@centtech.com> | 2008-01-17 16:25:08 -0500 | 
|---|---|---|
| committer | Dave Jones <davej@redhat.com> | 2008-02-06 22:57:58 -0500 | 
| commit | 535ae38c9f4025faadedd17fac5f11e79e1cfdb2 (patch) | |
| tree | 1449c7d7f0e885293552a0d74b3159038dca6cd0 | |
| parent | 6c9cda78b4f1fb89b0b6b8c03ce55dbdf0b1bdef (diff) | |
[CPUFREQ] Support Model D parts and newer in e_powersaver
Patch by VIA that updates e_powersaver.c to work with our model D parts
and newer.
From: Jesse Ahrens <jahrens@centtech.com>
Signed-off-by: Dave Jones <davej@redhat.com>
| -rw-r--r-- | arch/x86/kernel/cpu/cpufreq/e_powersaver.c | 37 | 
1 files changed, 32 insertions, 5 deletions
| diff --git a/arch/x86/kernel/cpu/cpufreq/e_powersaver.c b/arch/x86/kernel/cpu/cpufreq/e_powersaver.c index 326a4c81f684..34a227ecb253 100644 --- a/arch/x86/kernel/cpu/cpufreq/e_powersaver.c +++ b/arch/x86/kernel/cpu/cpufreq/e_powersaver.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #define EPS_BRAND_C7 1 | 23 | #define EPS_BRAND_C7 1 | 
| 24 | #define EPS_BRAND_EDEN 2 | 24 | #define EPS_BRAND_EDEN 2 | 
| 25 | #define EPS_BRAND_C3 3 | 25 | #define EPS_BRAND_C3 3 | 
| 26 | #define EPS_BRAND_C7D 4 | ||
| 26 | 27 | ||
| 27 | struct eps_cpu_data { | 28 | struct eps_cpu_data { | 
| 28 | u32 fsb; | 29 | u32 fsb; | 
| @@ -54,6 +55,7 @@ static int eps_set_state(struct eps_cpu_data *centaur, | |||
| 54 | { | 55 | { | 
| 55 | struct cpufreq_freqs freqs; | 56 | struct cpufreq_freqs freqs; | 
| 56 | u32 lo, hi; | 57 | u32 lo, hi; | 
| 58 | u8 current_multiplier, current_voltage; | ||
| 57 | int err = 0; | 59 | int err = 0; | 
| 58 | int i; | 60 | int i; | 
| 59 | 61 | ||
| @@ -93,6 +95,15 @@ postchange: | |||
| 93 | rdmsr(MSR_IA32_PERF_STATUS, lo, hi); | 95 | rdmsr(MSR_IA32_PERF_STATUS, lo, hi); | 
| 94 | freqs.new = centaur->fsb * ((lo >> 8) & 0xff); | 96 | freqs.new = centaur->fsb * ((lo >> 8) & 0xff); | 
| 95 | 97 | ||
| 98 | /* Print voltage and multiplier */ | ||
| 99 | rdmsr(MSR_IA32_PERF_STATUS, lo, hi); | ||
| 100 | current_voltage = lo & 0xff; | ||
| 101 | printk(KERN_INFO "eps: Current voltage = %dmV\n", | ||
| 102 | current_voltage * 16 + 700); | ||
| 103 | current_multiplier = (lo >> 8) & 0xff; | ||
| 104 | printk(KERN_INFO "eps: Current multiplier = %d\n", | ||
| 105 | current_multiplier); | ||
| 106 | |||
| 96 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 107 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 
| 97 | return err; | 108 | return err; | 
| 98 | } | 109 | } | 
| @@ -141,9 +152,10 @@ static int eps_cpu_init(struct cpufreq_policy *policy) | |||
| 141 | u8 current_multiplier, current_voltage; | 152 | u8 current_multiplier, current_voltage; | 
| 142 | u8 max_multiplier, max_voltage; | 153 | u8 max_multiplier, max_voltage; | 
| 143 | u8 min_multiplier, min_voltage; | 154 | u8 min_multiplier, min_voltage; | 
| 144 | u8 brand; | 155 | u8 brand = 0; | 
| 145 | u32 fsb; | 156 | u32 fsb; | 
| 146 | struct eps_cpu_data *centaur; | 157 | struct eps_cpu_data *centaur; | 
| 158 | struct cpuinfo_x86 *c = &cpu_data(0); | ||
| 147 | struct cpufreq_frequency_table *f_table; | 159 | struct cpufreq_frequency_table *f_table; | 
| 148 | int k, step, voltage; | 160 | int k, step, voltage; | 
| 149 | int ret; | 161 | int ret; | 
| @@ -154,8 +166,20 @@ static int eps_cpu_init(struct cpufreq_policy *policy) | |||
| 154 | 166 | ||
| 155 | /* Check brand */ | 167 | /* Check brand */ | 
| 156 | printk("eps: Detected VIA "); | 168 | printk("eps: Detected VIA "); | 
| 157 | rdmsr(0x1153, lo, hi); | 169 | |
| 158 | brand = (((lo >> 2) ^ lo) >> 18) & 3; | 170 | switch (c->x86_model) { | 
| 171 | case 10: | ||
| 172 | rdmsr(0x1153, lo, hi); | ||
| 173 | brand = (((lo >> 2) ^ lo) >> 18) & 3; | ||
| 174 | printk(KERN_CONT "Model A "); | ||
| 175 | break; | ||
| 176 | case 13: | ||
| 177 | rdmsr(0x1154, lo, hi); | ||
| 178 | brand = (((lo >> 4) ^ (lo >> 2))) & 0x000000ff; | ||
| 179 | printk(KERN_CONT "Model D "); | ||
| 180 | break; | ||
| 181 | } | ||
| 182 | |||
| 159 | switch(brand) { | 183 | switch(brand) { | 
| 160 | case EPS_BRAND_C7M: | 184 | case EPS_BRAND_C7M: | 
| 161 | printk("C7-M\n"); | 185 | printk("C7-M\n"); | 
| @@ -166,6 +190,9 @@ static int eps_cpu_init(struct cpufreq_policy *policy) | |||
| 166 | case EPS_BRAND_EDEN: | 190 | case EPS_BRAND_EDEN: | 
| 167 | printk("Eden\n"); | 191 | printk("Eden\n"); | 
| 168 | break; | 192 | break; | 
| 193 | case EPS_BRAND_C7D: | ||
| 194 | printk(KERN_CONT "C7-D\n"); | ||
| 195 | break; | ||
| 169 | case EPS_BRAND_C3: | 196 | case EPS_BRAND_C3: | 
| 170 | printk("C3\n"); | 197 | printk("C3\n"); | 
| 171 | return -ENODEV; | 198 | return -ENODEV; | 
| @@ -208,7 +235,7 @@ static int eps_cpu_init(struct cpufreq_policy *policy) | |||
| 208 | if (current_multiplier > max_multiplier | 235 | if (current_multiplier > max_multiplier | 
| 209 | || max_multiplier <= min_multiplier) | 236 | || max_multiplier <= min_multiplier) | 
| 210 | return -EINVAL; | 237 | return -EINVAL; | 
| 211 | if (current_voltage > 0x1c || max_voltage > 0x1c) | 238 | if (current_voltage > 0x1f || max_voltage > 0x1f) | 
| 212 | return -EINVAL; | 239 | return -EINVAL; | 
| 213 | if (max_voltage < min_voltage) | 240 | if (max_voltage < min_voltage) | 
| 214 | return -EINVAL; | 241 | return -EINVAL; | 
| @@ -310,7 +337,7 @@ static int __init eps_init(void) | |||
| 310 | /* This driver will work only on Centaur C7 processors with | 337 | /* This driver will work only on Centaur C7 processors with | 
| 311 | * Enhanced SpeedStep/PowerSaver registers */ | 338 | * Enhanced SpeedStep/PowerSaver registers */ | 
| 312 | if (c->x86_vendor != X86_VENDOR_CENTAUR | 339 | if (c->x86_vendor != X86_VENDOR_CENTAUR | 
| 313 | || c->x86 != 6 || c->x86_model != 10) | 340 | || c->x86 != 6 || c->x86_model < 10) | 
| 314 | return -ENODEV; | 341 | return -ENODEV; | 
| 315 | if (!cpu_has(c, X86_FEATURE_EST)) | 342 | if (!cpu_has(c, X86_FEATURE_EST)) | 
| 316 | return -ENODEV; | 343 | return -ENODEV; | 
