# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1550 -> 1.1551 # arch/i386/kernel/cpu/cpufreq/powernow-k8.c 1.9 -> 1.10 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 04/01/31 tony@atomide.com 1.1551 # Sanity check on the BIOS provided max speed vs. current speed # # - Moves the current speed detection a bit earlier # - Overrides the max speed and voltage if current running values are # greater than BIOS provided values # - Ignores incorrect BIOS numpst value as it is not used anyways # -------------------------------------------- # diff -Nru a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c Sat Jan 31 12:21:04 2004 +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c Sat Jan 31 12:21:05 2004 @@ -539,6 +539,34 @@ return 1; } +/* Use current frequency if greater than BIOS value. */ +static inline int +fid_check_max(int cur, int max) +{ + if (max < cur) { + printk(KERN_WARNING BFX "max speed fid listed as 0x%02x, " + "should be at least 0x%02x. Using current speed.\n", + max, cur); + return cur; + } + + return max; +} + +/* Use current voltage if greater than BIOS value. */ +static inline int +vid_check_max(int cur, int max) +{ + if (max < cur) { + printk(KERN_WARNING BFX "max voltage vid listed as 0x%02x, " + "should be at least 0x%02x. Using current speed.\n", + max, cur); + return cur; + } + + return max; +} + /* Find and validate the PSB/PST table in BIOS. */ static inline int find_psb_table(void) @@ -603,8 +631,8 @@ dprintk(KERN_DEBUG PFX "numpst: 0x%x\n", psb->numpst); if (psb->numpst != 1) { - printk(KERN_ERR BFX "numpst must be 1\n"); - return -ENODEV; + printk(KERN_WARNING BFX "numpst listed as %i " + "should be 1. Using 1.\n", psb->numpst); } dprintk(KERN_DEBUG PFX "cpuid: 0x%x\n", psb->cpuid); @@ -668,6 +696,15 @@ return -ENODEV; } + if (query_current_values_with_pending_wait()) { + kfree(ppst); + return -EIO; + } + + /* Do a sanity check on the max values vs. current values */ + ppst[numps-1].fid = fid_check_max(currfid, ppst[numps-1].fid); + ppst[numps-1].vid = vid_check_max(currvid, ppst[numps-1].vid); + for (j = 1; j < numps; j++) { if ((lastfid >= ppst[j].fid) || (ppst[j].fid & 1) @@ -696,11 +733,6 @@ kfree(ppst); return -ENODEV; } - } - - if (query_current_values_with_pending_wait()) { - kfree(ppst); - return -EIO; } printk(KERN_INFO PFX "currfid 0x%x, currvid 0x%x\n",