amd8111_edac.c 16 KB

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