i7300_idle.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. /*
  2. * (C) Copyright 2008 Intel Corporation
  3. * Authors:
  4. * Andy Henroid <andrew.d.henroid@intel.com>
  5. * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
  6. */
  7. /*
  8. * Save DIMM power on Intel 7300-based platforms when all CPUs/cores
  9. * are idle, using the DIMM thermal throttling capability.
  10. *
  11. * This driver depends on the Intel integrated DMA controller (I/O AT).
  12. * If the driver for I/O AT (drivers/dma/ioatdma*) is also enabled,
  13. * this driver should work cooperatively.
  14. */
  15. /* #define DEBUG */
  16. #include <linux/module.h>
  17. #include <linux/pci.h>
  18. #include <linux/sched.h>
  19. #include <linux/notifier.h>
  20. #include <linux/cpumask.h>
  21. #include <linux/ktime.h>
  22. #include <linux/delay.h>
  23. #include <linux/debugfs.h>
  24. #include <linux/stop_machine.h>
  25. #include <linux/i7300_idle.h>
  26. #include <asm/idle.h>
  27. #include "../dma/ioatdma_hw.h"
  28. #include "../dma/ioatdma_registers.h"
  29. #define I7300_IDLE_DRIVER_VERSION "1.55"
  30. #define I7300_PRINT "i7300_idle:"
  31. #define MAX_STOP_RETRIES 10
  32. static int debug;
  33. module_param_named(debug, debug, uint, 0644);
  34. MODULE_PARM_DESC(debug, "Enable debug printks in this driver");
  35. #define dprintk(fmt, arg...) \
  36. do { if (debug) printk(KERN_INFO I7300_PRINT fmt, ##arg); } while (0)
  37. /*
  38. * Value to set THRTLOW to when initiating throttling
  39. * 0 = No throttling
  40. * 1 = Throttle when > 4 activations per eval window (Maximum throttling)
  41. * 2 = Throttle when > 8 activations
  42. * 168 = Throttle when > 672 activations (Minimum throttling)
  43. */
  44. #define MAX_THROTTLE_LOW_LIMIT 168
  45. static uint throttle_low_limit = 1;
  46. module_param_named(throttle_low_limit, throttle_low_limit, uint, 0644);
  47. MODULE_PARM_DESC(throttle_low_limit,
  48. "Value for THRTLOWLM activation field "
  49. "(0 = disable throttle, 1 = Max throttle, 168 = Min throttle)");
  50. /*
  51. * simple invocation and duration statistics
  52. */
  53. static unsigned long total_starts;
  54. static unsigned long total_us;
  55. #ifdef DEBUG
  56. static unsigned long past_skip;
  57. #endif
  58. static struct pci_dev *fbd_dev;
  59. static spinlock_t i7300_idle_lock;
  60. static int i7300_idle_active;
  61. static u8 i7300_idle_thrtctl_saved;
  62. static u8 i7300_idle_thrtlow_saved;
  63. static u32 i7300_idle_mc_saved;
  64. static cpumask_t idle_cpumask;
  65. static ktime_t start_ktime;
  66. static unsigned long avg_idle_us;
  67. static struct dentry *debugfs_dir;
  68. /* Begin: I/O AT Helper routines */
  69. #define IOAT_CHANBASE(ioat_ctl, chan) (ioat_ctl + 0x80 + 0x80 * chan)
  70. /* Snoop control (disable snoops when coherency is not important) */
  71. #define IOAT_DESC_SADDR_SNP_CTL (1UL << 1)
  72. #define IOAT_DESC_DADDR_SNP_CTL (1UL << 2)
  73. static struct pci_dev *ioat_dev;
  74. static struct ioat_dma_descriptor *ioat_desc; /* I/O AT desc & data (1 page) */
  75. static unsigned long ioat_desc_phys;
  76. static u8 *ioat_iomap; /* I/O AT memory-mapped control regs (aka CB_BAR) */
  77. static u8 *ioat_chanbase;
  78. /* Start I/O AT memory copy */
  79. static int i7300_idle_ioat_start(void)
  80. {
  81. u32 err;
  82. /* Clear error (due to circular descriptor pointer) */
  83. err = readl(ioat_chanbase + IOAT_CHANERR_OFFSET);
  84. if (err)
  85. writel(err, ioat_chanbase + IOAT_CHANERR_OFFSET);
  86. writeb(IOAT_CHANCMD_START, ioat_chanbase + IOAT1_CHANCMD_OFFSET);
  87. return 0;
  88. }
  89. /* Stop I/O AT memory copy */
  90. static void i7300_idle_ioat_stop(void)
  91. {
  92. int i;
  93. u64 sts;
  94. for (i = 0; i < MAX_STOP_RETRIES; i++) {
  95. writeb(IOAT_CHANCMD_RESET,
  96. ioat_chanbase + IOAT1_CHANCMD_OFFSET);
  97. udelay(10);
  98. sts = readq(ioat_chanbase + IOAT1_CHANSTS_OFFSET) &
  99. IOAT_CHANSTS_DMA_TRANSFER_STATUS;
  100. if (sts != IOAT_CHANSTS_DMA_TRANSFER_STATUS_ACTIVE)
  101. break;
  102. }
  103. if (i == MAX_STOP_RETRIES) {
  104. dprintk("failed to stop I/O AT after %d retries\n",
  105. MAX_STOP_RETRIES);
  106. }
  107. }
  108. /* Test I/O AT by copying 1024 byte from 2k to 1k */
  109. static int __init i7300_idle_ioat_selftest(u8 *ctl,
  110. struct ioat_dma_descriptor *desc, unsigned long desc_phys)
  111. {
  112. u64 chan_sts;
  113. memset(desc, 0, 2048);
  114. memset((u8 *) desc + 2048, 0xab, 1024);
  115. desc[0].size = 1024;
  116. desc[0].ctl = 0;
  117. desc[0].src_addr = desc_phys + 2048;
  118. desc[0].dst_addr = desc_phys + 1024;
  119. desc[0].next = 0;
  120. writeb(IOAT_CHANCMD_RESET, ioat_chanbase + IOAT1_CHANCMD_OFFSET);
  121. writeb(IOAT_CHANCMD_START, ioat_chanbase + IOAT1_CHANCMD_OFFSET);
  122. udelay(1000);
  123. chan_sts = readq(ioat_chanbase + IOAT1_CHANSTS_OFFSET) &
  124. IOAT_CHANSTS_DMA_TRANSFER_STATUS;
  125. if (chan_sts != IOAT_CHANSTS_DMA_TRANSFER_STATUS_DONE) {
  126. /* Not complete, reset the channel */
  127. writeb(IOAT_CHANCMD_RESET,
  128. ioat_chanbase + IOAT1_CHANCMD_OFFSET);
  129. return -1;
  130. }
  131. if (*(u32 *) ((u8 *) desc + 3068) != 0xabababab ||
  132. *(u32 *) ((u8 *) desc + 2044) != 0xabababab) {
  133. dprintk("Data values src 0x%x, dest 0x%x, memset 0x%x\n",
  134. *(u32 *) ((u8 *) desc + 2048),
  135. *(u32 *) ((u8 *) desc + 1024),
  136. *(u32 *) ((u8 *) desc + 3072));
  137. return -1;
  138. }
  139. return 0;
  140. }
  141. static struct device dummy_dma_dev = {
  142. .bus_id = "fallback device",
  143. .coherent_dma_mask = DMA_64BIT_MASK,
  144. .dma_mask = &dummy_dma_dev.coherent_dma_mask,
  145. };
  146. /* Setup and initialize I/O AT */
  147. /* This driver needs I/O AT as the throttling takes effect only when there is
  148. * some memory activity. We use I/O AT to set up a dummy copy, while all CPUs
  149. * go idle and memory is throttled.
  150. */
  151. static int __init i7300_idle_ioat_init(void)
  152. {
  153. u8 ver, chan_count, ioat_chan;
  154. u16 chan_ctl;
  155. ioat_iomap = (u8 *) ioremap_nocache(pci_resource_start(ioat_dev, 0),
  156. pci_resource_len(ioat_dev, 0));
  157. if (!ioat_iomap) {
  158. printk(KERN_ERR I7300_PRINT "failed to map I/O AT registers\n");
  159. goto err_ret;
  160. }
  161. ver = readb(ioat_iomap + IOAT_VER_OFFSET);
  162. if (ver != IOAT_VER_1_2) {
  163. printk(KERN_ERR I7300_PRINT "unknown I/O AT version (%u.%u)\n",
  164. ver >> 4, ver & 0xf);
  165. goto err_unmap;
  166. }
  167. chan_count = readb(ioat_iomap + IOAT_CHANCNT_OFFSET);
  168. if (!chan_count) {
  169. printk(KERN_ERR I7300_PRINT "unexpected # of I/O AT channels "
  170. "(%u)\n",
  171. chan_count);
  172. goto err_unmap;
  173. }
  174. ioat_chan = chan_count - 1;
  175. ioat_chanbase = IOAT_CHANBASE(ioat_iomap, ioat_chan);
  176. chan_ctl = readw(ioat_chanbase + IOAT_CHANCTRL_OFFSET);
  177. if (chan_ctl & IOAT_CHANCTRL_CHANNEL_IN_USE) {
  178. printk(KERN_ERR I7300_PRINT "channel %d in use\n", ioat_chan);
  179. goto err_unmap;
  180. }
  181. writew(IOAT_CHANCTRL_CHANNEL_IN_USE,
  182. ioat_chanbase + IOAT_CHANCTRL_OFFSET);
  183. ioat_desc = (struct ioat_dma_descriptor *)dma_alloc_coherent(
  184. &dummy_dma_dev, 4096,
  185. (dma_addr_t *)&ioat_desc_phys, GFP_KERNEL);
  186. if (!ioat_desc) {
  187. printk(KERN_ERR I7300_PRINT "failed to allocate I/O AT desc\n");
  188. goto err_mark_unused;
  189. }
  190. writel(ioat_desc_phys & 0xffffffffUL,
  191. ioat_chanbase + IOAT1_CHAINADDR_OFFSET_LOW);
  192. writel(ioat_desc_phys >> 32,
  193. ioat_chanbase + IOAT1_CHAINADDR_OFFSET_HIGH);
  194. if (i7300_idle_ioat_selftest(ioat_iomap, ioat_desc, ioat_desc_phys)) {
  195. printk(KERN_ERR I7300_PRINT "I/O AT self-test failed\n");
  196. goto err_free;
  197. }
  198. /* Setup circular I/O AT descriptor chain */
  199. ioat_desc[0].ctl = IOAT_DESC_SADDR_SNP_CTL | IOAT_DESC_DADDR_SNP_CTL;
  200. ioat_desc[0].src_addr = ioat_desc_phys + 2048;
  201. ioat_desc[0].dst_addr = ioat_desc_phys + 3072;
  202. ioat_desc[0].size = 128;
  203. ioat_desc[0].next = ioat_desc_phys + sizeof(struct ioat_dma_descriptor);
  204. ioat_desc[1].ctl = ioat_desc[0].ctl;
  205. ioat_desc[1].src_addr = ioat_desc[0].src_addr;
  206. ioat_desc[1].dst_addr = ioat_desc[0].dst_addr;
  207. ioat_desc[1].size = ioat_desc[0].size;
  208. ioat_desc[1].next = ioat_desc_phys;
  209. return 0;
  210. err_free:
  211. dma_free_coherent(&dummy_dma_dev, 4096, (void *)ioat_desc, 0);
  212. err_mark_unused:
  213. writew(0, ioat_chanbase + IOAT_CHANCTRL_OFFSET);
  214. err_unmap:
  215. iounmap(ioat_iomap);
  216. err_ret:
  217. return -ENODEV;
  218. }
  219. /* Cleanup I/O AT */
  220. static void __exit i7300_idle_ioat_exit(void)
  221. {
  222. int i;
  223. u64 chan_sts;
  224. i7300_idle_ioat_stop();
  225. /* Wait for a while for the channel to halt before releasing */
  226. for (i = 0; i < MAX_STOP_RETRIES; i++) {
  227. writeb(IOAT_CHANCMD_RESET,
  228. ioat_chanbase + IOAT1_CHANCMD_OFFSET);
  229. chan_sts = readq(ioat_chanbase + IOAT1_CHANSTS_OFFSET) &
  230. IOAT_CHANSTS_DMA_TRANSFER_STATUS;
  231. if (chan_sts != IOAT_CHANSTS_DMA_TRANSFER_STATUS_ACTIVE) {
  232. writew(0, ioat_chanbase + IOAT_CHANCTRL_OFFSET);
  233. break;
  234. }
  235. udelay(1000);
  236. }
  237. chan_sts = readq(ioat_chanbase + IOAT1_CHANSTS_OFFSET) &
  238. IOAT_CHANSTS_DMA_TRANSFER_STATUS;
  239. /*
  240. * We tried to reset multiple times. If IO A/T channel is still active
  241. * flag an error and return without cleanup. Memory leak is better
  242. * than random corruption in that extreme error situation.
  243. */
  244. if (chan_sts == IOAT_CHANSTS_DMA_TRANSFER_STATUS_ACTIVE) {
  245. printk(KERN_ERR I7300_PRINT "Unable to stop IO A/T channels."
  246. " Not freeing resources\n");
  247. return;
  248. }
  249. dma_free_coherent(&dummy_dma_dev, 4096, (void *)ioat_desc, 0);
  250. iounmap(ioat_iomap);
  251. }
  252. /* End: I/O AT Helper routines */
  253. #define DIMM_THRTLOW 0x64
  254. #define DIMM_THRTCTL 0x67
  255. #define DIMM_THRTCTL_THRMHUNT (1UL << 0)
  256. #define DIMM_MC 0x40
  257. #define DIMM_GTW_MODE (1UL << 17)
  258. #define DIMM_GBLACT 0x60
  259. /*
  260. * Keep track of an exponential-decaying average of recent idle durations.
  261. * The latest duration gets DURATION_WEIGHT_PCT percentage weight
  262. * in this average, with the old average getting the remaining weight.
  263. *
  264. * High weights emphasize recent history, low weights include long history.
  265. */
  266. #define DURATION_WEIGHT_PCT 55
  267. /*
  268. * When the decaying average of recent durations or the predicted duration
  269. * of the next timer interrupt is shorter than duration_threshold, the
  270. * driver will decline to throttle.
  271. */
  272. #define DURATION_THRESHOLD_US 100
  273. /* Store DIMM thermal throttle configuration */
  274. static int i7300_idle_thrt_save(void)
  275. {
  276. u32 new_mc_val;
  277. u8 gblactlm;
  278. pci_read_config_byte(fbd_dev, DIMM_THRTCTL, &i7300_idle_thrtctl_saved);
  279. pci_read_config_byte(fbd_dev, DIMM_THRTLOW, &i7300_idle_thrtlow_saved);
  280. pci_read_config_dword(fbd_dev, DIMM_MC, &i7300_idle_mc_saved);
  281. /*
  282. * Make sure we have Global Throttling Window Mode set to have a
  283. * "short" window. This (mostly) works around an issue where
  284. * throttling persists until the end of the global throttling window
  285. * size. On the tested system, this was resulting in a maximum of
  286. * 64 ms to exit throttling (average 32 ms). The actual numbers
  287. * depends on system frequencies. Setting the short window reduces
  288. * this by a factor of 4096.
  289. *
  290. * We will only do this only if the system is set for
  291. * unlimited-activations while in open-loop throttling (i.e., when
  292. * Global Activation Throttle Limit is zero).
  293. */
  294. pci_read_config_byte(fbd_dev, DIMM_GBLACT, &gblactlm);
  295. dprintk("thrtctl_saved = 0x%02x, thrtlow_saved = 0x%02x\n",
  296. i7300_idle_thrtctl_saved,
  297. i7300_idle_thrtlow_saved);
  298. dprintk("mc_saved = 0x%08x, gblactlm = 0x%02x\n",
  299. i7300_idle_mc_saved,
  300. gblactlm);
  301. if (gblactlm == 0) {
  302. new_mc_val = i7300_idle_mc_saved | DIMM_GTW_MODE;
  303. pci_write_config_dword(fbd_dev, DIMM_MC, new_mc_val);
  304. return 0;
  305. } else {
  306. dprintk("could not set GTW_MODE = 1 (OLTT enabled)\n");
  307. return -ENODEV;
  308. }
  309. }
  310. /* Restore DIMM thermal throttle configuration */
  311. static void i7300_idle_thrt_restore(void)
  312. {
  313. pci_write_config_dword(fbd_dev, DIMM_MC, i7300_idle_mc_saved);
  314. pci_write_config_byte(fbd_dev, DIMM_THRTLOW, i7300_idle_thrtlow_saved);
  315. pci_write_config_byte(fbd_dev, DIMM_THRTCTL, i7300_idle_thrtctl_saved);
  316. }
  317. /* Enable DIMM thermal throttling */
  318. static void i7300_idle_start(void)
  319. {
  320. u8 new_ctl;
  321. u8 limit;
  322. new_ctl = i7300_idle_thrtctl_saved & ~DIMM_THRTCTL_THRMHUNT;
  323. pci_write_config_byte(fbd_dev, DIMM_THRTCTL, new_ctl);
  324. limit = throttle_low_limit;
  325. if (unlikely(limit > MAX_THROTTLE_LOW_LIMIT))
  326. limit = MAX_THROTTLE_LOW_LIMIT;
  327. pci_write_config_byte(fbd_dev, DIMM_THRTLOW, limit);
  328. new_ctl = i7300_idle_thrtctl_saved | DIMM_THRTCTL_THRMHUNT;
  329. pci_write_config_byte(fbd_dev, DIMM_THRTCTL, new_ctl);
  330. }
  331. /* Disable DIMM thermal throttling */
  332. static void i7300_idle_stop(void)
  333. {
  334. u8 new_ctl;
  335. u8 got_ctl;
  336. new_ctl = i7300_idle_thrtctl_saved & ~DIMM_THRTCTL_THRMHUNT;
  337. pci_write_config_byte(fbd_dev, DIMM_THRTCTL, new_ctl);
  338. pci_write_config_byte(fbd_dev, DIMM_THRTLOW, i7300_idle_thrtlow_saved);
  339. pci_write_config_byte(fbd_dev, DIMM_THRTCTL, i7300_idle_thrtctl_saved);
  340. pci_read_config_byte(fbd_dev, DIMM_THRTCTL, &got_ctl);
  341. WARN_ON_ONCE(got_ctl != i7300_idle_thrtctl_saved);
  342. }
  343. /*
  344. * i7300_avg_duration_check()
  345. * return 0 if the decaying average of recent idle durations is
  346. * more than DURATION_THRESHOLD_US
  347. */
  348. static int i7300_avg_duration_check(void)
  349. {
  350. if (avg_idle_us >= DURATION_THRESHOLD_US)
  351. return 0;
  352. #ifdef DEBUG
  353. past_skip++;
  354. #endif
  355. return 1;
  356. }
  357. /* Idle notifier to look at idle CPUs */
  358. static int i7300_idle_notifier(struct notifier_block *nb, unsigned long val,
  359. void *data)
  360. {
  361. unsigned long flags;
  362. ktime_t now_ktime;
  363. static ktime_t idle_begin_time;
  364. static int time_init = 1;
  365. if (!throttle_low_limit)
  366. return 0;
  367. if (unlikely(time_init)) {
  368. time_init = 0;
  369. idle_begin_time = ktime_get();
  370. }
  371. spin_lock_irqsave(&i7300_idle_lock, flags);
  372. if (val == IDLE_START) {
  373. cpu_set(smp_processor_id(), idle_cpumask);
  374. if (cpus_weight(idle_cpumask) != num_online_cpus())
  375. goto end;
  376. now_ktime = ktime_get();
  377. idle_begin_time = now_ktime;
  378. if (i7300_avg_duration_check())
  379. goto end;
  380. i7300_idle_active = 1;
  381. total_starts++;
  382. start_ktime = now_ktime;
  383. i7300_idle_start();
  384. i7300_idle_ioat_start();
  385. } else if (val == IDLE_END) {
  386. cpu_clear(smp_processor_id(), idle_cpumask);
  387. if (cpus_weight(idle_cpumask) == (num_online_cpus() - 1)) {
  388. /* First CPU coming out of idle */
  389. u64 idle_duration_us;
  390. now_ktime = ktime_get();
  391. idle_duration_us = ktime_to_us(ktime_sub
  392. (now_ktime, idle_begin_time));
  393. avg_idle_us =
  394. ((100 - DURATION_WEIGHT_PCT) * avg_idle_us +
  395. DURATION_WEIGHT_PCT * idle_duration_us) / 100;
  396. if (i7300_idle_active) {
  397. ktime_t idle_ktime;
  398. idle_ktime = ktime_sub(now_ktime, start_ktime);
  399. total_us += ktime_to_us(idle_ktime);
  400. i7300_idle_ioat_stop();
  401. i7300_idle_stop();
  402. i7300_idle_active = 0;
  403. }
  404. }
  405. }
  406. end:
  407. spin_unlock_irqrestore(&i7300_idle_lock, flags);
  408. return 0;
  409. }
  410. static struct notifier_block i7300_idle_nb = {
  411. .notifier_call = i7300_idle_notifier,
  412. };
  413. MODULE_DEVICE_TABLE(pci, pci_tbl);
  414. int stats_open_generic(struct inode *inode, struct file *fp)
  415. {
  416. fp->private_data = inode->i_private;
  417. return 0;
  418. }
  419. static ssize_t stats_read_ul(struct file *fp, char __user *ubuf, size_t count,
  420. loff_t *off)
  421. {
  422. unsigned long *p = fp->private_data;
  423. char buf[32];
  424. int len;
  425. len = snprintf(buf, 32, "%lu\n", *p);
  426. return simple_read_from_buffer(ubuf, count, off, buf, len);
  427. }
  428. static const struct file_operations idle_fops = {
  429. .open = stats_open_generic,
  430. .read = stats_read_ul,
  431. };
  432. struct debugfs_file_info {
  433. void *ptr;
  434. char name[32];
  435. struct dentry *file;
  436. } debugfs_file_list[] = {
  437. {&total_starts, "total_starts", NULL},
  438. {&total_us, "total_us", NULL},
  439. #ifdef DEBUG
  440. {&past_skip, "past_skip", NULL},
  441. #endif
  442. {NULL, "", NULL}
  443. };
  444. static int __init i7300_idle_init(void)
  445. {
  446. spin_lock_init(&i7300_idle_lock);
  447. cpus_clear(idle_cpumask);
  448. total_us = 0;
  449. if (i7300_idle_platform_probe(&fbd_dev, &ioat_dev))
  450. return -ENODEV;
  451. if (i7300_idle_thrt_save())
  452. return -ENODEV;
  453. if (i7300_idle_ioat_init())
  454. return -ENODEV;
  455. debugfs_dir = debugfs_create_dir("i7300_idle", NULL);
  456. if (debugfs_dir) {
  457. int i = 0;
  458. while (debugfs_file_list[i].ptr != NULL) {
  459. debugfs_file_list[i].file = debugfs_create_file(
  460. debugfs_file_list[i].name,
  461. S_IRUSR,
  462. debugfs_dir,
  463. debugfs_file_list[i].ptr,
  464. &idle_fops);
  465. i++;
  466. }
  467. }
  468. idle_notifier_register(&i7300_idle_nb);
  469. printk(KERN_INFO "i7300_idle: loaded v%s\n", I7300_IDLE_DRIVER_VERSION);
  470. return 0;
  471. }
  472. static void __exit i7300_idle_exit(void)
  473. {
  474. idle_notifier_unregister(&i7300_idle_nb);
  475. if (debugfs_dir) {
  476. int i = 0;
  477. while (debugfs_file_list[i].file != NULL) {
  478. debugfs_remove(debugfs_file_list[i].file);
  479. i++;
  480. }
  481. debugfs_remove(debugfs_dir);
  482. }
  483. i7300_idle_thrt_restore();
  484. i7300_idle_ioat_exit();
  485. }
  486. module_init(i7300_idle_init);
  487. module_exit(i7300_idle_exit);
  488. MODULE_AUTHOR("Andy Henroid <andrew.d.henroid@intel.com>");
  489. MODULE_DESCRIPTION("Intel Chipset DIMM Idle Power Saving Driver v"
  490. I7300_IDLE_DRIVER_VERSION);
  491. MODULE_LICENSE("GPL");