powernow-k7.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. /*
  2. * AMD K7 Powernow driver.
  3. * (C) 2003 Dave Jones on behalf of SuSE Labs.
  4. *
  5. * Licensed under the terms of the GNU GPL License version 2.
  6. * Based upon datasheets & sample CPUs kindly provided by AMD.
  7. *
  8. * Errata 5:
  9. * CPU may fail to execute a FID/VID change in presence of interrupt.
  10. * - We cli/sti on stepping A0 CPUs around the FID/VID transition.
  11. * Errata 15:
  12. * CPU with half frequency multipliers may hang upon wakeup from disconnect.
  13. * - We disable half multipliers if ACPI is used on A0 stepping CPUs.
  14. */
  15. #include <linux/kernel.h>
  16. #include <linux/module.h>
  17. #include <linux/moduleparam.h>
  18. #include <linux/init.h>
  19. #include <linux/cpufreq.h>
  20. #include <linux/slab.h>
  21. #include <linux/string.h>
  22. #include <linux/dmi.h>
  23. #include <linux/timex.h>
  24. #include <linux/io.h>
  25. #include <asm/timer.h> /* Needed for recalibrate_cpu_khz() */
  26. #include <asm/msr.h>
  27. #include <asm/cpu_device_id.h>
  28. #ifdef CONFIG_X86_POWERNOW_K7_ACPI
  29. #include <linux/acpi.h>
  30. #include <acpi/processor.h>
  31. #endif
  32. #include "powernow-k7.h"
  33. #define PFX "powernow: "
  34. struct psb_s {
  35. u8 signature[10];
  36. u8 tableversion;
  37. u8 flags;
  38. u16 settlingtime;
  39. u8 reserved1;
  40. u8 numpst;
  41. };
  42. struct pst_s {
  43. u32 cpuid;
  44. u8 fsbspeed;
  45. u8 maxfid;
  46. u8 startvid;
  47. u8 numpstates;
  48. };
  49. #ifdef CONFIG_X86_POWERNOW_K7_ACPI
  50. union powernow_acpi_control_t {
  51. struct {
  52. unsigned long fid:5,
  53. vid:5,
  54. sgtc:20,
  55. res1:2;
  56. } bits;
  57. unsigned long val;
  58. };
  59. #endif
  60. /* divide by 1000 to get VCore voltage in V. */
  61. static const int mobile_vid_table[32] = {
  62. 2000, 1950, 1900, 1850, 1800, 1750, 1700, 1650,
  63. 1600, 1550, 1500, 1450, 1400, 1350, 1300, 0,
  64. 1275, 1250, 1225, 1200, 1175, 1150, 1125, 1100,
  65. 1075, 1050, 1025, 1000, 975, 950, 925, 0,
  66. };
  67. /* divide by 10 to get FID. */
  68. static const int fid_codes[32] = {
  69. 110, 115, 120, 125, 50, 55, 60, 65,
  70. 70, 75, 80, 85, 90, 95, 100, 105,
  71. 30, 190, 40, 200, 130, 135, 140, 210,
  72. 150, 225, 160, 165, 170, 180, -1, -1,
  73. };
  74. /* This parameter is used in order to force ACPI instead of legacy method for
  75. * configuration purpose.
  76. */
  77. static int acpi_force;
  78. static struct cpufreq_frequency_table *powernow_table;
  79. static unsigned int can_scale_bus;
  80. static unsigned int can_scale_vid;
  81. static unsigned int minimum_speed = -1;
  82. static unsigned int maximum_speed;
  83. static unsigned int number_scales;
  84. static unsigned int fsb;
  85. static unsigned int latency;
  86. static char have_a0;
  87. static int check_fsb(unsigned int fsbspeed)
  88. {
  89. int delta;
  90. unsigned int f = fsb / 1000;
  91. delta = (fsbspeed > f) ? fsbspeed - f : f - fsbspeed;
  92. return delta < 5;
  93. }
  94. static const struct x86_cpu_id powernow_k7_cpuids[] = {
  95. { X86_VENDOR_AMD, 6, },
  96. {}
  97. };
  98. MODULE_DEVICE_TABLE(x86cpu, powernow_k7_cpuids);
  99. static int check_powernow(void)
  100. {
  101. struct cpuinfo_x86 *c = &cpu_data(0);
  102. unsigned int maxei, eax, ebx, ecx, edx;
  103. if (!x86_match_cpu(powernow_k7_cpuids))
  104. return 0;
  105. /* Get maximum capabilities */
  106. maxei = cpuid_eax(0x80000000);
  107. if (maxei < 0x80000007) { /* Any powernow info ? */
  108. #ifdef MODULE
  109. printk(KERN_INFO PFX "No powernow capabilities detected\n");
  110. #endif
  111. return 0;
  112. }
  113. if ((c->x86_model == 6) && (c->x86_mask == 0)) {
  114. printk(KERN_INFO PFX "K7 660[A0] core detected, "
  115. "enabling errata workarounds\n");
  116. have_a0 = 1;
  117. }
  118. cpuid(0x80000007, &eax, &ebx, &ecx, &edx);
  119. /* Check we can actually do something before we say anything.*/
  120. if (!(edx & (1 << 1 | 1 << 2)))
  121. return 0;
  122. printk(KERN_INFO PFX "PowerNOW! Technology present. Can scale: ");
  123. if (edx & 1 << 1) {
  124. printk("frequency");
  125. can_scale_bus = 1;
  126. }
  127. if ((edx & (1 << 1 | 1 << 2)) == 0x6)
  128. printk(" and ");
  129. if (edx & 1 << 2) {
  130. printk("voltage");
  131. can_scale_vid = 1;
  132. }
  133. printk(".\n");
  134. return 1;
  135. }
  136. #ifdef CONFIG_X86_POWERNOW_K7_ACPI
  137. static void invalidate_entry(unsigned int entry)
  138. {
  139. powernow_table[entry].frequency = CPUFREQ_ENTRY_INVALID;
  140. }
  141. #endif
  142. static int get_ranges(unsigned char *pst)
  143. {
  144. unsigned int j;
  145. unsigned int speed;
  146. u8 fid, vid;
  147. powernow_table = kzalloc((sizeof(*powernow_table) *
  148. (number_scales + 1)), GFP_KERNEL);
  149. if (!powernow_table)
  150. return -ENOMEM;
  151. for (j = 0 ; j < number_scales; j++) {
  152. fid = *pst++;
  153. powernow_table[j].frequency = (fsb * fid_codes[fid]) / 10;
  154. powernow_table[j].driver_data = fid; /* lower 8 bits */
  155. speed = powernow_table[j].frequency;
  156. if ((fid_codes[fid] % 10) == 5) {
  157. #ifdef CONFIG_X86_POWERNOW_K7_ACPI
  158. if (have_a0 == 1)
  159. invalidate_entry(j);
  160. #endif
  161. }
  162. if (speed < minimum_speed)
  163. minimum_speed = speed;
  164. if (speed > maximum_speed)
  165. maximum_speed = speed;
  166. vid = *pst++;
  167. powernow_table[j].driver_data |= (vid << 8); /* upper 8 bits */
  168. pr_debug(" FID: 0x%x (%d.%dx [%dMHz]) "
  169. "VID: 0x%x (%d.%03dV)\n", fid, fid_codes[fid] / 10,
  170. fid_codes[fid] % 10, speed/1000, vid,
  171. mobile_vid_table[vid]/1000,
  172. mobile_vid_table[vid]%1000);
  173. }
  174. powernow_table[number_scales].frequency = CPUFREQ_TABLE_END;
  175. powernow_table[number_scales].driver_data = 0;
  176. return 0;
  177. }
  178. static void change_FID(int fid)
  179. {
  180. union msr_fidvidctl fidvidctl;
  181. rdmsrl(MSR_K7_FID_VID_CTL, fidvidctl.val);
  182. if (fidvidctl.bits.FID != fid) {
  183. fidvidctl.bits.SGTC = latency;
  184. fidvidctl.bits.FID = fid;
  185. fidvidctl.bits.VIDC = 0;
  186. fidvidctl.bits.FIDC = 1;
  187. wrmsrl(MSR_K7_FID_VID_CTL, fidvidctl.val);
  188. }
  189. }
  190. static void change_VID(int vid)
  191. {
  192. union msr_fidvidctl fidvidctl;
  193. rdmsrl(MSR_K7_FID_VID_CTL, fidvidctl.val);
  194. if (fidvidctl.bits.VID != vid) {
  195. fidvidctl.bits.SGTC = latency;
  196. fidvidctl.bits.VID = vid;
  197. fidvidctl.bits.FIDC = 0;
  198. fidvidctl.bits.VIDC = 1;
  199. wrmsrl(MSR_K7_FID_VID_CTL, fidvidctl.val);
  200. }
  201. }
  202. static int powernow_target(struct cpufreq_policy *policy, unsigned int index)
  203. {
  204. u8 fid, vid;
  205. struct cpufreq_freqs freqs;
  206. union msr_fidvidstatus fidvidstatus;
  207. int cfid;
  208. /* fid are the lower 8 bits of the index we stored into
  209. * the cpufreq frequency table in powernow_decode_bios,
  210. * vid are the upper 8 bits.
  211. */
  212. fid = powernow_table[index].driver_data & 0xFF;
  213. vid = (powernow_table[index].driver_data & 0xFF00) >> 8;
  214. rdmsrl(MSR_K7_FID_VID_STATUS, fidvidstatus.val);
  215. cfid = fidvidstatus.bits.CFID;
  216. freqs.old = fsb * fid_codes[cfid] / 10;
  217. freqs.new = powernow_table[index].frequency;
  218. /* Now do the magic poking into the MSRs. */
  219. if (have_a0 == 1) /* A0 errata 5 */
  220. local_irq_disable();
  221. if (freqs.old > freqs.new) {
  222. /* Going down, so change FID first */
  223. change_FID(fid);
  224. change_VID(vid);
  225. } else {
  226. /* Going up, so change VID first */
  227. change_VID(vid);
  228. change_FID(fid);
  229. }
  230. if (have_a0 == 1)
  231. local_irq_enable();
  232. return 0;
  233. }
  234. #ifdef CONFIG_X86_POWERNOW_K7_ACPI
  235. static struct acpi_processor_performance *acpi_processor_perf;
  236. static int powernow_acpi_init(void)
  237. {
  238. int i;
  239. int retval = 0;
  240. union powernow_acpi_control_t pc;
  241. if (acpi_processor_perf != NULL && powernow_table != NULL) {
  242. retval = -EINVAL;
  243. goto err0;
  244. }
  245. acpi_processor_perf = kzalloc(sizeof(*acpi_processor_perf), GFP_KERNEL);
  246. if (!acpi_processor_perf) {
  247. retval = -ENOMEM;
  248. goto err0;
  249. }
  250. if (!zalloc_cpumask_var(&acpi_processor_perf->shared_cpu_map,
  251. GFP_KERNEL)) {
  252. retval = -ENOMEM;
  253. goto err05;
  254. }
  255. if (acpi_processor_register_performance(acpi_processor_perf, 0)) {
  256. retval = -EIO;
  257. goto err1;
  258. }
  259. if (acpi_processor_perf->control_register.space_id !=
  260. ACPI_ADR_SPACE_FIXED_HARDWARE) {
  261. retval = -ENODEV;
  262. goto err2;
  263. }
  264. if (acpi_processor_perf->status_register.space_id !=
  265. ACPI_ADR_SPACE_FIXED_HARDWARE) {
  266. retval = -ENODEV;
  267. goto err2;
  268. }
  269. number_scales = acpi_processor_perf->state_count;
  270. if (number_scales < 2) {
  271. retval = -ENODEV;
  272. goto err2;
  273. }
  274. powernow_table = kzalloc((sizeof(*powernow_table) *
  275. (number_scales + 1)), GFP_KERNEL);
  276. if (!powernow_table) {
  277. retval = -ENOMEM;
  278. goto err2;
  279. }
  280. pc.val = (unsigned long) acpi_processor_perf->states[0].control;
  281. for (i = 0; i < number_scales; i++) {
  282. u8 fid, vid;
  283. struct acpi_processor_px *state =
  284. &acpi_processor_perf->states[i];
  285. unsigned int speed, speed_mhz;
  286. pc.val = (unsigned long) state->control;
  287. pr_debug("acpi: P%d: %d MHz %d mW %d uS control %08x SGTC %d\n",
  288. i,
  289. (u32) state->core_frequency,
  290. (u32) state->power,
  291. (u32) state->transition_latency,
  292. (u32) state->control,
  293. pc.bits.sgtc);
  294. vid = pc.bits.vid;
  295. fid = pc.bits.fid;
  296. powernow_table[i].frequency = fsb * fid_codes[fid] / 10;
  297. powernow_table[i].driver_data = fid; /* lower 8 bits */
  298. powernow_table[i].driver_data |= (vid << 8); /* upper 8 bits */
  299. speed = powernow_table[i].frequency;
  300. speed_mhz = speed / 1000;
  301. /* processor_perflib will multiply the MHz value by 1000 to
  302. * get a KHz value (e.g. 1266000). However, powernow-k7 works
  303. * with true KHz values (e.g. 1266768). To ensure that all
  304. * powernow frequencies are available, we must ensure that
  305. * ACPI doesn't restrict them, so we round up the MHz value
  306. * to ensure that perflib's computed KHz value is greater than
  307. * or equal to powernow's KHz value.
  308. */
  309. if (speed % 1000 > 0)
  310. speed_mhz++;
  311. if ((fid_codes[fid] % 10) == 5) {
  312. if (have_a0 == 1)
  313. invalidate_entry(i);
  314. }
  315. pr_debug(" FID: 0x%x (%d.%dx [%dMHz]) "
  316. "VID: 0x%x (%d.%03dV)\n", fid, fid_codes[fid] / 10,
  317. fid_codes[fid] % 10, speed_mhz, vid,
  318. mobile_vid_table[vid]/1000,
  319. mobile_vid_table[vid]%1000);
  320. if (state->core_frequency != speed_mhz) {
  321. state->core_frequency = speed_mhz;
  322. pr_debug(" Corrected ACPI frequency to %d\n",
  323. speed_mhz);
  324. }
  325. if (latency < pc.bits.sgtc)
  326. latency = pc.bits.sgtc;
  327. if (speed < minimum_speed)
  328. minimum_speed = speed;
  329. if (speed > maximum_speed)
  330. maximum_speed = speed;
  331. }
  332. powernow_table[i].frequency = CPUFREQ_TABLE_END;
  333. powernow_table[i].driver_data = 0;
  334. /* notify BIOS that we exist */
  335. acpi_processor_notify_smm(THIS_MODULE);
  336. return 0;
  337. err2:
  338. acpi_processor_unregister_performance(0);
  339. err1:
  340. free_cpumask_var(acpi_processor_perf->shared_cpu_map);
  341. err05:
  342. kfree(acpi_processor_perf);
  343. err0:
  344. printk(KERN_WARNING PFX "ACPI perflib can not be used on "
  345. "this platform\n");
  346. acpi_processor_perf = NULL;
  347. return retval;
  348. }
  349. #else
  350. static int powernow_acpi_init(void)
  351. {
  352. printk(KERN_INFO PFX "no support for ACPI processor found."
  353. " Please recompile your kernel with ACPI processor\n");
  354. return -EINVAL;
  355. }
  356. #endif
  357. static void print_pst_entry(struct pst_s *pst, unsigned int j)
  358. {
  359. pr_debug("PST:%d (@%p)\n", j, pst);
  360. pr_debug(" cpuid: 0x%x fsb: %d maxFID: 0x%x startvid: 0x%x\n",
  361. pst->cpuid, pst->fsbspeed, pst->maxfid, pst->startvid);
  362. }
  363. static int powernow_decode_bios(int maxfid, int startvid)
  364. {
  365. struct psb_s *psb;
  366. struct pst_s *pst;
  367. unsigned int i, j;
  368. unsigned char *p;
  369. unsigned int etuple;
  370. unsigned int ret;
  371. etuple = cpuid_eax(0x80000001);
  372. for (i = 0xC0000; i < 0xffff0 ; i += 16) {
  373. p = phys_to_virt(i);
  374. if (memcmp(p, "AMDK7PNOW!", 10) == 0) {
  375. pr_debug("Found PSB header at %p\n", p);
  376. psb = (struct psb_s *) p;
  377. pr_debug("Table version: 0x%x\n", psb->tableversion);
  378. if (psb->tableversion != 0x12) {
  379. printk(KERN_INFO PFX "Sorry, only v1.2 tables"
  380. " supported right now\n");
  381. return -ENODEV;
  382. }
  383. pr_debug("Flags: 0x%x\n", psb->flags);
  384. if ((psb->flags & 1) == 0)
  385. pr_debug("Mobile voltage regulator\n");
  386. else
  387. pr_debug("Desktop voltage regulator\n");
  388. latency = psb->settlingtime;
  389. if (latency < 100) {
  390. printk(KERN_INFO PFX "BIOS set settling time "
  391. "to %d microseconds. "
  392. "Should be at least 100. "
  393. "Correcting.\n", latency);
  394. latency = 100;
  395. }
  396. pr_debug("Settling Time: %d microseconds.\n",
  397. psb->settlingtime);
  398. pr_debug("Has %d PST tables. (Only dumping ones "
  399. "relevant to this CPU).\n",
  400. psb->numpst);
  401. p += sizeof(*psb);
  402. pst = (struct pst_s *) p;
  403. for (j = 0; j < psb->numpst; j++) {
  404. pst = (struct pst_s *) p;
  405. number_scales = pst->numpstates;
  406. if ((etuple == pst->cpuid) &&
  407. check_fsb(pst->fsbspeed) &&
  408. (maxfid == pst->maxfid) &&
  409. (startvid == pst->startvid)) {
  410. print_pst_entry(pst, j);
  411. p = (char *)pst + sizeof(*pst);
  412. ret = get_ranges(p);
  413. return ret;
  414. } else {
  415. unsigned int k;
  416. p = (char *)pst + sizeof(*pst);
  417. for (k = 0; k < number_scales; k++)
  418. p += 2;
  419. }
  420. }
  421. printk(KERN_INFO PFX "No PST tables match this cpuid "
  422. "(0x%x)\n", etuple);
  423. printk(KERN_INFO PFX "This is indicative of a broken "
  424. "BIOS.\n");
  425. return -EINVAL;
  426. }
  427. p++;
  428. }
  429. return -ENODEV;
  430. }
  431. /*
  432. * We use the fact that the bus frequency is somehow
  433. * a multiple of 100000/3 khz, then we compute sgtc according
  434. * to this multiple.
  435. * That way, we match more how AMD thinks all of that work.
  436. * We will then get the same kind of behaviour already tested under
  437. * the "well-known" other OS.
  438. */
  439. static int fixup_sgtc(void)
  440. {
  441. unsigned int sgtc;
  442. unsigned int m;
  443. m = fsb / 3333;
  444. if ((m % 10) >= 5)
  445. m += 5;
  446. m /= 10;
  447. sgtc = 100 * m * latency;
  448. sgtc = sgtc / 3;
  449. if (sgtc > 0xfffff) {
  450. printk(KERN_WARNING PFX "SGTC too large %d\n", sgtc);
  451. sgtc = 0xfffff;
  452. }
  453. return sgtc;
  454. }
  455. static unsigned int powernow_get(unsigned int cpu)
  456. {
  457. union msr_fidvidstatus fidvidstatus;
  458. unsigned int cfid;
  459. if (cpu)
  460. return 0;
  461. rdmsrl(MSR_K7_FID_VID_STATUS, fidvidstatus.val);
  462. cfid = fidvidstatus.bits.CFID;
  463. return fsb * fid_codes[cfid] / 10;
  464. }
  465. static int acer_cpufreq_pst(const struct dmi_system_id *d)
  466. {
  467. printk(KERN_WARNING PFX
  468. "%s laptop with broken PST tables in BIOS detected.\n",
  469. d->ident);
  470. printk(KERN_WARNING PFX
  471. "You need to downgrade to 3A21 (09/09/2002), or try a newer "
  472. "BIOS than 3A71 (01/20/2003)\n");
  473. printk(KERN_WARNING PFX
  474. "cpufreq scaling has been disabled as a result of this.\n");
  475. return 0;
  476. }
  477. /*
  478. * Some Athlon laptops have really fucked PST tables.
  479. * A BIOS update is all that can save them.
  480. * Mention this, and disable cpufreq.
  481. */
  482. static struct dmi_system_id powernow_dmi_table[] = {
  483. {
  484. .callback = acer_cpufreq_pst,
  485. .ident = "Acer Aspire",
  486. .matches = {
  487. DMI_MATCH(DMI_SYS_VENDOR, "Insyde Software"),
  488. DMI_MATCH(DMI_BIOS_VERSION, "3A71"),
  489. },
  490. },
  491. { }
  492. };
  493. static int powernow_cpu_init(struct cpufreq_policy *policy)
  494. {
  495. union msr_fidvidstatus fidvidstatus;
  496. int result;
  497. if (policy->cpu != 0)
  498. return -ENODEV;
  499. rdmsrl(MSR_K7_FID_VID_STATUS, fidvidstatus.val);
  500. recalibrate_cpu_khz();
  501. fsb = (10 * cpu_khz) / fid_codes[fidvidstatus.bits.CFID];
  502. if (!fsb) {
  503. printk(KERN_WARNING PFX "can not determine bus frequency\n");
  504. return -EINVAL;
  505. }
  506. pr_debug("FSB: %3dMHz\n", fsb/1000);
  507. if (dmi_check_system(powernow_dmi_table) || acpi_force) {
  508. printk(KERN_INFO PFX "PSB/PST known to be broken. "
  509. "Trying ACPI instead\n");
  510. result = powernow_acpi_init();
  511. } else {
  512. result = powernow_decode_bios(fidvidstatus.bits.MFID,
  513. fidvidstatus.bits.SVID);
  514. if (result) {
  515. printk(KERN_INFO PFX "Trying ACPI perflib\n");
  516. maximum_speed = 0;
  517. minimum_speed = -1;
  518. latency = 0;
  519. result = powernow_acpi_init();
  520. if (result) {
  521. printk(KERN_INFO PFX
  522. "ACPI and legacy methods failed\n");
  523. }
  524. } else {
  525. /* SGTC use the bus clock as timer */
  526. latency = fixup_sgtc();
  527. printk(KERN_INFO PFX "SGTC: %d\n", latency);
  528. }
  529. }
  530. if (result)
  531. return result;
  532. printk(KERN_INFO PFX "Minimum speed %d MHz. Maximum speed %d MHz.\n",
  533. minimum_speed/1000, maximum_speed/1000);
  534. policy->cpuinfo.transition_latency =
  535. cpufreq_scale(2000000UL, fsb, latency);
  536. return cpufreq_table_validate_and_show(policy, powernow_table);
  537. }
  538. static int powernow_cpu_exit(struct cpufreq_policy *policy)
  539. {
  540. #ifdef CONFIG_X86_POWERNOW_K7_ACPI
  541. if (acpi_processor_perf) {
  542. acpi_processor_unregister_performance(0);
  543. free_cpumask_var(acpi_processor_perf->shared_cpu_map);
  544. kfree(acpi_processor_perf);
  545. }
  546. #endif
  547. kfree(powernow_table);
  548. return 0;
  549. }
  550. static struct cpufreq_driver powernow_driver = {
  551. .verify = cpufreq_generic_frequency_table_verify,
  552. .target_index = powernow_target,
  553. .get = powernow_get,
  554. #ifdef CONFIG_X86_POWERNOW_K7_ACPI
  555. .bios_limit = acpi_processor_get_bios_limit,
  556. #endif
  557. .init = powernow_cpu_init,
  558. .exit = powernow_cpu_exit,
  559. .name = "powernow-k7",
  560. .attr = cpufreq_generic_attr,
  561. };
  562. static int __init powernow_init(void)
  563. {
  564. if (check_powernow() == 0)
  565. return -ENODEV;
  566. return cpufreq_register_driver(&powernow_driver);
  567. }
  568. static void __exit powernow_exit(void)
  569. {
  570. cpufreq_unregister_driver(&powernow_driver);
  571. }
  572. module_param(acpi_force, int, 0444);
  573. MODULE_PARM_DESC(acpi_force, "Force ACPI to be used.");
  574. MODULE_AUTHOR("Dave Jones");
  575. MODULE_DESCRIPTION("Powernow driver for AMD K7 processors.");
  576. MODULE_LICENSE("GPL");
  577. late_initcall(powernow_init);
  578. module_exit(powernow_exit);