aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/powernow-k8.c
diff options
context:
space:
mode:
authorStratos Karafotis <stratosk@semaphore.gr>2014-05-11 13:26:16 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-05-16 19:27:01 -0400
commite54173b4ed0fca1a5dce9911f54e71f2917d4869 (patch)
tree214054f9124d500974986e8e1f3ddcbd948131a7 /drivers/cpufreq/powernow-k8.c
parent60d1ea4e0aaeedb89c4336eb4d1359bee2cb33aa (diff)
cpufreq: powernow-k8: Suppress checkpatch warnings
Suppress the following checkpatch.pl warnings: - WARNING: Prefer pr_err(... to printk(KERN_ERR ... - WARNING: Prefer pr_info(... to printk(KERN_INFO ... - WARNING: Prefer pr_warn(... to printk(KERN_WARNING ... - WARNING: quoted string split across lines - WARNING: please, no spaces at the start of a line Also, define the pr_fmt macro instead of PFX for the module name. Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/powernow-k8.c')
-rw-r--r--drivers/cpufreq/powernow-k8.c180
1 files changed, 73 insertions, 107 deletions
diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c
index 1b6ae6b57c11..f9ce7e4bf0fe 100644
--- a/drivers/cpufreq/powernow-k8.c
+++ b/drivers/cpufreq/powernow-k8.c
@@ -27,6 +27,8 @@
27 * power and thermal data sheets, (e.g. 30417.pdf, 30430.pdf, 43375.pdf) 27 * power and thermal data sheets, (e.g. 30417.pdf, 30430.pdf, 43375.pdf)
28 */ 28 */
29 29
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31
30#include <linux/kernel.h> 32#include <linux/kernel.h>
31#include <linux/smp.h> 33#include <linux/smp.h>
32#include <linux/module.h> 34#include <linux/module.h>
@@ -45,7 +47,6 @@
45#include <linux/mutex.h> 47#include <linux/mutex.h>
46#include <acpi/processor.h> 48#include <acpi/processor.h>
47 49
48#define PFX "powernow-k8: "
49#define VERSION "version 2.20.00" 50#define VERSION "version 2.20.00"
50#include "powernow-k8.h" 51#include "powernow-k8.h"
51 52
@@ -161,7 +162,7 @@ static int write_new_fid(struct powernow_k8_data *data, u32 fid)
161 u32 i = 0; 162 u32 i = 0;
162 163
163 if ((fid & INVALID_FID_MASK) || (data->currvid & INVALID_VID_MASK)) { 164 if ((fid & INVALID_FID_MASK) || (data->currvid & INVALID_VID_MASK)) {
164 printk(KERN_ERR PFX "internal error - overflow on fid write\n"); 165 pr_err("internal error - overflow on fid write\n");
165 return 1; 166 return 1;
166 } 167 }
167 168
@@ -175,9 +176,7 @@ static int write_new_fid(struct powernow_k8_data *data, u32 fid)
175 do { 176 do {
176 wrmsr(MSR_FIDVID_CTL, lo, data->plllock * PLL_LOCK_CONVERSION); 177 wrmsr(MSR_FIDVID_CTL, lo, data->plllock * PLL_LOCK_CONVERSION);
177 if (i++ > 100) { 178 if (i++ > 100) {
178 printk(KERN_ERR PFX 179 pr_err("Hardware error - pending bit very stuck - no further pstate changes possible\n");
179 "Hardware error - pending bit very stuck - "
180 "no further pstate changes possible\n");
181 return 1; 180 return 1;
182 } 181 }
183 } while (query_current_values_with_pending_wait(data)); 182 } while (query_current_values_with_pending_wait(data));
@@ -185,15 +184,13 @@ static int write_new_fid(struct powernow_k8_data *data, u32 fid)
185 count_off_irt(data); 184 count_off_irt(data);
186 185
187 if (savevid != data->currvid) { 186 if (savevid != data->currvid) {
188 printk(KERN_ERR PFX 187 pr_err("vid change on fid trans, old 0x%x, new 0x%x\n",
189 "vid change on fid trans, old 0x%x, new 0x%x\n", 188 savevid, data->currvid);
190 savevid, data->currvid);
191 return 1; 189 return 1;
192 } 190 }
193 191
194 if (fid != data->currfid) { 192 if (fid != data->currfid) {
195 printk(KERN_ERR PFX 193 pr_err("fid trans failed, fid 0x%x, curr 0x%x\n", fid,
196 "fid trans failed, fid 0x%x, curr 0x%x\n", fid,
197 data->currfid); 194 data->currfid);
198 return 1; 195 return 1;
199 } 196 }
@@ -209,7 +206,7 @@ static int write_new_vid(struct powernow_k8_data *data, u32 vid)
209 int i = 0; 206 int i = 0;
210 207
211 if ((data->currfid & INVALID_FID_MASK) || (vid & INVALID_VID_MASK)) { 208 if ((data->currfid & INVALID_FID_MASK) || (vid & INVALID_VID_MASK)) {
212 printk(KERN_ERR PFX "internal error - overflow on vid write\n"); 209 pr_err("internal error - overflow on vid write\n");
213 return 1; 210 return 1;
214 } 211 }
215 212
@@ -223,23 +220,19 @@ static int write_new_vid(struct powernow_k8_data *data, u32 vid)
223 do { 220 do {
224 wrmsr(MSR_FIDVID_CTL, lo, STOP_GRANT_5NS); 221 wrmsr(MSR_FIDVID_CTL, lo, STOP_GRANT_5NS);
225 if (i++ > 100) { 222 if (i++ > 100) {
226 printk(KERN_ERR PFX "internal error - pending bit " 223 pr_err("internal error - pending bit very stuck - no further pstate changes possible\n");
227 "very stuck - no further pstate "
228 "changes possible\n");
229 return 1; 224 return 1;
230 } 225 }
231 } while (query_current_values_with_pending_wait(data)); 226 } while (query_current_values_with_pending_wait(data));
232 227
233 if (savefid != data->currfid) { 228 if (savefid != data->currfid) {
234 printk(KERN_ERR PFX "fid changed on vid trans, old " 229 pr_err("fid changed on vid trans, old 0x%x new 0x%x\n",
235 "0x%x new 0x%x\n", 230 savefid, data->currfid);
236 savefid, data->currfid);
237 return 1; 231 return 1;
238 } 232 }
239 233
240 if (vid != data->currvid) { 234 if (vid != data->currvid) {
241 printk(KERN_ERR PFX "vid trans failed, vid 0x%x, " 235 pr_err("vid trans failed, vid 0x%x, curr 0x%x\n",
242 "curr 0x%x\n",
243 vid, data->currvid); 236 vid, data->currvid);
244 return 1; 237 return 1;
245 } 238 }
@@ -283,8 +276,7 @@ static int transition_fid_vid(struct powernow_k8_data *data,
283 return 1; 276 return 1;
284 277
285 if ((reqfid != data->currfid) || (reqvid != data->currvid)) { 278 if ((reqfid != data->currfid) || (reqvid != data->currvid)) {
286 printk(KERN_ERR PFX "failed (cpu%d): req 0x%x 0x%x, " 279 pr_err("failed (cpu%d): req 0x%x 0x%x, curr 0x%x 0x%x\n",
287 "curr 0x%x 0x%x\n",
288 smp_processor_id(), 280 smp_processor_id(),
289 reqfid, reqvid, data->currfid, data->currvid); 281 reqfid, reqvid, data->currfid, data->currvid);
290 return 1; 282 return 1;
@@ -304,8 +296,7 @@ static int core_voltage_pre_transition(struct powernow_k8_data *data,
304 u32 savefid = data->currfid; 296 u32 savefid = data->currfid;
305 u32 maxvid, lo, rvomult = 1; 297 u32 maxvid, lo, rvomult = 1;
306 298
307 pr_debug("ph1 (cpu%d): start, currfid 0x%x, currvid 0x%x, " 299 pr_debug("ph1 (cpu%d): start, currfid 0x%x, currvid 0x%x, reqvid 0x%x, rvo 0x%x\n",
308 "reqvid 0x%x, rvo 0x%x\n",
309 smp_processor_id(), 300 smp_processor_id(),
310 data->currfid, data->currvid, reqvid, data->rvo); 301 data->currfid, data->currvid, reqvid, data->rvo);
311 302
@@ -342,8 +333,7 @@ static int core_voltage_pre_transition(struct powernow_k8_data *data,
342 return 1; 333 return 1;
343 334
344 if (savefid != data->currfid) { 335 if (savefid != data->currfid) {
345 printk(KERN_ERR PFX "ph1 err, currfid changed 0x%x\n", 336 pr_err("ph1 err, currfid changed 0x%x\n", data->currfid);
346 data->currfid);
347 return 1; 337 return 1;
348 } 338 }
349 339
@@ -360,13 +350,11 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid)
360 u32 fid_interval, savevid = data->currvid; 350 u32 fid_interval, savevid = data->currvid;
361 351
362 if (data->currfid == reqfid) { 352 if (data->currfid == reqfid) {
363 printk(KERN_ERR PFX "ph2 null fid transition 0x%x\n", 353 pr_err("ph2 null fid transition 0x%x\n", data->currfid);
364 data->currfid);
365 return 0; 354 return 0;
366 } 355 }
367 356
368 pr_debug("ph2 (cpu%d): starting, currfid 0x%x, currvid 0x%x, " 357 pr_debug("ph2 (cpu%d): starting, currfid 0x%x, currvid 0x%x, reqfid 0x%x\n",
369 "reqfid 0x%x\n",
370 smp_processor_id(), 358 smp_processor_id(),
371 data->currfid, data->currvid, reqfid); 359 data->currfid, data->currvid, reqfid);
372 360
@@ -409,15 +397,13 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid)
409 return 1; 397 return 1;
410 398
411 if (data->currfid != reqfid) { 399 if (data->currfid != reqfid) {
412 printk(KERN_ERR PFX 400 pr_err("ph2: mismatch, failed fid transition, curr 0x%x, req 0x%x\n",
413 "ph2: mismatch, failed fid transition, "
414 "curr 0x%x, req 0x%x\n",
415 data->currfid, reqfid); 401 data->currfid, reqfid);
416 return 1; 402 return 1;
417 } 403 }
418 404
419 if (savevid != data->currvid) { 405 if (savevid != data->currvid) {
420 printk(KERN_ERR PFX "ph2: vid changed, save 0x%x, curr 0x%x\n", 406 pr_err("ph2: vid changed, save 0x%x, curr 0x%x\n",
421 savevid, data->currvid); 407 savevid, data->currvid);
422 return 1; 408 return 1;
423 } 409 }
@@ -444,17 +430,14 @@ static int core_voltage_post_transition(struct powernow_k8_data *data,
444 return 1; 430 return 1;
445 431
446 if (savefid != data->currfid) { 432 if (savefid != data->currfid) {
447 printk(KERN_ERR PFX 433 pr_err("ph3: bad fid change, save 0x%x, curr 0x%x\n",
448 "ph3: bad fid change, save 0x%x, curr 0x%x\n", 434 savefid, data->currfid);
449 savefid, data->currfid);
450 return 1; 435 return 1;
451 } 436 }
452 437
453 if (data->currvid != reqvid) { 438 if (data->currvid != reqvid) {
454 printk(KERN_ERR PFX 439 pr_err("ph3: failed vid transition\n, req 0x%x, curr 0x%x",
455 "ph3: failed vid transition\n, " 440 reqvid, data->currvid);
456 "req 0x%x, curr 0x%x",
457 reqvid, data->currvid);
458 return 1; 441 return 1;
459 } 442 }
460 } 443 }
@@ -498,23 +481,20 @@ static void check_supported_cpu(void *_rc)
498 if ((eax & CPUID_XFAM) == CPUID_XFAM_K8) { 481 if ((eax & CPUID_XFAM) == CPUID_XFAM_K8) {
499 if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) || 482 if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) ||
500 ((eax & CPUID_XMOD) > CPUID_XMOD_REV_MASK)) { 483 ((eax & CPUID_XMOD) > CPUID_XMOD_REV_MASK)) {
501 printk(KERN_INFO PFX 484 pr_info("Processor cpuid %x not supported\n", eax);
502 "Processor cpuid %x not supported\n", eax);
503 return; 485 return;
504 } 486 }
505 487
506 eax = cpuid_eax(CPUID_GET_MAX_CAPABILITIES); 488 eax = cpuid_eax(CPUID_GET_MAX_CAPABILITIES);
507 if (eax < CPUID_FREQ_VOLT_CAPABILITIES) { 489 if (eax < CPUID_FREQ_VOLT_CAPABILITIES) {
508 printk(KERN_INFO PFX 490 pr_info("No frequency change capabilities detected\n");
509 "No frequency change capabilities detected\n");
510 return; 491 return;
511 } 492 }
512 493
513 cpuid(CPUID_FREQ_VOLT_CAPABILITIES, &eax, &ebx, &ecx, &edx); 494 cpuid(CPUID_FREQ_VOLT_CAPABILITIES, &eax, &ebx, &ecx, &edx);
514 if ((edx & P_STATE_TRANSITION_CAPABLE) 495 if ((edx & P_STATE_TRANSITION_CAPABLE)
515 != P_STATE_TRANSITION_CAPABLE) { 496 != P_STATE_TRANSITION_CAPABLE) {
516 printk(KERN_INFO PFX 497 pr_info("Power state transitions not supported\n");
517 "Power state transitions not supported\n");
518 return; 498 return;
519 } 499 }
520 *rc = 0; 500 *rc = 0;
@@ -529,43 +509,39 @@ static int check_pst_table(struct powernow_k8_data *data, struct pst_s *pst,
529 509
530 for (j = 0; j < data->numps; j++) { 510 for (j = 0; j < data->numps; j++) {
531 if (pst[j].vid > LEAST_VID) { 511 if (pst[j].vid > LEAST_VID) {
532 printk(KERN_ERR FW_BUG PFX "vid %d invalid : 0x%x\n", 512 pr_err(FW_BUG "vid %d invalid : 0x%x\n", j,
533 j, pst[j].vid); 513 pst[j].vid);
534 return -EINVAL; 514 return -EINVAL;
535 } 515 }
536 if (pst[j].vid < data->rvo) { 516 if (pst[j].vid < data->rvo) {
537 /* vid + rvo >= 0 */ 517 /* vid + rvo >= 0 */
538 printk(KERN_ERR FW_BUG PFX "0 vid exceeded with pstate" 518 pr_err(FW_BUG "0 vid exceeded with pstate %d\n", j);
539 " %d\n", j);
540 return -ENODEV; 519 return -ENODEV;
541 } 520 }
542 if (pst[j].vid < maxvid + data->rvo) { 521 if (pst[j].vid < maxvid + data->rvo) {
543 /* vid + rvo >= maxvid */ 522 /* vid + rvo >= maxvid */
544 printk(KERN_ERR FW_BUG PFX "maxvid exceeded with pstate" 523 pr_err(FW_BUG "maxvid exceeded with pstate %d\n", j);
545 " %d\n", j);
546 return -ENODEV; 524 return -ENODEV;
547 } 525 }
548 if (pst[j].fid > MAX_FID) { 526 if (pst[j].fid > MAX_FID) {
549 printk(KERN_ERR FW_BUG PFX "maxfid exceeded with pstate" 527 pr_err(FW_BUG "maxfid exceeded with pstate %d\n", j);
550 " %d\n", j);
551 return -ENODEV; 528 return -ENODEV;
552 } 529 }
553 if (j && (pst[j].fid < HI_FID_TABLE_BOTTOM)) { 530 if (j && (pst[j].fid < HI_FID_TABLE_BOTTOM)) {
554 /* Only first fid is allowed to be in "low" range */ 531 /* Only first fid is allowed to be in "low" range */
555 printk(KERN_ERR FW_BUG PFX "two low fids - %d : " 532 pr_err(FW_BUG "two low fids - %d : 0x%x\n", j,
556 "0x%x\n", j, pst[j].fid); 533 pst[j].fid);
557 return -EINVAL; 534 return -EINVAL;
558 } 535 }
559 if (pst[j].fid < lastfid) 536 if (pst[j].fid < lastfid)
560 lastfid = pst[j].fid; 537 lastfid = pst[j].fid;
561 } 538 }
562 if (lastfid & 1) { 539 if (lastfid & 1) {
563 printk(KERN_ERR FW_BUG PFX "lastfid invalid\n"); 540 pr_err(FW_BUG "lastfid invalid\n");
564 return -EINVAL; 541 return -EINVAL;
565 } 542 }
566 if (lastfid > LO_FID_TABLE_TOP) 543 if (lastfid > LO_FID_TABLE_TOP)
567 printk(KERN_INFO FW_BUG PFX 544 pr_info(FW_BUG "first fid not from lo freq table\n");
568 "first fid not from lo freq table\n");
569 545
570 return 0; 546 return 0;
571} 547}
@@ -582,16 +558,14 @@ static void print_basics(struct powernow_k8_data *data)
582 for (j = 0; j < data->numps; j++) { 558 for (j = 0; j < data->numps; j++) {
583 if (data->powernow_table[j].frequency != 559 if (data->powernow_table[j].frequency !=
584 CPUFREQ_ENTRY_INVALID) { 560 CPUFREQ_ENTRY_INVALID) {
585 printk(KERN_INFO PFX 561 pr_info("fid 0x%x (%d MHz), vid 0x%x\n",
586 "fid 0x%x (%d MHz), vid 0x%x\n", 562 data->powernow_table[j].driver_data & 0xff,
587 data->powernow_table[j].driver_data & 0xff, 563 data->powernow_table[j].frequency/1000,
588 data->powernow_table[j].frequency/1000, 564 data->powernow_table[j].driver_data >> 8);
589 data->powernow_table[j].driver_data >> 8);
590 } 565 }
591 } 566 }
592 if (data->batps) 567 if (data->batps)
593 printk(KERN_INFO PFX "Only %d pstates on battery\n", 568 pr_info("Only %d pstates on battery\n", data->batps);
594 data->batps);
595} 569}
596 570
597static int fill_powernow_table(struct powernow_k8_data *data, 571static int fill_powernow_table(struct powernow_k8_data *data,
@@ -602,21 +576,20 @@ static int fill_powernow_table(struct powernow_k8_data *data,
602 576
603 if (data->batps) { 577 if (data->batps) {
604 /* use ACPI support to get full speed on mains power */ 578 /* use ACPI support to get full speed on mains power */
605 printk(KERN_WARNING PFX 579 pr_warn("Only %d pstates usable (use ACPI driver for full range\n",
606 "Only %d pstates usable (use ACPI driver for full " 580 data->batps);
607 "range\n", data->batps);
608 data->numps = data->batps; 581 data->numps = data->batps;
609 } 582 }
610 583
611 for (j = 1; j < data->numps; j++) { 584 for (j = 1; j < data->numps; j++) {
612 if (pst[j-1].fid >= pst[j].fid) { 585 if (pst[j-1].fid >= pst[j].fid) {
613 printk(KERN_ERR PFX "PST out of sequence\n"); 586 pr_err("PST out of sequence\n");
614 return -EINVAL; 587 return -EINVAL;
615 } 588 }
616 } 589 }
617 590
618 if (data->numps < 2) { 591 if (data->numps < 2) {
619 printk(KERN_ERR PFX "no p states to transition\n"); 592 pr_err("no p states to transition\n");
620 return -ENODEV; 593 return -ENODEV;
621 } 594 }
622 595
@@ -626,7 +599,7 @@ static int fill_powernow_table(struct powernow_k8_data *data,
626 powernow_table = kzalloc((sizeof(*powernow_table) 599 powernow_table = kzalloc((sizeof(*powernow_table)
627 * (data->numps + 1)), GFP_KERNEL); 600 * (data->numps + 1)), GFP_KERNEL);
628 if (!powernow_table) { 601 if (!powernow_table) {
629 printk(KERN_ERR PFX "powernow_table memory alloc failure\n"); 602 pr_err("powernow_table memory alloc failure\n");
630 return -ENOMEM; 603 return -ENOMEM;
631 } 604 }
632 605
@@ -681,13 +654,13 @@ static int find_psb_table(struct powernow_k8_data *data)
681 654
682 pr_debug("table vers: 0x%x\n", psb->tableversion); 655 pr_debug("table vers: 0x%x\n", psb->tableversion);
683 if (psb->tableversion != PSB_VERSION_1_4) { 656 if (psb->tableversion != PSB_VERSION_1_4) {
684 printk(KERN_ERR FW_BUG PFX "PSB table is not v1.4\n"); 657 pr_err(FW_BUG "PSB table is not v1.4\n");
685 return -ENODEV; 658 return -ENODEV;
686 } 659 }
687 660
688 pr_debug("flags: 0x%x\n", psb->flags1); 661 pr_debug("flags: 0x%x\n", psb->flags1);
689 if (psb->flags1) { 662 if (psb->flags1) {
690 printk(KERN_ERR FW_BUG PFX "unknown flags\n"); 663 pr_err(FW_BUG "unknown flags\n");
691 return -ENODEV; 664 return -ENODEV;
692 } 665 }
693 666
@@ -716,7 +689,7 @@ static int find_psb_table(struct powernow_k8_data *data)
716 cpst = 1; 689 cpst = 1;
717 } 690 }
718 if (cpst != 1) { 691 if (cpst != 1) {
719 printk(KERN_ERR FW_BUG PFX "numpst must be 1\n"); 692 pr_err(FW_BUG "numpst must be 1\n");
720 return -ENODEV; 693 return -ENODEV;
721 } 694 }
722 695
@@ -742,9 +715,8 @@ static int find_psb_table(struct powernow_k8_data *data)
742 * BIOS and Kernel Developer's Guide, which is available on 715 * BIOS and Kernel Developer's Guide, which is available on
743 * www.amd.com 716 * www.amd.com
744 */ 717 */
745 printk(KERN_ERR FW_BUG PFX "No PSB or ACPI _PSS objects\n"); 718 pr_err(FW_BUG "No PSB or ACPI _PSS objects\n");
746 printk(KERN_ERR PFX "Make sure that your BIOS is up to date" 719 pr_err("Make sure that your BIOS is up to date and Cool'N'Quiet support is enabled in BIOS setup\n");
747 " and Cool'N'Quiet support is enabled in BIOS setup\n");
748 return -ENODEV; 720 return -ENODEV;
749} 721}
750 722
@@ -819,8 +791,7 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
819 acpi_processor_notify_smm(THIS_MODULE); 791 acpi_processor_notify_smm(THIS_MODULE);
820 792
821 if (!zalloc_cpumask_var(&data->acpi_data.shared_cpu_map, GFP_KERNEL)) { 793 if (!zalloc_cpumask_var(&data->acpi_data.shared_cpu_map, GFP_KERNEL)) {
822 printk(KERN_ERR PFX 794 pr_err("unable to alloc powernow_k8_data cpumask\n");
823 "unable to alloc powernow_k8_data cpumask\n");
824 ret_val = -ENOMEM; 795 ret_val = -ENOMEM;
825 goto err_out_mem; 796 goto err_out_mem;
826 } 797 }
@@ -885,9 +856,8 @@ static int fill_powernow_table_fidvid(struct powernow_k8_data *data,
885 } 856 }
886 857
887 if (freq != (data->acpi_data.states[i].core_frequency * 1000)) { 858 if (freq != (data->acpi_data.states[i].core_frequency * 1000)) {
888 printk(KERN_INFO PFX "invalid freq entries " 859 pr_info("invalid freq entries %u kHz vs. %u kHz\n",
889 "%u kHz vs. %u kHz\n", freq, 860 freq, (unsigned int)
890 (unsigned int)
891 (data->acpi_data.states[i].core_frequency 861 (data->acpi_data.states[i].core_frequency
892 * 1000)); 862 * 1000));
893 invalidate_entry(powernow_table, i); 863 invalidate_entry(powernow_table, i);
@@ -916,7 +886,7 @@ static int get_transition_latency(struct powernow_k8_data *data)
916 max_latency = cur_latency; 886 max_latency = cur_latency;
917 } 887 }
918 if (max_latency == 0) { 888 if (max_latency == 0) {
919 pr_err(FW_WARN PFX "Invalid zero transition latency\n"); 889 pr_err(FW_WARN "Invalid zero transition latency\n");
920 max_latency = 1; 890 max_latency = 1;
921 } 891 }
922 /* value in usecs, needs to be in nanoseconds */ 892 /* value in usecs, needs to be in nanoseconds */
@@ -991,7 +961,7 @@ static long powernowk8_target_fn(void *arg)
991 checkvid = data->currvid; 961 checkvid = data->currvid;
992 962
993 if (pending_bit_stuck()) { 963 if (pending_bit_stuck()) {
994 printk(KERN_ERR PFX "failing targ, change pending bit set\n"); 964 pr_err("failing targ, change pending bit set\n");
995 return -EIO; 965 return -EIO;
996 } 966 }
997 967
@@ -1003,12 +973,11 @@ static long powernowk8_target_fn(void *arg)
1003 return -EIO; 973 return -EIO;
1004 974
1005 pr_debug("targ: curr fid 0x%x, vid 0x%x\n", 975 pr_debug("targ: curr fid 0x%x, vid 0x%x\n",
1006 data->currfid, data->currvid); 976 data->currfid, data->currvid);
1007 977
1008 if ((checkvid != data->currvid) || 978 if ((checkvid != data->currvid) ||
1009 (checkfid != data->currfid)) { 979 (checkfid != data->currfid)) {
1010 pr_info(PFX 980 pr_info("error - out of sync, fix 0x%x 0x%x, vid 0x%x 0x%x\n",
1011 "error - out of sync, fix 0x%x 0x%x, vid 0x%x 0x%x\n",
1012 checkfid, data->currfid, 981 checkfid, data->currfid,
1013 checkvid, data->currvid); 982 checkvid, data->currvid);
1014 } 983 }
@@ -1020,7 +989,7 @@ static long powernowk8_target_fn(void *arg)
1020 ret = transition_frequency_fidvid(data, newstate); 989 ret = transition_frequency_fidvid(data, newstate);
1021 990
1022 if (ret) { 991 if (ret) {
1023 printk(KERN_ERR PFX "transition frequency failed\n"); 992 pr_err("transition frequency failed\n");
1024 mutex_unlock(&fidvid_mutex); 993 mutex_unlock(&fidvid_mutex);
1025 return 1; 994 return 1;
1026 } 995 }
@@ -1049,7 +1018,7 @@ static void powernowk8_cpu_init_on_cpu(void *_init_on_cpu)
1049 struct init_on_cpu *init_on_cpu = _init_on_cpu; 1018 struct init_on_cpu *init_on_cpu = _init_on_cpu;
1050 1019
1051 if (pending_bit_stuck()) { 1020 if (pending_bit_stuck()) {
1052 printk(KERN_ERR PFX "failing init, change pending bit set\n"); 1021 pr_err("failing init, change pending bit set\n");
1053 init_on_cpu->rc = -ENODEV; 1022 init_on_cpu->rc = -ENODEV;
1054 return; 1023 return;
1055 } 1024 }
@@ -1064,11 +1033,10 @@ static void powernowk8_cpu_init_on_cpu(void *_init_on_cpu)
1064 init_on_cpu->rc = 0; 1033 init_on_cpu->rc = 0;
1065} 1034}
1066 1035
1067static const char missing_pss_msg[] = 1036#define MISSING_PSS_MSG \
1068 KERN_ERR 1037 FW_BUG "No compatible ACPI _PSS objects found.\n" \
1069 FW_BUG PFX "No compatible ACPI _PSS objects found.\n" 1038 FW_BUG "First, make sure Cool'N'Quiet is enabled in the BIOS.\n" \
1070 FW_BUG PFX "First, make sure Cool'N'Quiet is enabled in the BIOS.\n" 1039 FW_BUG "If that doesn't help, try upgrading your BIOS.\n"
1071 FW_BUG PFX "If that doesn't help, try upgrading your BIOS.\n";
1072 1040
1073/* per CPU init entry point to the driver */ 1041/* per CPU init entry point to the driver */
1074static int powernowk8_cpu_init(struct cpufreq_policy *pol) 1042static int powernowk8_cpu_init(struct cpufreq_policy *pol)
@@ -1083,7 +1051,7 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol)
1083 1051
1084 data = kzalloc(sizeof(*data), GFP_KERNEL); 1052 data = kzalloc(sizeof(*data), GFP_KERNEL);
1085 if (!data) { 1053 if (!data) {
1086 printk(KERN_ERR PFX "unable to alloc powernow_k8_data"); 1054 pr_err("unable to alloc powernow_k8_data");
1087 return -ENOMEM; 1055 return -ENOMEM;
1088 } 1056 }
1089 1057
@@ -1095,13 +1063,11 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol)
1095 * an UP version, and is deprecated by AMD. 1063 * an UP version, and is deprecated by AMD.
1096 */ 1064 */
1097 if (num_online_cpus() != 1) { 1065 if (num_online_cpus() != 1) {
1098 printk_once(missing_pss_msg); 1066 pr_err_once(MISSING_PSS_MSG);
1099 goto err_out; 1067 goto err_out;
1100 } 1068 }
1101 if (pol->cpu != 0) { 1069 if (pol->cpu != 0) {
1102 printk(KERN_ERR FW_BUG PFX "No ACPI _PSS objects for " 1070 pr_err(FW_BUG "No ACPI _PSS objects for CPU other than CPU0. Complain to your BIOS vendor.\n");
1103 "CPU other than CPU0. Complain to your BIOS "
1104 "vendor.\n");
1105 goto err_out; 1071 goto err_out;
1106 } 1072 }
1107 rc = find_psb_table(data); 1073 rc = find_psb_table(data);
@@ -1129,7 +1095,7 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol)
1129 1095
1130 /* min/max the cpu is capable of */ 1096 /* min/max the cpu is capable of */
1131 if (cpufreq_table_validate_and_show(pol, data->powernow_table)) { 1097 if (cpufreq_table_validate_and_show(pol, data->powernow_table)) {
1132 printk(KERN_ERR FW_BUG PFX "invalid powernow_table\n"); 1098 pr_err(FW_BUG "invalid powernow_table\n");
1133 powernow_k8_cpu_exit_acpi(data); 1099 powernow_k8_cpu_exit_acpi(data);
1134 kfree(data->powernow_table); 1100 kfree(data->powernow_table);
1135 kfree(data); 1101 kfree(data);
@@ -1137,7 +1103,7 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol)
1137 } 1103 }
1138 1104
1139 pr_debug("cpu_init done, current fid 0x%x, vid 0x%x\n", 1105 pr_debug("cpu_init done, current fid 0x%x, vid 0x%x\n",
1140 data->currfid, data->currvid); 1106 data->currfid, data->currvid);
1141 1107
1142 /* Point all the CPUs in this policy to the same data */ 1108 /* Point all the CPUs in this policy to the same data */
1143 for_each_cpu(cpu, pol->cpus) 1109 for_each_cpu(cpu, pol->cpus)
@@ -1220,12 +1186,12 @@ static void __request_acpi_cpufreq(void)
1220 goto request; 1186 goto request;
1221 1187
1222 if (strncmp(cur_drv, drv, min_t(size_t, strlen(cur_drv), strlen(drv)))) 1188 if (strncmp(cur_drv, drv, min_t(size_t, strlen(cur_drv), strlen(drv))))
1223 pr_warn(PFX "WTF driver: %s\n", cur_drv); 1189 pr_warn("WTF driver: %s\n", cur_drv);
1224 1190
1225 return; 1191 return;
1226 1192
1227 request: 1193 request:
1228 pr_warn(PFX "This CPU is not supported anymore, using acpi-cpufreq instead.\n"); 1194 pr_warn("This CPU is not supported anymore, using acpi-cpufreq instead.\n");
1229 request_module(drv); 1195 request_module(drv);
1230} 1196}
1231 1197
@@ -1260,7 +1226,7 @@ static int powernowk8_init(void)
1260 if (ret) 1226 if (ret)
1261 return ret; 1227 return ret;
1262 1228
1263 pr_info(PFX "Found %d %s (%d cpu cores) (" VERSION ")\n", 1229 pr_info("Found %d %s (%d cpu cores) (" VERSION ")\n",
1264 num_online_nodes(), boot_cpu_data.x86_model_id, supported_cpus); 1230 num_online_nodes(), boot_cpu_data.x86_model_id, supported_cpus);
1265 1231
1266 return ret; 1232 return ret;
@@ -1274,8 +1240,8 @@ static void __exit powernowk8_exit(void)
1274 cpufreq_unregister_driver(&cpufreq_amd64_driver); 1240 cpufreq_unregister_driver(&cpufreq_amd64_driver);
1275} 1241}
1276 1242
1277MODULE_AUTHOR("Paul Devriendt <paul.devriendt@amd.com> and " 1243MODULE_AUTHOR("Paul Devriendt <paul.devriendt@amd.com>");
1278 "Mark Langsdorf <mark.langsdorf@amd.com>"); 1244MODULE_AUTHOR("Mark Langsdorf <mark.langsdorf@amd.com>");
1279MODULE_DESCRIPTION("AMD Athlon 64 and Opteron processor frequency driver."); 1245MODULE_DESCRIPTION("AMD Athlon 64 and Opteron processor frequency driver.");
1280MODULE_LICENSE("GPL"); 1246MODULE_LICENSE("GPL");
1281 1247