amd8111_edac.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. /*
  2. * amd8111_edac.c, AMD8111 Hyper Transport chip EDAC kernel module
  3. *
  4. * Copyright (c) 2008 Wind River Systems, Inc.
  5. *
  6. * Authors: Cao Qingtao <qingtao.cao@windriver.com>
  7. * Benjamin Walsh <benjamin.walsh@windriver.com>
  8. * Hu Yongqi <yongqi.hu@windriver.com>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  17. * See the GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22. */
  23. #include <linux/module.h>
  24. #include <linux/init.h>
  25. #include <linux/interrupt.h>
  26. #include <linux/bitops.h>
  27. #include <linux/edac.h>
  28. #include <linux/pci_ids.h>
  29. #include <asm/io.h>
  30. #include "edac_core.h"
  31. #include "edac_module.h"
  32. #include "amd8111_edac.h"
  33. #define AMD8111_EDAC_REVISION " Ver: 1.0.0"
  34. #define AMD8111_EDAC_MOD_STR "amd8111_edac"
  35. #define PCI_DEVICE_ID_AMD_8111_PCI 0x7460
  36. enum amd8111_edac_devs {
  37. LPC_BRIDGE = 0,
  38. };
  39. enum amd8111_edac_pcis {
  40. PCI_BRIDGE = 0,
  41. };
  42. /* Wrapper functions for accessing PCI configuration space */
  43. static int edac_pci_read_dword(struct pci_dev *dev, int reg, u32 *val32)
  44. {
  45. int ret;
  46. ret = pci_read_config_dword(dev, reg, val32);
  47. if (ret != 0)
  48. printk(KERN_ERR AMD8111_EDAC_MOD_STR
  49. " PCI Access Read Error at 0x%x\n", reg);
  50. return ret;
  51. }
  52. static void edac_pci_read_byte(struct pci_dev *dev, int reg, u8 *val8)
  53. {
  54. int ret;
  55. ret = pci_read_config_byte(dev, reg, val8);
  56. if (ret != 0)
  57. printk(KERN_ERR AMD8111_EDAC_MOD_STR
  58. " PCI Access Read Error at 0x%x\n", reg);
  59. }
  60. static void edac_pci_write_dword(struct pci_dev *dev, int reg, u32 val32)
  61. {
  62. int ret;
  63. ret = pci_write_config_dword(dev, reg, val32);
  64. if (ret != 0)
  65. printk(KERN_ERR AMD8111_EDAC_MOD_STR
  66. " PCI Access Write Error at 0x%x\n", reg);
  67. }
  68. static void edac_pci_write_byte(struct pci_dev *dev, int reg, u8 val8)
  69. {
  70. int ret;
  71. ret = pci_write_config_byte(dev, reg, val8);
  72. if (ret != 0)
  73. printk(KERN_ERR AMD8111_EDAC_MOD_STR
  74. " PCI Access Write Error at 0x%x\n", reg);
  75. }
  76. /*
  77. * device-specific methods for amd8111 PCI Bridge Controller
  78. *
  79. * Error Reporting and Handling for amd8111 chipset could be found
  80. * in its datasheet 3.1.2 section, P37
  81. */
  82. static void amd8111_pci_bridge_init(struct amd8111_pci_info *pci_info)
  83. {
  84. u32 val32;
  85. struct pci_dev *dev = pci_info->dev;
  86. /* First clear error detection flags on the host interface */
  87. /* Clear SSE/SMA/STA flags in the global status register*/
  88. edac_pci_read_dword(dev, REG_PCI_STSCMD, &val32);
  89. if (val32 & PCI_STSCMD_CLEAR_MASK)
  90. edac_pci_write_dword(dev, REG_PCI_STSCMD, val32);
  91. /* Clear CRC and Link Fail flags in HT Link Control reg */
  92. edac_pci_read_dword(dev, REG_HT_LINK, &val32);
  93. if (val32 & HT_LINK_CLEAR_MASK)
  94. edac_pci_write_dword(dev, REG_HT_LINK, val32);
  95. /* Second clear all fault on the secondary interface */
  96. /* Clear error flags in the memory-base limit reg. */
  97. edac_pci_read_dword(dev, REG_MEM_LIM, &val32);
  98. if (val32 & MEM_LIMIT_CLEAR_MASK)
  99. edac_pci_write_dword(dev, REG_MEM_LIM, val32);
  100. /* Clear Discard Timer Expired flag in Interrupt/Bridge Control reg */
  101. edac_pci_read_dword(dev, REG_PCI_INTBRG_CTRL, &val32);
  102. if (val32 & PCI_INTBRG_CTRL_CLEAR_MASK)
  103. edac_pci_write_dword(dev, REG_PCI_INTBRG_CTRL, val32);
  104. /* Last enable error detections */
  105. if (edac_op_state == EDAC_OPSTATE_POLL) {
  106. /* Enable System Error reporting in global status register */
  107. edac_pci_read_dword(dev, REG_PCI_STSCMD, &val32);
  108. val32 |= PCI_STSCMD_SERREN;
  109. edac_pci_write_dword(dev, REG_PCI_STSCMD, val32);
  110. /* Enable CRC Sync flood packets to HyperTransport Link */
  111. edac_pci_read_dword(dev, REG_HT_LINK, &val32);
  112. val32 |= HT_LINK_CRCFEN;
  113. edac_pci_write_dword(dev, REG_HT_LINK, val32);
  114. /* Enable SSE reporting etc in Interrupt control reg */
  115. edac_pci_read_dword(dev, REG_PCI_INTBRG_CTRL, &val32);
  116. val32 |= PCI_INTBRG_CTRL_POLL_MASK;
  117. edac_pci_write_dword(dev, REG_PCI_INTBRG_CTRL, val32);
  118. }
  119. }
  120. static void amd8111_pci_bridge_exit(struct amd8111_pci_info *pci_info)
  121. {
  122. u32 val32;
  123. struct pci_dev *dev = pci_info->dev;
  124. if (edac_op_state == EDAC_OPSTATE_POLL) {
  125. /* Disable System Error reporting */
  126. edac_pci_read_dword(dev, REG_PCI_STSCMD, &val32);
  127. val32 &= ~PCI_STSCMD_SERREN;
  128. edac_pci_write_dword(dev, REG_PCI_STSCMD, val32);
  129. /* Disable CRC flood packets */
  130. edac_pci_read_dword(dev, REG_HT_LINK, &val32);
  131. val32 &= ~HT_LINK_CRCFEN;
  132. edac_pci_write_dword(dev, REG_HT_LINK, val32);
  133. /* Disable DTSERREN/MARSP/SERREN in Interrupt Control reg */
  134. edac_pci_read_dword(dev, REG_PCI_INTBRG_CTRL, &val32);
  135. val32 &= ~PCI_INTBRG_CTRL_POLL_MASK;
  136. edac_pci_write_dword(dev, REG_PCI_INTBRG_CTRL, val32);
  137. }
  138. }
  139. static void amd8111_pci_bridge_check(struct edac_pci_ctl_info *edac_dev)
  140. {
  141. struct amd8111_pci_info *pci_info = edac_dev->pvt_info;
  142. struct pci_dev *dev = pci_info->dev;
  143. u32 val32;
  144. /* Check out PCI Bridge Status and Command Register */
  145. edac_pci_read_dword(dev, REG_PCI_STSCMD, &val32);
  146. if (val32 & PCI_STSCMD_CLEAR_MASK) {
  147. printk(KERN_INFO "Error(s) in PCI bridge status and command"
  148. "register on device %s\n", pci_info->ctl_name);
  149. printk(KERN_INFO "SSE: %d, RMA: %d, RTA: %d\n",
  150. (val32 & PCI_STSCMD_SSE) != 0,
  151. (val32 & PCI_STSCMD_RMA) != 0,
  152. (val32 & PCI_STSCMD_RTA) != 0);
  153. val32 |= PCI_STSCMD_CLEAR_MASK;
  154. edac_pci_write_dword(dev, REG_PCI_STSCMD, val32);
  155. edac_pci_handle_npe(edac_dev, edac_dev->ctl_name);
  156. }
  157. /* Check out HyperTransport Link Control Register */
  158. edac_pci_read_dword(dev, REG_HT_LINK, &val32);
  159. if (val32 & HT_LINK_LKFAIL) {
  160. printk(KERN_INFO "Error(s) in hypertransport link control"
  161. "register on device %s\n", pci_info->ctl_name);
  162. printk(KERN_INFO "LKFAIL: %d\n",
  163. (val32 & HT_LINK_LKFAIL) != 0);
  164. val32 |= HT_LINK_LKFAIL;
  165. edac_pci_write_dword(dev, REG_HT_LINK, val32);
  166. edac_pci_handle_npe(edac_dev, edac_dev->ctl_name);
  167. }
  168. /* Check out PCI Interrupt and Bridge Control Register */
  169. edac_pci_read_dword(dev, REG_PCI_INTBRG_CTRL, &val32);
  170. if (val32 & PCI_INTBRG_CTRL_DTSTAT) {
  171. printk(KERN_INFO "Error(s) in PCI interrupt and bridge control"
  172. "register on device %s\n", pci_info->ctl_name);
  173. printk(KERN_INFO "DTSTAT: %d\n",
  174. (val32 & PCI_INTBRG_CTRL_DTSTAT) != 0);
  175. val32 |= PCI_INTBRG_CTRL_DTSTAT;
  176. edac_pci_write_dword(dev, REG_PCI_INTBRG_CTRL, val32);
  177. edac_pci_handle_npe(edac_dev, edac_dev->ctl_name);
  178. }
  179. /* Check out PCI Bridge Memory Base-Limit Register */
  180. edac_pci_read_dword(dev, REG_MEM_LIM, &val32);
  181. if (val32 & MEM_LIMIT_CLEAR_MASK) {
  182. printk(KERN_INFO
  183. "Error(s) in mem limit register on %s device\n",
  184. pci_info->ctl_name);
  185. printk(KERN_INFO "DPE: %d, RSE: %d, RMA: %d\n"
  186. "RTA: %d, STA: %d, MDPE: %d\n",
  187. (val32 & MEM_LIMIT_DPE) != 0,
  188. (val32 & MEM_LIMIT_RSE) != 0,
  189. (val32 & MEM_LIMIT_RMA) != 0,
  190. (val32 & MEM_LIMIT_RTA) != 0,
  191. (val32 & MEM_LIMIT_STA) != 0,
  192. (val32 & MEM_LIMIT_MDPE) != 0);
  193. val32 |= MEM_LIMIT_CLEAR_MASK;
  194. edac_pci_write_dword(dev, REG_MEM_LIM, val32);
  195. edac_pci_handle_npe(edac_dev, edac_dev->ctl_name);
  196. }
  197. }
  198. static struct resource *legacy_io_res;
  199. static int at_compat_reg_broken;
  200. #define LEGACY_NR_PORTS 1
  201. /* device-specific methods for amd8111 LPC Bridge device */
  202. static void amd8111_lpc_bridge_init(struct amd8111_dev_info *dev_info)
  203. {
  204. u8 val8;
  205. struct pci_dev *dev = dev_info->dev;
  206. /* First clear REG_AT_COMPAT[SERR, IOCHK] if necessary */
  207. legacy_io_res = request_region(REG_AT_COMPAT, LEGACY_NR_PORTS,
  208. AMD8111_EDAC_MOD_STR);
  209. if (!legacy_io_res)
  210. printk(KERN_INFO "%s: failed to request legacy I/O region "
  211. "start %d, len %d\n", __func__,
  212. REG_AT_COMPAT, LEGACY_NR_PORTS);
  213. else {
  214. val8 = __do_inb(REG_AT_COMPAT);
  215. if (val8 == 0xff) { /* buggy port */
  216. printk(KERN_INFO "%s: port %d is buggy, not supported"
  217. " by hardware?\n", __func__, REG_AT_COMPAT);
  218. at_compat_reg_broken = 1;
  219. release_region(REG_AT_COMPAT, LEGACY_NR_PORTS);
  220. legacy_io_res = NULL;
  221. } else {
  222. u8 out8 = 0;
  223. if (val8 & AT_COMPAT_SERR)
  224. out8 = AT_COMPAT_CLRSERR;
  225. if (val8 & AT_COMPAT_IOCHK)
  226. out8 |= AT_COMPAT_CLRIOCHK;
  227. if (out8 > 0)
  228. __do_outb(out8, REG_AT_COMPAT);
  229. }
  230. }
  231. /* Second clear error flags on LPC bridge */
  232. edac_pci_read_byte(dev, REG_IO_CTRL_1, &val8);
  233. if (val8 & IO_CTRL_1_CLEAR_MASK)
  234. edac_pci_write_byte(dev, REG_IO_CTRL_1, val8);
  235. }
  236. static void amd8111_lpc_bridge_exit(struct amd8111_dev_info *dev_info)
  237. {
  238. if (legacy_io_res)
  239. release_region(REG_AT_COMPAT, LEGACY_NR_PORTS);
  240. }
  241. static void amd8111_lpc_bridge_check(struct edac_device_ctl_info *edac_dev)
  242. {
  243. struct amd8111_dev_info *dev_info = edac_dev->pvt_info;
  244. struct pci_dev *dev = dev_info->dev;
  245. u8 val8;
  246. edac_pci_read_byte(dev, REG_IO_CTRL_1, &val8);
  247. if (val8 & IO_CTRL_1_CLEAR_MASK) {
  248. printk(KERN_INFO
  249. "Error(s) in IO control register on %s device\n",
  250. dev_info->ctl_name);
  251. printk(KERN_INFO "LPC ERR: %d, PW2LPC: %d\n",
  252. (val8 & IO_CTRL_1_LPC_ERR) != 0,
  253. (val8 & IO_CTRL_1_PW2LPC) != 0);
  254. val8 |= IO_CTRL_1_CLEAR_MASK;
  255. edac_pci_write_byte(dev, REG_IO_CTRL_1, val8);
  256. edac_device_handle_ue(edac_dev, 0, 0, edac_dev->ctl_name);
  257. }
  258. if (at_compat_reg_broken == 0) {
  259. u8 out8 = 0;
  260. val8 = __do_inb(REG_AT_COMPAT);
  261. if (val8 & AT_COMPAT_SERR)
  262. out8 = AT_COMPAT_CLRSERR;
  263. if (val8 & AT_COMPAT_IOCHK)
  264. out8 |= AT_COMPAT_CLRIOCHK;
  265. if (out8 > 0) {
  266. __do_outb(out8, REG_AT_COMPAT);
  267. edac_device_handle_ue(edac_dev, 0, 0,
  268. edac_dev->ctl_name);
  269. }
  270. }
  271. }
  272. /* General devices represented by edac_device_ctl_info */
  273. static struct amd8111_dev_info amd8111_devices[] = {
  274. [LPC_BRIDGE] = {
  275. .err_dev = PCI_DEVICE_ID_AMD_8111_LPC,
  276. .ctl_name = "lpc",
  277. .init = amd8111_lpc_bridge_init,
  278. .exit = amd8111_lpc_bridge_exit,
  279. .check = amd8111_lpc_bridge_check,
  280. },
  281. {0},
  282. };
  283. /* PCI controllers represented by edac_pci_ctl_info */
  284. static struct amd8111_pci_info amd8111_pcis[] = {
  285. [PCI_BRIDGE] = {
  286. .err_dev = PCI_DEVICE_ID_AMD_8111_PCI,
  287. .ctl_name = "AMD8111_PCI_Controller",
  288. .init = amd8111_pci_bridge_init,
  289. .exit = amd8111_pci_bridge_exit,
  290. .check = amd8111_pci_bridge_check,
  291. },
  292. {0},
  293. };
  294. static int amd8111_dev_probe(struct pci_dev *dev,
  295. const struct pci_device_id *id)
  296. {
  297. struct amd8111_dev_info *dev_info = &amd8111_devices[id->driver_data];
  298. dev_info->dev = pci_get_device(PCI_VENDOR_ID_AMD,
  299. dev_info->err_dev, NULL);
  300. if (!dev_info->dev) {
  301. printk(KERN_ERR "EDAC device not found:"
  302. "vendor %x, device %x, name %s\n",
  303. PCI_VENDOR_ID_AMD, dev_info->err_dev,
  304. dev_info->ctl_name);
  305. return -ENODEV;
  306. }
  307. if (pci_enable_device(dev_info->dev)) {
  308. pci_dev_put(dev_info->dev);
  309. printk(KERN_ERR "failed to enable:"
  310. "vendor %x, device %x, name %s\n",
  311. PCI_VENDOR_ID_AMD, dev_info->err_dev,
  312. dev_info->ctl_name);
  313. return -ENODEV;
  314. }
  315. /*
  316. * we do not allocate extra private structure for
  317. * edac_device_ctl_info, but make use of existing
  318. * one instead.
  319. */
  320. dev_info->edac_idx = edac_device_alloc_index();
  321. dev_info->edac_dev =
  322. edac_device_alloc_ctl_info(0, dev_info->ctl_name, 1,
  323. NULL, 0, 0,
  324. NULL, 0, dev_info->edac_idx);
  325. if (!dev_info->edac_dev)
  326. return -ENOMEM;
  327. dev_info->edac_dev->pvt_info = dev_info;
  328. dev_info->edac_dev->dev = &dev_info->dev->dev;
  329. dev_info->edac_dev->mod_name = AMD8111_EDAC_MOD_STR;
  330. dev_info->edac_dev->ctl_name = dev_info->ctl_name;
  331. dev_info->edac_dev->dev_name = dev_name(&dev_info->dev->dev);
  332. if (edac_op_state == EDAC_OPSTATE_POLL)
  333. dev_info->edac_dev->edac_check = dev_info->check;
  334. if (dev_info->init)
  335. dev_info->init(dev_info);
  336. if (edac_device_add_device(dev_info->edac_dev) > 0) {
  337. printk(KERN_ERR "failed to add edac_dev for %s\n",
  338. dev_info->ctl_name);
  339. edac_device_free_ctl_info(dev_info->edac_dev);
  340. return -ENODEV;
  341. }
  342. printk(KERN_INFO "added one edac_dev on AMD8111 "
  343. "vendor %x, device %x, name %s\n",
  344. PCI_VENDOR_ID_AMD, dev_info->err_dev,
  345. dev_info->ctl_name);
  346. return 0;
  347. }
  348. static void amd8111_dev_remove(struct pci_dev *dev)
  349. {
  350. struct amd8111_dev_info *dev_info;
  351. for (dev_info = amd8111_devices; dev_info->err_dev; dev_info++)
  352. if (dev_info->dev->device == dev->device)
  353. break;
  354. if (!dev_info->err_dev) /* should never happen */
  355. return;
  356. if (dev_info->edac_dev) {
  357. edac_device_del_device(dev_info->edac_dev->dev);
  358. edac_device_free_ctl_info(dev_info->edac_dev);
  359. }
  360. if (dev_info->exit)
  361. dev_info->exit(dev_info);
  362. pci_dev_put(dev_info->dev);
  363. }
  364. static int amd8111_pci_probe(struct pci_dev *dev,
  365. const struct pci_device_id *id)
  366. {
  367. struct amd8111_pci_info *pci_info = &amd8111_pcis[id->driver_data];
  368. pci_info->dev = pci_get_device(PCI_VENDOR_ID_AMD,
  369. pci_info->err_dev, NULL);
  370. if (!pci_info->dev) {
  371. printk(KERN_ERR "EDAC device not found:"
  372. "vendor %x, device %x, name %s\n",
  373. PCI_VENDOR_ID_AMD, pci_info->err_dev,
  374. pci_info->ctl_name);
  375. return -ENODEV;
  376. }
  377. if (pci_enable_device(pci_info->dev)) {
  378. pci_dev_put(pci_info->dev);
  379. printk(KERN_ERR "failed to enable:"
  380. "vendor %x, device %x, name %s\n",
  381. PCI_VENDOR_ID_AMD, pci_info->err_dev,
  382. pci_info->ctl_name);
  383. return -ENODEV;
  384. }
  385. /*
  386. * we do not allocate extra private structure for
  387. * edac_pci_ctl_info, but make use of existing
  388. * one instead.
  389. */
  390. pci_info->edac_idx = edac_pci_alloc_index();
  391. pci_info->edac_dev = edac_pci_alloc_ctl_info(0, pci_info->ctl_name);
  392. if (!pci_info->edac_dev)
  393. return -ENOMEM;
  394. pci_info->edac_dev->pvt_info = pci_info;
  395. pci_info->edac_dev->dev = &pci_info->dev->dev;
  396. pci_info->edac_dev->mod_name = AMD8111_EDAC_MOD_STR;
  397. pci_info->edac_dev->ctl_name = pci_info->ctl_name;
  398. pci_info->edac_dev->dev_name = dev_name(&pci_info->dev->dev);
  399. if (edac_op_state == EDAC_OPSTATE_POLL)
  400. pci_info->edac_dev->edac_check = pci_info->check;
  401. if (pci_info->init)
  402. pci_info->init(pci_info);
  403. if (edac_pci_add_device(pci_info->edac_dev, pci_info->edac_idx) > 0) {
  404. printk(KERN_ERR "failed to add edac_pci for %s\n",
  405. pci_info->ctl_name);
  406. edac_pci_free_ctl_info(pci_info->edac_dev);
  407. return -ENODEV;
  408. }
  409. printk(KERN_INFO "added one edac_pci on AMD8111 "
  410. "vendor %x, device %x, name %s\n",
  411. PCI_VENDOR_ID_AMD, pci_info->err_dev,
  412. pci_info->ctl_name);
  413. return 0;
  414. }
  415. static void amd8111_pci_remove(struct pci_dev *dev)
  416. {
  417. struct amd8111_pci_info *pci_info;
  418. for (pci_info = amd8111_pcis; pci_info->err_dev; pci_info++)
  419. if (pci_info->dev->device == dev->device)
  420. break;
  421. if (!pci_info->err_dev) /* should never happen */
  422. return;
  423. if (pci_info->edac_dev) {
  424. edac_pci_del_device(pci_info->edac_dev->dev);
  425. edac_pci_free_ctl_info(pci_info->edac_dev);
  426. }
  427. if (pci_info->exit)
  428. pci_info->exit(pci_info);
  429. pci_dev_put(pci_info->dev);
  430. }
  431. /* PCI Device ID talbe for general EDAC device */
  432. static const struct pci_device_id amd8111_edac_dev_tbl[] = {
  433. {
  434. PCI_VEND_DEV(AMD, 8111_LPC),
  435. .subvendor = PCI_ANY_ID,
  436. .subdevice = PCI_ANY_ID,
  437. .class = 0,
  438. .class_mask = 0,
  439. .driver_data = LPC_BRIDGE,
  440. },
  441. {
  442. 0,
  443. } /* table is NULL-terminated */
  444. };
  445. MODULE_DEVICE_TABLE(pci, amd8111_edac_dev_tbl);
  446. static struct pci_driver amd8111_edac_dev_driver = {
  447. .name = "AMD8111_EDAC_DEV",
  448. .probe = amd8111_dev_probe,
  449. .remove = amd8111_dev_remove,
  450. .id_table = amd8111_edac_dev_tbl,
  451. };
  452. /* PCI Device ID table for EDAC PCI controller */
  453. static const struct pci_device_id amd8111_edac_pci_tbl[] = {
  454. {
  455. PCI_VEND_DEV(AMD, 8111_PCI),
  456. .subvendor = PCI_ANY_ID,
  457. .subdevice = PCI_ANY_ID,
  458. .class = 0,
  459. .class_mask = 0,
  460. .driver_data = PCI_BRIDGE,
  461. },
  462. {
  463. 0,
  464. } /* table is NULL-terminated */
  465. };
  466. MODULE_DEVICE_TABLE(pci, amd8111_edac_pci_tbl);
  467. static struct pci_driver amd8111_edac_pci_driver = {
  468. .name = "AMD8111_EDAC_PCI",
  469. .probe = amd8111_pci_probe,
  470. .remove = amd8111_pci_remove,
  471. .id_table = amd8111_edac_pci_tbl,
  472. };
  473. static int __init amd8111_edac_init(void)
  474. {
  475. int val;
  476. printk(KERN_INFO "AMD8111 EDAC driver " AMD8111_EDAC_REVISION "\n");
  477. printk(KERN_INFO "\t(c) 2008 Wind River Systems, Inc.\n");
  478. /* Only POLL mode supported so far */
  479. edac_op_state = EDAC_OPSTATE_POLL;
  480. val = pci_register_driver(&amd8111_edac_dev_driver);
  481. val |= pci_register_driver(&amd8111_edac_pci_driver);
  482. return val;
  483. }
  484. static void __exit amd8111_edac_exit(void)
  485. {
  486. pci_unregister_driver(&amd8111_edac_pci_driver);
  487. pci_unregister_driver(&amd8111_edac_dev_driver);
  488. }
  489. module_init(amd8111_edac_init);
  490. module_exit(amd8111_edac_exit);
  491. MODULE_LICENSE("GPL");
  492. MODULE_AUTHOR("Cao Qingtao <qingtao.cao@windriver.com>\n");
  493. MODULE_DESCRIPTION("AMD8111 HyperTransport I/O Hub EDAC kernel module");