
From: Pavel Machek <pavel@suse.cz>

We curretly have an off-by-fctor-of-1000:

cat /proc/cpufreq

          minimum CPU frequency  -  maximum CPU frequency  -  policy
CPU  0         2000 kHz (100 %)  -       2000 kHz (100 %)  -  powersave


I do not have explanation why it is 2MHz - 2MHz.  On my system I removed
bug which prevented my system from being reported as 0.8MHz - 1.8MHz.  (And
modulo cosmetic uglyness, it worked).

This fixes cosmetic uglyness, adds proper copyrights, removes warning
"untested on PREEMPT" (someone tested it, and makes it easier to override
PST by user (eMachine users will need that one).


---

 arch/i386/kernel/cpu/cpufreq/powernow-k8.c |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diff -puN arch/i386/kernel/cpu/cpufreq/powernow-k8.c~powernow-k8-fix arch/i386/kernel/cpu/cpufreq/powernow-k8.c
--- 25/arch/i386/kernel/cpu/cpufreq/powernow-k8.c~powernow-k8-fix	2004-02-28 16:53:54.000000000 -0800
+++ 25-akpm/arch/i386/kernel/cpu/cpufreq/powernow-k8.c	2004-02-28 16:53:54.000000000 -0800
@@ -8,6 +8,8 @@
  *
  *  Based on the powernow-k7.c module written by Dave Jones.
  *  (C) 2003 Dave Jones <davej@codemonkey.ork.uk> on behalf of SuSE Labs
+ *  (C) 2004 Dominik Brodowski <linux@brodo.de>
+ *  (C) 2004 Pavel Machek <pavel@suse.cz>
  *  Licensed under the terms of the GNU GPL License version 2.
  *  Based upon datasheets & sample CPUs kindly provided by AMD.
  *
@@ -34,10 +36,6 @@
 #define VERSION "version 1.00.08a"
 #include "powernow-k8.h"
 
-#ifdef CONFIG_PREEMPT
-#warning this driver has not been tested on a preempt system
-#endif
-
 static u32 vstable;	/* voltage stabalization time, from PSB, units 20 us */
 static u32 plllock;	/* pll lock time, from PSB, units 1 us */
 static u32 numps;	/* number of p-states, from PSB */
@@ -636,13 +634,22 @@ find_psb_table(void)
 			return -ENOMEM;
 		}
 
-		for (j = 0; j < numps; j++) {
-			printk(KERN_INFO PFX "   %d : fid 0x%x (%d MHz), vid 0x%x\n", j,
-			       pst[j].fid, find_freq_from_fid(pst[j].fid), pst[j].vid);
+		for (j = 0; j < psb->numpstates; j++) {
 			powernow_table[j].index = pst[j].fid; /* lower 8 bits */
 			powernow_table[j].index |= (pst[j].vid << 8); /* upper 8 bits */
-			powernow_table[j].frequency = find_freq_from_fid(pst[j].fid);
 		}
+
+		/* If you want to override your frequency tables, this
+		   is right place. */
+
+		for (j = 0; j < numps; j++) {
+			powernow_table[j].frequency = find_freq_from_fid(powernow_table[j].index & 0xff)*1000;
+			printk(KERN_INFO PFX "   %d : fid 0x%x (%d MHz), vid 0x%x\n", j,
+			       powernow_table[j].index & 0xff,
+			       powernow_table[j].frequency/1000,
+			       powernow_table[j].index >> 8);
+		}
+
 		powernow_table[numps].frequency = CPUFREQ_TABLE_END;
 		powernow_table[numps].index = 0;
 

_
