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_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. int ret = -ENODEV;
  299. dev_info->dev = pci_get_device(PCI_VENDOR_ID_AMD,
  300. dev_info->err_dev, NULL);
  301. if (!dev_info->dev) {
  302. printk(KERN_ERR "EDAC device not found:"
  303. "vendor %x, device %x, name %s\n",
  304. PCI_VENDOR_ID_AMD, dev_info->err_dev,
  305. dev_info->ctl_name);
  306. goto err;
  307. }
  308. if (pci_enable_device(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. goto err_dev_put;
  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. ret = -ENOMEM;
  327. goto err_dev_put;
  328. }
  329. dev_info->edac_dev->pvt_info = dev_info;
  330. dev_info->edac_dev->dev = &dev_info->dev->dev;
  331. dev_info->edac_dev->mod_name = AMD8111_EDAC_MOD_STR;
  332. dev_info->edac_dev->ctl_name = dev_info->ctl_name;
  333. dev_info->edac_dev->dev_name = dev_name(&dev_info->dev->dev);
  334. if (edac_op_state == EDAC_OPSTATE_POLL)
  335. dev_info->edac_dev->edac_check = dev_info->check;
  336. if (dev_info->init)
  337. dev_info->init(dev_info);
  338. if (edac_device_add_device(dev_info->edac_dev) > 0) {
  339. printk(KERN_ERR "failed to add edac_dev for %s\n",
  340. dev_info->ctl_name);
  341. goto err_edac_free_ctl;
  342. }
  343. printk(KERN_INFO "added one edac_dev on AMD8111 "
  344. "vendor %x, device %x, name %s\n",
  345. PCI_VENDOR_ID_AMD, dev_info->err_dev,
  346. dev_info->ctl_name);
  347. return 0;
  348. err_edac_free_ctl:
  349. edac_device_free_ctl_info(dev_info->edac_dev);
  350. err_dev_put:
  351. pci_dev_put(dev_info->dev);
  352. err:
  353. return ret;
  354. }
  355. static void amd8111_dev_remove(struct pci_dev *dev)
  356. {
  357. struct amd8111_dev_info *dev_info;
  358. for (dev_info = amd8111_devices; dev_info->err_dev; dev_info++)
  359. if (dev_info->dev->device == dev->device)
  360. break;
  361. if (!dev_info->err_dev) /* should never happen */
  362. return;
  363. if (dev_info->edac_dev) {
  364. edac_device_del_device(dev_info->edac_dev->dev);
  365. edac_device_free_ctl_info(dev_info->edac_dev);
  366. }
  367. if (dev_info->exit)
  368. dev_info->exit(dev_info);
  369. pci_dev_put(dev_info->dev);
  370. }
  371. static int amd8111_pci_probe(struct pci_dev *dev,
  372. const struct pci_device_id *id)
  373. {
  374. struct amd8111_pci_info *pci_info = &amd8111_pcis[id->driver_data];
  375. int ret = -ENODEV;
  376. pci_info->dev = pci_get_device(PCI_VENDOR_ID_AMD,
  377. pci_info->err_dev, NULL);
  378. if (!pci_info->dev) {
  379. printk(KERN_ERR "EDAC device not found:"
  380. "vendor %x, device %x, name %s\n",
  381. PCI_VENDOR_ID_AMD, pci_info->err_dev,
  382. pci_info->ctl_name);
  383. goto err;
  384. }
  385. if (pci_enable_device(pci_info->dev)) {
  386. printk(KERN_ERR "failed to enable:"
  387. "vendor %x, device %x, name %s\n",
  388. PCI_VENDOR_ID_AMD, pci_info->err_dev,
  389. pci_info->ctl_name);
  390. goto err_dev_put;
  391. }
  392. /*
  393. * we do not allocate extra private structure for
  394. * edac_pci_ctl_info, but make use of existing
  395. * one instead.
  396. */
  397. pci_info->edac_idx = edac_pci_alloc_index();
  398. pci_info->edac_dev = edac_pci_alloc_ctl_info(0, pci_info->ctl_name);
  399. if (!pci_info->edac_dev) {
  400. ret = -ENOMEM;
  401. goto err_dev_put;
  402. }
  403. pci_info->edac_dev->pvt_info = pci_info;
  404. pci_info->edac_dev->dev = &pci_info->dev->dev;
  405. pci_info->edac_dev->mod_name = AMD8111_EDAC_MOD_STR;
  406. pci_info->edac_dev->ctl_name = pci_info->ctl_name;
  407. pci_info->edac_dev->dev_name = dev_name(&pci_info->dev->dev);
  408. if (edac_op_state == EDAC_OPSTATE_POLL)
  409. pci_info->edac_dev->edac_check = pci_info->check;
  410. if (pci_info->init)
  411. pci_info->init(pci_info);
  412. if (edac_pci_add_device(pci_info->edac_dev, pci_info->edac_idx) > 0) {
  413. printk(KERN_ERR "failed to add edac_pci for %s\n",
  414. pci_info->ctl_name);
  415. goto err_edac_free_ctl;
  416. }
  417. printk(KERN_INFO "added one edac_pci on AMD8111 "
  418. "vendor %x, device %x, name %s\n",
  419. PCI_VENDOR_ID_AMD, pci_info->err_dev,
  420. pci_info->ctl_name);
  421. return 0;
  422. err_edac_free_ctl:
  423. edac_pci_free_ctl_info(pci_info->edac_dev);
  424. err_dev_put:
  425. pci_dev_put(pci_info->dev);
  426. err:
  427. return ret;
  428. }
  429. static void amd8111_pci_remove(struct pci_dev *dev)
  430. {
  431. struct amd8111_pci_info *pci_info;
  432. for (pci_info = amd8111_pcis; pci_info->err_dev; pci_info++)
  433. if (pci_info->dev->device == dev->device)
  434. break;
  435. if (!pci_info->err_dev) /* should never happen */
  436. return;
  437. if (pci_info->edac_dev) {
  438. edac_pci_del_device(pci_info->edac_dev->dev);
  439. edac_pci_free_ctl_info(pci_info->edac_dev);
  440. }
  441. if (pci_info->exit)
  442. pci_info->exit(pci_info);
  443. pci_dev_put(pci_info->dev);
  444. }
  445. /* PCI Device ID talbe for general EDAC device */
  446. static const struct pci_device_id amd8111_edac_dev_tbl[] = {
  447. {
  448. PCI_VEND_DEV(AMD, 8111_LPC),
  449. .subvendor = PCI_ANY_ID,
  450. .subdevice = PCI_ANY_ID,
  451. .class = 0,
  452. .class_mask = 0,
  453. .driver_data = LPC_BRIDGE,
  454. },
  455. {
  456. 0,
  457. } /* table is NULL-terminated */
  458. };
  459. MODULE_DEVICE_TABLE(pci, amd8111_edac_dev_tbl);
  460. static struct pci_driver amd8111_edac_dev_driver = {
  461. .name = "AMD8111_EDAC_DEV",
  462. .probe = amd8111_dev_probe,
  463. .remove = amd8111_dev_remove,
  464. .id_table = amd8111_edac_dev_tbl,
  465. };
  466. /* PCI Device ID table for EDAC PCI controller */
  467. static const struct pci_device_id amd8111_edac_pci_tbl[] = {
  468. {
  469. PCI_VEND_DEV(AMD, 8111_PCI),
  470. .subvendor = PCI_ANY_ID,
  471. .subdevice = PCI_ANY_ID,
  472. .class = 0,
  473. .class_mask = 0,
  474. .driver_data = PCI_BRIDGE,
  475. },
  476. {
  477. 0,
  478. } /* table is NULL-terminated */
  479. };
  480. MODULE_DEVICE_TABLE(pci, amd8111_edac_pci_tbl);
  481. static struct pci_driver amd8111_edac_pci_driver = {
  482. .name = "AMD8111_EDAC_PCI",
  483. .probe = amd8111_pci_probe,
  484. .remove = amd8111_pci_remove,
  485. .id_table = amd8111_edac_pci_tbl,
  486. };
  487. static int __init amd8111_edac_init(void)
  488. {
  489. int val;
  490. printk(KERN_INFO "AMD8111 EDAC driver " AMD8111_EDAC_REVISION "\n");
  491. printk(KERN_INFO "\t(c) 2008 Wind River Systems, Inc.\n");
  492. /* Only POLL mode supported so far */
  493. edac_op_state = EDAC_OPSTATE_POLL;
  494. val = pci_register_driver(&amd8111_edac_dev_driver);
  495. val |= pci_register_driver(&amd8111_edac_pci_driver);
  496. return val;
  497. }
  498. static void __exit amd8111_edac_exit(void)
  499. {
  500. pci_unregister_driver(&amd8111_edac_pci_driver);
  501. pci_unregister_driver(&amd8111_edac_dev_driver);
  502. }
  503. module_init(amd8111_edac_init);
  504. module_exit(amd8111_edac_exit);
  505. MODULE_LICENSE("GPL");
  506. MODULE_AUTHOR("Cao Qingtao <qingtao.cao@windriver.com>\n");
  507. MODULE_DESCRIPTION("AMD8111 HyperTransport I/O Hub EDAC kernel module");