amd8111_edac.c 17 KB

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