blob: e0a3b217c52b93cd1da1ada0631573d0e030a319 [file] [log] [blame]
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001/* Intel 7 core Memory Controller kernel module (Nehalem)
2 *
3 * This file may be distributed under the terms of the
4 * GNU General Public License version 2 only.
5 *
6 * Copyright (c) 2009 by:
7 * Mauro Carvalho Chehab <mchehab@redhat.com>
8 *
9 * Red Hat Inc. http://www.redhat.com
10 *
11 * Forked and adapted from the i5400_edac driver
12 *
13 * Based on the following public Intel datasheets:
14 * Intel Core i7 Processor Extreme Edition and Intel Core i7 Processor
15 * Datasheet, Volume 2:
16 * http://download.intel.com/design/processor/datashts/320835.pdf
17 * Intel Xeon Processor 5500 Series Datasheet Volume 2
18 * http://www.intel.com/Assets/PDF/datasheet/321322.pdf
19 * also available at:
20 * http://www.arrownac.com/manufacturers/intel/s/nehalem/5500-datasheet-v2.pdf
21 */
22
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -030023#include <linux/module.h>
24#include <linux/init.h>
25#include <linux/pci.h>
26#include <linux/pci_ids.h>
27#include <linux/slab.h>
28#include <linux/edac.h>
29#include <linux/mmzone.h>
30
31#include "edac_core.h"
32
Mauro Carvalho Chehab7b029d02009-06-22 22:48:29 -030033/* To use the new pci_[read/write]_config_qword instead of two dword */
34#define USE_QWORD 1
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -030035
36/*
37 * Alter this version for the module when modifications are made
38 */
39#define I7CORE_REVISION " Ver: 1.0.0 " __DATE__
40#define EDAC_MOD_STR "i7core_edac"
41
42/* HACK: temporary, just to enable all logs, for now */
43#undef debugf0
44#define debugf0(fmt, arg...) edac_printk(KERN_INFO, "i7core", fmt, ##arg)
45
46/*
47 * Debug macros
48 */
49#define i7core_printk(level, fmt, arg...) \
50 edac_printk(level, "i7core", fmt, ##arg)
51
52#define i7core_mc_printk(mci, level, fmt, arg...) \
53 edac_mc_chipset_printk(mci, level, "i7core", fmt, ##arg)
54
55/*
56 * i7core Memory Controller Registers
57 */
58
59 /* OFFSETS for Device 3 Function 0 */
60
61#define MC_CONTROL 0x48
62#define MC_STATUS 0x4c
63#define MC_MAX_DOD 0x64
64
Mauro Carvalho Chehab442305b2009-06-22 22:48:29 -030065/*
66 * OFFSETS for Device 3 Function 4, as inicated on Xeon 5500 datasheet:
67 * http://www.arrownac.com/manufacturers/intel/s/nehalem/5500-datasheet-v2.pdf
68 */
69
70#define MC_TEST_ERR_RCV1 0x60
71 #define DIMM2_COR_ERR(r) ((r) & 0x7fff)
72
73#define MC_TEST_ERR_RCV0 0x64
74 #define DIMM1_COR_ERR(r) (((r) >> 16) & 0x7fff)
75 #define DIMM0_COR_ERR(r) ((r) & 0x7fff)
76
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -030077 /* OFFSETS for Devices 4,5 and 6 Function 0 */
78
Mauro Carvalho Chehab0b2b7b72009-06-22 22:48:29 -030079#define MC_CHANNEL_DIMM_INIT_PARAMS 0x58
80 #define THREE_DIMMS_PRESENT (1 << 24)
81 #define SINGLE_QUAD_RANK_PRESENT (1 << 23)
82 #define QUAD_RANK_PRESENT (1 << 22)
83 #define REGISTERED_DIMM (1 << 15)
84
Mauro Carvalho Chehabf122a892009-06-22 22:48:29 -030085#define MC_CHANNEL_MAPPER 0x60
86 #define RDLCH(r, ch) ((((r) >> (3 + (ch * 6))) & 0x07) - 1)
87 #define WRLCH(r, ch) ((((r) >> (ch * 6)) & 0x07) - 1)
88
Mauro Carvalho Chehab0b2b7b72009-06-22 22:48:29 -030089#define MC_CHANNEL_RANK_PRESENT 0x7c
90 #define RANK_PRESENT_MASK 0xffff
91
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -030092#define MC_CHANNEL_ADDR_MATCH 0xf0
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -030093#define MC_CHANNEL_ERROR_MASK 0xf8
94#define MC_CHANNEL_ERROR_INJECT 0xfc
95 #define INJECT_ADDR_PARITY 0x10
96 #define INJECT_ECC 0x08
97 #define MASK_CACHELINE 0x06
98 #define MASK_FULL_CACHELINE 0x06
99 #define MASK_MSB32_CACHELINE 0x04
100 #define MASK_LSB32_CACHELINE 0x02
101 #define NO_MASK_CACHELINE 0x00
102 #define REPEAT_EN 0x01
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300103
Mauro Carvalho Chehab0b2b7b72009-06-22 22:48:29 -0300104 /* OFFSETS for Devices 4,5 and 6 Function 1 */
105#define MC_DOD_CH_DIMM0 0x48
106#define MC_DOD_CH_DIMM1 0x4c
107#define MC_DOD_CH_DIMM2 0x50
108 #define RANKOFFSET_MASK ((1 << 12) | (1 << 11) | (1 << 10))
109 #define RANKOFFSET(x) ((x & RANKOFFSET_MASK) >> 10)
110 #define DIMM_PRESENT_MASK (1 << 9)
111 #define DIMM_PRESENT(x) (((x) & DIMM_PRESENT_MASK) >> 9)
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300112 #define MC_DOD_NUMBANK_MASK ((1 << 8) | (1 << 7))
113 #define MC_DOD_NUMBANK(x) (((x) & MC_DOD_NUMBANK_MASK) >> 7)
114 #define MC_DOD_NUMRANK_MASK ((1 << 6) | (1 << 5))
115 #define MC_DOD_NUMRANK(x) (((x) & MC_DOD_NUMRANK_MASK) >> 5)
Mauro Carvalho Chehab5566cb72009-06-22 22:48:31 -0300116 #define MC_DOD_NUMROW_MASK ((1 << 4) | (1 << 3)| (1 << 2))
117 #define MC_DOD_NUMROW(x) (((x) & MC_DOD_NUMROW_MASK) >> 2)
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300118 #define MC_DOD_NUMCOL_MASK 3
119 #define MC_DOD_NUMCOL(x) ((x) & MC_DOD_NUMCOL_MASK)
Mauro Carvalho Chehab0b2b7b72009-06-22 22:48:29 -0300120
Mauro Carvalho Chehabf122a892009-06-22 22:48:29 -0300121#define MC_RANK_PRESENT 0x7c
122
Mauro Carvalho Chehab0b2b7b72009-06-22 22:48:29 -0300123#define MC_SAG_CH_0 0x80
124#define MC_SAG_CH_1 0x84
125#define MC_SAG_CH_2 0x88
126#define MC_SAG_CH_3 0x8c
127#define MC_SAG_CH_4 0x90
128#define MC_SAG_CH_5 0x94
129#define MC_SAG_CH_6 0x98
130#define MC_SAG_CH_7 0x9c
131
132#define MC_RIR_LIMIT_CH_0 0x40
133#define MC_RIR_LIMIT_CH_1 0x44
134#define MC_RIR_LIMIT_CH_2 0x48
135#define MC_RIR_LIMIT_CH_3 0x4C
136#define MC_RIR_LIMIT_CH_4 0x50
137#define MC_RIR_LIMIT_CH_5 0x54
138#define MC_RIR_LIMIT_CH_6 0x58
139#define MC_RIR_LIMIT_CH_7 0x5C
140#define MC_RIR_LIMIT_MASK ((1 << 10) - 1)
141
142#define MC_RIR_WAY_CH 0x80
143 #define MC_RIR_WAY_OFFSET_MASK (((1 << 14) - 1) & ~0x7)
144 #define MC_RIR_WAY_RANK_MASK 0x7
145
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300146/*
147 * i7core structs
148 */
149
150#define NUM_CHANS 3
Mauro Carvalho Chehab442305b2009-06-22 22:48:29 -0300151#define MAX_DIMMS 3 /* Max DIMMS per channel */
152#define MAX_MCR_FUNC 4
153#define MAX_CHAN_FUNC 3
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300154
155struct i7core_info {
156 u32 mc_control;
157 u32 mc_status;
158 u32 max_dod;
Mauro Carvalho Chehabf122a892009-06-22 22:48:29 -0300159 u32 ch_map;
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300160};
161
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300162
163struct i7core_inject {
164 int enable;
165
166 u32 section;
167 u32 type;
168 u32 eccmask;
169
170 /* Error address mask */
171 int channel, dimm, rank, bank, page, col;
172};
173
Mauro Carvalho Chehab0b2b7b72009-06-22 22:48:29 -0300174struct i7core_channel {
Mauro Carvalho Chehab442305b2009-06-22 22:48:29 -0300175 u32 ranks;
176 u32 dimms;
Mauro Carvalho Chehab0b2b7b72009-06-22 22:48:29 -0300177};
178
Mauro Carvalho Chehab8f331902009-06-22 22:48:29 -0300179struct pci_id_descr {
180 int dev;
181 int func;
182 int dev_id;
183 struct pci_dev *pdev;
184};
185
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300186struct i7core_pvt {
Mauro Carvalho Chehab442305b2009-06-22 22:48:29 -0300187 struct pci_dev *pci_mcr[MAX_MCR_FUNC + 1];
188 struct pci_dev *pci_ch[NUM_CHANS][MAX_CHAN_FUNC + 1];
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300189 struct i7core_info info;
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300190 struct i7core_inject inject;
Mauro Carvalho Chehab0b2b7b72009-06-22 22:48:29 -0300191 struct i7core_channel channel[NUM_CHANS];
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -0300192 int channels; /* Number of active channels */
Mauro Carvalho Chehab442305b2009-06-22 22:48:29 -0300193
194 int ce_count_available;
195 unsigned long ce_count[MAX_DIMMS]; /* ECC corrected errors counts per dimm */
196 int last_ce_count[MAX_DIMMS];
197
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300198};
199
200/* Device name and register DID (Device ID) */
201struct i7core_dev_info {
202 const char *ctl_name; /* name for this device */
203 u16 fsb_mapping_errors; /* DID for the branchmap,control */
204};
205
Mauro Carvalho Chehab8f331902009-06-22 22:48:29 -0300206#define PCI_DESCR(device, function, device_id) \
207 .dev = (device), \
208 .func = (function), \
209 .dev_id = (device_id)
210
211struct pci_id_descr pci_devs[] = {
212 /* Memory controller */
213 { PCI_DESCR(3, 0, PCI_DEVICE_ID_INTEL_I7_MCR) },
214 { PCI_DESCR(3, 1, PCI_DEVICE_ID_INTEL_I7_MC_TAD) },
215 { PCI_DESCR(3, 2, PCI_DEVICE_ID_INTEL_I7_MC_RAS) }, /* if RDIMM is supported */
216 { PCI_DESCR(3, 4, PCI_DEVICE_ID_INTEL_I7_MC_TEST) },
217
218 /* Channel 0 */
219 { PCI_DESCR(4, 0, PCI_DEVICE_ID_INTEL_I7_MC_CH0_CTRL) },
220 { PCI_DESCR(4, 1, PCI_DEVICE_ID_INTEL_I7_MC_CH0_ADDR) },
221 { PCI_DESCR(4, 2, PCI_DEVICE_ID_INTEL_I7_MC_CH0_RANK) },
222 { PCI_DESCR(4, 3, PCI_DEVICE_ID_INTEL_I7_MC_CH0_TC) },
223
224 /* Channel 1 */
225 { PCI_DESCR(5, 0, PCI_DEVICE_ID_INTEL_I7_MC_CH1_CTRL) },
226 { PCI_DESCR(5, 1, PCI_DEVICE_ID_INTEL_I7_MC_CH1_ADDR) },
227 { PCI_DESCR(5, 2, PCI_DEVICE_ID_INTEL_I7_MC_CH1_RANK) },
228 { PCI_DESCR(5, 3, PCI_DEVICE_ID_INTEL_I7_MC_CH1_TC) },
229
230 /* Channel 2 */
231 { PCI_DESCR(6, 0, PCI_DEVICE_ID_INTEL_I7_MC_CH2_CTRL) },
232 { PCI_DESCR(6, 1, PCI_DEVICE_ID_INTEL_I7_MC_CH2_ADDR) },
233 { PCI_DESCR(6, 2, PCI_DEVICE_ID_INTEL_I7_MC_CH2_RANK) },
234 { PCI_DESCR(6, 3, PCI_DEVICE_ID_INTEL_I7_MC_CH2_TC) },
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300235};
Mauro Carvalho Chehab8f331902009-06-22 22:48:29 -0300236#define N_DEVS ARRAY_SIZE(pci_devs)
237
238/*
239 * pci_device_id table for which devices we are looking for
240 * This should match the first device at pci_devs table
241 */
242static const struct pci_device_id i7core_pci_tbl[] __devinitdata = {
243 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_I7_MCR)},
244 {0,} /* 0 terminated list. */
245};
246
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300247
248/* Table of devices attributes supported by this driver */
249static const struct i7core_dev_info i7core_devs[] = {
250 {
251 .ctl_name = "i7 Core",
252 .fsb_mapping_errors = PCI_DEVICE_ID_INTEL_I7_MCR,
253 },
254};
255
256static struct edac_pci_ctl_info *i7core_pci;
257
258/****************************************************************************
259 Anciliary status routines
260 ****************************************************************************/
261
262 /* MC_CONTROL bits */
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -0300263#define CH_ACTIVE(pvt, ch) ((pvt)->info.mc_control & (1 << (8 + ch)))
264#define ECCx8(pvt) ((pvt)->info.mc_control & (1 << 1))
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300265
266 /* MC_STATUS bits */
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -0300267#define ECC_ENABLED(pvt) ((pvt)->info.mc_status & (1 << 3))
268#define CH_DISABLED(pvt, ch) ((pvt)->info.mc_status & (1 << ch))
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300269
270 /* MC_MAX_DOD read functions */
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300271static inline int numdimms(u32 dimms)
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300272{
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300273 return (dimms & 0x3) + 1;
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300274}
275
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300276static inline int numrank(u32 rank)
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300277{
278 static int ranks[4] = { 1, 2, 4, -EINVAL };
279
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300280 return ranks[rank & 0x3];
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300281}
282
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300283static inline int numbank(u32 bank)
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300284{
285 static int banks[4] = { 4, 8, 16, -EINVAL };
286
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300287 return banks[bank & 0x3];
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300288}
289
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300290static inline int numrow(u32 row)
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300291{
292 static int rows[8] = {
293 1 << 12, 1 << 13, 1 << 14, 1 << 15,
294 1 << 16, -EINVAL, -EINVAL, -EINVAL,
295 };
296
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300297 return rows[row & 0x7];
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300298}
299
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300300static inline int numcol(u32 col)
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300301{
302 static int cols[8] = {
303 1 << 10, 1 << 11, 1 << 12, -EINVAL,
304 };
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300305 return cols[col & 0x3];
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300306}
307
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300308
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300309/****************************************************************************
310 Memory check routines
311 ****************************************************************************/
Mauro Carvalho Chehabeb94fc42009-06-22 22:48:31 -0300312static struct pci_dev *get_pdev_slot_func(int slot, int func)
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -0300313{
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -0300314 int i;
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -0300315
316 for (i = 0; i < N_DEVS; i++) {
317 if (!pci_devs[i].pdev)
318 continue;
319
Mauro Carvalho Chehabeb94fc42009-06-22 22:48:31 -0300320 if (PCI_SLOT(pci_devs[i].pdev->devfn) == slot &&
321 PCI_FUNC(pci_devs[i].pdev->devfn) == func) {
322 return pci_devs[i].pdev;
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -0300323 }
324 }
325
Mauro Carvalho Chehabeb94fc42009-06-22 22:48:31 -0300326 return NULL;
327}
328
329static int i7core_get_active_channels(int *channels, int *csrows)
330{
331 struct pci_dev *pdev = NULL;
332 int i, j;
333 u32 status, control;
334
335 *channels = 0;
336 *csrows = 0;
337
338 pdev = get_pdev_slot_func(3, 0);
Mauro Carvalho Chehabb7c76152009-06-22 22:48:30 -0300339 if (!pdev) {
340 i7core_printk(KERN_ERR, "Couldn't find fn 3.0!!!\n");
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -0300341 return -ENODEV;
Mauro Carvalho Chehabb7c76152009-06-22 22:48:30 -0300342 }
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -0300343
344 /* Device 3 function 0 reads */
345 pci_read_config_dword(pdev, MC_STATUS, &status);
346 pci_read_config_dword(pdev, MC_CONTROL, &control);
347
348 for (i = 0; i < NUM_CHANS; i++) {
Mauro Carvalho Chehabeb94fc42009-06-22 22:48:31 -0300349 u32 dimm_dod[3];
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -0300350 /* Check if the channel is active */
351 if (!(control & (1 << (8 + i))))
352 continue;
353
354 /* Check if the channel is disabled */
355 if (status & (1 << i)) {
356 continue;
357 }
358
Mauro Carvalho Chehabeb94fc42009-06-22 22:48:31 -0300359 pdev = get_pdev_slot_func(i + 4, 1);
360 if (!pdev) {
361 i7core_printk(KERN_ERR, "Couldn't find fn %d.%d!!!\n",
362 i + 4, 1);
363 return -ENODEV;
364 }
365 /* Devices 4-6 function 1 */
366 pci_read_config_dword(pdev,
367 MC_DOD_CH_DIMM0, &dimm_dod[0]);
368 pci_read_config_dword(pdev,
369 MC_DOD_CH_DIMM1, &dimm_dod[1]);
370 pci_read_config_dword(pdev,
371 MC_DOD_CH_DIMM2, &dimm_dod[2]);
372
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -0300373 (*channels)++;
Mauro Carvalho Chehabeb94fc42009-06-22 22:48:31 -0300374
375 for (j = 0; j < 3; j++) {
376 if (!DIMM_PRESENT(dimm_dod[j]))
377 continue;
378 (*csrows)++;
379 }
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -0300380 }
381
Mauro Carvalho Chehab1c6fed82009-06-22 22:48:30 -0300382 debugf0("Number of active channels: %d\n", *channels);
383
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -0300384 return 0;
385}
386
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300387static int get_dimm_config(struct mem_ctl_info *mci)
388{
389 struct i7core_pvt *pvt = mci->pvt_info;
Mauro Carvalho Chehab1c6fed82009-06-22 22:48:30 -0300390 struct csrow_info *csr;
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300391 struct pci_dev *pdev;
Mauro Carvalho Chehab7dd69532009-06-22 22:48:30 -0300392 int i, j, csrow = 0;
Mauro Carvalho Chehab5566cb72009-06-22 22:48:31 -0300393 unsigned long last_page = 0;
Mauro Carvalho Chehab1c6fed82009-06-22 22:48:30 -0300394 enum edac_type mode;
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300395 enum mem_type mtype;
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300396
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300397 /* Get data from the MC register, function 0 */
398 pdev = pvt->pci_mcr[0];
Mauro Carvalho Chehab7dd69532009-06-22 22:48:30 -0300399 if (!pdev)
Mauro Carvalho Chehab8f331902009-06-22 22:48:29 -0300400 return -ENODEV;
401
Mauro Carvalho Chehabf122a892009-06-22 22:48:29 -0300402 /* Device 3 function 0 reads */
Mauro Carvalho Chehab7dd69532009-06-22 22:48:30 -0300403 pci_read_config_dword(pdev, MC_CONTROL, &pvt->info.mc_control);
404 pci_read_config_dword(pdev, MC_STATUS, &pvt->info.mc_status);
405 pci_read_config_dword(pdev, MC_MAX_DOD, &pvt->info.max_dod);
406 pci_read_config_dword(pdev, MC_CHANNEL_MAPPER, &pvt->info.ch_map);
Mauro Carvalho Chehabf122a892009-06-22 22:48:29 -0300407
408 debugf0("MC control=0x%08x status=0x%08x dod=0x%08x map=0x%08x\n",
409 pvt->info.mc_control, pvt->info.mc_status,
410 pvt->info.max_dod, pvt->info.ch_map);
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300411
Mauro Carvalho Chehab1c6fed82009-06-22 22:48:30 -0300412 if (ECC_ENABLED(pvt)) {
Mauro Carvalho Chehab5566cb72009-06-22 22:48:31 -0300413 debugf0("ECC enabled with x%d SDCC\n", ECCx8(pvt) ?8:4);
Mauro Carvalho Chehab1c6fed82009-06-22 22:48:30 -0300414 if (ECCx8(pvt))
415 mode = EDAC_S8ECD8ED;
416 else
417 mode = EDAC_S4ECD4ED;
418 } else {
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300419 debugf0("ECC disabled\n");
Mauro Carvalho Chehab1c6fed82009-06-22 22:48:30 -0300420 mode = EDAC_NONE;
421 }
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300422
423 /* FIXME: need to handle the error codes */
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300424 debugf0("DOD Max limits: DIMMS: %d, %d-ranked, %d-banked\n",
425 numdimms(pvt->info.max_dod),
426 numrank(pvt->info.max_dod >> 2),
427 numbank(pvt->info.max_dod >> 4));
428 debugf0("DOD Max rows x colums = 0x%x x 0x%x\n",
429 numrow(pvt->info.max_dod >> 6),
430 numcol(pvt->info.max_dod >> 9));
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300431
Mauro Carvalho Chehab0b2b7b72009-06-22 22:48:29 -0300432 debugf0("Memory channel configuration:\n");
433
434 for (i = 0; i < NUM_CHANS; i++) {
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300435 u32 data, dimm_dod[3], value[8];
Mauro Carvalho Chehab0b2b7b72009-06-22 22:48:29 -0300436
437 if (!CH_ACTIVE(pvt, i)) {
438 debugf0("Channel %i is not active\n", i);
439 continue;
440 }
441 if (CH_DISABLED(pvt, i)) {
442 debugf0("Channel %i is disabled\n", i);
443 continue;
444 }
445
Mauro Carvalho Chehabf122a892009-06-22 22:48:29 -0300446 /* Devices 4-6 function 0 */
Mauro Carvalho Chehab0b2b7b72009-06-22 22:48:29 -0300447 pci_read_config_dword(pvt->pci_ch[i][0],
448 MC_CHANNEL_DIMM_INIT_PARAMS, &data);
449
450 pvt->channel[i].ranks = (data & QUAD_RANK_PRESENT)? 4 : 2;
451
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300452 if (data & REGISTERED_DIMM)
453 mtype = MEM_RDDR3;
454 else
455 mtype = MEM_DDR3;
456#if 0
Mauro Carvalho Chehab0b2b7b72009-06-22 22:48:29 -0300457 if (data & THREE_DIMMS_PRESENT)
458 pvt->channel[i].dimms = 3;
459 else if (data & SINGLE_QUAD_RANK_PRESENT)
460 pvt->channel[i].dimms = 1;
461 else
462 pvt->channel[i].dimms = 2;
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300463#endif
464
465 /* Devices 4-6 function 1 */
466 pci_read_config_dword(pvt->pci_ch[i][1],
467 MC_DOD_CH_DIMM0, &dimm_dod[0]);
468 pci_read_config_dword(pvt->pci_ch[i][1],
469 MC_DOD_CH_DIMM1, &dimm_dod[1]);
470 pci_read_config_dword(pvt->pci_ch[i][1],
471 MC_DOD_CH_DIMM2, &dimm_dod[2]);
Mauro Carvalho Chehab0b2b7b72009-06-22 22:48:29 -0300472
Mauro Carvalho Chehab1c6fed82009-06-22 22:48:30 -0300473 debugf0("Ch%d phy rd%d, wr%d (0x%08x): "
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300474 "%d ranks, %cDIMMs\n",
Mauro Carvalho Chehab1c6fed82009-06-22 22:48:30 -0300475 i,
476 RDLCH(pvt->info.ch_map, i), WRLCH(pvt->info.ch_map, i),
477 data,
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300478 pvt->channel[i].ranks,
479 (data & REGISTERED_DIMM)? 'R' : 'U');
Mauro Carvalho Chehab7dd69532009-06-22 22:48:30 -0300480
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300481 for (j = 0; j < 3; j++) {
482 u32 banks, ranks, rows, cols;
Mauro Carvalho Chehab5566cb72009-06-22 22:48:31 -0300483 u32 size, npages;
Mauro Carvalho Chehab1c6fed82009-06-22 22:48:30 -0300484
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300485 if (!DIMM_PRESENT(dimm_dod[j]))
486 continue;
Mauro Carvalho Chehab1c6fed82009-06-22 22:48:30 -0300487
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300488 banks = numbank(MC_DOD_NUMBANK(dimm_dod[j]));
489 ranks = numrank(MC_DOD_NUMRANK(dimm_dod[j]));
490 rows = numrow(MC_DOD_NUMROW(dimm_dod[j]));
491 cols = numcol(MC_DOD_NUMCOL(dimm_dod[j]));
Mauro Carvalho Chehab1c6fed82009-06-22 22:48:30 -0300492
Mauro Carvalho Chehab5566cb72009-06-22 22:48:31 -0300493 /* DDR3 has 8 I/O banks */
494 size = (rows * cols * banks * ranks) >> (20 - 3);
495
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300496 pvt->channel[i].dimms++;
497
Mauro Carvalho Chehab5566cb72009-06-22 22:48:31 -0300498 debugf0("\tdimm %d (0x%08x) %d Mb offset: %x, "
499 "numbank: %d,\n\t\t"
500 "numrank: %d, numrow: %#x, numcol: %#x\n",
501 j, dimm_dod[j], size,
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300502 RANKOFFSET(dimm_dod[j]),
503 banks, ranks, rows, cols);
504
Mauro Carvalho Chehabeb94fc42009-06-22 22:48:31 -0300505#if PAGE_SHIFT > 20
506 npages = size >> (PAGE_SHIFT - 20);
507#else
508 npages = size << (20 - PAGE_SHIFT);
509#endif
Mauro Carvalho Chehab5566cb72009-06-22 22:48:31 -0300510
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300511 csr = &mci->csrows[csrow];
Mauro Carvalho Chehab5566cb72009-06-22 22:48:31 -0300512 csr->first_page = last_page + 1;
513 last_page += npages;
514 csr->last_page = last_page;
515 csr->nr_pages = npages;
516
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300517 csr->page_mask = 0;
Mauro Carvalho Chehabeb94fc42009-06-22 22:48:31 -0300518 csr->grain = 8;
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300519 csr->csrow_idx = csrow;
Mauro Carvalho Chehabeb94fc42009-06-22 22:48:31 -0300520 csr->nr_channels = 1;
521
522 csr->channels[0].chan_idx = i;
523 csr->channels[0].ce_count = 0;
Mauro Carvalho Chehab854d3342009-06-22 22:48:30 -0300524
525 switch (banks) {
526 case 4:
527 csr->dtype = DEV_X4;
528 break;
529 case 8:
530 csr->dtype = DEV_X8;
531 break;
532 case 16:
533 csr->dtype = DEV_X16;
534 break;
535 default:
536 csr->dtype = DEV_UNKNOWN;
537 }
538
539 csr->edac_mode = mode;
540 csr->mtype = mtype;
541
542 csrow++;
543 }
544
545 pci_read_config_dword(pdev, MC_SAG_CH_0, &value[0]);
546 pci_read_config_dword(pdev, MC_SAG_CH_1, &value[1]);
547 pci_read_config_dword(pdev, MC_SAG_CH_2, &value[2]);
548 pci_read_config_dword(pdev, MC_SAG_CH_3, &value[3]);
549 pci_read_config_dword(pdev, MC_SAG_CH_4, &value[4]);
550 pci_read_config_dword(pdev, MC_SAG_CH_5, &value[5]);
551 pci_read_config_dword(pdev, MC_SAG_CH_6, &value[6]);
552 pci_read_config_dword(pdev, MC_SAG_CH_7, &value[7]);
553 printk("\t[%i] DIVBY3\tREMOVED\tOFFSET\n", i);
554 for (j = 0; j < 8; j++)
555 printk("\t\t%#x\t%#x\t%#x\n",
556 (value[j] >> 27) & 0x1,
557 (value[j] >> 24) & 0x7,
558 (value[j] && ((1 << 24) - 1)));
Mauro Carvalho Chehab0b2b7b72009-06-22 22:48:29 -0300559 }
560
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -0300561 return 0;
562}
563
564/****************************************************************************
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300565 Error insertion routines
566 ****************************************************************************/
567
568/* The i7core has independent error injection features per channel.
569 However, to have a simpler code, we don't allow enabling error injection
570 on more than one channel.
571 Also, since a change at an inject parameter will be applied only at enable,
572 we're disabling error injection on all write calls to the sysfs nodes that
573 controls the error code injection.
574 */
Mauro Carvalho Chehab8f331902009-06-22 22:48:29 -0300575static int disable_inject(struct mem_ctl_info *mci)
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300576{
577 struct i7core_pvt *pvt = mci->pvt_info;
578
579 pvt->inject.enable = 0;
580
Mauro Carvalho Chehab8f331902009-06-22 22:48:29 -0300581 if (!pvt->pci_ch[pvt->inject.channel][0])
582 return -ENODEV;
583
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300584 pci_write_config_dword(pvt->pci_ch[pvt->inject.channel][0],
585 MC_CHANNEL_ERROR_MASK, 0);
Mauro Carvalho Chehab8f331902009-06-22 22:48:29 -0300586
587 return 0;
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300588}
589
590/*
591 * i7core inject inject.section
592 *
593 * accept and store error injection inject.section value
594 * bit 0 - refers to the lower 32-byte half cacheline
595 * bit 1 - refers to the upper 32-byte half cacheline
596 */
597static ssize_t i7core_inject_section_store(struct mem_ctl_info *mci,
598 const char *data, size_t count)
599{
600 struct i7core_pvt *pvt = mci->pvt_info;
601 unsigned long value;
602 int rc;
603
604 if (pvt->inject.enable)
605 disable_inject(mci);
606
607 rc = strict_strtoul(data, 10, &value);
608 if ((rc < 0) || (value > 3))
609 return 0;
610
611 pvt->inject.section = (u32) value;
612 return count;
613}
614
615static ssize_t i7core_inject_section_show(struct mem_ctl_info *mci,
616 char *data)
617{
618 struct i7core_pvt *pvt = mci->pvt_info;
619 return sprintf(data, "0x%08x\n", pvt->inject.section);
620}
621
622/*
623 * i7core inject.type
624 *
625 * accept and store error injection inject.section value
626 * bit 0 - repeat enable - Enable error repetition
627 * bit 1 - inject ECC error
628 * bit 2 - inject parity error
629 */
630static ssize_t i7core_inject_type_store(struct mem_ctl_info *mci,
631 const char *data, size_t count)
632{
633 struct i7core_pvt *pvt = mci->pvt_info;
634 unsigned long value;
635 int rc;
636
637 if (pvt->inject.enable)
638 disable_inject(mci);
639
640 rc = strict_strtoul(data, 10, &value);
641 if ((rc < 0) || (value > 7))
642 return 0;
643
644 pvt->inject.type = (u32) value;
645 return count;
646}
647
648static ssize_t i7core_inject_type_show(struct mem_ctl_info *mci,
649 char *data)
650{
651 struct i7core_pvt *pvt = mci->pvt_info;
652 return sprintf(data, "0x%08x\n", pvt->inject.type);
653}
654
655/*
656 * i7core_inject_inject.eccmask_store
657 *
658 * The type of error (UE/CE) will depend on the inject.eccmask value:
659 * Any bits set to a 1 will flip the corresponding ECC bit
660 * Correctable errors can be injected by flipping 1 bit or the bits within
661 * a symbol pair (2 consecutive aligned 8-bit pairs - i.e. 7:0 and 15:8 or
662 * 23:16 and 31:24). Flipping bits in two symbol pairs will cause an
663 * uncorrectable error to be injected.
664 */
665static ssize_t i7core_inject_eccmask_store(struct mem_ctl_info *mci,
666 const char *data, size_t count)
667{
668 struct i7core_pvt *pvt = mci->pvt_info;
669 unsigned long value;
670 int rc;
671
672 if (pvt->inject.enable)
673 disable_inject(mci);
674
675 rc = strict_strtoul(data, 10, &value);
676 if (rc < 0)
677 return 0;
678
679 pvt->inject.eccmask = (u32) value;
680 return count;
681}
682
683static ssize_t i7core_inject_eccmask_show(struct mem_ctl_info *mci,
684 char *data)
685{
686 struct i7core_pvt *pvt = mci->pvt_info;
687 return sprintf(data, "0x%08x\n", pvt->inject.eccmask);
688}
689
690/*
691 * i7core_addrmatch
692 *
693 * The type of error (UE/CE) will depend on the inject.eccmask value:
694 * Any bits set to a 1 will flip the corresponding ECC bit
695 * Correctable errors can be injected by flipping 1 bit or the bits within
696 * a symbol pair (2 consecutive aligned 8-bit pairs - i.e. 7:0 and 15:8 or
697 * 23:16 and 31:24). Flipping bits in two symbol pairs will cause an
698 * uncorrectable error to be injected.
699 */
700static ssize_t i7core_inject_addrmatch_store(struct mem_ctl_info *mci,
701 const char *data, size_t count)
702{
703 struct i7core_pvt *pvt = mci->pvt_info;
704 char *cmd, *val;
705 long value;
706 int rc;
707
708 if (pvt->inject.enable)
709 disable_inject(mci);
710
711 do {
712 cmd = strsep((char **) &data, ":");
713 if (!cmd)
714 break;
715 val = strsep((char **) &data, " \n\t");
716 if (!val)
717 return cmd - data;
718
719 if (!strcasecmp(val,"any"))
720 value = -1;
721 else {
722 rc = strict_strtol(val, 10, &value);
723 if ((rc < 0) || (value < 0))
724 return cmd - data;
725 }
726
727 if (!strcasecmp(cmd,"channel")) {
728 if (value < 3)
729 pvt->inject.channel = value;
730 else
731 return cmd - data;
732 } else if (!strcasecmp(cmd,"dimm")) {
733 if (value < 4)
734 pvt->inject.dimm = value;
735 else
736 return cmd - data;
737 } else if (!strcasecmp(cmd,"rank")) {
738 if (value < 4)
739 pvt->inject.rank = value;
740 else
741 return cmd - data;
742 } else if (!strcasecmp(cmd,"bank")) {
743 if (value < 4)
744 pvt->inject.bank = value;
745 else
746 return cmd - data;
747 } else if (!strcasecmp(cmd,"page")) {
748 if (value <= 0xffff)
749 pvt->inject.page = value;
750 else
751 return cmd - data;
752 } else if (!strcasecmp(cmd,"col") ||
753 !strcasecmp(cmd,"column")) {
754 if (value <= 0x3fff)
755 pvt->inject.col = value;
756 else
757 return cmd - data;
758 }
759 } while (1);
760
761 return count;
762}
763
764static ssize_t i7core_inject_addrmatch_show(struct mem_ctl_info *mci,
765 char *data)
766{
767 struct i7core_pvt *pvt = mci->pvt_info;
768 char channel[4], dimm[4], bank[4], rank[4], page[7], col[7];
769
770 if (pvt->inject.channel < 0)
771 sprintf(channel, "any");
772 else
773 sprintf(channel, "%d", pvt->inject.channel);
774 if (pvt->inject.dimm < 0)
775 sprintf(dimm, "any");
776 else
777 sprintf(dimm, "%d", pvt->inject.dimm);
778 if (pvt->inject.bank < 0)
779 sprintf(bank, "any");
780 else
781 sprintf(bank, "%d", pvt->inject.bank);
782 if (pvt->inject.rank < 0)
783 sprintf(rank, "any");
784 else
785 sprintf(rank, "%d", pvt->inject.rank);
786 if (pvt->inject.page < 0)
787 sprintf(page, "any");
788 else
789 sprintf(page, "0x%04x", pvt->inject.page);
790 if (pvt->inject.col < 0)
791 sprintf(col, "any");
792 else
793 sprintf(col, "0x%04x", pvt->inject.col);
794
795 return sprintf(data, "channel: %s\ndimm: %s\nbank: %s\n"
796 "rank: %s\npage: %s\ncolumn: %s\n",
797 channel, dimm, bank, rank, page, col);
798}
799
800/*
801 * This routine prepares the Memory Controller for error injection.
802 * The error will be injected when some process tries to write to the
803 * memory that matches the given criteria.
804 * The criteria can be set in terms of a mask where dimm, rank, bank, page
805 * and col can be specified.
806 * A -1 value for any of the mask items will make the MCU to ignore
807 * that matching criteria for error injection.
808 *
809 * It should be noticed that the error will only happen after a write operation
810 * on a memory that matches the condition. if REPEAT_EN is not enabled at
811 * inject mask, then it will produce just one error. Otherwise, it will repeat
812 * until the injectmask would be cleaned.
813 *
814 * FIXME: This routine assumes that MAXNUMDIMMS value of MC_MAX_DOD
815 * is reliable enough to check if the MC is using the
816 * three channels. However, this is not clear at the datasheet.
817 */
818static ssize_t i7core_inject_enable_store(struct mem_ctl_info *mci,
819 const char *data, size_t count)
820{
821 struct i7core_pvt *pvt = mci->pvt_info;
822 u32 injectmask;
823 u64 mask = 0;
824 int rc;
825 long enable;
826
Mauro Carvalho Chehab8f331902009-06-22 22:48:29 -0300827 if (!pvt->pci_ch[pvt->inject.channel][0])
828 return 0;
829
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300830 rc = strict_strtoul(data, 10, &enable);
831 if ((rc < 0))
832 return 0;
833
834 if (enable) {
835 pvt->inject.enable = 1;
836 } else {
837 disable_inject(mci);
838 return count;
839 }
840
841 /* Sets pvt->inject.dimm mask */
842 if (pvt->inject.dimm < 0)
Mauro Carvalho Chehab7b029d02009-06-22 22:48:29 -0300843 mask |= 1L << 41;
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300844 else {
Mauro Carvalho Chehab0b2b7b72009-06-22 22:48:29 -0300845 if (pvt->channel[pvt->inject.channel].dimms > 2)
Mauro Carvalho Chehab7b029d02009-06-22 22:48:29 -0300846 mask |= (pvt->inject.dimm & 0x3L) << 35;
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300847 else
Mauro Carvalho Chehab7b029d02009-06-22 22:48:29 -0300848 mask |= (pvt->inject.dimm & 0x1L) << 36;
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300849 }
850
851 /* Sets pvt->inject.rank mask */
852 if (pvt->inject.rank < 0)
Mauro Carvalho Chehab7b029d02009-06-22 22:48:29 -0300853 mask |= 1L << 40;
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300854 else {
Mauro Carvalho Chehab0b2b7b72009-06-22 22:48:29 -0300855 if (pvt->channel[pvt->inject.channel].dimms > 2)
Mauro Carvalho Chehab7b029d02009-06-22 22:48:29 -0300856 mask |= (pvt->inject.rank & 0x1L) << 34;
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300857 else
Mauro Carvalho Chehab7b029d02009-06-22 22:48:29 -0300858 mask |= (pvt->inject.rank & 0x3L) << 34;
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300859 }
860
861 /* Sets pvt->inject.bank mask */
862 if (pvt->inject.bank < 0)
Mauro Carvalho Chehab7b029d02009-06-22 22:48:29 -0300863 mask |= 1L << 39;
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300864 else
Mauro Carvalho Chehab7b029d02009-06-22 22:48:29 -0300865 mask |= (pvt->inject.bank & 0x15L) << 30;
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300866
867 /* Sets pvt->inject.page mask */
868 if (pvt->inject.page < 0)
Mauro Carvalho Chehab7b029d02009-06-22 22:48:29 -0300869 mask |= 1L << 38;
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300870 else
Mauro Carvalho Chehab7b029d02009-06-22 22:48:29 -0300871 mask |= (pvt->inject.page & 0xffffL) << 14;
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300872
873 /* Sets pvt->inject.column mask */
874 if (pvt->inject.col < 0)
Mauro Carvalho Chehab7b029d02009-06-22 22:48:29 -0300875 mask |= 1L << 37;
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300876 else
Mauro Carvalho Chehab7b029d02009-06-22 22:48:29 -0300877 mask |= (pvt->inject.col & 0x3fffL);
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300878
Mauro Carvalho Chehab7b029d02009-06-22 22:48:29 -0300879#if USE_QWORD
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300880 pci_write_config_qword(pvt->pci_ch[pvt->inject.channel][0],
881 MC_CHANNEL_ADDR_MATCH, mask);
Mauro Carvalho Chehab7b029d02009-06-22 22:48:29 -0300882#else
883 pci_write_config_dword(pvt->pci_ch[pvt->inject.channel][0],
884 MC_CHANNEL_ADDR_MATCH, mask);
885 pci_write_config_dword(pvt->pci_ch[pvt->inject.channel][0],
886 MC_CHANNEL_ADDR_MATCH + 4, mask >> 32L);
887#endif
888
889#if 1
890#if USE_QWORD
891 u64 rdmask;
892 pci_read_config_qword(pvt->pci_ch[pvt->inject.channel][0],
893 MC_CHANNEL_ADDR_MATCH, &rdmask);
894 debugf0("Inject addr match write 0x%016llx, read: 0x%016llx\n",
895 mask, rdmask);
896#else
897 u32 rdmask1, rdmask2;
898
899 pci_read_config_dword(pvt->pci_ch[pvt->inject.channel][0],
900 MC_CHANNEL_ADDR_MATCH, &rdmask1);
901 pci_read_config_dword(pvt->pci_ch[pvt->inject.channel][0],
902 MC_CHANNEL_ADDR_MATCH + 4, &rdmask2);
903
904 debugf0("Inject addr match write 0x%016llx, read: 0x%08x%08x\n",
905 mask, rdmask1, rdmask2);
906#endif
907#endif
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300908
909 pci_write_config_dword(pvt->pci_ch[pvt->inject.channel][0],
910 MC_CHANNEL_ERROR_MASK, pvt->inject.eccmask);
911
912 /*
913 * bit 0: REPEAT_EN
914 * bits 1-2: MASK_HALF_CACHELINE
915 * bit 3: INJECT_ECC
916 * bit 4: INJECT_ADDR_PARITY
917 */
918
Mauro Carvalho Chehab7b029d02009-06-22 22:48:29 -0300919 injectmask = (pvt->inject.type & 1) |
920 (pvt->inject.section & 0x3) << 1 |
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300921 (pvt->inject.type & 0x6) << (3 - 1);
922
923 pci_write_config_dword(pvt->pci_ch[pvt->inject.channel][0],
924 MC_CHANNEL_ERROR_MASK, injectmask);
925
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300926 debugf0("Error inject addr match 0x%016llx, ecc 0x%08x, inject 0x%08x\n",
927 mask, pvt->inject.eccmask, injectmask);
928
Mauro Carvalho Chehab7b029d02009-06-22 22:48:29 -0300929
930
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300931 return count;
932}
933
934static ssize_t i7core_inject_enable_show(struct mem_ctl_info *mci,
935 char *data)
936{
937 struct i7core_pvt *pvt = mci->pvt_info;
Mauro Carvalho Chehab7b029d02009-06-22 22:48:29 -0300938 u32 injectmask;
939
940 pci_read_config_dword(pvt->pci_ch[pvt->inject.channel][0],
941 MC_CHANNEL_ERROR_MASK, &injectmask);
942
943 debugf0("Inject error read: 0x%018x\n", injectmask);
944
945 if (injectmask & 0x0c)
946 pvt->inject.enable = 1;
947
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300948 return sprintf(data, "%d\n", pvt->inject.enable);
949}
950
Mauro Carvalho Chehab442305b2009-06-22 22:48:29 -0300951static ssize_t i7core_ce_regs_show(struct mem_ctl_info *mci, char *data)
952{
953 struct i7core_pvt *pvt = mci->pvt_info;
954
955 if (!pvt->ce_count_available)
956 return sprintf(data, "unavailable\n");
957
958 return sprintf(data, "dimm0: %lu\ndimm1: %lu\ndimm2: %lu\n",
959 pvt->ce_count[0],
960 pvt->ce_count[1],
961 pvt->ce_count[2]);
962}
963
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -0300964/*
965 * Sysfs struct
966 */
967static struct mcidev_sysfs_attribute i7core_inj_attrs[] = {
968
969 {
970 .attr = {
971 .name = "inject_section",
972 .mode = (S_IRUGO | S_IWUSR)
973 },
974 .show = i7core_inject_section_show,
975 .store = i7core_inject_section_store,
976 }, {
977 .attr = {
978 .name = "inject_type",
979 .mode = (S_IRUGO | S_IWUSR)
980 },
981 .show = i7core_inject_type_show,
982 .store = i7core_inject_type_store,
983 }, {
984 .attr = {
985 .name = "inject_eccmask",
986 .mode = (S_IRUGO | S_IWUSR)
987 },
988 .show = i7core_inject_eccmask_show,
989 .store = i7core_inject_eccmask_store,
990 }, {
991 .attr = {
992 .name = "inject_addrmatch",
993 .mode = (S_IRUGO | S_IWUSR)
994 },
995 .show = i7core_inject_addrmatch_show,
996 .store = i7core_inject_addrmatch_store,
997 }, {
998 .attr = {
999 .name = "inject_enable",
1000 .mode = (S_IRUGO | S_IWUSR)
1001 },
1002 .show = i7core_inject_enable_show,
1003 .store = i7core_inject_enable_store,
Mauro Carvalho Chehab442305b2009-06-22 22:48:29 -03001004 }, {
1005 .attr = {
1006 .name = "corrected_error_counts",
1007 .mode = (S_IRUGO | S_IWUSR)
1008 },
1009 .show = i7core_ce_regs_show,
1010 .store = NULL,
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -03001011 },
1012};
1013
1014/****************************************************************************
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001015 Device initialization routines: put/get, init/exit
1016 ****************************************************************************/
1017
1018/*
1019 * i7core_put_devices 'put' all the devices that we have
1020 * reserved via 'get'
1021 */
Mauro Carvalho Chehab8f331902009-06-22 22:48:29 -03001022static void i7core_put_devices(void)
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001023{
Mauro Carvalho Chehab8f331902009-06-22 22:48:29 -03001024 int i;
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001025
Mauro Carvalho Chehab8f331902009-06-22 22:48:29 -03001026 for (i = 0; i < N_DEVS; i++)
1027 pci_dev_put(pci_devs[i].pdev);
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001028}
1029
1030/*
1031 * i7core_get_devices Find and perform 'get' operation on the MCH's
1032 * device/functions we want to reference for this driver
1033 *
1034 * Need to 'get' device 16 func 1 and func 2
1035 */
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -03001036static int i7core_get_devices(void)
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001037{
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -03001038 int rc, i;
Mauro Carvalho Chehab8f331902009-06-22 22:48:29 -03001039 struct pci_dev *pdev = NULL;
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001040
Mauro Carvalho Chehab8f331902009-06-22 22:48:29 -03001041 for (i = 0; i < N_DEVS; i++) {
1042 pdev = pci_get_device(PCI_VENDOR_ID_INTEL,
1043 pci_devs[i].dev_id, NULL);
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -03001044 if (likely(pdev))
1045 pci_devs[i].pdev = pdev;
1046 else {
Mauro Carvalho Chehab8f331902009-06-22 22:48:29 -03001047 i7core_printk(KERN_ERR,
1048 "Device not found: PCI ID %04x:%04x "
1049 "(dev %d, func %d)\n",
1050 PCI_VENDOR_ID_INTEL, pci_devs[i].dev_id,
1051 pci_devs[i].dev,pci_devs[i].func);
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001052
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -03001053 /* Dev 3 function 2 only exists on chips with RDIMMs */
1054 if ((pci_devs[i].dev == 3) && (pci_devs[i].func == 2))
1055 continue;
1056
1057 /* End of list, leave */
1058 rc = -ENODEV;
1059 goto error;
Mauro Carvalho Chehab8f331902009-06-22 22:48:29 -03001060 }
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -03001061
Mauro Carvalho Chehab8f331902009-06-22 22:48:29 -03001062 /* Sanity check */
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -03001063 if (unlikely(PCI_SLOT(pdev->devfn) != pci_devs[i].dev ||
1064 PCI_FUNC(pdev->devfn) != pci_devs[i].func)) {
Mauro Carvalho Chehab8f331902009-06-22 22:48:29 -03001065 i7core_printk(KERN_ERR,
1066 "Device PCI ID %04x:%04x "
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -03001067 "has fn %d.%d instead of fn %d.%d\n",
Mauro Carvalho Chehab8f331902009-06-22 22:48:29 -03001068 PCI_VENDOR_ID_INTEL, pci_devs[i].dev_id,
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -03001069 PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn),
1070 pci_devs[i].dev, pci_devs[i].func);
1071 rc = -EINVAL;
1072 goto error;
1073 }
1074
1075 /* Be sure that the device is enabled */
1076 rc = pci_enable_device(pdev);
1077 if (unlikely(rc < 0)) {
1078 i7core_printk(KERN_ERR,
1079 "Couldn't enable PCI ID %04x:%04x "
1080 "fn %d.%d\n",
1081 PCI_VENDOR_ID_INTEL, pci_devs[i].dev_id,
1082 PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
1083 goto error;
Mauro Carvalho Chehab8f331902009-06-22 22:48:29 -03001084 }
1085
1086 i7core_printk(KERN_INFO,
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -03001087 "Registered device %0x:%0x fn %d.%d\n",
Mauro Carvalho Chehab8f331902009-06-22 22:48:29 -03001088 PCI_VENDOR_ID_INTEL, pci_devs[i].dev_id,
1089 PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001090 }
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001091
1092 return 0;
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -03001093
1094error:
1095 i7core_put_devices();
1096 return -EINVAL;
1097}
1098
1099static int mci_bind_devs(struct mem_ctl_info *mci)
1100{
1101 struct i7core_pvt *pvt = mci->pvt_info;
1102 struct pci_dev *pdev;
1103 int i, func, slot;
1104
1105 for (i = 0; i < N_DEVS; i++) {
1106 pdev = pci_devs[i].pdev;
1107 if (!pdev)
1108 continue;
1109
1110 func = PCI_FUNC(pdev->devfn);
1111 slot = PCI_SLOT(pdev->devfn);
1112 if (slot == 3) {
1113 if (unlikely(func > MAX_MCR_FUNC))
1114 goto error;
1115 pvt->pci_mcr[func] = pdev;
1116 } else if (likely(slot >= 4 && slot < 4 + NUM_CHANS)) {
1117 if (unlikely(func > MAX_CHAN_FUNC))
1118 goto error;
1119 pvt->pci_ch[slot - 4][func] = pdev;
1120 } else
1121 goto error;
1122
1123 debugf0("Associated fn %d.%d, dev = %p\n",
1124 PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), pdev);
1125 }
1126 return 0;
1127
1128error:
1129 i7core_printk(KERN_ERR, "Device %d, function %d "
1130 "is out of the expected range\n",
1131 slot, func);
1132 return -EINVAL;
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001133}
1134
Mauro Carvalho Chehab442305b2009-06-22 22:48:29 -03001135/****************************************************************************
1136 Error check routines
1137 ****************************************************************************/
1138
1139/* This function is based on the device 3 function 4 registers as described on:
1140 * Intel Xeon Processor 5500 Series Datasheet Volume 2
1141 * http://www.intel.com/Assets/PDF/datasheet/321322.pdf
1142 * also available at:
1143 * http://www.arrownac.com/manufacturers/intel/s/nehalem/5500-datasheet-v2.pdf
1144 */
1145static void check_mc_test_err(struct mem_ctl_info *mci)
1146{
1147 struct i7core_pvt *pvt = mci->pvt_info;
1148 u32 rcv1, rcv0;
1149 int new0, new1, new2;
1150
1151 if (!pvt->pci_mcr[4]) {
1152 debugf0("%s MCR registers not found\n",__func__);
1153 return;
1154 }
1155
1156 /* Corrected error reads */
1157 pci_read_config_dword(pvt->pci_mcr[4], MC_TEST_ERR_RCV1, &rcv1);
1158 pci_read_config_dword(pvt->pci_mcr[4], MC_TEST_ERR_RCV0, &rcv0);
1159
1160 /* Store the new values */
1161 new2 = DIMM2_COR_ERR(rcv1);
1162 new1 = DIMM1_COR_ERR(rcv0);
1163 new0 = DIMM0_COR_ERR(rcv0);
1164
1165 debugf2("%s CE rcv1=0x%08x rcv0=0x%08x, %d %d %d\n",
1166 (pvt->ce_count_available ? "UPDATE" : "READ"),
1167 rcv1, rcv0, new0, new1, new2);
1168
1169 /* Updates CE counters if it is not the first time here */
1170 if (pvt->ce_count_available) {
1171 /* Updates CE counters */
1172 int add0, add1, add2;
1173
1174 add2 = new2 - pvt->last_ce_count[2];
1175 add1 = new1 - pvt->last_ce_count[1];
1176 add0 = new0 - pvt->last_ce_count[0];
1177
1178 if (add2 < 0)
1179 add2 += 0x7fff;
1180 pvt->ce_count[2] += add2;
1181
1182 if (add1 < 0)
1183 add1 += 0x7fff;
1184 pvt->ce_count[1] += add1;
1185
1186 if (add0 < 0)
1187 add0 += 0x7fff;
1188 pvt->ce_count[0] += add0;
1189 } else
1190 pvt->ce_count_available = 1;
1191
1192 /* Store the new values */
1193 pvt->last_ce_count[2] = new2;
1194 pvt->last_ce_count[1] = new1;
1195 pvt->last_ce_count[0] = new0;
1196}
1197
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001198/*
Mauro Carvalho Chehab87d1d272009-06-22 22:48:29 -03001199 * i7core_check_error Retrieve and process errors reported by the
1200 * hardware. Called by the Core module.
1201 */
1202static void i7core_check_error(struct mem_ctl_info *mci)
1203{
Mauro Carvalho Chehab442305b2009-06-22 22:48:29 -03001204 check_mc_test_err(mci);
Mauro Carvalho Chehab87d1d272009-06-22 22:48:29 -03001205}
1206
1207/*
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001208 * i7core_probe Probe for ONE instance of device to see if it is
1209 * present.
1210 * return:
1211 * 0 for FOUND a device
1212 * < 0 for error code
1213 */
1214static int __devinit i7core_probe(struct pci_dev *pdev,
1215 const struct pci_device_id *id)
1216{
1217 struct mem_ctl_info *mci;
1218 struct i7core_pvt *pvt;
Mauro Carvalho Chehabeb94fc42009-06-22 22:48:31 -03001219 int num_channels;
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001220 int num_csrows;
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001221 int dev_idx = id->driver_data;
Mauro Carvalho Chehabb7c76152009-06-22 22:48:30 -03001222 int rc;
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001223
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -03001224 if (unlikely(dev_idx >= ARRAY_SIZE(i7core_devs)))
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001225 return -EINVAL;
1226
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -03001227 /* get the pci devices we want to reserve for our use */
Mauro Carvalho Chehabb7c76152009-06-22 22:48:30 -03001228 rc = i7core_get_devices();
1229 if (unlikely(rc < 0))
1230 return rc;
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001231
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -03001232 /* Check the number of active and not disabled channels */
Mauro Carvalho Chehabeb94fc42009-06-22 22:48:31 -03001233 rc = i7core_get_active_channels(&num_channels, &num_csrows);
Mauro Carvalho Chehabb7c76152009-06-22 22:48:30 -03001234 if (unlikely (rc < 0))
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -03001235 goto fail0;
1236
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001237 /* allocate a new MC control structure */
1238 mci = edac_mc_alloc(sizeof(*pvt), num_csrows, num_channels, 0);
Mauro Carvalho Chehabb7c76152009-06-22 22:48:30 -03001239 if (unlikely (!mci)) {
1240 rc = -ENOMEM;
1241 goto fail0;
1242 }
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001243
1244 debugf0("MC: " __FILE__ ": %s(): mci = %p\n", __func__, mci);
1245
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -03001246 mci->dev = &pdev->dev; /* record ptr to the generic device */
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001247
1248 pvt = mci->pvt_info;
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -03001249 memset(pvt, 0, sizeof(*pvt));
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001250
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001251 mci->mc_idx = 0;
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -03001252 mci->mtype_cap = MEM_FLAG_DDR3; /* FIXME: how to handle RDDR3? */
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001253 mci->edac_ctl_cap = EDAC_FLAG_NONE;
1254 mci->edac_cap = EDAC_FLAG_NONE;
1255 mci->mod_name = "i7core_edac.c";
1256 mci->mod_ver = I7CORE_REVISION;
1257 mci->ctl_name = i7core_devs[dev_idx].ctl_name;
1258 mci->dev_name = pci_name(pdev);
1259 mci->ctl_page_to_phys = NULL;
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -03001260 mci->mc_driver_sysfs_attributes = i7core_inj_attrs;
Mauro Carvalho Chehab87d1d272009-06-22 22:48:29 -03001261 /* Set the function pointer to an actual operation function */
1262 mci->edac_check = i7core_check_error;
Mauro Carvalho Chehab8f331902009-06-22 22:48:29 -03001263
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -03001264 /* Store pci devices at mci for faster access */
Mauro Carvalho Chehabb7c76152009-06-22 22:48:30 -03001265 rc = mci_bind_devs(mci);
1266 if (unlikely (rc < 0))
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -03001267 goto fail1;
1268
1269 /* Get dimm basic config */
1270 get_dimm_config(mci);
1271
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001272 /* add this new MC control structure to EDAC's list of MCs */
Mauro Carvalho Chehabb7c76152009-06-22 22:48:30 -03001273 if (unlikely(edac_mc_add_mc(mci))) {
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001274 debugf0("MC: " __FILE__
1275 ": %s(): failed edac_mc_add_mc()\n", __func__);
1276 /* FIXME: perhaps some code should go here that disables error
1277 * reporting if we just enabled it
1278 */
Mauro Carvalho Chehabb7c76152009-06-22 22:48:30 -03001279
1280 rc = -EINVAL;
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001281 goto fail1;
1282 }
1283
1284 /* allocating generic PCI control info */
1285 i7core_pci = edac_pci_create_generic_ctl(&pdev->dev, EDAC_MOD_STR);
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -03001286 if (unlikely (!i7core_pci)) {
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001287 printk(KERN_WARNING
1288 "%s(): Unable to create PCI control\n",
1289 __func__);
1290 printk(KERN_WARNING
1291 "%s(): PCI error report via EDAC not setup\n",
1292 __func__);
1293 }
1294
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -03001295 /* Default error mask is any memory */
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -03001296 pvt->inject.channel = 0;
Mauro Carvalho Chehab194a40f2009-06-22 22:48:28 -03001297 pvt->inject.dimm = -1;
1298 pvt->inject.rank = -1;
1299 pvt->inject.bank = -1;
1300 pvt->inject.page = -1;
1301 pvt->inject.col = -1;
1302
Mauro Carvalho Chehabef708b52009-06-22 22:48:30 -03001303 i7core_printk(KERN_INFO, "Driver loaded.\n");
Mauro Carvalho Chehab8f331902009-06-22 22:48:29 -03001304
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001305 return 0;
1306
1307fail1:
Mauro Carvalho Chehabb7c76152009-06-22 22:48:30 -03001308 edac_mc_free(mci);
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001309
1310fail0:
Mauro Carvalho Chehabb7c76152009-06-22 22:48:30 -03001311 i7core_put_devices();
1312 return rc;
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001313}
1314
1315/*
1316 * i7core_remove destructor for one instance of device
1317 *
1318 */
1319static void __devexit i7core_remove(struct pci_dev *pdev)
1320{
1321 struct mem_ctl_info *mci;
1322
1323 debugf0(__FILE__ ": %s()\n", __func__);
1324
1325 if (i7core_pci)
1326 edac_pci_release_generic_ctl(i7core_pci);
1327
1328 mci = edac_mc_del_mc(&pdev->dev);
Mauro Carvalho Chehab87d1d272009-06-22 22:48:29 -03001329
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001330 if (!mci)
1331 return;
1332
1333 /* retrieve references to resources, and free those resources */
Mauro Carvalho Chehab8f331902009-06-22 22:48:29 -03001334 i7core_put_devices();
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001335
1336 edac_mc_free(mci);
1337}
1338
Mauro Carvalho Chehaba0c36a12009-06-22 22:41:15 -03001339MODULE_DEVICE_TABLE(pci, i7core_pci_tbl);
1340
1341/*
1342 * i7core_driver pci_driver structure for this module
1343 *
1344 */
1345static struct pci_driver i7core_driver = {
1346 .name = "i7core_edac",
1347 .probe = i7core_probe,
1348 .remove = __devexit_p(i7core_remove),
1349 .id_table = i7core_pci_tbl,
1350};
1351
1352/*
1353 * i7core_init Module entry function
1354 * Try to initialize this module for its devices
1355 */
1356static int __init i7core_init(void)
1357{
1358 int pci_rc;
1359
1360 debugf2("MC: " __FILE__ ": %s()\n", __func__);
1361
1362 /* Ensure that the OPSTATE is set correctly for POLL or NMI */
1363 opstate_init();
1364
1365 pci_rc = pci_register_driver(&i7core_driver);
1366
1367 return (pci_rc < 0) ? pci_rc : 0;
1368}
1369
1370/*
1371 * i7core_exit() Module exit function
1372 * Unregister the driver
1373 */
1374static void __exit i7core_exit(void)
1375{
1376 debugf2("MC: " __FILE__ ": %s()\n", __func__);
1377 pci_unregister_driver(&i7core_driver);
1378}
1379
1380module_init(i7core_init);
1381module_exit(i7core_exit);
1382
1383MODULE_LICENSE("GPL");
1384MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
1385MODULE_AUTHOR("Red Hat Inc. (http://www.redhat.com)");
1386MODULE_DESCRIPTION("MC Driver for Intel i7 Core memory controllers - "
1387 I7CORE_REVISION);
1388
1389module_param(edac_op_state, int, 0444);
1390MODULE_PARM_DESC(edac_op_state, "EDAC Error Reporting state: 0=Poll,1=NMI");