aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/i82443bxgx_edac.c
diff options
context:
space:
mode:
authorDouglas Thompson <dougthompson@xmission.com>2007-07-19 04:50:07 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 13:04:55 -0400
commit11116601092c42364892d3f59c8f4a8a30916867 (patch)
tree528fa8d3ed0d019fd41a4d15de11a933a968119c /drivers/edac/i82443bxgx_edac.c
parent203333cbbaae3941504c2b6e92850783bf361b6f (diff)
drivers/edac: Lindent i82443bxgx
Run i82443bxgx.c file through Lindent for cleanup Signed-off-by: Douglas Thompson <dougthompson@xmission.com> Signed-off-by: Dave Jiang <djiang@mvista.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/edac/i82443bxgx_edac.c')
-rw-r--r--drivers/edac/i82443bxgx_edac.c160
1 files changed, 72 insertions, 88 deletions
diff --git a/drivers/edac/i82443bxgx_edac.c b/drivers/edac/i82443bxgx_edac.c
index f88ea075ff2d..c0070aba87bb 100644
--- a/drivers/edac/i82443bxgx_edac.c
+++ b/drivers/edac/i82443bxgx_edac.c
@@ -35,7 +35,6 @@
35 35
36#define EDAC_MOD_STR "i82443bxgx_edac" 36#define EDAC_MOD_STR "i82443bxgx_edac"
37 37
38
39/* The 82443BX supports SDRAM, or EDO (EDO for mobile only), "Memory 38/* The 82443BX supports SDRAM, or EDO (EDO for mobile only), "Memory
40 * Size: 8 MB to 512 MB (1GB with Registered DIMMs) with eight memory 39 * Size: 8 MB to 512 MB (1GB with Registered DIMMs) with eight memory
41 * rows" "The 82443BX supports multiple-bit error detection and 40 * rows" "The 82443BX supports multiple-bit error detection and
@@ -61,67 +60,60 @@
61#define I82443BXGX_NR_CHANS 1 60#define I82443BXGX_NR_CHANS 1
62#define I82443BXGX_NR_DIMMS 4 61#define I82443BXGX_NR_DIMMS 4
63 62
64
65
66/* 82443 PCI Device 0 */ 63/* 82443 PCI Device 0 */
67#define I82443BXGX_NBXCFG 0x50 /* 32bit register starting at this PCI 64#define I82443BXGX_NBXCFG 0x50 /* 32bit register starting at this PCI
68 * config space offset */ 65 * config space offset */
69#define I82443BXGX_NBXCFG_OFFSET_NON_ECCROW 24 /* Array of bits, zero if 66#define I82443BXGX_NBXCFG_OFFSET_NON_ECCROW 24 /* Array of bits, zero if
70 * row is non-ECC */ 67 * row is non-ECC */
71#define I82443BXGX_NBXCFG_OFFSET_DRAM_FREQ 12 /* 2 bits,00=100MHz,10=66 MHz */ 68#define I82443BXGX_NBXCFG_OFFSET_DRAM_FREQ 12 /* 2 bits,00=100MHz,10=66 MHz */
72 69
73#define I82443BXGX_NBXCFG_OFFSET_DRAM_INTEGRITY 7 /* 2 bits: */ 70#define I82443BXGX_NBXCFG_OFFSET_DRAM_INTEGRITY 7 /* 2 bits: */
74#define I82443BXGX_NBXCFG_INTEGRITY_NONE 0x0 /* 00 = Non-ECC */ 71#define I82443BXGX_NBXCFG_INTEGRITY_NONE 0x0 /* 00 = Non-ECC */
75#define I82443BXGX_NBXCFG_INTEGRITY_EC 0x1 /* 01 = EC (only) */ 72#define I82443BXGX_NBXCFG_INTEGRITY_EC 0x1 /* 01 = EC (only) */
76#define I82443BXGX_NBXCFG_INTEGRITY_ECC 0x2 /* 10 = ECC */ 73#define I82443BXGX_NBXCFG_INTEGRITY_ECC 0x2 /* 10 = ECC */
77#define I82443BXGX_NBXCFG_INTEGRITY_SCRUB 0x3 /* 11 = ECC + HW Scrub */ 74#define I82443BXGX_NBXCFG_INTEGRITY_SCRUB 0x3 /* 11 = ECC + HW Scrub */
78 75
79#define I82443BXGX_NBXCFG_OFFSET_ECC_DIAG_ENABLE 6 76#define I82443BXGX_NBXCFG_OFFSET_ECC_DIAG_ENABLE 6
80 77
81
82/* 82443 PCI Device 0 */ 78/* 82443 PCI Device 0 */
83#define I82443BXGX_EAP 0x80 /* 32bit register starting at this PCI 79#define I82443BXGX_EAP 0x80 /* 32bit register starting at this PCI
84 * config space offset, Error Address 80 * config space offset, Error Address
85 * Pointer Register */ 81 * Pointer Register */
86#define I82443BXGX_EAP_OFFSET_EAP 12 /* High 20 bits of error address */ 82#define I82443BXGX_EAP_OFFSET_EAP 12 /* High 20 bits of error address */
87#define I82443BXGX_EAP_OFFSET_MBE BIT(1) /* Err at EAP was multi-bit (W1TC) */ 83#define I82443BXGX_EAP_OFFSET_MBE BIT(1) /* Err at EAP was multi-bit (W1TC) */
88#define I82443BXGX_EAP_OFFSET_SBE BIT(0) /* Err at EAP was single-bit (W1TC)*/ 84#define I82443BXGX_EAP_OFFSET_SBE BIT(0) /* Err at EAP was single-bit (W1TC) */
89 85
90#define I82443BXGX_ERRCMD 0x90 /* 8bit register starting at this PCI 86#define I82443BXGX_ERRCMD 0x90 /* 8bit register starting at this PCI
91 * config space offset. */ 87 * config space offset. */
92#define I82443BXGX_ERRCMD_OFFSET_SERR_ON_MBE BIT(1) /* 1 = enable */ 88#define I82443BXGX_ERRCMD_OFFSET_SERR_ON_MBE BIT(1) /* 1 = enable */
93#define I82443BXGX_ERRCMD_OFFSET_SERR_ON_SBE BIT(0) /* 1 = enable */ 89#define I82443BXGX_ERRCMD_OFFSET_SERR_ON_SBE BIT(0) /* 1 = enable */
94 90
95#define I82443BXGX_ERRSTS 0x91 /* 16bit register starting at this PCI 91#define I82443BXGX_ERRSTS 0x91 /* 16bit register starting at this PCI
96 * config space offset. */ 92 * config space offset. */
97#define I82443BXGX_ERRSTS_OFFSET_MBFRE 5 /* 3 bits - first err row multibit */ 93#define I82443BXGX_ERRSTS_OFFSET_MBFRE 5 /* 3 bits - first err row multibit */
98#define I82443BXGX_ERRSTS_OFFSET_MEF BIT(4) /* 1 = MBE occurred */ 94#define I82443BXGX_ERRSTS_OFFSET_MEF BIT(4) /* 1 = MBE occurred */
99#define I82443BXGX_ERRSTS_OFFSET_SBFRE 1 /* 3 bits - first err row singlebit */ 95#define I82443BXGX_ERRSTS_OFFSET_SBFRE 1 /* 3 bits - first err row singlebit */
100#define I82443BXGX_ERRSTS_OFFSET_SEF BIT(0) /* 1 = SBE occurred */ 96#define I82443BXGX_ERRSTS_OFFSET_SEF BIT(0) /* 1 = SBE occurred */
101
102 97
103#define I82443BXGX_DRAMC 0x57 /* 8bit register starting at this PCI 98#define I82443BXGX_DRAMC 0x57 /* 8bit register starting at this PCI
104 * config space offset. */ 99 * config space offset. */
105#define I82443BXGX_DRAMC_OFFSET_DT 3 /* 2 bits, DRAM Type */ 100#define I82443BXGX_DRAMC_OFFSET_DT 3 /* 2 bits, DRAM Type */
106#define I82443BXGX_DRAMC_DRAM_IS_EDO 0 /* 00 = EDO */ 101#define I82443BXGX_DRAMC_DRAM_IS_EDO 0 /* 00 = EDO */
107#define I82443BXGX_DRAMC_DRAM_IS_SDRAM 1 /* 01 = SDRAM */ 102#define I82443BXGX_DRAMC_DRAM_IS_SDRAM 1 /* 01 = SDRAM */
108#define I82443BXGX_DRAMC_DRAM_IS_RSDRAM 2 /* 10 = Registered SDRAM */ 103#define I82443BXGX_DRAMC_DRAM_IS_RSDRAM 2 /* 10 = Registered SDRAM */
109
110
111#define I82443BXGX_DRB 0x60 /* 8x 8bit registers starting at this PCI
112 * config space offset. */
113 104
105#define I82443BXGX_DRB 0x60 /* 8x 8bit registers starting at this PCI
106 * config space offset. */
114 107
115/* FIXME - don't poll when ECC disabled? */ 108/* FIXME - don't poll when ECC disabled? */
116 109
117
118struct i82443bxgx_edacmc_error_info { 110struct i82443bxgx_edacmc_error_info {
119 u32 eap; 111 u32 eap;
120}; 112};
121 113
122 114static void i82443bxgx_edacmc_get_error_info(struct mem_ctl_info *mci,
123static void i82443bxgx_edacmc_get_error_info (struct mem_ctl_info *mci, 115 struct i82443bxgx_edacmc_error_info
124 struct i82443bxgx_edacmc_error_info *info) 116 *info)
125{ 117{
126 struct pci_dev *pdev; 118 struct pci_dev *pdev;
127 pdev = to_pci_dev(mci->dev); 119 pdev = to_pci_dev(mci->dev);
@@ -139,9 +131,10 @@ static void i82443bxgx_edacmc_get_error_info (struct mem_ctl_info *mci,
139 I82443BXGX_EAP_OFFSET_MBE); 131 I82443BXGX_EAP_OFFSET_MBE);
140} 132}
141 133
142 134static int i82443bxgx_edacmc_process_error_info(struct mem_ctl_info *mci,
143static int i82443bxgx_edacmc_process_error_info (struct mem_ctl_info *mci, 135 struct
144 struct i82443bxgx_edacmc_error_info *info, int handle_errors) 136 i82443bxgx_edacmc_error_info
137 *info, int handle_errors)
145{ 138{
146 int error_found = 0; 139 int error_found = 0;
147 u32 eapaddr, page, pageoffset; 140 u32 eapaddr, page, pageoffset;
@@ -152,31 +145,26 @@ static int i82443bxgx_edacmc_process_error_info (struct mem_ctl_info *mci,
152 page = eapaddr >> PAGE_SHIFT; 145 page = eapaddr >> PAGE_SHIFT;
153 pageoffset = eapaddr - (page << PAGE_SHIFT); 146 pageoffset = eapaddr - (page << PAGE_SHIFT);
154 147
155 if (info->eap & I82443BXGX_EAP_OFFSET_SBE) { 148 if (info->eap & I82443BXGX_EAP_OFFSET_SBE) {
156 error_found = 1; 149 error_found = 1;
157 if (handle_errors) 150 if (handle_errors)
158 edac_mc_handle_ce( 151 edac_mc_handle_ce(mci, page, pageoffset,
159 mci, page, pageoffset, 152 /* 440BX/GX don't make syndrome information available */
160 /* 440BX/GX don't make syndrome information available */ 153 0, edac_mc_find_csrow_by_page(mci, page), 0, /* channel */
161 0, 154 mci->ctl_name);
162 edac_mc_find_csrow_by_page(mci, page),
163 0, /* channel */
164 mci->ctl_name);
165 } 155 }
166 156
167 if (info->eap & I82443BXGX_EAP_OFFSET_MBE) { 157 if (info->eap & I82443BXGX_EAP_OFFSET_MBE) {
168 error_found = 1; 158 error_found = 1;
169 if (handle_errors) 159 if (handle_errors)
170 edac_mc_handle_ue( 160 edac_mc_handle_ue(mci, page, pageoffset,
171 mci, page, pageoffset, 161 edac_mc_find_csrow_by_page(mci, page),
172 edac_mc_find_csrow_by_page(mci, page), 162 mci->ctl_name);
173 mci->ctl_name);
174 } 163 }
175 164
176 return error_found; 165 return error_found;
177} 166}
178 167
179
180static void i82443bxgx_edacmc_check(struct mem_ctl_info *mci) 168static void i82443bxgx_edacmc_check(struct mem_ctl_info *mci)
181{ 169{
182 struct i82443bxgx_edacmc_error_info info; 170 struct i82443bxgx_edacmc_error_info info;
@@ -186,11 +174,10 @@ static void i82443bxgx_edacmc_check(struct mem_ctl_info *mci)
186 i82443bxgx_edacmc_process_error_info(mci, &info, 1); 174 i82443bxgx_edacmc_process_error_info(mci, &info, 1);
187} 175}
188 176
189
190static void i82443bxgx_init_csrows(struct mem_ctl_info *mci, 177static void i82443bxgx_init_csrows(struct mem_ctl_info *mci,
191 struct pci_dev *pdev, 178 struct pci_dev *pdev,
192 enum edac_type edac_mode, 179 enum edac_type edac_mode,
193 enum mem_type mtype) 180 enum mem_type mtype)
194{ 181{
195 struct csrow_info *csrow; 182 struct csrow_info *csrow;
196 int index; 183 int index;
@@ -233,8 +220,7 @@ static void i82443bxgx_init_csrows(struct mem_ctl_info *mci,
233 } 220 }
234} 221}
235 222
236 223static int i82443bxgx_edacmc_probe1(struct pci_dev *pdev, int dev_idx)
237static int i82443bxgx_edacmc_probe1(struct pci_dev *pdev, int dev_idx)
238{ 224{
239 struct mem_ctl_info *mci; 225 struct mem_ctl_info *mci;
240 u8 dramc; 226 u8 dramc;
@@ -260,7 +246,7 @@ static int i82443bxgx_edacmc_probe1(struct pci_dev *pdev, int dev_idx)
260 mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_EC | EDAC_FLAG_SECDED; 246 mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_EC | EDAC_FLAG_SECDED;
261 pci_read_config_byte(pdev, I82443BXGX_DRAMC, &dramc); 247 pci_read_config_byte(pdev, I82443BXGX_DRAMC, &dramc);
262 switch ((dramc >> I82443BXGX_DRAMC_OFFSET_DT) & (BIT(0) | BIT(1))) { 248 switch ((dramc >> I82443BXGX_DRAMC_OFFSET_DT) & (BIT(0) | BIT(1))) {
263 case I82443BXGX_DRAMC_DRAM_IS_EDO: 249 case I82443BXGX_DRAMC_DRAM_IS_EDO:
264 mtype = MEM_EDO; 250 mtype = MEM_EDO;
265 break; 251 break;
266 case I82443BXGX_DRAMC_DRAM_IS_SDRAM: 252 case I82443BXGX_DRAMC_DRAM_IS_SDRAM:
@@ -270,7 +256,8 @@ static int i82443bxgx_edacmc_probe1(struct pci_dev *pdev, int dev_idx)
270 mtype = MEM_RDR; 256 mtype = MEM_RDR;
271 break; 257 break;
272 default: 258 default:
273 debugf0("Unknown/reserved DRAM type value in DRAMC register!\n"); 259 debugf0
260 ("Unknown/reserved DRAM type value in DRAMC register!\n");
274 mtype = -MEM_UNKNOWN; 261 mtype = -MEM_UNKNOWN;
275 } 262 }
276 263
@@ -282,13 +269,12 @@ static int i82443bxgx_edacmc_probe1(struct pci_dev *pdev, int dev_idx)
282 mci->scrub_cap = SCRUB_FLAG_HW_SRC; 269 mci->scrub_cap = SCRUB_FLAG_HW_SRC;
283 pci_read_config_dword(pdev, I82443BXGX_NBXCFG, &nbxcfg); 270 pci_read_config_dword(pdev, I82443BXGX_NBXCFG, &nbxcfg);
284 ecc_mode = ((nbxcfg >> I82443BXGX_NBXCFG_OFFSET_DRAM_INTEGRITY) & 271 ecc_mode = ((nbxcfg >> I82443BXGX_NBXCFG_OFFSET_DRAM_INTEGRITY) &
285 (BIT(0) | BIT(1))); 272 (BIT(0) | BIT(1)));
286 273
287 mci->scrub_mode = (ecc_mode == I82443BXGX_NBXCFG_INTEGRITY_SCRUB) 274 mci->scrub_mode = (ecc_mode == I82443BXGX_NBXCFG_INTEGRITY_SCRUB)
288 ? SCRUB_HW_SRC 275 ? SCRUB_HW_SRC : SCRUB_NONE;
289 : SCRUB_NONE;
290 276
291 switch(ecc_mode) { 277 switch (ecc_mode) {
292 case I82443BXGX_NBXCFG_INTEGRITY_NONE: 278 case I82443BXGX_NBXCFG_INTEGRITY_NONE:
293 edac_mode = EDAC_NONE; 279 edac_mode = EDAC_NONE;
294 break; 280 break;
@@ -300,8 +286,9 @@ static int i82443bxgx_edacmc_probe1(struct pci_dev *pdev, int dev_idx)
300 edac_mode = EDAC_SECDED; 286 edac_mode = EDAC_SECDED;
301 break; 287 break;
302 default: 288 default:
303 debugf0("%s(): Unknown/reserved ECC state in NBXCFG register!\n", 289 debugf0
304 __func__); 290 ("%s(): Unknown/reserved ECC state in NBXCFG register!\n",
291 __func__);
305 edac_mode = EDAC_UNKNOWN; 292 edac_mode = EDAC_UNKNOWN;
306 break; 293 break;
307 } 294 }
@@ -312,8 +299,10 @@ static int i82443bxgx_edacmc_probe1(struct pci_dev *pdev, int dev_idx)
312 * here, or we get "phantom" errors occuring at module-load 299 * here, or we get "phantom" errors occuring at module-load
313 * time. */ 300 * time. */
314 pci_write_bits32(pdev, I82443BXGX_EAP, 301 pci_write_bits32(pdev, I82443BXGX_EAP,
315 (I82443BXGX_EAP_OFFSET_SBE | I82443BXGX_EAP_OFFSET_MBE), 302 (I82443BXGX_EAP_OFFSET_SBE |
316 (I82443BXGX_EAP_OFFSET_SBE | I82443BXGX_EAP_OFFSET_MBE)); 303 I82443BXGX_EAP_OFFSET_MBE),
304 (I82443BXGX_EAP_OFFSET_SBE |
305 I82443BXGX_EAP_OFFSET_MBE));
317 306
318 mci->mod_name = EDAC_MOD_STR; 307 mci->mod_name = EDAC_MOD_STR;
319 mci->mod_ver = I82443_REVISION; 308 mci->mod_ver = I82443_REVISION;
@@ -330,36 +319,36 @@ static int i82443bxgx_edacmc_probe1(struct pci_dev *pdev, int dev_idx)
330 debugf3("MC: " __FILE__ ": %s(): success\n", __func__); 319 debugf3("MC: " __FILE__ ": %s(): success\n", __func__);
331 return 0; 320 return 0;
332 321
333fail: 322 fail:
334 edac_mc_free(mci); 323 edac_mc_free(mci);
335 return -ENODEV; 324 return -ENODEV;
336} 325}
326
337EXPORT_SYMBOL_GPL(i82443bxgx_edacmc_probe1); 327EXPORT_SYMBOL_GPL(i82443bxgx_edacmc_probe1);
338 328
339/* returns count (>= 0), or negative on error */ 329/* returns count (>= 0), or negative on error */
340static int __devinit i82443bxgx_edacmc_init_one(struct pci_dev *pdev, 330static int __devinit i82443bxgx_edacmc_init_one(struct pci_dev *pdev,
341 const struct pci_device_id *ent) 331 const struct pci_device_id *ent)
342{ 332{
343 debugf0("MC: " __FILE__ ": %s()\n", __func__); 333 debugf0("MC: " __FILE__ ": %s()\n", __func__);
344 334
345 /* don't need to call pci_device_enable() */ 335 /* don't need to call pci_device_enable() */
346 return i82443bxgx_edacmc_probe1(pdev, ent->driver_data); 336 return i82443bxgx_edacmc_probe1(pdev, ent->driver_data);
347} 337}
348 338
349
350static void __devexit i82443bxgx_edacmc_remove_one(struct pci_dev *pdev) 339static void __devexit i82443bxgx_edacmc_remove_one(struct pci_dev *pdev)
351{ 340{
352 struct mem_ctl_info *mci; 341 struct mem_ctl_info *mci;
353 342
354 debugf0(__FILE__ ": %s()\n", __func__); 343 debugf0(__FILE__ ": %s()\n", __func__);
355 344
356 if ((mci = edac_mc_del_mc(&pdev->dev)) == NULL ) 345 if ((mci = edac_mc_del_mc(&pdev->dev)) == NULL)
357 return; 346 return;
358 347
359 edac_mc_free(mci); 348 edac_mc_free(mci);
360} 349}
361EXPORT_SYMBOL_GPL(i82443bxgx_edacmc_remove_one);
362 350
351EXPORT_SYMBOL_GPL(i82443bxgx_edacmc_remove_one);
363 352
364static const struct pci_device_id i82443bxgx_pci_tbl[] __devinitdata = { 353static const struct pci_device_id i82443bxgx_pci_tbl[] __devinitdata = {
365 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443BX_0)}, 354 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443BX_0)},
@@ -371,7 +360,6 @@ static const struct pci_device_id i82443bxgx_pci_tbl[] __devinitdata = {
371 360
372MODULE_DEVICE_TABLE(pci, i82443bxgx_pci_tbl); 361MODULE_DEVICE_TABLE(pci, i82443bxgx_pci_tbl);
373 362
374
375static struct pci_driver i82443bxgx_edacmc_driver = { 363static struct pci_driver i82443bxgx_edacmc_driver = {
376 .name = EDAC_MOD_STR, 364 .name = EDAC_MOD_STR,
377 .probe = i82443bxgx_edacmc_init_one, 365 .probe = i82443bxgx_edacmc_init_one,
@@ -379,23 +367,19 @@ static struct pci_driver i82443bxgx_edacmc_driver = {
379 .id_table = i82443bxgx_pci_tbl, 367 .id_table = i82443bxgx_pci_tbl,
380}; 368};
381 369
382
383static int __init i82443bxgx_edacmc_init(void) 370static int __init i82443bxgx_edacmc_init(void)
384{ 371{
385 return pci_register_driver(&i82443bxgx_edacmc_driver); 372 return pci_register_driver(&i82443bxgx_edacmc_driver);
386} 373}
387 374
388
389static void __exit i82443bxgx_edacmc_exit(void) 375static void __exit i82443bxgx_edacmc_exit(void)
390{ 376{
391 pci_unregister_driver(&i82443bxgx_edacmc_driver); 377 pci_unregister_driver(&i82443bxgx_edacmc_driver);
392} 378}
393 379
394
395module_init(i82443bxgx_edacmc_init); 380module_init(i82443bxgx_edacmc_init);
396module_exit(i82443bxgx_edacmc_exit); 381module_exit(i82443bxgx_edacmc_exit);
397 382
398
399MODULE_LICENSE("GPL"); 383MODULE_LICENSE("GPL");
400MODULE_AUTHOR("Tim Small <tim@buttersideup.com> - WPAD"); 384MODULE_AUTHOR("Tim Small <tim@buttersideup.com> - WPAD");
401MODULE_DESCRIPTION("EDAC MC support for Intel 82443BX/GX memory controllers"); 385MODULE_DESCRIPTION("EDAC MC support for Intel 82443BX/GX memory controllers");