bk://linux-dj.bkbits.net/cpufreq davej@redhat.com|ChangeSet|20040524210620|06313 davej # This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2004/05/24 18:05:20-07:00 akpm@bix.(none) # Merge bk://linux-dj.bkbits.net/cpufreq # into bix.(none):/usr/src/bk-cpufreq # # arch/i386/kernel/cpu/cpufreq/p4-clockmod.c # 2004/05/24 18:05:16-07:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/05/24 22:06:20+01:00 davej@redhat.com # [CPUFREQ] Scaling on VIA C3 Nehemiah works now. # So remove the warning printk. # # arch/i386/kernel/cpu/cpufreq/longhaul.c # 2004/05/24 22:06:13+01:00 davej@redhat.com +1 -5 # [CPUFREQ] Scaling on VIA C3 Nehemiah works now. # So remove the warning printk. # # ChangeSet # 2004/05/24 22:03:26+01:00 davej@redhat.com # [CPUFREQ] Make longhaul debug a module option. # # arch/i386/kernel/cpu/cpufreq/longhaul.c # 2004/05/24 22:03:19+01:00 davej@redhat.com +14 -12 # [CPUFREQ] Make longhaul debug a module option. # # ChangeSet # 2004/05/24 21:39:03+01:00 davej@redhat.com # [CPUFREQ] Fix leak in powernow-k8 # Spotted by Yury Umanets # # arch/i386/kernel/cpu/cpufreq/powernow-k8.c # 2004/05/24 21:38:56+01:00 davej@redhat.com +5 -1 # [CPUFREQ] Fix leak in powernow-k8 # Spotted by Yury Umanets # # ChangeSet # 2004/05/24 21:29:57+01:00 davej@redhat.com # [CPUFREQ] Remove a bunch of trailing whitespace from the powernow-k8 driver. # # arch/i386/kernel/cpu/cpufreq/powernow-k8.c # 2004/05/24 21:29:50+01:00 davej@redhat.com +4 -4 # [CPUFREQ] Remove a bunch of trailing whitespace from the powernow-k8 driver. # # ChangeSet # 2004/05/24 21:20:35+01:00 davej@redhat.com # [CPUFREQ] Quieten the powernow-k7 init printk a little. # There seem to be quite a few desktop K7 processors which support the # powernow cpuid call, but don't actually offer any powernow scaling. # In which case the driver prints out # "PowerNOW! Technology present. Can scale: nothing" which looks a bit odd, # and just adds to confusion of end-users. # Change things so that we don't print anything at all if we can't do anything. # # Also kill some trailing whitespace gremlins that crept in. # # arch/i386/kernel/cpu/cpufreq/powernow-k7.c # 2004/05/24 21:20:28+01:00 davej@redhat.com +7 -7 # [CPUFREQ] Quieten the powernow-k7 init printk a little. # There seem to be quite a few desktop K7 processors which support the # powernow cpuid call, but don't actually offer any powernow scaling. # In which case the driver prints out # "PowerNOW! Technology present. Can scale: nothing" which looks a bit odd, # and just adds to confusion of end-users. # Change things so that we don't print anything at all if we can't do anything. # # Also kill some trailing whitespace gremlins that crept in. # # ChangeSet # 2004/05/24 21:12:04+01:00 davej@redhat.com # [CPUFREQ] Use correct printk prefix in p4-clockmod driver # # arch/i386/kernel/cpu/cpufreq/p4-clockmod.c # 2004/05/24 21:11:57+01:00 davej@redhat.com +1 -1 # [CPUFREQ] Use correct printk prefix in p4-clockmod driver # # ChangeSet # 2004/05/24 21:09:12+01:00 davej@redhat.com # [CPUFREQ] Remove some unneeded includes. # # arch/i386/kernel/cpu/cpufreq/p4-clockmod.c # 2004/05/24 21:09:05+01:00 davej@redhat.com +0 -1 # [CPUFREQ] Remove some unneeded includes. # # arch/i386/kernel/cpu/cpufreq/gx-suspmod.c # 2004/05/24 21:09:05+01:00 davej@redhat.com +0 -1 # [CPUFREQ] Remove some unneeded includes. # # ChangeSet # 2004/05/24 21:06:38+01:00 davej@redhat.com # [CPUFREQ] Convert longhaul driver to use module_param # # arch/i386/kernel/cpu/cpufreq/longhaul.c # 2004/05/24 21:06:31+01:00 davej@redhat.com +3 -1 # [CPUFREQ] Convert longhaul driver to use module_param # # ChangeSet # 2004/05/23 15:24:28+01:00 davej@redhat.com # [CPUFREQ] Silence noisy debugging printk in longhaul driver. # # arch/i386/kernel/cpu/cpufreq/longhaul.c # 2004/05/23 15:24:20+01:00 davej@redhat.com +29 -30 # [CPUFREQ] Silence noisy debugging printk in longhaul driver. # # (Also remove a load of whitespace noise) # # ChangeSet # 2004/05/19 13:26:42-07:00 akpm@bix.(none) # Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-cpufreq # # drivers/serial/sh-sci.c # 2004/05/19 13:26:39-07:00 akpm@bix.(none) +0 -0 # Auto merged # # drivers/pcmcia/soc_common.c # 2004/05/19 13:26:39-07:00 akpm@bix.(none) +0 -0 # Auto merged # # arch/x86_64/kernel/time.c # 2004/05/19 13:26:39-07:00 akpm@bix.(none) +0 -0 # Auto merged # # BitKeeper/deleted/.del-sh-sci.c~bc16578fc6688d3 # 2004/05/19 13:26:39-07:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/05/16 01:34:52-07:00 akpm@bix.(none) # Merge bk://linux-dj.bkbits.net/cpufreq # into bix.(none):/usr/src/bk-cpufreq # # arch/i386/kernel/cpu/cpufreq/p4-clockmod.c # 2004/05/16 01:34:49-07:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/05/16 01:32:08-07:00 akpm@bix.(none) # resolve stuff # # drivers/pcmcia/soc_common.c # 2004/05/16 01:32:03-07:00 akpm@bix.(none) +36 -0 # resolve stuff # # BitKeeper/deleted/.del-sh-sci.c~bc16578fc6688d3 # 2004/05/16 01:26:51-07:00 akpm@bix.(none) +0 -0 # Auto merged # # drivers/pcmcia/soc_common.c # 2004/05/16 01:26:51-07:00 akpm@bix.(none) +0 -0 # Merge rename: drivers/pcmcia/sa11xx_core.c -> drivers/pcmcia/soc_common.c # # BitKeeper/deleted/.del-sh-sci.c~bc16578fc6688d3 # 2004/05/16 01:26:51-07:00 akpm@bix.(none) +0 -0 # Merge rename: drivers/char/sh-sci.c -> BitKeeper/deleted/.del-sh-sci.c~bc16578fc6688d3 # # ChangeSet # 2004/05/14 21:21:34-07:00 akpm@bix.(none) # Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-cpufreq # # drivers/serial/sh-sci.c # 2004/05/14 21:21:31-07:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/05/11 16:39:15-07:00 akpm@bix.(none) # Merge bk://linux-dj.bkbits.net/cpufreq # into bix.(none):/usr/src/bk-cpufreq # # arch/i386/kernel/cpu/cpufreq/p4-clockmod.c # 2004/05/11 16:39:12-07:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/05/11 16:38:21-07:00 akpm@bix.(none) # Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-cpufreq # # arch/x86_64/kernel/time.c # 2004/05/11 16:38:18-07:00 akpm@bix.(none) +0 -0 # Auto merged # # arch/i386/kernel/cpu/cpufreq/p4-clockmod.c # 2004/05/11 16:38:18-07:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/04/13 10:02:09-07:00 akpm@bix.(none) # Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-cpufreq # # arch/i386/kernel/cpu/cpufreq/Kconfig # 2004/04/13 10:02:06-07:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/04/12 20:52:00-07:00 akpm@bix.(none) # Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-cpufreq # # arch/i386/kernel/cpu/cpufreq/Kconfig # 2004/04/12 20:51:56-07:00 akpm@bix.(none) +0 -0 # Auto merged # diff -Nru a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c --- a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c 2004-05-25 21:21:03 -07:00 +++ b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c 2004-05-25 21:21:03 -07:00 @@ -75,7 +75,6 @@ #include #include -#include #include #include #include diff -Nru a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c --- a/arch/i386/kernel/cpu/cpufreq/longhaul.c 2004-05-25 21:21:03 -07:00 +++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c 2004-05-25 21:21:03 -07:00 @@ -18,7 +18,8 @@ */ #include -#include +#include +#include #include #include #include @@ -30,25 +31,25 @@ #include "longhaul.h" -#define DEBUG - -#ifdef DEBUG -#define dprintk(msg...) printk(msg) -#else -#define dprintk(msg...) do { } while(0) -#endif - #define PFX "longhaul: " static unsigned int numscales=16, numvscales; +static unsigned int fsb; static int minvid, maxvid; static int can_scale_voltage; static int vrmrev; - /* Module parameters */ static int dont_scale_voltage; -static unsigned int fsb; +static int debug; +static int debug; + +static void dprintk(const char *msg, ...) +{ + if (debug == 1) + printk(msg); +} + #define __hlt() __asm__ __volatile__("hlt": : :"memory") @@ -118,8 +119,7 @@ cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); - dprintk (KERN_INFO PFX "FSB:%d Mult:%d.%dx\n", fsb, - mult/10, mult%10); + dprintk (KERN_INFO PFX "FSB:%d Mult:%d.%dx\n", fsb, mult/10, mult%10); switch (longhaul_version) { case 1: @@ -167,16 +167,16 @@ longhaul.bits.SoftBusRatio = clock_ratio_index & 0xf; longhaul.bits.SoftBusRatio4 = (clock_ratio_index & 0x10) >> 4; longhaul.bits.EnableSoftBusRatio = 1; - + longhaul.bits.RevisionKey = 0x0; - + wrmsrl(MSR_VIA_LONGHAUL, longhaul.val); __hlt(); - + rdmsrl (MSR_VIA_LONGHAUL, longhaul.val); longhaul.bits.EnableSoftBusRatio = 0; longhaul.bits.RevisionKey = 0xf; - wrmsrl (MSR_VIA_LONGHAUL, longhaul.val); + wrmsrl (MSR_VIA_LONGHAUL, longhaul.val); break; } @@ -276,26 +276,26 @@ break; } break; - + case 4: rdmsrl (MSR_VIA_LONGHAUL, longhaul.val); - + //TODO: Nehemiah may have borken MaxMHzBR. // need to extrapolate from FSB. - + invalue2 = longhaul.bits.MinMHzBR; invalue = longhaul.bits.MaxMHzBR; - if (longhaul.bits.MaxMHzBR4) + if (longhaul.bits.MaxMHzBR4) invalue += 16; maxmult=multipliers[invalue]; - + maxmult=longhaul_get_cpu_mult(); - + printk(KERN_INFO PFX " invalue: %ld maxmult: %d \n", invalue, maxmult); printk(KERN_INFO PFX " invalue2: %ld \n", invalue2); - + minmult=50; - + switch (longhaul.bits.MaxMHzFSB) { case 0x0: fsb=133; break; @@ -306,8 +306,8 @@ case 0x3: fsb=66; break; } - - break; + + break; } dprintk (KERN_INFO PFX "MinMult=%d.%dx MaxMult=%d.%dx\n", @@ -418,13 +418,13 @@ unsigned int relation) { unsigned int table_index = 0; - unsigned int new_clock_ratio = 0; + unsigned int new_clock_ratio = 0; if (cpufreq_frequency_table_target(policy, longhaul_table, target_freq, relation, &table_index)) return -EINVAL; new_clock_ratio = longhaul_table[table_index].index & 0xFF; - + longhaul_setstate(new_clock_ratio); return 0; @@ -500,7 +500,6 @@ break; } break; - default: cpuname = "Unknown"; @@ -514,11 +513,11 @@ if (ret != 0) return ret; - if ((longhaul_version==2) && (dont_scale_voltage==0)) + if ((longhaul_version==2) && (dont_scale_voltage==0)) longhaul_setup_voltagescaling(); policy->governor = CPUFREQ_DEFAULT_GOVERNOR; - policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; + policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; policy->cur = calc_speed (longhaul_get_cpu_mult(), fsb); ret = cpufreq_frequency_table_cpuinfo(policy, longhaul_table); @@ -542,14 +541,14 @@ }; static struct cpufreq_driver longhaul_driver = { - .verify = longhaul_verify, - .target = longhaul_target, - .get = longhaul_get, - .init = longhaul_cpu_init, - .exit = longhaul_cpu_exit, - .name = "longhaul", - .owner = THIS_MODULE, - .attr = longhaul_attr, + .verify = longhaul_verify, + .target = longhaul_target, + .get = longhaul_get, + .init = longhaul_cpu_init, + .exit = longhaul_cpu_exit, + .name = "longhaul", + .owner = THIS_MODULE, + .attr = longhaul_attr, }; static int __init longhaul_init (void) @@ -560,12 +559,8 @@ return -ENODEV; switch (c->x86_model) { - case 6 ... 8: + case 6 ... 9: return cpufreq_register_driver(&longhaul_driver); - case 9: - printk (KERN_INFO PFX "Nehemiah unsupported: Waiting on working silicon " - "from VIA before this is usable.\n"); - break; default: printk (KERN_INFO PFX "Unknown VIA CPU. Contact davej@codemonkey.org.uk\n"); } @@ -579,7 +574,11 @@ kfree(longhaul_table); } -MODULE_PARM (dont_scale_voltage, "i"); +module_param (dont_scale_voltage, int, 0644); +MODULE_PARM_DESC(dont_scale_voltage, "Don't scale voltage of processor"); + +module_param (debug, int, 0644); +MODULE_PARM_DESC(debug, "Dump debugging information."); MODULE_AUTHOR ("Dave Jones "); MODULE_DESCRIPTION ("Longhaul driver for VIA Cyrix processors."); diff -Nru a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c --- a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c 2004-05-25 21:21:03 -07:00 +++ b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c 2004-05-25 21:21:03 -07:00 @@ -27,7 +27,6 @@ #include #include #include -#include #include #include @@ -35,7 +34,7 @@ #include "speedstep-lib.h" -#define PFX "cpufreq: " +#define PFX "p4-clockmod: " /* * Duty Cycle (3bits), note DC_DISABLE is not specified in diff -Nru a/arch/i386/kernel/cpu/cpufreq/powernow-k7.c b/arch/i386/kernel/cpu/cpufreq/powernow-k7.c --- a/arch/i386/kernel/cpu/cpufreq/powernow-k7.c 2004-05-25 21:21:03 -07:00 +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k7.c 2004-05-25 21:21:03 -07:00 @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include #include @@ -86,7 +86,7 @@ /* divide by 10 to get FID. */ static int fid_codes[32] = { 110, 115, 120, 125, 50, 55, 60, 65, - 70, 75, 80, 85, 90, 95, 100, 105, + 70, 75, 80, 85, 90, 95, 100, 105, 30, 190, 40, 200, 130, 135, 140, 210, 150, 225, 160, 165, 170, 180, -1, -1, }; @@ -144,6 +144,11 @@ } cpuid(0x80000007, &eax, &ebx, &ecx, &edx); + + /* Check we can actually do something before we say anything.*/ + if (!(edx & (1 << 1 | 1 << 2))) + return 0; + printk (KERN_INFO PFX "PowerNOW! Technology present. Can scale: "); if (edx & 1 << 1) { @@ -157,11 +162,6 @@ if (edx & 1 << 2) { printk ("voltage"); can_scale_vid=1; - } - - if (!(edx & (1 << 1 | 1 << 2))) { - printk ("nothing.\n"); - return 0; } printk (".\n"); 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 2004-05-25 21:21:03 -07:00 +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c 2004-05-25 21:21:03 -07:00 @@ -553,7 +553,7 @@ printk(KERN_ERR PFX "no p states to transition\n"); return -ENODEV; } - + if (check_pst_table(data, pst, maxvid)) return -EINVAL; @@ -736,9 +736,9 @@ /* verify only 1 entry from the lo frequency table */ if ((fid < HI_FID_TABLE_BOTTOM) && (cntlofreq++)) { printk(KERN_ERR PFX "Too many lo freq table entries\n"); - goto err_out; + goto err_out_mem; } - + if (powernow_table[i].frequency != (data->acpi_data.states[i].core_frequency * 1000)) { printk(KERN_INFO PFX "invalid freq entries %u kHz vs. %u kHz\n", powernow_table[i].frequency, @@ -757,12 +757,16 @@ print_basics(data); powernow_k8_acpi_pst_values(data, 0); return 0; + +err_out_mem: + kfree(powernow_table); + err_out: acpi_processor_unregister_performance(&data->acpi_data, data->cpu); /* data->acpi_data.state_count informs us at ->exit() whether ACPI was used */ data->acpi_data.state_count = 0; - + return -ENODEV; } @@ -1047,7 +1051,7 @@ if (query_current_values_with_pending_wait(data)) goto out; - khz = find_khz_freq_from_fid(data->currfid); + khz = find_khz_freq_from_fid(data->currfid); out: preempt_enable_no_resched(); diff -Nru a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c --- a/drivers/pcmcia/soc_common.c 2004-05-25 21:21:03 -07:00 +++ b/drivers/pcmcia/soc_common.c 2004-05-25 21:21:03 -07:00 @@ -772,3 +772,39 @@ return 0; } + } + + return 0; +} + +static struct notifier_block sa1100_pcmcia_notifier_block = { + .notifier_call = sa1100_pcmcia_notifier +}; + +static int __init sa11xx_pcmcia_init(void) +{ + int ret; + + printk(KERN_INFO "SA11xx PCMCIA\n"); + + ret = cpufreq_register_notifier(&sa1100_pcmcia_notifier_block, + CPUFREQ_TRANSITION_NOTIFIER); + if (ret < 0) + printk(KERN_ERR "Unable to register CPU frequency change " + "notifier (%d)\n", ret); + + return ret; +} +module_init(sa11xx_pcmcia_init); + +static void __exit sa11xx_pcmcia_exit(void) +{ + cpufreq_unregister_notifier(&sa1100_pcmcia_notifier_block, CPUFREQ_TRANSITION_NOTIFIER); +} + +module_exit(sa11xx_pcmcia_exit); +#endif + +MODULE_AUTHOR("John Dorsey "); +MODULE_DESCRIPTION("Linux PCMCIA Card Services: SA-11xx core socket driver"); +MODULE_LICENSE("Dual MPL/GPL");