diff options
| -rw-r--r-- | drivers/cpufreq/powernow-k6.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/cpufreq/powernow-k6.c b/drivers/cpufreq/powernow-k6.c index 16359ab2c459..b9a444e358b5 100644 --- a/drivers/cpufreq/powernow-k6.c +++ b/drivers/cpufreq/powernow-k6.c | |||
| @@ -37,17 +37,20 @@ MODULE_PARM_DESC(bus_frequency, "Bus frequency in kHz"); | |||
| 37 | 37 | ||
| 38 | /* Clock ratio multiplied by 10 - see table 27 in AMD#23446 */ | 38 | /* Clock ratio multiplied by 10 - see table 27 in AMD#23446 */ |
| 39 | static struct cpufreq_frequency_table clock_ratio[] = { | 39 | static struct cpufreq_frequency_table clock_ratio[] = { |
| 40 | {45, /* 000 -> 4.5x */ 0}, | 40 | {60, /* 110 -> 6.0x */ 0}, |
| 41 | {55, /* 011 -> 5.5x */ 0}, | ||
| 41 | {50, /* 001 -> 5.0x */ 0}, | 42 | {50, /* 001 -> 5.0x */ 0}, |
| 43 | {45, /* 000 -> 4.5x */ 0}, | ||
| 42 | {40, /* 010 -> 4.0x */ 0}, | 44 | {40, /* 010 -> 4.0x */ 0}, |
| 43 | {55, /* 011 -> 5.5x */ 0}, | ||
| 44 | {20, /* 100 -> 2.0x */ 0}, | ||
| 45 | {30, /* 101 -> 3.0x */ 0}, | ||
| 46 | {60, /* 110 -> 6.0x */ 0}, | ||
| 47 | {35, /* 111 -> 3.5x */ 0}, | 45 | {35, /* 111 -> 3.5x */ 0}, |
| 46 | {30, /* 101 -> 3.0x */ 0}, | ||
| 47 | {20, /* 100 -> 2.0x */ 0}, | ||
| 48 | {0, CPUFREQ_TABLE_END} | 48 | {0, CPUFREQ_TABLE_END} |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | static const u8 index_to_register[8] = { 6, 3, 1, 0, 2, 7, 5, 4 }; | ||
| 52 | static const u8 register_to_index[8] = { 3, 2, 4, 1, 7, 6, 0, 5 }; | ||
| 53 | |||
| 51 | static const struct { | 54 | static const struct { |
| 52 | unsigned freq; | 55 | unsigned freq; |
| 53 | unsigned mult; | 56 | unsigned mult; |
| @@ -91,7 +94,7 @@ static int powernow_k6_get_cpu_multiplier(void) | |||
| 91 | 94 | ||
| 92 | local_irq_enable(); | 95 | local_irq_enable(); |
| 93 | 96 | ||
| 94 | return clock_ratio[(invalue >> 5)&7].driver_data; | 97 | return clock_ratio[register_to_index[(invalue >> 5)&7]].driver_data; |
| 95 | } | 98 | } |
| 96 | 99 | ||
| 97 | static void powernow_k6_set_cpu_multiplier(unsigned int best_i) | 100 | static void powernow_k6_set_cpu_multiplier(unsigned int best_i) |
| @@ -111,7 +114,7 @@ static void powernow_k6_set_cpu_multiplier(unsigned int best_i) | |||
| 111 | write_cr0(cr0 | X86_CR0_CD); | 114 | write_cr0(cr0 | X86_CR0_CD); |
| 112 | wbinvd(); | 115 | wbinvd(); |
| 113 | 116 | ||
| 114 | outvalue = (1<<12) | (1<<10) | (1<<9) | (best_i<<5); | 117 | outvalue = (1<<12) | (1<<10) | (1<<9) | (index_to_register[best_i]<<5); |
| 115 | 118 | ||
| 116 | msrval = POWERNOW_IOPORT + 0x1; | 119 | msrval = POWERNOW_IOPORT + 0x1; |
| 117 | wrmsr(MSR_K6_EPMR, msrval, 0); /* enable the PowerNow port */ | 120 | wrmsr(MSR_K6_EPMR, msrval, 0); /* enable the PowerNow port */ |
