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 " __DATE__
  34. #define AMD8111_EDAC_MOD_STR "amd8111_edac"
  35. #define PCI_DEVICE_ID_AMD_8111_PCI 0x7460
  36. static int edac_dev_idx;
  37. enum amd8111_edac_devs {
  38. LPC_BRIDGE = 0,
  39. };
  40. enum amd8111_edac_pcis {
  41. PCI_BRIDGE = 0,
  42. };
  43. /* Wrapper functions for accessing PCI configuration space */
  44. static int edac_pci_read_dword(struct pci_dev *dev, int reg, u32 *val32)
  45. {
  46. int ret;
  47. ret = pci_read_config_dword(dev, reg, val32);
  48. if (ret != 0)
  49. printk(KERN_ERR AMD8111_EDAC_MOD_STR
  50. " PCI Access Read Error at 0x%x\n", reg);
  51. return ret;
  52. }
  53. static void edac_pci_read_byte(struct pci_dev *dev, int reg, u8 *val8)
  54. {
  55. int ret;
  56. ret = pci_read_config_byte(dev, reg, val8);
  57. if (ret != 0)
  58. printk(KERN_ERR AMD8111_EDAC_MOD_STR
  59. " PCI Access Read Error at 0x%x\n", reg);
  60. }
  61. static void edac_pci_write_dword(struct pci_dev *dev, int reg, u32 val32)
  62. {
  63. int ret;
  64. ret = pci_write_config_dword(dev, reg, val32);
  65. if (ret != 0)
  66. printk(KERN_ERR AMD8111_EDAC_MOD_STR
  67. " PCI Access Write Error at 0x%x\n", reg);
  68. }
  69. static void edac_pci_write_byte(struct pci_dev *dev, int reg, u8 val8)
  70. {
  71. int ret;
  72. ret = pci_write_config_byte(dev, reg, val8);
  73. if (ret != 0)
  74. printk(KERN_ERR AMD8111_EDAC_MOD_STR
  75. " PCI Access Write Error at 0x%x\n", reg);
  76. }
  77. /*
  78. * device-specific methods for amd8111 PCI Bridge Controller
  79. *
  80. * Error Reporting and Handling for amd8111 chipset could be found
  81. * in its datasheet 3.1.2 section, P37
  82. */
  83. static void amd8111_pci_bridge_init(struct amd8111_pci_info *pci_info)
  84. {
  85. u32 val32;
  86. struct pci_dev *dev = pci_info->dev;
  87. /* First clear error detection flags on the host interface */
  88. /* Clear SSE/SMA/STA flags in the global status register*/
  89. edac_pci_read_dword(dev, REG_PCI_STSCMD, &val32);
  90. if (val32 & PCI_STSCMD_CLEAR_MASK)
  91. edac_pci_write_dword(dev, REG_PCI_STSCMD, val32);
  92. /* Clear CRC and Link Fail flags in HT Link Control reg */
  93. edac_pci_read_dword(dev, REG_HT_LINK, &val32);
  94. if (val32 & HT_LINK_CLEAR_MASK)
  95. edac_pci_write_dword(dev, REG_HT_LINK, val32);
  96. /* Second clear all fault on the secondary interface */
  97. /* Clear error flags in the memory-base limit reg. */
  98. edac_pci_read_dword(dev, REG_MEM_LIM, &val32);
  99. if (val32 & MEM_LIMIT_CLEAR_MASK)
  100. edac_pci_write_dword(dev, REG_MEM_LIM, val32);
  101. /* Clear Discard Timer Expired flag in Interrupt/Bridge Control reg */
  102. edac_pci_read_dword(dev, REG_PCI_INTBRG_CTRL, &val32);
  103. if (val32 & PCI_INTBRG_CTRL_CLEAR_MASK)
  104. edac_pci_write_dword(dev, REG_PCI_INTBRG_CTRL, val32);
  105. /* Last enable error detections */
  106. if (edac_op_state == EDAC_OPSTATE_POLL) {
  107. /* Enable System Error reporting in global status register */
  108. edac_pci_read_dword(dev, REG_PCI_STSCMD, &val32);
  109. val32 |= PCI_STSCMD_SERREN;
  110. edac_pci_write_dword(dev, REG_PCI_STSCMD, val32);
  111. /* Enable CRC Sync flood packets to HyperTransport Link */
  112. edac_pci_read_dword(dev, REG_HT_LINK, &val32);
  113. val32 |= HT_LINK_CRCFEN;
  114. edac_pci_write_dword(dev, REG_HT_LINK, val32);
  115. /* Enable SSE reporting etc in Interrupt control reg */
  116. edac_pci_read_dword(dev, REG_PCI_INTBRG_CTRL, &val32);
  117. val32 |= PCI_INTBRG_CTRL_POLL_MASK;
  118. edac_pci_write_dword(dev, REG_PCI_INTBRG_CTRL, val32);
  119. }
  120. }
  121. static void amd8111_pci_bridge_exit(struct amd8111_pci_info *pci_info)
  122. {
  123. u32 val32;
  124. struct pci_dev *dev = pci_info->dev;
  125. if (edac_op_state == EDAC_OPSTATE_POLL) {
  126. /* Disable System Error reporting */
  127. edac_pci_read_dword(dev, REG_PCI_STSCMD, &val32);
  128. val32 &= ~PCI_STSCMD_SERREN;
  129. edac_pci_write_dword(dev, REG_PCI_STSCMD, val32);
  130. /* Disable CRC flood packets */
  131. edac_pci_read_dword(dev, REG_HT_LINK, &val32);
  132. val32 &= ~HT_LINK_CRCFEN;
  133. edac_pci_write_dword(dev, REG_HT_LINK, val32);
  134. /* Disable DTSERREN/MARSP/SERREN in Interrupt Control reg */
  135. edac_pci_read_dword(dev, REG_PCI_INTBRG_CTRL, &val32);
  136. val32 &= ~PCI_INTBRG_CTRL_POLL_MASK;
  137. edac_pci_write_dword(dev, REG_PCI_INTBRG_CTRL, val32);
  138. }
  139. }
  140. static void amd8111_pci_bridge_check(struct edac_pci_ctl_info *edac_dev)
  141. {
  142. struct amd8111_pci_info *pci_info = edac_dev->pvt_info;
  143. struct pci_dev *dev = pci_info->dev;
  144. u32 val32;
  145. /* Check out PCI Bridge Status and Command Register */
  146. edac_pci_read_dword(dev, REG_PCI_STSCMD, &val32);
  147. if (val32 & PCI_STSCMD_CLEAR_MASK) {
  148. printk(KERN_INFO "Error(s) in PCI bridge status and command"
  149. "register on device %s\n", pci_info->ctl_name);
  150. printk(KERN_INFO "SSE: %d, RMA: %d, RTA: %d\n",
  151. (val32 & PCI_STSCMD_SSE) != 0,
  152. (val32 & PCI_STSCMD_RMA) != 0,
  153. (val32 & PCI_STSCMD_RTA) != 0);
  154. val32 |= PCI_STSCMD_CLEAR_MASK;
  155. edac_pci_write_dword(dev, REG_PCI_STSCMD, val32);
  156. edac_pci_handle_npe(edac_dev, edac_dev->ctl_name);
  157. }
  158. /* Check out HyperTransport Link Control Register */
  159. edac_pci_read_dword(dev, REG_HT_LINK, &val32);
  160. if (val32 & HT_LINK_LKFAIL) {
  161. printk(KERN_INFO "Error(s) in hypertransport link control"
  162. "register on device %s\n", pci_info->ctl_name);
  163. printk(KERN_INFO "LKFAIL: %d\n",
  164. (val32 & HT_LINK_LKFAIL) != 0);
  165. val32 |= HT_LINK_LKFAIL;
  166. edac_pci_write_dword(dev, REG_HT_LINK, val32);
  167. edac_pci_handle_npe(edac_dev, edac_dev->ctl_name);
  168. }
  169. /* Check out PCI Interrupt and Bridge Control Register */
  170. edac_pci_read_dword(dev, REG_PCI_INTBRG_CTRL, &val32);
  171. if (val32 & PCI_INTBRG_CTRL_DTSTAT) {
  172. printk(KERN_INFO "Error(s) in PCI interrupt and bridge control"
  173. "register on device %s\n", pci_info->ctl_name);
  174. printk(KERN_INFO "DTSTAT: %d\n",
  175. (val32 & PCI_INTBRG_CTRL_DTSTAT) != 0);
  176. val32 |= PCI_INTBRG_CTRL_DTSTAT;
  177. edac_pci_write_dword(dev, REG_PCI_INTBRG_CTRL, val32);
  178. edac_pci_handle_npe(edac_dev, edac_dev->ctl_name);
  179. }
  180. /* Check out PCI Bridge Memory Base-Limit Register */
  181. edac_pci_read_dword(dev, REG_MEM_LIM, &val32);
  182. if (val32 & MEM_LIMIT_CLEAR_MASK) {
  183. printk(KERN_INFO
  184. "Error(s) in mem limit register on %s device\n",
  185. pci_info->ctl_name);
  186. printk(KERN_INFO "DPE: %d, RSE: %d, RMA: %d\n"
  187. "RTA: %d, STA: %d, MDPE: %d\n",
  188. (val32 & MEM_LIMIT_DPE) != 0,
  189. (val32 & MEM_LIMIT_RSE) != 0,
  190. (val32 & MEM_LIMIT_RMA) != 0,
  191. (val32 & MEM_LIMIT_RTA) != 0,
  192. (val32 & MEM_LIMIT_STA) != 0,
  193. (val32 & MEM_LIMIT_MDPE) != 0);
  194. val32 |= MEM_LIMIT_CLEAR_MASK;
  195. edac_pci_write_dword(dev, REG_MEM_LIM, val32);
  196. edac_pci_handle_npe(edac_dev, edac_dev->ctl_name);
  197. }
  198. }
  199. static struct resource *legacy_io_res;
  200. static int at_compat_reg_broken;
  201. #define LEGACY_NR_PORTS 1
  202. /* device-specific methods for amd8111 LPC Bridge device */
  203. static void amd8111_lpc_bridge_init(struct amd8111_dev_info *dev_info)
  204. {
  205. u8 val8;
  206. struct pci_dev *dev = dev_info->dev;
  207. /* First clear REG_AT_COMPAT[SERR, IOCHK] if necessary */
  208. legacy_io_res = request_region(REG_AT_COMPAT, LEGACY_NR_PORTS,
  209. AMD8111_EDAC_MOD_STR);
  210. if (!legacy_io_res)
  211. printk(KERN_INFO "%s: failed to request legacy I/O region "
  212. "start %d, len %d\n", __func__,
  213. REG_AT_COMPAT, LEGACY_NR_PORTS);
  214. else {
  215. val8 = __do_inb(REG_AT_COMPAT);
  216. if (val8 == 0xff) { /* buggy port */
  217. printk(KERN_INFO "%s: port %d is buggy, not supported"
  218. " by hardware?\n", __func__, REG_AT_COMPAT);
  219. at_compat_reg_broken = 1;
  220. release_region(REG_AT_COMPAT, LEGACY_NR_PORTS);
  221. legacy_io_res = NULL;
  222. } else {
  223. u8 out8 = 0;
  224. if (val8 & AT_COMPAT_SERR)
  225. out8 = AT_COMPAT_CLRSERR;
  226. if (val8 & AT_COMPAT_IOCHK)
  227. out8 |= AT_COMPAT_CLRIOCHK;
  228. if (out8 > 0)
  229. __do_outb(out8, REG_AT_COMPAT);
  230. }
  231. }
  232. /* Second clear error flags on LPC bridge */
  233. edac_pci_read_byte(dev, REG_IO_CTRL_1, &val8);
  234. if (val8 & IO_CTRL_1_CLEAR_MASK)
  235. edac_pci_write_byte(dev, REG_IO_CTRL_1, val8);
  236. }
  237. static void amd8111_lpc_bridge_exit(struct amd8111_dev_info *dev_info)
  238. {
  239. if (legacy_io_res)
  240. release_region(REG_AT_COMPAT, LEGACY_NR_PORTS);
  241. }
  242. static void amd8111_lpc_bridge_check(struct edac_device_ctl_info *edac_dev)
  243. {
  244. struct amd8111_dev_info *dev_info = edac_dev->pvt_info;
  245. struct pci_dev *dev = dev_info->dev;
  246. u8 val8;
  247. edac_pci_read_byte(dev, REG_IO_CTRL_1, &val8);
  248. if (val8 & IO_CTRL_1_CLEAR_MASK) {
  249. printk(KERN_INFO
  250. "Error(s) in IO control register on %s device\n",
  251. dev_info->ctl_name);
  252. printk(KERN_INFO "LPC ERR: %d, PW2LPC: %d\n",
  253. (val8 & IO_CTRL_1_LPC_ERR) != 0,
  254. (val8 & IO_CTRL_1_PW2LPC) != 0);
  255. val8 |= IO_CTRL_1_CLEAR_MASK;
  256. edac_pci_write_byte(dev, REG_IO_CTRL_1, val8);
  257. edac_device_handle_ue(edac_dev, 0, 0, edac_dev->ctl_name);
  258. }
  259. if (at_compat_reg_broken == 0) {
  260. u8 out8 = 0;
  261. val8 = __do_inb(REG_AT_COMPAT);
  262. if (val8 & AT_COMPAT_SERR)
  263. out8 = AT_COMPAT_CLRSERR;
  264. if (val8 & AT_COMPAT_IOCHK)
  265. out8 |= AT_COMPAT_CLRIOCHK;
  266. if (out8 > 0) {
  267. __do_outb(out8, REG_AT_COMPAT);
  268. edac_device_handle_ue(edac_dev, 0, 0,
  269. edac_dev->ctl_name);
  270. }
  271. }
  272. }
  273. /* General devices represented by edac_device_ctl_info */
  274. static struct amd8111_dev_info amd8111_devices[] = {
  275. [LPC_BRIDGE] = {
  276. .err_dev = PCI_DEVICE_ID_AMD_8111_LPC,
  277. .ctl_name = "lpc",
  278. .init = amd8111_lpc_bridge_init,
  279. .exit = amd8111_lpc_bridge_exit,
  280. .check = amd8111_lpc_bridge_check,
  281. },
  282. {0},
  283. };
  284. /* PCI controllers represented by edac_pci_ctl_info */
  285. static struct amd8111_pci_info amd8111_pcis[] = {
  286. [PCI_BRIDGE] = {
  287. .err_dev = PCI_DEVICE_ID_AMD_8111_PCI,
  288. .ctl_name = "AMD8111_PCI_Controller",
  289. .init = amd8111_pci_bridge_init,
  290. .exit = amd8111_pci_bridge_exit,
  291. .check = amd8111_pci_bridge_check,
  292. },
  293. {0},
  294. };
  295. static int amd8111_dev_probe(struct pci_dev *dev,
  296. const struct pci_device_id *id)
  297. {
  298. struct amd8111_dev_info *dev_info = &amd8111_devices[id->driver_data];
  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. return -ENODEV;
  307. }
  308. if (pci_enable_device(dev_info->dev)) {
  309. pci_dev_put(dev_info->dev);
  310. printk(KERN_ERR "failed to enable:"
  311. "vendor %x, device %x, name %s\n",
  312. PCI_VENDOR_ID_AMD, dev_info->err_dev,
  313. dev_info->ctl_name);
  314. return -ENODEV;
  315. }
  316. /*
  317. * we do not allocate extra private structure for
  318. * edac_device_ctl_info, but make use of existing
  319. * one instead.
  320. */
  321. dev_info->edac_idx = edac_dev_idx++;
  322. dev_info->edac_dev =
  323. edac_device_alloc_ctl_info(0, dev_info->ctl_name, 1,
  324. NULL, 0, 0,
  325. NULL, 0, dev_info->edac_idx);
  326. if (!dev_info->edac_dev)
  327. return -ENOMEM;
  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_info->dev->dev.bus_id;
  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. edac_device_free_ctl_info(dev_info->edac_dev);
  341. return -ENODEV;
  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. }
  349. static void amd8111_dev_remove(struct pci_dev *dev)
  350. {
  351. struct amd8111_dev_info *dev_info;
  352. for (dev_info = amd8111_devices; dev_info->err_dev; dev_info++)
  353. if (dev_info->dev->device == dev->device)
  354. break;
  355. if (!dev_info->err_dev) /* should never happen */
  356. return;
  357. if (dev_info->edac_dev) {
  358. edac_device_del_device(dev_info->edac_dev->dev);
  359. edac_device_free_ctl_info(dev_info->edac_dev);
  360. }
  361. if (dev_info->exit)
  362. dev_info->exit(dev_info);
  363. pci_dev_put(dev_info->dev);
  364. }
  365. static int amd8111_pci_probe(struct pci_dev *dev,
  366. const struct pci_device_id *id)
  367. {
  368. struct amd8111_pci_info *pci_info = &amd8111_pcis[id->driver_data];
  369. pci_info->dev = pci_get_device(PCI_VENDOR_ID_AMD,
  370. pci_info->err_dev, NULL);
  371. if (!pci_info->dev) {
  372. printk(KERN_ERR "EDAC device not found:"
  373. "vendor %x, device %x, name %s\n",
  374. PCI_VENDOR_ID_AMD, pci_info->err_dev,
  375. pci_info->ctl_name);
  376. return -ENODEV;
  377. }
  378. if (pci_enable_device(pci_info->dev)) {
  379. pci_dev_put(pci_info->dev);
  380. printk(KERN_ERR "failed to enable:"
  381. "vendor %x, device %x, name %s\n",
  382. PCI_VENDOR_ID_AMD, pci_info->err_dev,
  383. pci_info->ctl_name);
  384. return -ENODEV;
  385. }
  386. /*
  387. * we do not allocate extra private structure for
  388. * edac_pci_ctl_info, but make use of existing
  389. * one instead.
  390. */
  391. pci_info->edac_idx = edac_pci_alloc_index();
  392. pci_info->edac_dev = edac_pci_alloc_ctl_info(0, pci_info->ctl_name);
  393. if (!pci_info->edac_dev)
  394. return -ENOMEM;
  395. pci_info->edac_dev->pvt_info = pci_info;
  396. pci_info->edac_dev->dev = &pci_info->dev->dev;
  397. pci_info->edac_dev->mod_name = AMD8111_EDAC_MOD_STR;
  398. pci_info->edac_dev->ctl_name = pci_info->ctl_name;
  399. pci_info->edac_dev->dev_name = pci_info->dev->dev.bus_id;
  400. if (edac_op_state == EDAC_OPSTATE_POLL)
  401. pci_info->edac_dev->edac_check = pci_info->check;
  402. if (pci_info->init)
  403. pci_info->init(pci_info);
  404. if (edac_pci_add_device(pci_info->edac_dev, pci_info->edac_idx) > 0) {
  405. printk(KERN_ERR "failed to add edac_pci for %s\n",
  406. pci_info->ctl_name);
  407. edac_pci_free_ctl_info(pci_info->edac_dev);
  408. return -ENODEV;
  409. }
  410. printk(KERN_INFO "added one edac_pci on AMD8111 "
  411. "vendor %x, device %x, name %s\n",
  412. PCI_VENDOR_ID_AMD, pci_info->err_dev,
  413. pci_info->ctl_name);
  414. return 0;
  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 <qingtao.cao@windriver.com>\n");
  494. MODULE_DESCRIPTION("AMD8111 HyperTransport I/O Hub EDAC kernel module");