diff options
Diffstat (limited to 'arch/i386')
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c | 3 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/powernow-k8.c | 50 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/powernow-k8.h | 9 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/speedstep-ich.c | 47 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/speedstep-lib.c | 32 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/speedstep-lib.h | 1 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/speedstep-smi.c | 1 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/proc.c | 6 | ||||
-rw-r--r-- | arch/i386/kernel/traps.c | 2 |
9 files changed, 106 insertions, 45 deletions
diff --git a/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c b/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c index 04a405345203..2b62dee35c6c 100644 --- a/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c +++ b/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c | |||
@@ -177,9 +177,10 @@ static unsigned int nforce2_fsb_read(int bootfsb) | |||
177 | */ | 177 | */ |
178 | static int nforce2_set_fsb(unsigned int fsb) | 178 | static int nforce2_set_fsb(unsigned int fsb) |
179 | { | 179 | { |
180 | u32 pll, temp = 0; | 180 | u32 temp = 0; |
181 | unsigned int tfsb; | 181 | unsigned int tfsb; |
182 | int diff; | 182 | int diff; |
183 | int pll = 0; | ||
183 | 184 | ||
184 | if ((fsb > max_fsb) || (fsb < NFORCE2_MIN_FSB)) { | 185 | if ((fsb > max_fsb) || (fsb < NFORCE2_MIN_FSB)) { |
185 | printk(KERN_ERR "cpufreq: FSB %d is out of range!\n", fsb); | 186 | printk(KERN_ERR "cpufreq: FSB %d is out of range!\n", fsb); |
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c index 68a1fc87f4ca..0fbbd4c1072e 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c | |||
@@ -45,7 +45,7 @@ | |||
45 | 45 | ||
46 | #define PFX "powernow-k8: " | 46 | #define PFX "powernow-k8: " |
47 | #define BFX PFX "BIOS error: " | 47 | #define BFX PFX "BIOS error: " |
48 | #define VERSION "version 1.50.4" | 48 | #define VERSION "version 1.60.0" |
49 | #include "powernow-k8.h" | 49 | #include "powernow-k8.h" |
50 | 50 | ||
51 | /* serialize freq changes */ | 51 | /* serialize freq changes */ |
@@ -216,10 +216,10 @@ static int write_new_vid(struct powernow_k8_data *data, u32 vid) | |||
216 | 216 | ||
217 | do { | 217 | do { |
218 | wrmsr(MSR_FIDVID_CTL, lo, STOP_GRANT_5NS); | 218 | wrmsr(MSR_FIDVID_CTL, lo, STOP_GRANT_5NS); |
219 | if (i++ > 100) { | 219 | if (i++ > 100) { |
220 | printk(KERN_ERR PFX "internal error - pending bit very stuck - no further pstate changes possible\n"); | 220 | printk(KERN_ERR PFX "internal error - pending bit very stuck - no further pstate changes possible\n"); |
221 | return 1; | 221 | return 1; |
222 | } | 222 | } |
223 | } while (query_current_values_with_pending_wait(data)); | 223 | } while (query_current_values_with_pending_wait(data)); |
224 | 224 | ||
225 | if (savefid != data->currfid) { | 225 | if (savefid != data->currfid) { |
@@ -336,7 +336,7 @@ static int core_voltage_pre_transition(struct powernow_k8_data *data, u32 reqvid | |||
336 | /* Phase 2 - core frequency transition */ | 336 | /* Phase 2 - core frequency transition */ |
337 | static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid) | 337 | static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid) |
338 | { | 338 | { |
339 | u32 vcoreqfid, vcocurrfid, vcofiddiff, savevid = data->currvid; | 339 | u32 vcoreqfid, vcocurrfid, vcofiddiff, fid_interval, savevid = data->currvid; |
340 | 340 | ||
341 | if ((reqfid < HI_FID_TABLE_BOTTOM) && (data->currfid < HI_FID_TABLE_BOTTOM)) { | 341 | if ((reqfid < HI_FID_TABLE_BOTTOM) && (data->currfid < HI_FID_TABLE_BOTTOM)) { |
342 | printk(KERN_ERR PFX "ph2: illegal lo-lo transition 0x%x 0x%x\n", | 342 | printk(KERN_ERR PFX "ph2: illegal lo-lo transition 0x%x 0x%x\n", |
@@ -359,9 +359,11 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid) | |||
359 | : vcoreqfid - vcocurrfid; | 359 | : vcoreqfid - vcocurrfid; |
360 | 360 | ||
361 | while (vcofiddiff > 2) { | 361 | while (vcofiddiff > 2) { |
362 | (data->currfid & 1) ? (fid_interval = 1) : (fid_interval = 2); | ||
363 | |||
362 | if (reqfid > data->currfid) { | 364 | if (reqfid > data->currfid) { |
363 | if (data->currfid > LO_FID_TABLE_TOP) { | 365 | if (data->currfid > LO_FID_TABLE_TOP) { |
364 | if (write_new_fid(data, data->currfid + 2)) { | 366 | if (write_new_fid(data, data->currfid + fid_interval)) { |
365 | return 1; | 367 | return 1; |
366 | } | 368 | } |
367 | } else { | 369 | } else { |
@@ -371,7 +373,7 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid) | |||
371 | } | 373 | } |
372 | } | 374 | } |
373 | } else { | 375 | } else { |
374 | if (write_new_fid(data, data->currfid - 2)) | 376 | if (write_new_fid(data, data->currfid - fid_interval)) |
375 | return 1; | 377 | return 1; |
376 | } | 378 | } |
377 | 379 | ||
@@ -464,7 +466,7 @@ static int check_supported_cpu(unsigned int cpu) | |||
464 | set_cpus_allowed(current, cpumask_of_cpu(cpu)); | 466 | set_cpus_allowed(current, cpumask_of_cpu(cpu)); |
465 | 467 | ||
466 | if (smp_processor_id() != cpu) { | 468 | if (smp_processor_id() != cpu) { |
467 | printk(KERN_ERR "limiting to cpu %u failed\n", cpu); | 469 | printk(KERN_ERR PFX "limiting to cpu %u failed\n", cpu); |
468 | goto out; | 470 | goto out; |
469 | } | 471 | } |
470 | 472 | ||
@@ -474,7 +476,7 @@ static int check_supported_cpu(unsigned int cpu) | |||
474 | eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE); | 476 | eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE); |
475 | if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) || | 477 | if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) || |
476 | ((eax & CPUID_XFAM) != CPUID_XFAM_K8) || | 478 | ((eax & CPUID_XFAM) != CPUID_XFAM_K8) || |
477 | ((eax & CPUID_XMOD) > CPUID_XMOD_REV_F)) { | 479 | ((eax & CPUID_XMOD) > CPUID_XMOD_REV_G)) { |
478 | printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax); | 480 | printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax); |
479 | goto out; | 481 | goto out; |
480 | } | 482 | } |
@@ -517,22 +519,24 @@ static int check_pst_table(struct powernow_k8_data *data, struct pst_s *pst, u8 | |||
517 | printk(KERN_ERR BFX "maxvid exceeded with pstate %d\n", j); | 519 | printk(KERN_ERR BFX "maxvid exceeded with pstate %d\n", j); |
518 | return -ENODEV; | 520 | return -ENODEV; |
519 | } | 521 | } |
520 | if ((pst[j].fid > MAX_FID) | 522 | if (pst[j].fid > MAX_FID) { |
521 | || (pst[j].fid & 1) | 523 | printk(KERN_ERR BFX "maxfid exceeded with pstate %d\n", j); |
522 | || (j && (pst[j].fid < HI_FID_TABLE_BOTTOM))) { | 524 | return -ENODEV; |
525 | } | ||
526 | if (j && (pst[j].fid < HI_FID_TABLE_BOTTOM)) { | ||
523 | /* Only first fid is allowed to be in "low" range */ | 527 | /* Only first fid is allowed to be in "low" range */ |
524 | printk(KERN_ERR PFX "two low fids - %d : 0x%x\n", j, pst[j].fid); | 528 | printk(KERN_ERR BFX "two low fids - %d : 0x%x\n", j, pst[j].fid); |
525 | return -EINVAL; | 529 | return -EINVAL; |
526 | } | 530 | } |
527 | if (pst[j].fid < lastfid) | 531 | if (pst[j].fid < lastfid) |
528 | lastfid = pst[j].fid; | 532 | lastfid = pst[j].fid; |
529 | } | 533 | } |
530 | if (lastfid & 1) { | 534 | if (lastfid & 1) { |
531 | printk(KERN_ERR PFX "lastfid invalid\n"); | 535 | printk(KERN_ERR BFX "lastfid invalid\n"); |
532 | return -EINVAL; | 536 | return -EINVAL; |
533 | } | 537 | } |
534 | if (lastfid > LO_FID_TABLE_TOP) | 538 | if (lastfid > LO_FID_TABLE_TOP) |
535 | printk(KERN_INFO PFX "first fid not from lo freq table\n"); | 539 | printk(KERN_INFO BFX "first fid not from lo freq table\n"); |
536 | 540 | ||
537 | return 0; | 541 | return 0; |
538 | } | 542 | } |
@@ -631,7 +635,7 @@ static int find_psb_table(struct powernow_k8_data *data) | |||
631 | 635 | ||
632 | dprintk("table vers: 0x%x\n", psb->tableversion); | 636 | dprintk("table vers: 0x%x\n", psb->tableversion); |
633 | if (psb->tableversion != PSB_VERSION_1_4) { | 637 | if (psb->tableversion != PSB_VERSION_1_4) { |
634 | printk(KERN_INFO BFX "PSB table is not v1.4\n"); | 638 | printk(KERN_ERR BFX "PSB table is not v1.4\n"); |
635 | return -ENODEV; | 639 | return -ENODEV; |
636 | } | 640 | } |
637 | 641 | ||
@@ -689,7 +693,7 @@ static int find_psb_table(struct powernow_k8_data *data) | |||
689 | * BIOS and Kernel Developer's Guide, which is available on | 693 | * BIOS and Kernel Developer's Guide, which is available on |
690 | * www.amd.com | 694 | * www.amd.com |
691 | */ | 695 | */ |
692 | printk(KERN_INFO PFX "BIOS error - no PSB or ACPI _PSS objects\n"); | 696 | printk(KERN_ERR PFX "BIOS error - no PSB or ACPI _PSS objects\n"); |
693 | return -ENODEV; | 697 | return -ENODEV; |
694 | } | 698 | } |
695 | 699 | ||
@@ -912,7 +916,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi | |||
912 | set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); | 916 | set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); |
913 | 917 | ||
914 | if (smp_processor_id() != pol->cpu) { | 918 | if (smp_processor_id() != pol->cpu) { |
915 | printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu); | 919 | printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu); |
916 | goto err_out; | 920 | goto err_out; |
917 | } | 921 | } |
918 | 922 | ||
@@ -982,6 +986,9 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
982 | cpumask_t oldmask = CPU_MASK_ALL; | 986 | cpumask_t oldmask = CPU_MASK_ALL; |
983 | int rc, i; | 987 | int rc, i; |
984 | 988 | ||
989 | if (!cpu_online(pol->cpu)) | ||
990 | return -ENODEV; | ||
991 | |||
985 | if (!check_supported_cpu(pol->cpu)) | 992 | if (!check_supported_cpu(pol->cpu)) |
986 | return -ENODEV; | 993 | return -ENODEV; |
987 | 994 | ||
@@ -1021,7 +1028,7 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
1021 | set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); | 1028 | set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); |
1022 | 1029 | ||
1023 | if (smp_processor_id() != pol->cpu) { | 1030 | if (smp_processor_id() != pol->cpu) { |
1024 | printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu); | 1031 | printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu); |
1025 | goto err_out; | 1032 | goto err_out; |
1026 | } | 1033 | } |
1027 | 1034 | ||
@@ -1162,10 +1169,9 @@ static void __exit powernowk8_exit(void) | |||
1162 | cpufreq_unregister_driver(&cpufreq_amd64_driver); | 1169 | cpufreq_unregister_driver(&cpufreq_amd64_driver); |
1163 | } | 1170 | } |
1164 | 1171 | ||
1165 | MODULE_AUTHOR("Paul Devriendt <paul.devriendt@amd.com> and Mark Langsdorf <mark.langsdorf@amd.com."); | 1172 | MODULE_AUTHOR("Paul Devriendt <paul.devriendt@amd.com> and Mark Langsdorf <mark.langsdorf@amd.com>"); |
1166 | MODULE_DESCRIPTION("AMD Athlon 64 and Opteron processor frequency driver."); | 1173 | MODULE_DESCRIPTION("AMD Athlon 64 and Opteron processor frequency driver."); |
1167 | MODULE_LICENSE("GPL"); | 1174 | MODULE_LICENSE("GPL"); |
1168 | 1175 | ||
1169 | late_initcall(powernowk8_init); | 1176 | late_initcall(powernowk8_init); |
1170 | module_exit(powernowk8_exit); | 1177 | module_exit(powernowk8_exit); |
1171 | |||
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h index b1e85bb36396..d0de37d58e9a 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h | |||
@@ -42,7 +42,7 @@ struct powernow_k8_data { | |||
42 | #define CPUID_XFAM 0x0ff00000 /* extended family */ | 42 | #define CPUID_XFAM 0x0ff00000 /* extended family */ |
43 | #define CPUID_XFAM_K8 0 | 43 | #define CPUID_XFAM_K8 0 |
44 | #define CPUID_XMOD 0x000f0000 /* extended model */ | 44 | #define CPUID_XMOD 0x000f0000 /* extended model */ |
45 | #define CPUID_XMOD_REV_F 0x00040000 | 45 | #define CPUID_XMOD_REV_G 0x00060000 |
46 | #define CPUID_USE_XFAM_XMOD 0x00000f00 | 46 | #define CPUID_USE_XFAM_XMOD 0x00000f00 |
47 | #define CPUID_GET_MAX_CAPABILITIES 0x80000000 | 47 | #define CPUID_GET_MAX_CAPABILITIES 0x80000000 |
48 | #define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007 | 48 | #define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007 |
@@ -86,13 +86,14 @@ struct powernow_k8_data { | |||
86 | * low fid table | 86 | * low fid table |
87 | * - lowest entry in the high fid table must be a <= 200MHz + 2 * the entry | 87 | * - lowest entry in the high fid table must be a <= 200MHz + 2 * the entry |
88 | * in the low fid table | 88 | * in the low fid table |
89 | * - the parts can only step at 200 MHz intervals, so 1.9 GHz is never valid | 89 | * - the parts can only step at <= 200 MHz intervals, odd fid values are |
90 | * supported in revision G and later revisions. | ||
90 | * - lowest frequency must be >= interprocessor hypertransport link speed | 91 | * - lowest frequency must be >= interprocessor hypertransport link speed |
91 | * (only applies to MP systems obviously) | 92 | * (only applies to MP systems obviously) |
92 | */ | 93 | */ |
93 | 94 | ||
94 | /* fids (frequency identifiers) are arranged in 2 tables - lo and hi */ | 95 | /* fids (frequency identifiers) are arranged in 2 tables - lo and hi */ |
95 | #define LO_FID_TABLE_TOP 6 /* fid values marking the boundary */ | 96 | #define LO_FID_TABLE_TOP 7 /* fid values marking the boundary */ |
96 | #define HI_FID_TABLE_BOTTOM 8 /* between the low and high tables */ | 97 | #define HI_FID_TABLE_BOTTOM 8 /* between the low and high tables */ |
97 | 98 | ||
98 | #define LO_VCOFREQ_TABLE_TOP 1400 /* corresponding vco frequency values */ | 99 | #define LO_VCOFREQ_TABLE_TOP 1400 /* corresponding vco frequency values */ |
@@ -106,7 +107,7 @@ struct powernow_k8_data { | |||
106 | #define MIN_FREQ 800 /* Min and max freqs, per spec */ | 107 | #define MIN_FREQ 800 /* Min and max freqs, per spec */ |
107 | #define MAX_FREQ 5000 | 108 | #define MAX_FREQ 5000 |
108 | 109 | ||
109 | #define INVALID_FID_MASK 0xffffffc1 /* not a valid fid if these bits are set */ | 110 | #define INVALID_FID_MASK 0xffffffc0 /* not a valid fid if these bits are set */ |
110 | #define INVALID_VID_MASK 0xffffffc0 /* not a valid vid if these bits are set */ | 111 | #define INVALID_VID_MASK 0xffffffc0 /* not a valid vid if these bits are set */ |
111 | 112 | ||
112 | #define VID_OFF 0x3f | 113 | #define VID_OFF 0x3f |
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c b/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c index 5b7d18a06afa..b425cd3d1838 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c | |||
@@ -40,6 +40,7 @@ static struct pci_dev *speedstep_chipset_dev; | |||
40 | */ | 40 | */ |
41 | static unsigned int speedstep_processor = 0; | 41 | static unsigned int speedstep_processor = 0; |
42 | 42 | ||
43 | static u32 pmbase; | ||
43 | 44 | ||
44 | /* | 45 | /* |
45 | * There are only two frequency states for each processor. Values | 46 | * There are only two frequency states for each processor. Values |
@@ -56,34 +57,47 @@ static struct cpufreq_frequency_table speedstep_freqs[] = { | |||
56 | 57 | ||
57 | 58 | ||
58 | /** | 59 | /** |
59 | * speedstep_set_state - set the SpeedStep state | 60 | * speedstep_find_register - read the PMBASE address |
60 | * @state: new processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH) | ||
61 | * | 61 | * |
62 | * Tries to change the SpeedStep state. | 62 | * Returns: -ENODEV if no register could be found |
63 | */ | 63 | */ |
64 | static void speedstep_set_state (unsigned int state) | 64 | static int speedstep_find_register (void) |
65 | { | 65 | { |
66 | u32 pmbase; | 66 | if (!speedstep_chipset_dev) |
67 | u8 pm2_blk; | 67 | return -ENODEV; |
68 | u8 value; | ||
69 | unsigned long flags; | ||
70 | |||
71 | if (!speedstep_chipset_dev || (state > 0x1)) | ||
72 | return; | ||
73 | 68 | ||
74 | /* get PMBASE */ | 69 | /* get PMBASE */ |
75 | pci_read_config_dword(speedstep_chipset_dev, 0x40, &pmbase); | 70 | pci_read_config_dword(speedstep_chipset_dev, 0x40, &pmbase); |
76 | if (!(pmbase & 0x01)) { | 71 | if (!(pmbase & 0x01)) { |
77 | printk(KERN_ERR "speedstep-ich: could not find speedstep register\n"); | 72 | printk(KERN_ERR "speedstep-ich: could not find speedstep register\n"); |
78 | return; | 73 | return -ENODEV; |
79 | } | 74 | } |
80 | 75 | ||
81 | pmbase &= 0xFFFFFFFE; | 76 | pmbase &= 0xFFFFFFFE; |
82 | if (!pmbase) { | 77 | if (!pmbase) { |
83 | printk(KERN_ERR "speedstep-ich: could not find speedstep register\n"); | 78 | printk(KERN_ERR "speedstep-ich: could not find speedstep register\n"); |
84 | return; | 79 | return -ENODEV; |
85 | } | 80 | } |
86 | 81 | ||
82 | dprintk("pmbase is 0x%x\n", pmbase); | ||
83 | return 0; | ||
84 | } | ||
85 | |||
86 | /** | ||
87 | * speedstep_set_state - set the SpeedStep state | ||
88 | * @state: new processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH) | ||
89 | * | ||
90 | * Tries to change the SpeedStep state. | ||
91 | */ | ||
92 | static void speedstep_set_state (unsigned int state) | ||
93 | { | ||
94 | u8 pm2_blk; | ||
95 | u8 value; | ||
96 | unsigned long flags; | ||
97 | |||
98 | if (state > 0x1) | ||
99 | return; | ||
100 | |||
87 | /* Disable IRQs */ | 101 | /* Disable IRQs */ |
88 | local_irq_save(flags); | 102 | local_irq_save(flags); |
89 | 103 | ||
@@ -315,10 +329,11 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) | |||
315 | cpus_allowed = current->cpus_allowed; | 329 | cpus_allowed = current->cpus_allowed; |
316 | set_cpus_allowed(current, policy->cpus); | 330 | set_cpus_allowed(current, policy->cpus); |
317 | 331 | ||
318 | /* detect low and high frequency */ | 332 | /* detect low and high frequency and transition latency */ |
319 | result = speedstep_get_freqs(speedstep_processor, | 333 | result = speedstep_get_freqs(speedstep_processor, |
320 | &speedstep_freqs[SPEEDSTEP_LOW].frequency, | 334 | &speedstep_freqs[SPEEDSTEP_LOW].frequency, |
321 | &speedstep_freqs[SPEEDSTEP_HIGH].frequency, | 335 | &speedstep_freqs[SPEEDSTEP_HIGH].frequency, |
336 | &policy->cpuinfo.transition_latency, | ||
322 | &speedstep_set_state); | 337 | &speedstep_set_state); |
323 | set_cpus_allowed(current, cpus_allowed); | 338 | set_cpus_allowed(current, cpus_allowed); |
324 | if (result) | 339 | if (result) |
@@ -335,7 +350,6 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) | |||
335 | 350 | ||
336 | /* cpuinfo and default policy values */ | 351 | /* cpuinfo and default policy values */ |
337 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | 352 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; |
338 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; | ||
339 | policy->cur = speed; | 353 | policy->cur = speed; |
340 | 354 | ||
341 | result = cpufreq_frequency_table_cpuinfo(policy, speedstep_freqs); | 355 | result = cpufreq_frequency_table_cpuinfo(policy, speedstep_freqs); |
@@ -400,6 +414,9 @@ static int __init speedstep_init(void) | |||
400 | return -EINVAL; | 414 | return -EINVAL; |
401 | } | 415 | } |
402 | 416 | ||
417 | if (speedstep_find_register()) | ||
418 | return -ENODEV; | ||
419 | |||
403 | return cpufreq_register_driver(&speedstep_driver); | 420 | return cpufreq_register_driver(&speedstep_driver); |
404 | } | 421 | } |
405 | 422 | ||
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c index d368b3f5fce8..7c47005a1805 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c | |||
@@ -320,11 +320,13 @@ EXPORT_SYMBOL_GPL(speedstep_detect_processor); | |||
320 | unsigned int speedstep_get_freqs(unsigned int processor, | 320 | unsigned int speedstep_get_freqs(unsigned int processor, |
321 | unsigned int *low_speed, | 321 | unsigned int *low_speed, |
322 | unsigned int *high_speed, | 322 | unsigned int *high_speed, |
323 | unsigned int *transition_latency, | ||
323 | void (*set_state) (unsigned int state)) | 324 | void (*set_state) (unsigned int state)) |
324 | { | 325 | { |
325 | unsigned int prev_speed; | 326 | unsigned int prev_speed; |
326 | unsigned int ret = 0; | 327 | unsigned int ret = 0; |
327 | unsigned long flags; | 328 | unsigned long flags; |
329 | struct timeval tv1, tv2; | ||
328 | 330 | ||
329 | if ((!processor) || (!low_speed) || (!high_speed) || (!set_state)) | 331 | if ((!processor) || (!low_speed) || (!high_speed) || (!set_state)) |
330 | return -EINVAL; | 332 | return -EINVAL; |
@@ -337,7 +339,7 @@ unsigned int speedstep_get_freqs(unsigned int processor, | |||
337 | return -EIO; | 339 | return -EIO; |
338 | 340 | ||
339 | dprintk("previous speed is %u\n", prev_speed); | 341 | dprintk("previous speed is %u\n", prev_speed); |
340 | 342 | ||
341 | local_irq_save(flags); | 343 | local_irq_save(flags); |
342 | 344 | ||
343 | /* switch to low state */ | 345 | /* switch to low state */ |
@@ -350,8 +352,17 @@ unsigned int speedstep_get_freqs(unsigned int processor, | |||
350 | 352 | ||
351 | dprintk("low speed is %u\n", *low_speed); | 353 | dprintk("low speed is %u\n", *low_speed); |
352 | 354 | ||
355 | /* start latency measurement */ | ||
356 | if (transition_latency) | ||
357 | do_gettimeofday(&tv1); | ||
358 | |||
353 | /* switch to high state */ | 359 | /* switch to high state */ |
354 | set_state(SPEEDSTEP_HIGH); | 360 | set_state(SPEEDSTEP_HIGH); |
361 | |||
362 | /* end latency measurement */ | ||
363 | if (transition_latency) | ||
364 | do_gettimeofday(&tv2); | ||
365 | |||
355 | *high_speed = speedstep_get_processor_frequency(processor); | 366 | *high_speed = speedstep_get_processor_frequency(processor); |
356 | if (!*high_speed) { | 367 | if (!*high_speed) { |
357 | ret = -EIO; | 368 | ret = -EIO; |
@@ -369,6 +380,25 @@ unsigned int speedstep_get_freqs(unsigned int processor, | |||
369 | if (*high_speed != prev_speed) | 380 | if (*high_speed != prev_speed) |
370 | set_state(SPEEDSTEP_LOW); | 381 | set_state(SPEEDSTEP_LOW); |
371 | 382 | ||
383 | if (transition_latency) { | ||
384 | *transition_latency = (tv2.tv_sec - tv1.tv_sec) * USEC_PER_SEC + | ||
385 | tv2.tv_usec - tv1.tv_usec; | ||
386 | dprintk("transition latency is %u uSec\n", *transition_latency); | ||
387 | |||
388 | /* convert uSec to nSec and add 20% for safety reasons */ | ||
389 | *transition_latency *= 1200; | ||
390 | |||
391 | /* check if the latency measurement is too high or too low | ||
392 | * and set it to a safe value (500uSec) in that case | ||
393 | */ | ||
394 | if (*transition_latency > 10000000 || *transition_latency < 50000) { | ||
395 | printk (KERN_WARNING "speedstep: frequency transition measured seems out of " | ||
396 | "range (%u nSec), falling back to a safe one of %u nSec.\n", | ||
397 | *transition_latency, 500000); | ||
398 | *transition_latency = 500000; | ||
399 | } | ||
400 | } | ||
401 | |||
372 | out: | 402 | out: |
373 | local_irq_restore(flags); | 403 | local_irq_restore(flags); |
374 | return (ret); | 404 | return (ret); |
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h index 261a2c9b7f6b..6a727fd3a77e 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h | |||
@@ -44,4 +44,5 @@ extern unsigned int speedstep_get_processor_frequency(unsigned int processor); | |||
44 | extern unsigned int speedstep_get_freqs(unsigned int processor, | 44 | extern unsigned int speedstep_get_freqs(unsigned int processor, |
45 | unsigned int *low_speed, | 45 | unsigned int *low_speed, |
46 | unsigned int *high_speed, | 46 | unsigned int *high_speed, |
47 | unsigned int *transition_latency, | ||
47 | void (*set_state) (unsigned int state)); | 48 | void (*set_state) (unsigned int state)); |
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c index 2718fb6f6aba..28cc5d524afc 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c | |||
@@ -269,6 +269,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) | |||
269 | result = speedstep_get_freqs(speedstep_processor, | 269 | result = speedstep_get_freqs(speedstep_processor, |
270 | &speedstep_freqs[SPEEDSTEP_LOW].frequency, | 270 | &speedstep_freqs[SPEEDSTEP_LOW].frequency, |
271 | &speedstep_freqs[SPEEDSTEP_HIGH].frequency, | 271 | &speedstep_freqs[SPEEDSTEP_HIGH].frequency, |
272 | NULL, | ||
272 | &speedstep_set_state); | 273 | &speedstep_set_state); |
273 | 274 | ||
274 | if (result) { | 275 | if (result) { |
diff --git a/arch/i386/kernel/cpu/proc.c b/arch/i386/kernel/cpu/proc.c index e7921315ae9d..6d91b274589c 100644 --- a/arch/i386/kernel/cpu/proc.c +++ b/arch/i386/kernel/cpu/proc.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <linux/string.h> | 3 | #include <linux/string.h> |
4 | #include <asm/semaphore.h> | 4 | #include <asm/semaphore.h> |
5 | #include <linux/seq_file.h> | 5 | #include <linux/seq_file.h> |
6 | #include <linux/cpufreq.h> | ||
6 | 7 | ||
7 | /* | 8 | /* |
8 | * Get CPU information for use by the procfs. | 9 | * Get CPU information for use by the procfs. |
@@ -86,8 +87,11 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
86 | seq_printf(m, "stepping\t: unknown\n"); | 87 | seq_printf(m, "stepping\t: unknown\n"); |
87 | 88 | ||
88 | if ( cpu_has(c, X86_FEATURE_TSC) ) { | 89 | if ( cpu_has(c, X86_FEATURE_TSC) ) { |
90 | unsigned int freq = cpufreq_quick_get(n); | ||
91 | if (!freq) | ||
92 | freq = cpu_khz; | ||
89 | seq_printf(m, "cpu MHz\t\t: %u.%03u\n", | 93 | seq_printf(m, "cpu MHz\t\t: %u.%03u\n", |
90 | cpu_khz / 1000, (cpu_khz % 1000)); | 94 | freq / 1000, (freq % 1000)); |
91 | } | 95 | } |
92 | 96 | ||
93 | /* Cache size */ | 97 | /* Cache size */ |
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c index f0dffa03fbba..ab0e9430f775 100644 --- a/arch/i386/kernel/traps.c +++ b/arch/i386/kernel/traps.c | |||
@@ -452,7 +452,7 @@ DO_VM86_ERROR( 3, SIGTRAP, "int3", int3) | |||
452 | #endif | 452 | #endif |
453 | DO_VM86_ERROR( 4, SIGSEGV, "overflow", overflow) | 453 | DO_VM86_ERROR( 4, SIGSEGV, "overflow", overflow) |
454 | DO_VM86_ERROR( 5, SIGSEGV, "bounds", bounds) | 454 | DO_VM86_ERROR( 5, SIGSEGV, "bounds", bounds) |
455 | DO_ERROR_INFO( 6, SIGILL, "invalid operand", invalid_op, ILL_ILLOPN, regs->eip) | 455 | DO_ERROR_INFO( 6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->eip) |
456 | DO_ERROR( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun) | 456 | DO_ERROR( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun) |
457 | DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS) | 457 | DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS) |
458 | DO_ERROR(11, SIGBUS, "segment not present", segment_not_present) | 458 | DO_ERROR(11, SIGBUS, "segment not present", segment_not_present) |