aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLangsdorf, Mark <mark.langsdorf@amd.com>2005-11-29 15:18:03 -0500
committerDave Jones <davej@redhat.com>2005-11-29 15:46:07 -0500
commit019a61b99338d0ac05de25317b85da88e7ec4b35 (patch)
tree51b3ed2180547ea582a43777244e11f84dd66e4f
parent8aae8284fece2b8fc404ccd40b7a30aa96f317b5 (diff)
[PATCH] Support 100 MHz frequency transitions
Future versions of the Opteron processor may support frequency transitions of 100 MHz, instead of the=20 current 200 MHz. This patch enables the powernow-k8 driver to transition to an odd FID code, indicating a multiple of 100 MHz frequency. Signed-off-by: Jacob Shin <jacob.shin@amd.com> Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com> Signed-off-by: Dave Jones <davej@redhat.com>
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.c17
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.h9
2 files changed, 12 insertions, 14 deletions
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
index 349782736808..a342b32c0843 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
@@ -45,7 +45,7 @@
45 45
46#define PFX "powernow-k8: " 46#define PFX "powernow-k8: "
47#define BFX PFX "BIOS error: " 47#define BFX PFX "BIOS error: "
48#define VERSION "version 1.50.5" 48#define VERSION "version 1.60.0"
49#include "powernow-k8.h" 49#include "powernow-k8.h"
50 50
51/* serialize freq changes */ 51/* serialize freq changes */
@@ -336,7 +336,7 @@ static int core_voltage_pre_transition(struct powernow_k8_data *data, u32 reqvid
336/* Phase 2 - core frequency transition */ 336/* Phase 2 - core frequency transition */
337static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid) 337static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid)
338{ 338{
339 u32 vcoreqfid, vcocurrfid, vcofiddiff, savevid = data->currvid; 339 u32 vcoreqfid, vcocurrfid, vcofiddiff, fid_interval, savevid = data->currvid;
340 340
341 if ((reqfid < HI_FID_TABLE_BOTTOM) && (data->currfid < HI_FID_TABLE_BOTTOM)) { 341 if ((reqfid < HI_FID_TABLE_BOTTOM) && (data->currfid < HI_FID_TABLE_BOTTOM)) {
342 printk(KERN_ERR PFX "ph2: illegal lo-lo transition 0x%x 0x%x\n", 342 printk(KERN_ERR PFX "ph2: illegal lo-lo transition 0x%x 0x%x\n",
@@ -359,9 +359,11 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid)
359 : vcoreqfid - vcocurrfid; 359 : vcoreqfid - vcocurrfid;
360 360
361 while (vcofiddiff > 2) { 361 while (vcofiddiff > 2) {
362 (data->currfid & 1) ? (fid_interval = 1) : (fid_interval = 2);
363
362 if (reqfid > data->currfid) { 364 if (reqfid > data->currfid) {
363 if (data->currfid > LO_FID_TABLE_TOP) { 365 if (data->currfid > LO_FID_TABLE_TOP) {
364 if (write_new_fid(data, data->currfid + 2)) { 366 if (write_new_fid(data, data->currfid + fid_interval)) {
365 return 1; 367 return 1;
366 } 368 }
367 } else { 369 } else {
@@ -371,7 +373,7 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid)
371 } 373 }
372 } 374 }
373 } else { 375 } else {
374 if (write_new_fid(data, data->currfid - 2)) 376 if (write_new_fid(data, data->currfid - fid_interval))
375 return 1; 377 return 1;
376 } 378 }
377 379
@@ -474,7 +476,7 @@ static int check_supported_cpu(unsigned int cpu)
474 eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE); 476 eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE);
475 if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) || 477 if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) ||
476 ((eax & CPUID_XFAM) != CPUID_XFAM_K8) || 478 ((eax & CPUID_XFAM) != CPUID_XFAM_K8) ||
477 ((eax & CPUID_XMOD) > CPUID_XMOD_REV_F)) { 479 ((eax & CPUID_XMOD) > CPUID_XMOD_REV_G)) {
478 printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax); 480 printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax);
479 goto out; 481 goto out;
480 } 482 }
@@ -521,10 +523,6 @@ static int check_pst_table(struct powernow_k8_data *data, struct pst_s *pst, u8
521 printk(KERN_ERR BFX "maxfid exceeded with pstate %d\n", j); 523 printk(KERN_ERR BFX "maxfid exceeded with pstate %d\n", j);
522 return -ENODEV; 524 return -ENODEV;
523 } 525 }
524 if (pst[j].fid & 1) {
525 printk(KERN_ERR BFX "fid invalid - %d : 0x%x\n", j, pst[j].fid);
526 return -EINVAL;
527 }
528 if (j && (pst[j].fid < HI_FID_TABLE_BOTTOM)) { 526 if (j && (pst[j].fid < HI_FID_TABLE_BOTTOM)) {
529 /* Only first fid is allowed to be in "low" range */ 527 /* Only first fid is allowed to be in "low" range */
530 printk(KERN_ERR BFX "two low fids - %d : 0x%x\n", j, pst[j].fid); 528 printk(KERN_ERR BFX "two low fids - %d : 0x%x\n", j, pst[j].fid);
@@ -1177,4 +1175,3 @@ MODULE_LICENSE("GPL");
1177 1175
1178late_initcall(powernowk8_init); 1176late_initcall(powernowk8_init);
1179module_exit(powernowk8_exit); 1177module_exit(powernowk8_exit);
1180
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
index b1e85bb36396..d0de37d58e9a 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
@@ -42,7 +42,7 @@ struct powernow_k8_data {
42#define CPUID_XFAM 0x0ff00000 /* extended family */ 42#define CPUID_XFAM 0x0ff00000 /* extended family */
43#define CPUID_XFAM_K8 0 43#define CPUID_XFAM_K8 0
44#define CPUID_XMOD 0x000f0000 /* extended model */ 44#define CPUID_XMOD 0x000f0000 /* extended model */
45#define CPUID_XMOD_REV_F 0x00040000 45#define CPUID_XMOD_REV_G 0x00060000
46#define CPUID_USE_XFAM_XMOD 0x00000f00 46#define CPUID_USE_XFAM_XMOD 0x00000f00
47#define CPUID_GET_MAX_CAPABILITIES 0x80000000 47#define CPUID_GET_MAX_CAPABILITIES 0x80000000
48#define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007 48#define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007
@@ -86,13 +86,14 @@ struct powernow_k8_data {
86 * low fid table 86 * low fid table
87 * - lowest entry in the high fid table must be a <= 200MHz + 2 * the entry 87 * - lowest entry in the high fid table must be a <= 200MHz + 2 * the entry
88 * in the low fid table 88 * in the low fid table
89 * - the parts can only step at 200 MHz intervals, so 1.9 GHz is never valid 89 * - the parts can only step at <= 200 MHz intervals, odd fid values are
90 * supported in revision G and later revisions.
90 * - lowest frequency must be >= interprocessor hypertransport link speed 91 * - lowest frequency must be >= interprocessor hypertransport link speed
91 * (only applies to MP systems obviously) 92 * (only applies to MP systems obviously)
92 */ 93 */
93 94
94/* fids (frequency identifiers) are arranged in 2 tables - lo and hi */ 95/* fids (frequency identifiers) are arranged in 2 tables - lo and hi */
95#define LO_FID_TABLE_TOP 6 /* fid values marking the boundary */ 96#define LO_FID_TABLE_TOP 7 /* fid values marking the boundary */
96#define HI_FID_TABLE_BOTTOM 8 /* between the low and high tables */ 97#define HI_FID_TABLE_BOTTOM 8 /* between the low and high tables */
97 98
98#define LO_VCOFREQ_TABLE_TOP 1400 /* corresponding vco frequency values */ 99#define LO_VCOFREQ_TABLE_TOP 1400 /* corresponding vco frequency values */
@@ -106,7 +107,7 @@ struct powernow_k8_data {
106#define MIN_FREQ 800 /* Min and max freqs, per spec */ 107#define MIN_FREQ 800 /* Min and max freqs, per spec */
107#define MAX_FREQ 5000 108#define MAX_FREQ 5000
108 109
109#define INVALID_FID_MASK 0xffffffc1 /* not a valid fid if these bits are set */ 110#define INVALID_FID_MASK 0xffffffc0 /* not a valid fid if these bits are set */
110#define INVALID_VID_MASK 0xffffffc0 /* not a valid vid if these bits are set */ 111#define INVALID_VID_MASK 0xffffffc0 /* not a valid vid if these bits are set */
111 112
112#define VID_OFF 0x3f 113#define VID_OFF 0x3f