powernow-k7.c 16 KB

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