From: Ducrot Bruno Subject: cpufreq/linux/arch/i386/kernel/cpufreq powernow-k7.c,1.44,1.45 Date: Fri, 19 Sep 2003 17:39:23 +0100 Sender: cpufreq-bounces@www.linux.org.uk Message-ID: Return-path: List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: cpufreq-bounces@www.linux.org.uk MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: cpufreq@lists.arm.linux.org.uk Update of /mnt/src/cvsroot/cpufreq/linux/arch/i386/kernel/cpufreq In directory flint:/tmp/cvs-serv13924/linux/arch/i386/kernel/cpufreq Modified Files: powernow-k7.c Log Message: Bug fix from current bk: * update davej email. * Add missing config.h includes * Read MSRs before trying to use them in powernow-k7 * We need to set SGTC when we change powernow-k7 voltage. * Work around buggy powernow-k7 BIOSes with low settling times. * Powernow-k7 latency timer needs to be in values of 10ns. * Explicitly disable scaling we don't need in powernow-k7 Index: powernow-k7.c =================================================================== RCS file: /mnt/src/cvsroot/cpufreq/linux/arch/i386/kernel/cpufreq/powernow-k7.c,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- powernow-k7.c 19 Aug 2003 13:38:32 -0000 1.44 +++ powernow-k7.c 19 Sep 2003 16:39:20 -0000 1.45 @@ -1,6 +1,7 @@ /* * AMD K7 Powernow driver. * (C) 2003 Dave Jones on behalf of SuSE Labs. + * (C) 2003 Dave Jones * * Licensed under the terms of the GNU GPL License version 2. * Based upon datasheets & sample CPUs kindly provided by AMD. @@ -13,6 +14,7 @@ * - We disable half multipliers if ACPI is used on A0 stepping CPUs. */ +#include #include #include #include @@ -190,10 +192,11 @@ { union msr_fidvidctl fidvidctl; + rdmsrl (MSR_K7_FID_VID_CTL, fidvidctl.val); if (fidvidctl.bits.FID != fid) { - rdmsrl (MSR_K7_FID_VID_CTL, fidvidctl.val); fidvidctl.bits.SGTC = latency; fidvidctl.bits.FID = fid; + fidvidctl.bits.VIDC = 0; fidvidctl.bits.FIDC = 1; wrmsrl (MSR_K7_FID_VID_CTL, fidvidctl.val); } @@ -204,9 +207,11 @@ { union msr_fidvidctl fidvidctl; + rdmsrl (MSR_K7_FID_VID_CTL, fidvidctl.val); if (fidvidctl.bits.VID != vid) { - rdmsrl (MSR_K7_FID_VID_CTL, fidvidctl.val); + fidvidctl.bits.SGTC = latency; fidvidctl.bits.VID = vid; + fidvidctl.bits.FIDC = 0; fidvidctl.bits.VIDC = 1; wrmsrl (MSR_K7_FID_VID_CTL, fidvidctl.val); } @@ -296,8 +301,14 @@ dprintk (" voltage regulator)\n"); latency = psb->settlingtime; + if (latency < 100) { + printk (KERN_INFO PFX "BIOS set settling time to %d microseconds." + "Should be at least 100. Correcting.\n", latency); + latency = 100; + } dprintk (KERN_INFO PFX "Settling Time: %d microseconds.\n", psb->settlingtime); dprintk (KERN_INFO PFX "Has %d PST tables. (Only dumping ones relevant to this CPU).\n", psb->numpst); + latency *= 100; /* SGTC needs to be in units of 10ns */ p += sizeof (struct psb_s); @@ -325,6 +336,8 @@ p+=2; } } + printk (KERN_INFO PFX "No PST tables match this cpuid (0x%x)\n", etuple); + printk ("This is indicative of a broken BIOS. Email davej@redhat.com\n"); return -EINVAL; } p++;