i5100_edac.c 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246
  1. /*
  2. * Intel 5100 Memory Controllers kernel module
  3. *
  4. * This file may be distributed under the terms of the
  5. * GNU General Public License.
  6. *
  7. * This module is based on the following document:
  8. *
  9. * Intel 5100X Chipset Memory Controller Hub (MCH) - Datasheet
  10. * http://download.intel.com/design/chipsets/datashts/318378.pdf
  11. *
  12. * The intel 5100 has two independent channels. EDAC core currently
  13. * can not reflect this configuration so instead the chip-select
  14. * rows for each respective channel are laid out one after another,
  15. * the first half belonging to channel 0, the second half belonging
  16. * to channel 1.
  17. *
  18. * This driver is for DDR2 DIMMs, and it uses chip select to select among the
  19. * several ranks. However, instead of showing memories as ranks, it outputs
  20. * them as DIMM's. An internal table creates the association between ranks
  21. * and DIMM's.
  22. */
  23. #include <linux/module.h>
  24. #include <linux/init.h>
  25. #include <linux/pci.h>
  26. #include <linux/pci_ids.h>
  27. #include <linux/edac.h>
  28. #include <linux/delay.h>
  29. #include <linux/mmzone.h>
  30. #include <linux/debugfs.h>
  31. #include "edac_core.h"
  32. #include "edac_module.h"
  33. /* register addresses */
  34. /* device 16, func 1 */
  35. #define I5100_MC 0x40 /* Memory Control Register */
  36. #define I5100_MC_SCRBEN_MASK (1 << 7)
  37. #define I5100_MC_SCRBDONE_MASK (1 << 4)
  38. #define I5100_MS 0x44 /* Memory Status Register */
  39. #define I5100_SPDDATA 0x48 /* Serial Presence Detect Status Reg */
  40. #define I5100_SPDCMD 0x4c /* Serial Presence Detect Command Reg */
  41. #define I5100_TOLM 0x6c /* Top of Low Memory */
  42. #define I5100_MIR0 0x80 /* Memory Interleave Range 0 */
  43. #define I5100_MIR1 0x84 /* Memory Interleave Range 1 */
  44. #define I5100_AMIR_0 0x8c /* Adjusted Memory Interleave Range 0 */
  45. #define I5100_AMIR_1 0x90 /* Adjusted Memory Interleave Range 1 */
  46. #define I5100_FERR_NF_MEM 0xa0 /* MC First Non Fatal Errors */
  47. #define I5100_FERR_NF_MEM_M16ERR_MASK (1 << 16)
  48. #define I5100_FERR_NF_MEM_M15ERR_MASK (1 << 15)
  49. #define I5100_FERR_NF_MEM_M14ERR_MASK (1 << 14)
  50. #define I5100_FERR_NF_MEM_M12ERR_MASK (1 << 12)
  51. #define I5100_FERR_NF_MEM_M11ERR_MASK (1 << 11)
  52. #define I5100_FERR_NF_MEM_M10ERR_MASK (1 << 10)
  53. #define I5100_FERR_NF_MEM_M6ERR_MASK (1 << 6)
  54. #define I5100_FERR_NF_MEM_M5ERR_MASK (1 << 5)
  55. #define I5100_FERR_NF_MEM_M4ERR_MASK (1 << 4)
  56. #define I5100_FERR_NF_MEM_M1ERR_MASK (1 << 1)
  57. #define I5100_FERR_NF_MEM_ANY_MASK \
  58. (I5100_FERR_NF_MEM_M16ERR_MASK | \
  59. I5100_FERR_NF_MEM_M15ERR_MASK | \
  60. I5100_FERR_NF_MEM_M14ERR_MASK | \
  61. I5100_FERR_NF_MEM_M12ERR_MASK | \
  62. I5100_FERR_NF_MEM_M11ERR_MASK | \
  63. I5100_FERR_NF_MEM_M10ERR_MASK | \
  64. I5100_FERR_NF_MEM_M6ERR_MASK | \
  65. I5100_FERR_NF_MEM_M5ERR_MASK | \
  66. I5100_FERR_NF_MEM_M4ERR_MASK | \
  67. I5100_FERR_NF_MEM_M1ERR_MASK)
  68. #define I5100_NERR_NF_MEM 0xa4 /* MC Next Non-Fatal Errors */
  69. #define I5100_EMASK_MEM 0xa8 /* MC Error Mask Register */
  70. #define I5100_MEM0EINJMSK0 0x200 /* Injection Mask0 Register Channel 0 */
  71. #define I5100_MEM1EINJMSK0 0x208 /* Injection Mask0 Register Channel 1 */
  72. #define I5100_MEMXEINJMSK0_EINJEN (1 << 27)
  73. #define I5100_MEM0EINJMSK1 0x204 /* Injection Mask1 Register Channel 0 */
  74. #define I5100_MEM1EINJMSK1 0x206 /* Injection Mask1 Register Channel 1 */
  75. /* Device 19, Function 0 */
  76. #define I5100_DINJ0 0x9a
  77. /* device 21 and 22, func 0 */
  78. #define I5100_MTR_0 0x154 /* Memory Technology Registers 0-3 */
  79. #define I5100_DMIR 0x15c /* DIMM Interleave Range */
  80. #define I5100_VALIDLOG 0x18c /* Valid Log Markers */
  81. #define I5100_NRECMEMA 0x190 /* Non-Recoverable Memory Error Log Reg A */
  82. #define I5100_NRECMEMB 0x194 /* Non-Recoverable Memory Error Log Reg B */
  83. #define I5100_REDMEMA 0x198 /* Recoverable Memory Data Error Log Reg A */
  84. #define I5100_REDMEMB 0x19c /* Recoverable Memory Data Error Log Reg B */
  85. #define I5100_RECMEMA 0x1a0 /* Recoverable Memory Error Log Reg A */
  86. #define I5100_RECMEMB 0x1a4 /* Recoverable Memory Error Log Reg B */
  87. #define I5100_MTR_4 0x1b0 /* Memory Technology Registers 4,5 */
  88. /* bit field accessors */
  89. static inline u32 i5100_mc_scrben(u32 mc)
  90. {
  91. return mc >> 7 & 1;
  92. }
  93. static inline u32 i5100_mc_errdeten(u32 mc)
  94. {
  95. return mc >> 5 & 1;
  96. }
  97. static inline u32 i5100_mc_scrbdone(u32 mc)
  98. {
  99. return mc >> 4 & 1;
  100. }
  101. static inline u16 i5100_spddata_rdo(u16 a)
  102. {
  103. return a >> 15 & 1;
  104. }
  105. static inline u16 i5100_spddata_sbe(u16 a)
  106. {
  107. return a >> 13 & 1;
  108. }
  109. static inline u16 i5100_spddata_busy(u16 a)
  110. {
  111. return a >> 12 & 1;
  112. }
  113. static inline u16 i5100_spddata_data(u16 a)
  114. {
  115. return a & ((1 << 8) - 1);
  116. }
  117. static inline u32 i5100_spdcmd_create(u32 dti, u32 ckovrd, u32 sa, u32 ba,
  118. u32 data, u32 cmd)
  119. {
  120. return ((dti & ((1 << 4) - 1)) << 28) |
  121. ((ckovrd & 1) << 27) |
  122. ((sa & ((1 << 3) - 1)) << 24) |
  123. ((ba & ((1 << 8) - 1)) << 16) |
  124. ((data & ((1 << 8) - 1)) << 8) |
  125. (cmd & 1);
  126. }
  127. static inline u16 i5100_tolm_tolm(u16 a)
  128. {
  129. return a >> 12 & ((1 << 4) - 1);
  130. }
  131. static inline u16 i5100_mir_limit(u16 a)
  132. {
  133. return a >> 4 & ((1 << 12) - 1);
  134. }
  135. static inline u16 i5100_mir_way1(u16 a)
  136. {
  137. return a >> 1 & 1;
  138. }
  139. static inline u16 i5100_mir_way0(u16 a)
  140. {
  141. return a & 1;
  142. }
  143. static inline u32 i5100_ferr_nf_mem_chan_indx(u32 a)
  144. {
  145. return a >> 28 & 1;
  146. }
  147. static inline u32 i5100_ferr_nf_mem_any(u32 a)
  148. {
  149. return a & I5100_FERR_NF_MEM_ANY_MASK;
  150. }
  151. static inline u32 i5100_nerr_nf_mem_any(u32 a)
  152. {
  153. return i5100_ferr_nf_mem_any(a);
  154. }
  155. static inline u32 i5100_dmir_limit(u32 a)
  156. {
  157. return a >> 16 & ((1 << 11) - 1);
  158. }
  159. static inline u32 i5100_dmir_rank(u32 a, u32 i)
  160. {
  161. return a >> (4 * i) & ((1 << 2) - 1);
  162. }
  163. static inline u16 i5100_mtr_present(u16 a)
  164. {
  165. return a >> 10 & 1;
  166. }
  167. static inline u16 i5100_mtr_ethrottle(u16 a)
  168. {
  169. return a >> 9 & 1;
  170. }
  171. static inline u16 i5100_mtr_width(u16 a)
  172. {
  173. return a >> 8 & 1;
  174. }
  175. static inline u16 i5100_mtr_numbank(u16 a)
  176. {
  177. return a >> 6 & 1;
  178. }
  179. static inline u16 i5100_mtr_numrow(u16 a)
  180. {
  181. return a >> 2 & ((1 << 2) - 1);
  182. }
  183. static inline u16 i5100_mtr_numcol(u16 a)
  184. {
  185. return a & ((1 << 2) - 1);
  186. }
  187. static inline u32 i5100_validlog_redmemvalid(u32 a)
  188. {
  189. return a >> 2 & 1;
  190. }
  191. static inline u32 i5100_validlog_recmemvalid(u32 a)
  192. {
  193. return a >> 1 & 1;
  194. }
  195. static inline u32 i5100_validlog_nrecmemvalid(u32 a)
  196. {
  197. return a & 1;
  198. }
  199. static inline u32 i5100_nrecmema_merr(u32 a)
  200. {
  201. return a >> 15 & ((1 << 5) - 1);
  202. }
  203. static inline u32 i5100_nrecmema_bank(u32 a)
  204. {
  205. return a >> 12 & ((1 << 3) - 1);
  206. }
  207. static inline u32 i5100_nrecmema_rank(u32 a)
  208. {
  209. return a >> 8 & ((1 << 3) - 1);
  210. }
  211. static inline u32 i5100_nrecmema_dm_buf_id(u32 a)
  212. {
  213. return a & ((1 << 8) - 1);
  214. }
  215. static inline u32 i5100_nrecmemb_cas(u32 a)
  216. {
  217. return a >> 16 & ((1 << 13) - 1);
  218. }
  219. static inline u32 i5100_nrecmemb_ras(u32 a)
  220. {
  221. return a & ((1 << 16) - 1);
  222. }
  223. static inline u32 i5100_redmemb_ecc_locator(u32 a)
  224. {
  225. return a & ((1 << 18) - 1);
  226. }
  227. static inline u32 i5100_recmema_merr(u32 a)
  228. {
  229. return i5100_nrecmema_merr(a);
  230. }
  231. static inline u32 i5100_recmema_bank(u32 a)
  232. {
  233. return i5100_nrecmema_bank(a);
  234. }
  235. static inline u32 i5100_recmema_rank(u32 a)
  236. {
  237. return i5100_nrecmema_rank(a);
  238. }
  239. static inline u32 i5100_recmemb_cas(u32 a)
  240. {
  241. return i5100_nrecmemb_cas(a);
  242. }
  243. static inline u32 i5100_recmemb_ras(u32 a)
  244. {
  245. return i5100_nrecmemb_ras(a);
  246. }
  247. /* some generic limits */
  248. #define I5100_MAX_RANKS_PER_CHAN 6
  249. #define I5100_CHANNELS 2
  250. #define I5100_MAX_RANKS_PER_DIMM 4
  251. #define I5100_DIMM_ADDR_LINES (6 - 3) /* 64 bits / 8 bits per byte */
  252. #define I5100_MAX_DIMM_SLOTS_PER_CHAN 4
  253. #define I5100_MAX_RANK_INTERLEAVE 4
  254. #define I5100_MAX_DMIRS 5
  255. #define I5100_SCRUB_REFRESH_RATE (5 * 60 * HZ)
  256. struct i5100_priv {
  257. /* ranks on each dimm -- 0 maps to not present -- obtained via SPD */
  258. int dimm_numrank[I5100_CHANNELS][I5100_MAX_DIMM_SLOTS_PER_CHAN];
  259. /*
  260. * mainboard chip select map -- maps i5100 chip selects to
  261. * DIMM slot chip selects. In the case of only 4 ranks per
  262. * channel, the mapping is fairly obvious but not unique.
  263. * we map -1 -> NC and assume both channels use the same
  264. * map...
  265. *
  266. */
  267. int dimm_csmap[I5100_MAX_DIMM_SLOTS_PER_CHAN][I5100_MAX_RANKS_PER_DIMM];
  268. /* memory interleave range */
  269. struct {
  270. u64 limit;
  271. unsigned way[2];
  272. } mir[I5100_CHANNELS];
  273. /* adjusted memory interleave range register */
  274. unsigned amir[I5100_CHANNELS];
  275. /* dimm interleave range */
  276. struct {
  277. unsigned rank[I5100_MAX_RANK_INTERLEAVE];
  278. u64 limit;
  279. } dmir[I5100_CHANNELS][I5100_MAX_DMIRS];
  280. /* memory technology registers... */
  281. struct {
  282. unsigned present; /* 0 or 1 */
  283. unsigned ethrottle; /* 0 or 1 */
  284. unsigned width; /* 4 or 8 bits */
  285. unsigned numbank; /* 2 or 3 lines */
  286. unsigned numrow; /* 13 .. 16 lines */
  287. unsigned numcol; /* 11 .. 12 lines */
  288. } mtr[I5100_CHANNELS][I5100_MAX_RANKS_PER_CHAN];
  289. u64 tolm; /* top of low memory in bytes */
  290. unsigned ranksperchan; /* number of ranks per channel */
  291. struct pci_dev *mc; /* device 16 func 1 */
  292. struct pci_dev *einj; /* device 19 func 0 */
  293. struct pci_dev *ch0mm; /* device 21 func 0 */
  294. struct pci_dev *ch1mm; /* device 22 func 0 */
  295. struct delayed_work i5100_scrubbing;
  296. int scrub_enable;
  297. /* Error injection */
  298. u8 inject_channel;
  299. u8 inject_hlinesel;
  300. u8 inject_deviceptr1;
  301. u8 inject_deviceptr2;
  302. u16 inject_eccmask1;
  303. u16 inject_eccmask2;
  304. struct dentry *debugfs;
  305. };
  306. static struct dentry *i5100_debugfs;
  307. /* map a rank/chan to a slot number on the mainboard */
  308. static int i5100_rank_to_slot(const struct mem_ctl_info *mci,
  309. int chan, int rank)
  310. {
  311. const struct i5100_priv *priv = mci->pvt_info;
  312. int i;
  313. for (i = 0; i < I5100_MAX_DIMM_SLOTS_PER_CHAN; i++) {
  314. int j;
  315. const int numrank = priv->dimm_numrank[chan][i];
  316. for (j = 0; j < numrank; j++)
  317. if (priv->dimm_csmap[i][j] == rank)
  318. return i * 2 + chan;
  319. }
  320. return -1;
  321. }
  322. static const char *i5100_err_msg(unsigned err)
  323. {
  324. static const char *merrs[] = {
  325. "unknown", /* 0 */
  326. "uncorrectable data ECC on replay", /* 1 */
  327. "unknown", /* 2 */
  328. "unknown", /* 3 */
  329. "aliased uncorrectable demand data ECC", /* 4 */
  330. "aliased uncorrectable spare-copy data ECC", /* 5 */
  331. "aliased uncorrectable patrol data ECC", /* 6 */
  332. "unknown", /* 7 */
  333. "unknown", /* 8 */
  334. "unknown", /* 9 */
  335. "non-aliased uncorrectable demand data ECC", /* 10 */
  336. "non-aliased uncorrectable spare-copy data ECC", /* 11 */
  337. "non-aliased uncorrectable patrol data ECC", /* 12 */
  338. "unknown", /* 13 */
  339. "correctable demand data ECC", /* 14 */
  340. "correctable spare-copy data ECC", /* 15 */
  341. "correctable patrol data ECC", /* 16 */
  342. "unknown", /* 17 */
  343. "SPD protocol error", /* 18 */
  344. "unknown", /* 19 */
  345. "spare copy initiated", /* 20 */
  346. "spare copy completed", /* 21 */
  347. };
  348. unsigned i;
  349. for (i = 0; i < ARRAY_SIZE(merrs); i++)
  350. if (1 << i & err)
  351. return merrs[i];
  352. return "none";
  353. }
  354. /* convert csrow index into a rank (per channel -- 0..5) */
  355. static int i5100_csrow_to_rank(const struct mem_ctl_info *mci, int csrow)
  356. {
  357. const struct i5100_priv *priv = mci->pvt_info;
  358. return csrow % priv->ranksperchan;
  359. }
  360. /* convert csrow index into a channel (0..1) */
  361. static int i5100_csrow_to_chan(const struct mem_ctl_info *mci, int csrow)
  362. {
  363. const struct i5100_priv *priv = mci->pvt_info;
  364. return csrow / priv->ranksperchan;
  365. }
  366. static void i5100_handle_ce(struct mem_ctl_info *mci,
  367. int chan,
  368. unsigned bank,
  369. unsigned rank,
  370. unsigned long syndrome,
  371. unsigned cas,
  372. unsigned ras,
  373. const char *msg)
  374. {
  375. char detail[80];
  376. /* Form out message */
  377. snprintf(detail, sizeof(detail),
  378. "bank %u, cas %u, ras %u\n",
  379. bank, cas, ras);
  380. edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 1,
  381. 0, 0, syndrome,
  382. chan, rank, -1,
  383. msg, detail);
  384. }
  385. static void i5100_handle_ue(struct mem_ctl_info *mci,
  386. int chan,
  387. unsigned bank,
  388. unsigned rank,
  389. unsigned long syndrome,
  390. unsigned cas,
  391. unsigned ras,
  392. const char *msg)
  393. {
  394. char detail[80];
  395. /* Form out message */
  396. snprintf(detail, sizeof(detail),
  397. "bank %u, cas %u, ras %u\n",
  398. bank, cas, ras);
  399. edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, 1,
  400. 0, 0, syndrome,
  401. chan, rank, -1,
  402. msg, detail);
  403. }
  404. static void i5100_read_log(struct mem_ctl_info *mci, int chan,
  405. u32 ferr, u32 nerr)
  406. {
  407. struct i5100_priv *priv = mci->pvt_info;
  408. struct pci_dev *pdev = (chan) ? priv->ch1mm : priv->ch0mm;
  409. u32 dw;
  410. u32 dw2;
  411. unsigned syndrome = 0;
  412. unsigned ecc_loc = 0;
  413. unsigned merr;
  414. unsigned bank;
  415. unsigned rank;
  416. unsigned cas;
  417. unsigned ras;
  418. pci_read_config_dword(pdev, I5100_VALIDLOG, &dw);
  419. if (i5100_validlog_redmemvalid(dw)) {
  420. pci_read_config_dword(pdev, I5100_REDMEMA, &dw2);
  421. syndrome = dw2;
  422. pci_read_config_dword(pdev, I5100_REDMEMB, &dw2);
  423. ecc_loc = i5100_redmemb_ecc_locator(dw2);
  424. }
  425. if (i5100_validlog_recmemvalid(dw)) {
  426. const char *msg;
  427. pci_read_config_dword(pdev, I5100_RECMEMA, &dw2);
  428. merr = i5100_recmema_merr(dw2);
  429. bank = i5100_recmema_bank(dw2);
  430. rank = i5100_recmema_rank(dw2);
  431. pci_read_config_dword(pdev, I5100_RECMEMB, &dw2);
  432. cas = i5100_recmemb_cas(dw2);
  433. ras = i5100_recmemb_ras(dw2);
  434. /* FIXME: not really sure if this is what merr is...
  435. */
  436. if (!merr)
  437. msg = i5100_err_msg(ferr);
  438. else
  439. msg = i5100_err_msg(nerr);
  440. i5100_handle_ce(mci, chan, bank, rank, syndrome, cas, ras, msg);
  441. }
  442. if (i5100_validlog_nrecmemvalid(dw)) {
  443. const char *msg;
  444. pci_read_config_dword(pdev, I5100_NRECMEMA, &dw2);
  445. merr = i5100_nrecmema_merr(dw2);
  446. bank = i5100_nrecmema_bank(dw2);
  447. rank = i5100_nrecmema_rank(dw2);
  448. pci_read_config_dword(pdev, I5100_NRECMEMB, &dw2);
  449. cas = i5100_nrecmemb_cas(dw2);
  450. ras = i5100_nrecmemb_ras(dw2);
  451. /* FIXME: not really sure if this is what merr is...
  452. */
  453. if (!merr)
  454. msg = i5100_err_msg(ferr);
  455. else
  456. msg = i5100_err_msg(nerr);
  457. i5100_handle_ue(mci, chan, bank, rank, syndrome, cas, ras, msg);
  458. }
  459. pci_write_config_dword(pdev, I5100_VALIDLOG, dw);
  460. }
  461. static void i5100_check_error(struct mem_ctl_info *mci)
  462. {
  463. struct i5100_priv *priv = mci->pvt_info;
  464. u32 dw, dw2;
  465. pci_read_config_dword(priv->mc, I5100_FERR_NF_MEM, &dw);
  466. if (i5100_ferr_nf_mem_any(dw)) {
  467. pci_read_config_dword(priv->mc, I5100_NERR_NF_MEM, &dw2);
  468. i5100_read_log(mci, i5100_ferr_nf_mem_chan_indx(dw),
  469. i5100_ferr_nf_mem_any(dw),
  470. i5100_nerr_nf_mem_any(dw2));
  471. pci_write_config_dword(priv->mc, I5100_NERR_NF_MEM, dw2);
  472. }
  473. pci_write_config_dword(priv->mc, I5100_FERR_NF_MEM, dw);
  474. }
  475. /* The i5100 chipset will scrub the entire memory once, then
  476. * set a done bit. Continuous scrubbing is achieved by enqueing
  477. * delayed work to a workqueue, checking every few minutes if
  478. * the scrubbing has completed and if so reinitiating it.
  479. */
  480. static void i5100_refresh_scrubbing(struct work_struct *work)
  481. {
  482. struct delayed_work *i5100_scrubbing = container_of(work,
  483. struct delayed_work,
  484. work);
  485. struct i5100_priv *priv = container_of(i5100_scrubbing,
  486. struct i5100_priv,
  487. i5100_scrubbing);
  488. u32 dw;
  489. pci_read_config_dword(priv->mc, I5100_MC, &dw);
  490. if (priv->scrub_enable) {
  491. pci_read_config_dword(priv->mc, I5100_MC, &dw);
  492. if (i5100_mc_scrbdone(dw)) {
  493. dw |= I5100_MC_SCRBEN_MASK;
  494. pci_write_config_dword(priv->mc, I5100_MC, dw);
  495. pci_read_config_dword(priv->mc, I5100_MC, &dw);
  496. }
  497. schedule_delayed_work(&(priv->i5100_scrubbing),
  498. I5100_SCRUB_REFRESH_RATE);
  499. }
  500. }
  501. /*
  502. * The bandwidth is based on experimentation, feel free to refine it.
  503. */
  504. static int i5100_set_scrub_rate(struct mem_ctl_info *mci, u32 bandwidth)
  505. {
  506. struct i5100_priv *priv = mci->pvt_info;
  507. u32 dw;
  508. pci_read_config_dword(priv->mc, I5100_MC, &dw);
  509. if (bandwidth) {
  510. priv->scrub_enable = 1;
  511. dw |= I5100_MC_SCRBEN_MASK;
  512. schedule_delayed_work(&(priv->i5100_scrubbing),
  513. I5100_SCRUB_REFRESH_RATE);
  514. } else {
  515. priv->scrub_enable = 0;
  516. dw &= ~I5100_MC_SCRBEN_MASK;
  517. cancel_delayed_work(&(priv->i5100_scrubbing));
  518. }
  519. pci_write_config_dword(priv->mc, I5100_MC, dw);
  520. pci_read_config_dword(priv->mc, I5100_MC, &dw);
  521. bandwidth = 5900000 * i5100_mc_scrben(dw);
  522. return bandwidth;
  523. }
  524. static int i5100_get_scrub_rate(struct mem_ctl_info *mci)
  525. {
  526. struct i5100_priv *priv = mci->pvt_info;
  527. u32 dw;
  528. pci_read_config_dword(priv->mc, I5100_MC, &dw);
  529. return 5900000 * i5100_mc_scrben(dw);
  530. }
  531. static struct pci_dev *pci_get_device_func(unsigned vendor,
  532. unsigned device,
  533. unsigned func)
  534. {
  535. struct pci_dev *ret = NULL;
  536. while (1) {
  537. ret = pci_get_device(vendor, device, ret);
  538. if (!ret)
  539. break;
  540. if (PCI_FUNC(ret->devfn) == func)
  541. break;
  542. }
  543. return ret;
  544. }
  545. static unsigned long i5100_npages(struct mem_ctl_info *mci, int csrow)
  546. {
  547. struct i5100_priv *priv = mci->pvt_info;
  548. const unsigned chan_rank = i5100_csrow_to_rank(mci, csrow);
  549. const unsigned chan = i5100_csrow_to_chan(mci, csrow);
  550. unsigned addr_lines;
  551. /* dimm present? */
  552. if (!priv->mtr[chan][chan_rank].present)
  553. return 0ULL;
  554. addr_lines =
  555. I5100_DIMM_ADDR_LINES +
  556. priv->mtr[chan][chan_rank].numcol +
  557. priv->mtr[chan][chan_rank].numrow +
  558. priv->mtr[chan][chan_rank].numbank;
  559. return (unsigned long)
  560. ((unsigned long long) (1ULL << addr_lines) / PAGE_SIZE);
  561. }
  562. static void i5100_init_mtr(struct mem_ctl_info *mci)
  563. {
  564. struct i5100_priv *priv = mci->pvt_info;
  565. struct pci_dev *mms[2] = { priv->ch0mm, priv->ch1mm };
  566. int i;
  567. for (i = 0; i < I5100_CHANNELS; i++) {
  568. int j;
  569. struct pci_dev *pdev = mms[i];
  570. for (j = 0; j < I5100_MAX_RANKS_PER_CHAN; j++) {
  571. const unsigned addr =
  572. (j < 4) ? I5100_MTR_0 + j * 2 :
  573. I5100_MTR_4 + (j - 4) * 2;
  574. u16 w;
  575. pci_read_config_word(pdev, addr, &w);
  576. priv->mtr[i][j].present = i5100_mtr_present(w);
  577. priv->mtr[i][j].ethrottle = i5100_mtr_ethrottle(w);
  578. priv->mtr[i][j].width = 4 + 4 * i5100_mtr_width(w);
  579. priv->mtr[i][j].numbank = 2 + i5100_mtr_numbank(w);
  580. priv->mtr[i][j].numrow = 13 + i5100_mtr_numrow(w);
  581. priv->mtr[i][j].numcol = 10 + i5100_mtr_numcol(w);
  582. }
  583. }
  584. }
  585. /*
  586. * FIXME: make this into a real i2c adapter (so that dimm-decode
  587. * will work)?
  588. */
  589. static int i5100_read_spd_byte(const struct mem_ctl_info *mci,
  590. u8 ch, u8 slot, u8 addr, u8 *byte)
  591. {
  592. struct i5100_priv *priv = mci->pvt_info;
  593. u16 w;
  594. unsigned long et;
  595. pci_read_config_word(priv->mc, I5100_SPDDATA, &w);
  596. if (i5100_spddata_busy(w))
  597. return -1;
  598. pci_write_config_dword(priv->mc, I5100_SPDCMD,
  599. i5100_spdcmd_create(0xa, 1, ch * 4 + slot, addr,
  600. 0, 0));
  601. /* wait up to 100ms */
  602. et = jiffies + HZ / 10;
  603. udelay(100);
  604. while (1) {
  605. pci_read_config_word(priv->mc, I5100_SPDDATA, &w);
  606. if (!i5100_spddata_busy(w))
  607. break;
  608. udelay(100);
  609. }
  610. if (!i5100_spddata_rdo(w) || i5100_spddata_sbe(w))
  611. return -1;
  612. *byte = i5100_spddata_data(w);
  613. return 0;
  614. }
  615. /*
  616. * fill dimm chip select map
  617. *
  618. * FIXME:
  619. * o not the only way to may chip selects to dimm slots
  620. * o investigate if there is some way to obtain this map from the bios
  621. */
  622. static void i5100_init_dimm_csmap(struct mem_ctl_info *mci)
  623. {
  624. struct i5100_priv *priv = mci->pvt_info;
  625. int i;
  626. for (i = 0; i < I5100_MAX_DIMM_SLOTS_PER_CHAN; i++) {
  627. int j;
  628. for (j = 0; j < I5100_MAX_RANKS_PER_DIMM; j++)
  629. priv->dimm_csmap[i][j] = -1; /* default NC */
  630. }
  631. /* only 2 chip selects per slot... */
  632. if (priv->ranksperchan == 4) {
  633. priv->dimm_csmap[0][0] = 0;
  634. priv->dimm_csmap[0][1] = 3;
  635. priv->dimm_csmap[1][0] = 1;
  636. priv->dimm_csmap[1][1] = 2;
  637. priv->dimm_csmap[2][0] = 2;
  638. priv->dimm_csmap[3][0] = 3;
  639. } else {
  640. priv->dimm_csmap[0][0] = 0;
  641. priv->dimm_csmap[0][1] = 1;
  642. priv->dimm_csmap[1][0] = 2;
  643. priv->dimm_csmap[1][1] = 3;
  644. priv->dimm_csmap[2][0] = 4;
  645. priv->dimm_csmap[2][1] = 5;
  646. }
  647. }
  648. static void i5100_init_dimm_layout(struct pci_dev *pdev,
  649. struct mem_ctl_info *mci)
  650. {
  651. struct i5100_priv *priv = mci->pvt_info;
  652. int i;
  653. for (i = 0; i < I5100_CHANNELS; i++) {
  654. int j;
  655. for (j = 0; j < I5100_MAX_DIMM_SLOTS_PER_CHAN; j++) {
  656. u8 rank;
  657. if (i5100_read_spd_byte(mci, i, j, 5, &rank) < 0)
  658. priv->dimm_numrank[i][j] = 0;
  659. else
  660. priv->dimm_numrank[i][j] = (rank & 3) + 1;
  661. }
  662. }
  663. i5100_init_dimm_csmap(mci);
  664. }
  665. static void i5100_init_interleaving(struct pci_dev *pdev,
  666. struct mem_ctl_info *mci)
  667. {
  668. u16 w;
  669. u32 dw;
  670. struct i5100_priv *priv = mci->pvt_info;
  671. struct pci_dev *mms[2] = { priv->ch0mm, priv->ch1mm };
  672. int i;
  673. pci_read_config_word(pdev, I5100_TOLM, &w);
  674. priv->tolm = (u64) i5100_tolm_tolm(w) * 256 * 1024 * 1024;
  675. pci_read_config_word(pdev, I5100_MIR0, &w);
  676. priv->mir[0].limit = (u64) i5100_mir_limit(w) << 28;
  677. priv->mir[0].way[1] = i5100_mir_way1(w);
  678. priv->mir[0].way[0] = i5100_mir_way0(w);
  679. pci_read_config_word(pdev, I5100_MIR1, &w);
  680. priv->mir[1].limit = (u64) i5100_mir_limit(w) << 28;
  681. priv->mir[1].way[1] = i5100_mir_way1(w);
  682. priv->mir[1].way[0] = i5100_mir_way0(w);
  683. pci_read_config_word(pdev, I5100_AMIR_0, &w);
  684. priv->amir[0] = w;
  685. pci_read_config_word(pdev, I5100_AMIR_1, &w);
  686. priv->amir[1] = w;
  687. for (i = 0; i < I5100_CHANNELS; i++) {
  688. int j;
  689. for (j = 0; j < 5; j++) {
  690. int k;
  691. pci_read_config_dword(mms[i], I5100_DMIR + j * 4, &dw);
  692. priv->dmir[i][j].limit =
  693. (u64) i5100_dmir_limit(dw) << 28;
  694. for (k = 0; k < I5100_MAX_RANKS_PER_DIMM; k++)
  695. priv->dmir[i][j].rank[k] =
  696. i5100_dmir_rank(dw, k);
  697. }
  698. }
  699. i5100_init_mtr(mci);
  700. }
  701. static void i5100_init_csrows(struct mem_ctl_info *mci)
  702. {
  703. int i;
  704. struct i5100_priv *priv = mci->pvt_info;
  705. for (i = 0; i < mci->tot_dimms; i++) {
  706. struct dimm_info *dimm;
  707. const unsigned long npages = i5100_npages(mci, i);
  708. const unsigned chan = i5100_csrow_to_chan(mci, i);
  709. const unsigned rank = i5100_csrow_to_rank(mci, i);
  710. if (!npages)
  711. continue;
  712. dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms, mci->n_layers,
  713. chan, rank, 0);
  714. dimm->nr_pages = npages;
  715. dimm->grain = 32;
  716. dimm->dtype = (priv->mtr[chan][rank].width == 4) ?
  717. DEV_X4 : DEV_X8;
  718. dimm->mtype = MEM_RDDR2;
  719. dimm->edac_mode = EDAC_SECDED;
  720. snprintf(dimm->label, sizeof(dimm->label), "DIMM%u",
  721. i5100_rank_to_slot(mci, chan, rank));
  722. edac_dbg(2, "dimm channel %d, rank %d, size %ld\n",
  723. chan, rank, (long)PAGES_TO_MiB(npages));
  724. }
  725. }
  726. /****************************************************************************
  727. * Error injection routines
  728. ****************************************************************************/
  729. static void i5100_do_inject(struct mem_ctl_info *mci)
  730. {
  731. struct i5100_priv *priv = mci->pvt_info;
  732. u32 mask0;
  733. u16 mask1;
  734. /* MEM[1:0]EINJMSK0
  735. * 31 - ADDRMATCHEN
  736. * 29:28 - HLINESEL
  737. * 00 Reserved
  738. * 01 Lower half of cache line
  739. * 10 Upper half of cache line
  740. * 11 Both upper and lower parts of cache line
  741. * 27 - EINJEN
  742. * 25:19 - XORMASK1 for deviceptr1
  743. * 9:5 - SEC2RAM for deviceptr2
  744. * 4:0 - FIR2RAM for deviceptr1
  745. */
  746. mask0 = ((priv->inject_hlinesel & 0x3) << 28) |
  747. I5100_MEMXEINJMSK0_EINJEN |
  748. ((priv->inject_eccmask1 & 0xffff) << 10) |
  749. ((priv->inject_deviceptr2 & 0x1f) << 5) |
  750. (priv->inject_deviceptr1 & 0x1f);
  751. /* MEM[1:0]EINJMSK1
  752. * 15:0 - XORMASK2 for deviceptr2
  753. */
  754. mask1 = priv->inject_eccmask2;
  755. if (priv->inject_channel == 0) {
  756. pci_write_config_dword(priv->mc, I5100_MEM0EINJMSK0, mask0);
  757. pci_write_config_word(priv->mc, I5100_MEM0EINJMSK1, mask1);
  758. } else {
  759. pci_write_config_dword(priv->mc, I5100_MEM1EINJMSK0, mask0);
  760. pci_write_config_word(priv->mc, I5100_MEM1EINJMSK1, mask1);
  761. }
  762. /* Error Injection Response Function
  763. * Intel 5100 Memory Controller Hub Chipset (318378) datasheet
  764. * hints about this register but carry no data about them. All
  765. * data regarding device 19 is based on experimentation and the
  766. * Intel 7300 Chipset Memory Controller Hub (318082) datasheet
  767. * which appears to be accurate for the i5100 in this area.
  768. *
  769. * The injection code don't work without setting this register.
  770. * The register needs to be flipped off then on else the hardware
  771. * will only preform the first injection.
  772. *
  773. * Stop condition bits 7:4
  774. * 1010 - Stop after one injection
  775. * 1011 - Never stop injecting faults
  776. *
  777. * Start condition bits 3:0
  778. * 1010 - Never start
  779. * 1011 - Start immediately
  780. */
  781. pci_write_config_byte(priv->einj, I5100_DINJ0, 0xaa);
  782. pci_write_config_byte(priv->einj, I5100_DINJ0, 0xab);
  783. }
  784. #define to_mci(k) container_of(k, struct mem_ctl_info, dev)
  785. static ssize_t inject_enable_write(struct file *file, const char __user *data,
  786. size_t count, loff_t *ppos)
  787. {
  788. struct device *dev = file->private_data;
  789. struct mem_ctl_info *mci = to_mci(dev);
  790. i5100_do_inject(mci);
  791. return count;
  792. }
  793. static const struct file_operations i5100_inject_enable_fops = {
  794. .open = simple_open,
  795. .write = inject_enable_write,
  796. .llseek = generic_file_llseek,
  797. };
  798. static int i5100_setup_debugfs(struct mem_ctl_info *mci)
  799. {
  800. struct i5100_priv *priv = mci->pvt_info;
  801. if (!i5100_debugfs)
  802. return -ENODEV;
  803. priv->debugfs = edac_debugfs_create_dir_at(mci->bus->name, i5100_debugfs);
  804. if (!priv->debugfs)
  805. return -ENOMEM;
  806. edac_debugfs_create_x8("inject_channel", S_IRUGO | S_IWUSR, priv->debugfs,
  807. &priv->inject_channel);
  808. edac_debugfs_create_x8("inject_hlinesel", S_IRUGO | S_IWUSR, priv->debugfs,
  809. &priv->inject_hlinesel);
  810. edac_debugfs_create_x8("inject_deviceptr1", S_IRUGO | S_IWUSR, priv->debugfs,
  811. &priv->inject_deviceptr1);
  812. edac_debugfs_create_x8("inject_deviceptr2", S_IRUGO | S_IWUSR, priv->debugfs,
  813. &priv->inject_deviceptr2);
  814. edac_debugfs_create_x16("inject_eccmask1", S_IRUGO | S_IWUSR, priv->debugfs,
  815. &priv->inject_eccmask1);
  816. edac_debugfs_create_x16("inject_eccmask2", S_IRUGO | S_IWUSR, priv->debugfs,
  817. &priv->inject_eccmask2);
  818. edac_debugfs_create_file("inject_enable", S_IWUSR, priv->debugfs,
  819. &mci->dev, &i5100_inject_enable_fops);
  820. return 0;
  821. }
  822. static int i5100_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
  823. {
  824. int rc;
  825. struct mem_ctl_info *mci;
  826. struct edac_mc_layer layers[2];
  827. struct i5100_priv *priv;
  828. struct pci_dev *ch0mm, *ch1mm, *einj;
  829. int ret = 0;
  830. u32 dw;
  831. int ranksperch;
  832. if (PCI_FUNC(pdev->devfn) != 1)
  833. return -ENODEV;
  834. rc = pci_enable_device(pdev);
  835. if (rc < 0) {
  836. ret = rc;
  837. goto bail;
  838. }
  839. /* ECC enabled? */
  840. pci_read_config_dword(pdev, I5100_MC, &dw);
  841. if (!i5100_mc_errdeten(dw)) {
  842. printk(KERN_INFO "i5100_edac: ECC not enabled.\n");
  843. ret = -ENODEV;
  844. goto bail_pdev;
  845. }
  846. /* figure out how many ranks, from strapped state of 48GB_Mode input */
  847. pci_read_config_dword(pdev, I5100_MS, &dw);
  848. ranksperch = !!(dw & (1 << 8)) * 2 + 4;
  849. /* enable error reporting... */
  850. pci_read_config_dword(pdev, I5100_EMASK_MEM, &dw);
  851. dw &= ~I5100_FERR_NF_MEM_ANY_MASK;
  852. pci_write_config_dword(pdev, I5100_EMASK_MEM, dw);
  853. /* device 21, func 0, Channel 0 Memory Map, Error Flag/Mask, etc... */
  854. ch0mm = pci_get_device_func(PCI_VENDOR_ID_INTEL,
  855. PCI_DEVICE_ID_INTEL_5100_21, 0);
  856. if (!ch0mm) {
  857. ret = -ENODEV;
  858. goto bail_pdev;
  859. }
  860. rc = pci_enable_device(ch0mm);
  861. if (rc < 0) {
  862. ret = rc;
  863. goto bail_ch0;
  864. }
  865. /* device 22, func 0, Channel 1 Memory Map, Error Flag/Mask, etc... */
  866. ch1mm = pci_get_device_func(PCI_VENDOR_ID_INTEL,
  867. PCI_DEVICE_ID_INTEL_5100_22, 0);
  868. if (!ch1mm) {
  869. ret = -ENODEV;
  870. goto bail_disable_ch0;
  871. }
  872. rc = pci_enable_device(ch1mm);
  873. if (rc < 0) {
  874. ret = rc;
  875. goto bail_ch1;
  876. }
  877. layers[0].type = EDAC_MC_LAYER_CHANNEL;
  878. layers[0].size = 2;
  879. layers[0].is_virt_csrow = false;
  880. layers[1].type = EDAC_MC_LAYER_SLOT;
  881. layers[1].size = ranksperch;
  882. layers[1].is_virt_csrow = true;
  883. mci = edac_mc_alloc(0, ARRAY_SIZE(layers), layers,
  884. sizeof(*priv));
  885. if (!mci) {
  886. ret = -ENOMEM;
  887. goto bail_disable_ch1;
  888. }
  889. /* device 19, func 0, Error injection */
  890. einj = pci_get_device_func(PCI_VENDOR_ID_INTEL,
  891. PCI_DEVICE_ID_INTEL_5100_19, 0);
  892. if (!einj) {
  893. ret = -ENODEV;
  894. goto bail_einj;
  895. }
  896. rc = pci_enable_device(einj);
  897. if (rc < 0) {
  898. ret = rc;
  899. goto bail_disable_einj;
  900. }
  901. mci->pdev = &pdev->dev;
  902. priv = mci->pvt_info;
  903. priv->ranksperchan = ranksperch;
  904. priv->mc = pdev;
  905. priv->ch0mm = ch0mm;
  906. priv->ch1mm = ch1mm;
  907. priv->einj = einj;
  908. INIT_DELAYED_WORK(&(priv->i5100_scrubbing), i5100_refresh_scrubbing);
  909. /* If scrubbing was already enabled by the bios, start maintaining it */
  910. pci_read_config_dword(pdev, I5100_MC, &dw);
  911. if (i5100_mc_scrben(dw)) {
  912. priv->scrub_enable = 1;
  913. schedule_delayed_work(&(priv->i5100_scrubbing),
  914. I5100_SCRUB_REFRESH_RATE);
  915. }
  916. i5100_init_dimm_layout(pdev, mci);
  917. i5100_init_interleaving(pdev, mci);
  918. mci->mtype_cap = MEM_FLAG_FB_DDR2;
  919. mci->edac_ctl_cap = EDAC_FLAG_SECDED;
  920. mci->edac_cap = EDAC_FLAG_SECDED;
  921. mci->mod_name = "i5100_edac.c";
  922. mci->mod_ver = "not versioned";
  923. mci->ctl_name = "i5100";
  924. mci->dev_name = pci_name(pdev);
  925. mci->ctl_page_to_phys = NULL;
  926. mci->edac_check = i5100_check_error;
  927. mci->set_sdram_scrub_rate = i5100_set_scrub_rate;
  928. mci->get_sdram_scrub_rate = i5100_get_scrub_rate;
  929. priv->inject_channel = 0;
  930. priv->inject_hlinesel = 0;
  931. priv->inject_deviceptr1 = 0;
  932. priv->inject_deviceptr2 = 0;
  933. priv->inject_eccmask1 = 0;
  934. priv->inject_eccmask2 = 0;
  935. i5100_init_csrows(mci);
  936. /* this strange construction seems to be in every driver, dunno why */
  937. switch (edac_op_state) {
  938. case EDAC_OPSTATE_POLL:
  939. case EDAC_OPSTATE_NMI:
  940. break;
  941. default:
  942. edac_op_state = EDAC_OPSTATE_POLL;
  943. break;
  944. }
  945. if (edac_mc_add_mc(mci)) {
  946. ret = -ENODEV;
  947. goto bail_scrub;
  948. }
  949. i5100_setup_debugfs(mci);
  950. return ret;
  951. bail_scrub:
  952. priv->scrub_enable = 0;
  953. cancel_delayed_work_sync(&(priv->i5100_scrubbing));
  954. edac_mc_free(mci);
  955. bail_disable_einj:
  956. pci_disable_device(einj);
  957. bail_einj:
  958. pci_dev_put(einj);
  959. bail_disable_ch1:
  960. pci_disable_device(ch1mm);
  961. bail_ch1:
  962. pci_dev_put(ch1mm);
  963. bail_disable_ch0:
  964. pci_disable_device(ch0mm);
  965. bail_ch0:
  966. pci_dev_put(ch0mm);
  967. bail_pdev:
  968. pci_disable_device(pdev);
  969. bail:
  970. return ret;
  971. }
  972. static void i5100_remove_one(struct pci_dev *pdev)
  973. {
  974. struct mem_ctl_info *mci;
  975. struct i5100_priv *priv;
  976. mci = edac_mc_del_mc(&pdev->dev);
  977. if (!mci)
  978. return;
  979. priv = mci->pvt_info;
  980. edac_debugfs_remove_recursive(priv->debugfs);
  981. priv->scrub_enable = 0;
  982. cancel_delayed_work_sync(&(priv->i5100_scrubbing));
  983. pci_disable_device(pdev);
  984. pci_disable_device(priv->ch0mm);
  985. pci_disable_device(priv->ch1mm);
  986. pci_disable_device(priv->einj);
  987. pci_dev_put(priv->ch0mm);
  988. pci_dev_put(priv->ch1mm);
  989. pci_dev_put(priv->einj);
  990. edac_mc_free(mci);
  991. }
  992. static const struct pci_device_id i5100_pci_tbl[] = {
  993. /* Device 16, Function 0, Channel 0 Memory Map, Error Flag/Mask, ... */
  994. { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5100_16) },
  995. { 0, }
  996. };
  997. MODULE_DEVICE_TABLE(pci, i5100_pci_tbl);
  998. static struct pci_driver i5100_driver = {
  999. .name = KBUILD_BASENAME,
  1000. .probe = i5100_init_one,
  1001. .remove = i5100_remove_one,
  1002. .id_table = i5100_pci_tbl,
  1003. };
  1004. static int __init i5100_init(void)
  1005. {
  1006. int pci_rc;
  1007. i5100_debugfs = edac_debugfs_create_dir_at("i5100_edac", NULL);
  1008. pci_rc = pci_register_driver(&i5100_driver);
  1009. return (pci_rc < 0) ? pci_rc : 0;
  1010. }
  1011. static void __exit i5100_exit(void)
  1012. {
  1013. edac_debugfs_remove(i5100_debugfs);
  1014. pci_unregister_driver(&i5100_driver);
  1015. }
  1016. module_init(i5100_init);
  1017. module_exit(i5100_exit);
  1018. MODULE_LICENSE("GPL");
  1019. MODULE_AUTHOR
  1020. ("Arthur Jones <ajones@riverbed.com>");
  1021. MODULE_DESCRIPTION("MC Driver for Intel I5100 memory controllers");