diff options
author | Dave Peterson <dsp@llnl.gov> | 2006-03-26 04:38:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-26 11:57:08 -0500 |
commit | e7ecd8910293564d357dbaf18eb179e06fa35fd0 (patch) | |
tree | 7ec33cd42783cc53dd3ce161802d1032cea869a7 /drivers/edac/e752x_edac.c | |
parent | 54933dddc3e8ccd9db48966d8ada11951cb8a558 (diff) |
[PATCH] EDAC: formatting cleanup
Cosmetic indentation/formatting cleanup for EDAC code. Make sure we
are using tabs rather than spaces to indent, etc.
Signed-off-by: David S. Peterson <dsp@llnl.gov>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/edac/e752x_edac.c')
-rw-r--r-- | drivers/edac/e752x_edac.c | 234 |
1 files changed, 134 insertions, 100 deletions
diff --git a/drivers/edac/e752x_edac.c b/drivers/edac/e752x_edac.c index c86db23d3af3..265cce72497c 100644 --- a/drivers/edac/e752x_edac.c +++ b/drivers/edac/e752x_edac.c | |||
@@ -17,26 +17,19 @@ | |||
17 | * | 17 | * |
18 | */ | 18 | */ |
19 | 19 | ||
20 | |||
21 | #include <linux/config.h> | 20 | #include <linux/config.h> |
22 | #include <linux/module.h> | 21 | #include <linux/module.h> |
23 | #include <linux/init.h> | 22 | #include <linux/init.h> |
24 | |||
25 | #include <linux/pci.h> | 23 | #include <linux/pci.h> |
26 | #include <linux/pci_ids.h> | 24 | #include <linux/pci_ids.h> |
27 | |||
28 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
29 | |||
30 | #include "edac_mc.h" | 26 | #include "edac_mc.h" |
31 | 27 | ||
32 | |||
33 | #define e752x_printk(level, fmt, arg...) \ | 28 | #define e752x_printk(level, fmt, arg...) \ |
34 | edac_printk(level, "e752x", fmt, ##arg) | 29 | edac_printk(level, "e752x", fmt, ##arg) |
35 | |||
36 | 30 | ||
37 | #define e752x_mc_printk(mci, level, fmt, arg...) \ | 31 | #define e752x_mc_printk(mci, level, fmt, arg...) \ |
38 | edac_mc_chipset_printk(mci, level, "e752x", fmt, ##arg) | 32 | edac_mc_chipset_printk(mci, level, "e752x", fmt, ##arg) |
39 | |||
40 | 33 | ||
41 | #ifndef PCI_DEVICE_ID_INTEL_7520_0 | 34 | #ifndef PCI_DEVICE_ID_INTEL_7520_0 |
42 | #define PCI_DEVICE_ID_INTEL_7520_0 0x3590 | 35 | #define PCI_DEVICE_ID_INTEL_7520_0 0x3590 |
@@ -64,7 +57,6 @@ | |||
64 | 57 | ||
65 | #define E752X_NR_CSROWS 8 /* number of csrows */ | 58 | #define E752X_NR_CSROWS 8 /* number of csrows */ |
66 | 59 | ||
67 | |||
68 | /* E752X register addresses - device 0 function 0 */ | 60 | /* E752X register addresses - device 0 function 0 */ |
69 | #define E752X_DRB 0x60 /* DRAM row boundary register (8b) */ | 61 | #define E752X_DRB 0x60 /* DRAM row boundary register (8b) */ |
70 | #define E752X_DRA 0x70 /* DRAM row attribute register (8b) */ | 62 | #define E752X_DRA 0x70 /* DRAM row attribute register (8b) */ |
@@ -164,7 +156,6 @@ enum e752x_chips { | |||
164 | E7320 = 2 | 156 | E7320 = 2 |
165 | }; | 157 | }; |
166 | 158 | ||
167 | |||
168 | struct e752x_pvt { | 159 | struct e752x_pvt { |
169 | struct pci_dev *bridge_ck; | 160 | struct pci_dev *bridge_ck; |
170 | struct pci_dev *dev_d0f0; | 161 | struct pci_dev *dev_d0f0; |
@@ -178,7 +169,6 @@ struct e752x_pvt { | |||
178 | const struct e752x_dev_info *dev_info; | 169 | const struct e752x_dev_info *dev_info; |
179 | }; | 170 | }; |
180 | 171 | ||
181 | |||
182 | struct e752x_dev_info { | 172 | struct e752x_dev_info { |
183 | u16 err_dev; | 173 | u16 err_dev; |
184 | u16 ctl_dev; | 174 | u16 ctl_dev; |
@@ -207,22 +197,24 @@ struct e752x_error_info { | |||
207 | 197 | ||
208 | static const struct e752x_dev_info e752x_devs[] = { | 198 | static const struct e752x_dev_info e752x_devs[] = { |
209 | [E7520] = { | 199 | [E7520] = { |
210 | .err_dev = PCI_DEVICE_ID_INTEL_7520_1_ERR, | 200 | .err_dev = PCI_DEVICE_ID_INTEL_7520_1_ERR, |
211 | .ctl_dev = PCI_DEVICE_ID_INTEL_7520_0, | 201 | .ctl_dev = PCI_DEVICE_ID_INTEL_7520_0, |
212 | .ctl_name = "E7520"}, | 202 | .ctl_name = "E7520" |
203 | }, | ||
213 | [E7525] = { | 204 | [E7525] = { |
214 | .err_dev = PCI_DEVICE_ID_INTEL_7525_1_ERR, | 205 | .err_dev = PCI_DEVICE_ID_INTEL_7525_1_ERR, |
215 | .ctl_dev = PCI_DEVICE_ID_INTEL_7525_0, | 206 | .ctl_dev = PCI_DEVICE_ID_INTEL_7525_0, |
216 | .ctl_name = "E7525"}, | 207 | .ctl_name = "E7525" |
208 | }, | ||
217 | [E7320] = { | 209 | [E7320] = { |
218 | .err_dev = PCI_DEVICE_ID_INTEL_7320_1_ERR, | 210 | .err_dev = PCI_DEVICE_ID_INTEL_7320_1_ERR, |
219 | .ctl_dev = PCI_DEVICE_ID_INTEL_7320_0, | 211 | .ctl_dev = PCI_DEVICE_ID_INTEL_7320_0, |
220 | .ctl_name = "E7320"}, | 212 | .ctl_name = "E7320" |
213 | }, | ||
221 | }; | 214 | }; |
222 | 215 | ||
223 | |||
224 | static unsigned long ctl_page_to_phys(struct mem_ctl_info *mci, | 216 | static unsigned long ctl_page_to_phys(struct mem_ctl_info *mci, |
225 | unsigned long page) | 217 | unsigned long page) |
226 | { | 218 | { |
227 | u32 remap; | 219 | u32 remap; |
228 | struct e752x_pvt *pvt = (struct e752x_pvt *) mci->pvt_info; | 220 | struct e752x_pvt *pvt = (struct e752x_pvt *) mci->pvt_info; |
@@ -231,17 +223,21 @@ static unsigned long ctl_page_to_phys(struct mem_ctl_info *mci, | |||
231 | 223 | ||
232 | if (page < pvt->tolm) | 224 | if (page < pvt->tolm) |
233 | return page; | 225 | return page; |
226 | |||
234 | if ((page >= 0x100000) && (page < pvt->remapbase)) | 227 | if ((page >= 0x100000) && (page < pvt->remapbase)) |
235 | return page; | 228 | return page; |
229 | |||
236 | remap = (page - pvt->tolm) + pvt->remapbase; | 230 | remap = (page - pvt->tolm) + pvt->remapbase; |
231 | |||
237 | if (remap < pvt->remaplimit) | 232 | if (remap < pvt->remaplimit) |
238 | return remap; | 233 | return remap; |
234 | |||
239 | e752x_printk(KERN_ERR, "Invalid page %lx - out of range\n", page); | 235 | e752x_printk(KERN_ERR, "Invalid page %lx - out of range\n", page); |
240 | return pvt->tolm - 1; | 236 | return pvt->tolm - 1; |
241 | } | 237 | } |
242 | 238 | ||
243 | static void do_process_ce(struct mem_ctl_info *mci, u16 error_one, | 239 | static void do_process_ce(struct mem_ctl_info *mci, u16 error_one, |
244 | u32 sec1_add, u16 sec1_syndrome) | 240 | u32 sec1_add, u16 sec1_syndrome) |
245 | { | 241 | { |
246 | u32 page; | 242 | u32 page; |
247 | int row; | 243 | int row; |
@@ -259,34 +255,36 @@ static void do_process_ce(struct mem_ctl_info *mci, u16 error_one, | |||
259 | /* chip select are bits 14 & 13 */ | 255 | /* chip select are bits 14 & 13 */ |
260 | row = ((page >> 1) & 3); | 256 | row = ((page >> 1) & 3); |
261 | e752x_printk(KERN_WARNING, | 257 | e752x_printk(KERN_WARNING, |
262 | "Test row %d Table %d %d %d %d %d %d %d %d\n", | 258 | "Test row %d Table %d %d %d %d %d %d %d %d\n", row, |
263 | row, pvt->map[0], pvt->map[1], pvt->map[2], | 259 | pvt->map[0], pvt->map[1], pvt->map[2], pvt->map[3], |
264 | pvt->map[3], pvt->map[4], pvt->map[5], | 260 | pvt->map[4], pvt->map[5], pvt->map[6], pvt->map[7]); |
265 | pvt->map[6], pvt->map[7]); | ||
266 | 261 | ||
267 | /* test for channel remapping */ | 262 | /* test for channel remapping */ |
268 | for (i = 0; i < 8; i++) { | 263 | for (i = 0; i < 8; i++) { |
269 | if (pvt->map[i] == row) | 264 | if (pvt->map[i] == row) |
270 | break; | 265 | break; |
271 | } | 266 | } |
267 | |||
272 | e752x_printk(KERN_WARNING, "Test computed row %d\n", i); | 268 | e752x_printk(KERN_WARNING, "Test computed row %d\n", i); |
269 | |||
273 | if (i < 8) | 270 | if (i < 8) |
274 | row = i; | 271 | row = i; |
275 | else | 272 | else |
276 | e752x_mc_printk(mci, KERN_WARNING, | 273 | e752x_mc_printk(mci, KERN_WARNING, |
277 | "row %d not found in remap table\n", row); | 274 | "row %d not found in remap table\n", row); |
278 | } else | 275 | } else |
279 | row = edac_mc_find_csrow_by_page(mci, page); | 276 | row = edac_mc_find_csrow_by_page(mci, page); |
277 | |||
280 | /* 0 = channel A, 1 = channel B */ | 278 | /* 0 = channel A, 1 = channel B */ |
281 | channel = !(error_one & 1); | 279 | channel = !(error_one & 1); |
282 | 280 | ||
283 | if (!pvt->map_type) | 281 | if (!pvt->map_type) |
284 | row = 7 - row; | 282 | row = 7 - row; |
283 | |||
285 | edac_mc_handle_ce(mci, page, 0, sec1_syndrome, row, channel, | 284 | edac_mc_handle_ce(mci, page, 0, sec1_syndrome, row, channel, |
286 | "e752x CE"); | 285 | "e752x CE"); |
287 | } | 286 | } |
288 | 287 | ||
289 | |||
290 | static inline void process_ce(struct mem_ctl_info *mci, u16 error_one, | 288 | static inline void process_ce(struct mem_ctl_info *mci, u16 error_one, |
291 | u32 sec1_add, u16 sec1_syndrome, int *error_found, | 289 | u32 sec1_add, u16 sec1_syndrome, int *error_found, |
292 | int handle_error) | 290 | int handle_error) |
@@ -297,8 +295,8 @@ static inline void process_ce(struct mem_ctl_info *mci, u16 error_one, | |||
297 | do_process_ce(mci, error_one, sec1_add, sec1_syndrome); | 295 | do_process_ce(mci, error_one, sec1_add, sec1_syndrome); |
298 | } | 296 | } |
299 | 297 | ||
300 | static void do_process_ue(struct mem_ctl_info *mci, u16 error_one, u32 ded_add, | 298 | static void do_process_ue(struct mem_ctl_info *mci, u16 error_one, |
301 | u32 scrb_add) | 299 | u32 ded_add, u32 scrb_add) |
302 | { | 300 | { |
303 | u32 error_2b, block_page; | 301 | u32 error_2b, block_page; |
304 | int row; | 302 | int row; |
@@ -308,25 +306,31 @@ static void do_process_ue(struct mem_ctl_info *mci, u16 error_one, u32 ded_add, | |||
308 | 306 | ||
309 | if (error_one & 0x0202) { | 307 | if (error_one & 0x0202) { |
310 | error_2b = ded_add; | 308 | error_2b = ded_add; |
309 | |||
311 | /* convert to 4k address */ | 310 | /* convert to 4k address */ |
312 | block_page = error_2b >> (PAGE_SHIFT - 4); | 311 | block_page = error_2b >> (PAGE_SHIFT - 4); |
312 | |||
313 | row = pvt->mc_symmetric ? | 313 | row = pvt->mc_symmetric ? |
314 | /* chip select are bits 14 & 13 */ | 314 | /* chip select are bits 14 & 13 */ |
315 | ((block_page >> 1) & 3) : | 315 | ((block_page >> 1) & 3) : |
316 | edac_mc_find_csrow_by_page(mci, block_page); | 316 | edac_mc_find_csrow_by_page(mci, block_page); |
317 | |||
317 | edac_mc_handle_ue(mci, block_page, 0, row, | 318 | edac_mc_handle_ue(mci, block_page, 0, row, |
318 | "e752x UE from Read"); | 319 | "e752x UE from Read"); |
319 | } | 320 | } |
320 | if (error_one & 0x0404) { | 321 | if (error_one & 0x0404) { |
321 | error_2b = scrb_add; | 322 | error_2b = scrb_add; |
323 | |||
322 | /* convert to 4k address */ | 324 | /* convert to 4k address */ |
323 | block_page = error_2b >> (PAGE_SHIFT - 4); | 325 | block_page = error_2b >> (PAGE_SHIFT - 4); |
326 | |||
324 | row = pvt->mc_symmetric ? | 327 | row = pvt->mc_symmetric ? |
325 | /* chip select are bits 14 & 13 */ | 328 | /* chip select are bits 14 & 13 */ |
326 | ((block_page >> 1) & 3) : | 329 | ((block_page >> 1) & 3) : |
327 | edac_mc_find_csrow_by_page(mci, block_page); | 330 | edac_mc_find_csrow_by_page(mci, block_page); |
331 | |||
328 | edac_mc_handle_ue(mci, block_page, 0, row, | 332 | edac_mc_handle_ue(mci, block_page, 0, row, |
329 | "e752x UE from Scruber"); | 333 | "e752x UE from Scruber"); |
330 | } | 334 | } |
331 | } | 335 | } |
332 | 336 | ||
@@ -359,13 +363,13 @@ static void do_process_ded_retry(struct mem_ctl_info *mci, u16 error, | |||
359 | struct e752x_pvt *pvt = (struct e752x_pvt *) mci->pvt_info; | 363 | struct e752x_pvt *pvt = (struct e752x_pvt *) mci->pvt_info; |
360 | 364 | ||
361 | error_1b = retry_add; | 365 | error_1b = retry_add; |
362 | page = error_1b >> (PAGE_SHIFT - 4); /* convert the addr to 4k page */ | 366 | page = error_1b >> (PAGE_SHIFT - 4); /* convert the addr to 4k page */ |
363 | row = pvt->mc_symmetric ? | 367 | row = pvt->mc_symmetric ? |
364 | ((page >> 1) & 3) : /* chip select are bits 14 & 13 */ | 368 | ((page >> 1) & 3) : /* chip select are bits 14 & 13 */ |
365 | edac_mc_find_csrow_by_page(mci, page); | 369 | edac_mc_find_csrow_by_page(mci, page); |
366 | e752x_mc_printk(mci, KERN_WARNING, | 370 | e752x_mc_printk(mci, KERN_WARNING, |
367 | "CE page 0x%lx, row %d : Memory read retry\n", | 371 | "CE page 0x%lx, row %d : Memory read retry\n", |
368 | (long unsigned int) page, row); | 372 | (long unsigned int) page, row); |
369 | } | 373 | } |
370 | 374 | ||
371 | static inline void process_ded_retry(struct mem_ctl_info *mci, u16 error, | 375 | static inline void process_ded_retry(struct mem_ctl_info *mci, u16 error, |
@@ -402,7 +406,7 @@ static void do_global_error(int fatal, u32 errors) | |||
402 | for (i = 0; i < 11; i++) { | 406 | for (i = 0; i < 11; i++) { |
403 | if (errors & (1 << i)) | 407 | if (errors & (1 << i)) |
404 | e752x_printk(KERN_WARNING, "%sError %s\n", | 408 | e752x_printk(KERN_WARNING, "%sError %s\n", |
405 | fatal_message[fatal], global_message[i]); | 409 | fatal_message[fatal], global_message[i]); |
406 | } | 410 | } |
407 | } | 411 | } |
408 | 412 | ||
@@ -429,7 +433,7 @@ static void do_hub_error(int fatal, u8 errors) | |||
429 | for (i = 0; i < 7; i++) { | 433 | for (i = 0; i < 7; i++) { |
430 | if (errors & (1 << i)) | 434 | if (errors & (1 << i)) |
431 | e752x_printk(KERN_WARNING, "%sError %s\n", | 435 | e752x_printk(KERN_WARNING, "%sError %s\n", |
432 | fatal_message[fatal], hub_message[i]); | 436 | fatal_message[fatal], hub_message[i]); |
433 | } | 437 | } |
434 | } | 438 | } |
435 | 439 | ||
@@ -456,7 +460,7 @@ static void do_membuf_error(u8 errors) | |||
456 | for (i = 0; i < 4; i++) { | 460 | for (i = 0; i < 4; i++) { |
457 | if (errors & (1 << i)) | 461 | if (errors & (1 << i)) |
458 | e752x_printk(KERN_WARNING, "Non-Fatal Error %s\n", | 462 | e752x_printk(KERN_WARNING, "Non-Fatal Error %s\n", |
459 | membuf_message[i]); | 463 | membuf_message[i]); |
460 | } | 464 | } |
461 | } | 465 | } |
462 | 466 | ||
@@ -489,7 +493,7 @@ static void do_sysbus_error(int fatal, u32 errors) | |||
489 | for (i = 0; i < 10; i++) { | 493 | for (i = 0; i < 10; i++) { |
490 | if (errors & (1 << i)) | 494 | if (errors & (1 << i)) |
491 | e752x_printk(KERN_WARNING, "%sError System Bus %s\n", | 495 | e752x_printk(KERN_WARNING, "%sError System Bus %s\n", |
492 | fatal_message[fatal], global_message[i]); | 496 | fatal_message[fatal], global_message[i]); |
493 | } | 497 | } |
494 | } | 498 | } |
495 | 499 | ||
@@ -502,33 +506,42 @@ static inline void sysbus_error(int fatal, u32 errors, int *error_found, | |||
502 | do_sysbus_error(fatal, errors); | 506 | do_sysbus_error(fatal, errors); |
503 | } | 507 | } |
504 | 508 | ||
505 | static void e752x_check_hub_interface (struct e752x_error_info *info, | 509 | static void e752x_check_hub_interface(struct e752x_error_info *info, |
506 | int *error_found, int handle_error) | 510 | int *error_found, int handle_error) |
507 | { | 511 | { |
508 | u8 stat8; | 512 | u8 stat8; |
509 | 513 | ||
510 | //pci_read_config_byte(dev,E752X_HI_FERR,&stat8); | 514 | //pci_read_config_byte(dev,E752X_HI_FERR,&stat8); |
515 | |||
511 | stat8 = info->hi_ferr; | 516 | stat8 = info->hi_ferr; |
517 | |||
512 | if(stat8 & 0x7f) { /* Error, so process */ | 518 | if(stat8 & 0x7f) { /* Error, so process */ |
513 | stat8 &= 0x7f; | 519 | stat8 &= 0x7f; |
520 | |||
514 | if(stat8 & 0x2b) | 521 | if(stat8 & 0x2b) |
515 | hub_error(1, stat8 & 0x2b, error_found, handle_error); | 522 | hub_error(1, stat8 & 0x2b, error_found, handle_error); |
523 | |||
516 | if(stat8 & 0x54) | 524 | if(stat8 & 0x54) |
517 | hub_error(0, stat8 & 0x54, error_found, handle_error); | 525 | hub_error(0, stat8 & 0x54, error_found, handle_error); |
518 | } | 526 | } |
527 | |||
519 | //pci_read_config_byte(dev,E752X_HI_NERR,&stat8); | 528 | //pci_read_config_byte(dev,E752X_HI_NERR,&stat8); |
529 | |||
520 | stat8 = info->hi_nerr; | 530 | stat8 = info->hi_nerr; |
531 | |||
521 | if(stat8 & 0x7f) { /* Error, so process */ | 532 | if(stat8 & 0x7f) { /* Error, so process */ |
522 | stat8 &= 0x7f; | 533 | stat8 &= 0x7f; |
534 | |||
523 | if (stat8 & 0x2b) | 535 | if (stat8 & 0x2b) |
524 | hub_error(1, stat8 & 0x2b, error_found, handle_error); | 536 | hub_error(1, stat8 & 0x2b, error_found, handle_error); |
537 | |||
525 | if(stat8 & 0x54) | 538 | if(stat8 & 0x54) |
526 | hub_error(0, stat8 & 0x54, error_found, handle_error); | 539 | hub_error(0, stat8 & 0x54, error_found, handle_error); |
527 | } | 540 | } |
528 | } | 541 | } |
529 | 542 | ||
530 | static void e752x_check_sysbus (struct e752x_error_info *info, int *error_found, | 543 | static void e752x_check_sysbus(struct e752x_error_info *info, |
531 | int handle_error) | 544 | int *error_found, int handle_error) |
532 | { | 545 | { |
533 | u32 stat32, error32; | 546 | u32 stat32, error32; |
534 | 547 | ||
@@ -540,27 +553,34 @@ static void e752x_check_sysbus (struct e752x_error_info *info, int *error_found, | |||
540 | 553 | ||
541 | error32 = (stat32 >> 16) & 0x3ff; | 554 | error32 = (stat32 >> 16) & 0x3ff; |
542 | stat32 = stat32 & 0x3ff; | 555 | stat32 = stat32 & 0x3ff; |
556 | |||
543 | if(stat32 & 0x083) | 557 | if(stat32 & 0x083) |
544 | sysbus_error(1, stat32 & 0x083, error_found, handle_error); | 558 | sysbus_error(1, stat32 & 0x083, error_found, handle_error); |
559 | |||
545 | if(stat32 & 0x37c) | 560 | if(stat32 & 0x37c) |
546 | sysbus_error(0, stat32 & 0x37c, error_found, handle_error); | 561 | sysbus_error(0, stat32 & 0x37c, error_found, handle_error); |
562 | |||
547 | if(error32 & 0x083) | 563 | if(error32 & 0x083) |
548 | sysbus_error(1, error32 & 0x083, error_found, handle_error); | 564 | sysbus_error(1, error32 & 0x083, error_found, handle_error); |
565 | |||
549 | if(error32 & 0x37c) | 566 | if(error32 & 0x37c) |
550 | sysbus_error(0, error32 & 0x37c, error_found, handle_error); | 567 | sysbus_error(0, error32 & 0x37c, error_found, handle_error); |
551 | } | 568 | } |
552 | 569 | ||
553 | static void e752x_check_membuf (struct e752x_error_info *info, int *error_found, | 570 | static void e752x_check_membuf (struct e752x_error_info *info, |
554 | int handle_error) | 571 | int *error_found, int handle_error) |
555 | { | 572 | { |
556 | u8 stat8; | 573 | u8 stat8; |
557 | 574 | ||
558 | stat8 = info->buf_ferr; | 575 | stat8 = info->buf_ferr; |
576 | |||
559 | if (stat8 & 0x0f) { /* Error, so process */ | 577 | if (stat8 & 0x0f) { /* Error, so process */ |
560 | stat8 &= 0x0f; | 578 | stat8 &= 0x0f; |
561 | membuf_error(stat8, error_found, handle_error); | 579 | membuf_error(stat8, error_found, handle_error); |
562 | } | 580 | } |
581 | |||
563 | stat8 = info->buf_nerr; | 582 | stat8 = info->buf_nerr; |
583 | |||
564 | if (stat8 & 0x0f) { /* Error, so process */ | 584 | if (stat8 & 0x0f) { /* Error, so process */ |
565 | stat8 &= 0x0f; | 585 | stat8 &= 0x0f; |
566 | membuf_error(stat8, error_found, handle_error); | 586 | membuf_error(stat8, error_found, handle_error); |
@@ -568,7 +588,8 @@ static void e752x_check_membuf (struct e752x_error_info *info, int *error_found, | |||
568 | } | 588 | } |
569 | 589 | ||
570 | static void e752x_check_dram (struct mem_ctl_info *mci, | 590 | static void e752x_check_dram (struct mem_ctl_info *mci, |
571 | struct e752x_error_info *info, int *error_found, int handle_error) | 591 | struct e752x_error_info *info, int *error_found, |
592 | int handle_error) | ||
572 | { | 593 | { |
573 | u16 error_one, error_next; | 594 | u16 error_one, error_next; |
574 | 595 | ||
@@ -618,7 +639,7 @@ static void e752x_check_dram (struct mem_ctl_info *mci, | |||
618 | } | 639 | } |
619 | 640 | ||
620 | static void e752x_get_error_info (struct mem_ctl_info *mci, | 641 | static void e752x_get_error_info (struct mem_ctl_info *mci, |
621 | struct e752x_error_info *info) | 642 | struct e752x_error_info *info) |
622 | { | 643 | { |
623 | struct pci_dev *dev; | 644 | struct pci_dev *dev; |
624 | struct e752x_pvt *pvt; | 645 | struct e752x_pvt *pvt; |
@@ -626,7 +647,6 @@ static void e752x_get_error_info (struct mem_ctl_info *mci, | |||
626 | memset(info, 0, sizeof(*info)); | 647 | memset(info, 0, sizeof(*info)); |
627 | pvt = (struct e752x_pvt *) mci->pvt_info; | 648 | pvt = (struct e752x_pvt *) mci->pvt_info; |
628 | dev = pvt->dev_d0f1; | 649 | dev = pvt->dev_d0f1; |
629 | |||
630 | pci_read_config_dword(dev, E752X_FERR_GLOBAL, &info->ferr_global); | 650 | pci_read_config_dword(dev, E752X_FERR_GLOBAL, &info->ferr_global); |
631 | 651 | ||
632 | if (info->ferr_global) { | 652 | if (info->ferr_global) { |
@@ -737,6 +757,7 @@ static int e752x_process_error_info (struct mem_ctl_info *mci, | |||
737 | static void e752x_check(struct mem_ctl_info *mci) | 757 | static void e752x_check(struct mem_ctl_info *mci) |
738 | { | 758 | { |
739 | struct e752x_error_info info; | 759 | struct e752x_error_info info; |
760 | |||
740 | debugf3("%s()\n", __func__); | 761 | debugf3("%s()\n", __func__); |
741 | e752x_get_error_info(mci, &info); | 762 | e752x_get_error_info(mci, &info); |
742 | e752x_process_error_info(mci, &info, 1); | 763 | e752x_process_error_info(mci, &info, 1); |
@@ -752,9 +773,9 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx) | |||
752 | struct e752x_pvt *pvt = NULL; | 773 | struct e752x_pvt *pvt = NULL; |
753 | u16 ddrcsr; | 774 | u16 ddrcsr; |
754 | u32 drc; | 775 | u32 drc; |
755 | int drc_chan; /* Number of channels 0=1chan,1=2chan */ | 776 | int drc_chan; /* Number of channels 0=1chan,1=2chan */ |
756 | int drc_drbg; /* DRB granularity 0=64mb,1=128mb */ | 777 | int drc_drbg; /* DRB granularity 0=64mb, 1=128mb */ |
757 | int drc_ddim; /* DRAM Data Integrity Mode 0=none,2=edac */ | 778 | int drc_ddim; /* DRAM Data Integrity Mode 0=none,2=edac */ |
758 | u32 dra; | 779 | u32 dra; |
759 | unsigned long last_cumul_size; | 780 | unsigned long last_cumul_size; |
760 | struct pci_dev *dev = NULL; | 781 | struct pci_dev *dev = NULL; |
@@ -785,7 +806,6 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx) | |||
785 | } | 806 | } |
786 | 807 | ||
787 | debugf3("%s(): init mci\n", __func__); | 808 | debugf3("%s(): init mci\n", __func__); |
788 | |||
789 | mci->mtype_cap = MEM_FLAG_RDDR; | 809 | mci->mtype_cap = MEM_FLAG_RDDR; |
790 | mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_SECDED | | 810 | mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_SECDED | |
791 | EDAC_FLAG_S4ECD4ED; | 811 | EDAC_FLAG_S4ECD4ED; |
@@ -798,19 +818,21 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx) | |||
798 | pvt = (struct e752x_pvt *) mci->pvt_info; | 818 | pvt = (struct e752x_pvt *) mci->pvt_info; |
799 | pvt->dev_info = &e752x_devs[dev_idx]; | 819 | pvt->dev_info = &e752x_devs[dev_idx]; |
800 | pvt->bridge_ck = pci_get_device(PCI_VENDOR_ID_INTEL, | 820 | pvt->bridge_ck = pci_get_device(PCI_VENDOR_ID_INTEL, |
801 | pvt->dev_info->err_dev, | 821 | pvt->dev_info->err_dev, |
802 | pvt->bridge_ck); | 822 | pvt->bridge_ck); |
823 | |||
803 | if (pvt->bridge_ck == NULL) | 824 | if (pvt->bridge_ck == NULL) |
804 | pvt->bridge_ck = pci_scan_single_device(pdev->bus, | 825 | pvt->bridge_ck = pci_scan_single_device(pdev->bus, |
805 | PCI_DEVFN(0, 1)); | 826 | PCI_DEVFN(0, 1)); |
827 | |||
806 | if (pvt->bridge_ck == NULL) { | 828 | if (pvt->bridge_ck == NULL) { |
807 | e752x_printk(KERN_ERR, "error reporting device not found:" | 829 | e752x_printk(KERN_ERR, "error reporting device not found:" |
808 | "vendor %x device 0x%x (broken BIOS?)\n", | 830 | "vendor %x device 0x%x (broken BIOS?)\n", |
809 | PCI_VENDOR_ID_INTEL, e752x_devs[dev_idx].err_dev); | 831 | PCI_VENDOR_ID_INTEL, e752x_devs[dev_idx].err_dev); |
810 | goto fail; | 832 | goto fail; |
811 | } | 833 | } |
812 | pvt->mc_symmetric = ((ddrcsr & 0x10) != 0); | ||
813 | 834 | ||
835 | pvt->mc_symmetric = ((ddrcsr & 0x10) != 0); | ||
814 | debugf3("%s(): more mci init\n", __func__); | 836 | debugf3("%s(): more mci init\n", __func__); |
815 | mci->ctl_name = pvt->dev_info->ctl_name; | 837 | mci->ctl_name = pvt->dev_info->ctl_name; |
816 | mci->edac_check = e752x_check; | 838 | mci->edac_check = e752x_check; |
@@ -828,6 +850,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx) | |||
828 | for (last_cumul_size = index = 0; index < mci->nr_csrows; index++) { | 850 | for (last_cumul_size = index = 0; index < mci->nr_csrows; index++) { |
829 | u8 value; | 851 | u8 value; |
830 | u32 cumul_size; | 852 | u32 cumul_size; |
853 | |||
831 | /* mem_dev 0=x8, 1=x4 */ | 854 | /* mem_dev 0=x8, 1=x4 */ |
832 | int mem_dev = (dra >> (index * 4 + 2)) & 0x3; | 855 | int mem_dev = (dra >> (index * 4 + 2)) & 0x3; |
833 | struct csrow_info *csrow = &mci->csrows[index]; | 856 | struct csrow_info *csrow = &mci->csrows[index]; |
@@ -838,15 +861,16 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx) | |||
838 | cumul_size = value << (25 + drc_drbg - PAGE_SHIFT); | 861 | cumul_size = value << (25 + drc_drbg - PAGE_SHIFT); |
839 | debugf3("%s(): (%d) cumul_size 0x%x\n", __func__, index, | 862 | debugf3("%s(): (%d) cumul_size 0x%x\n", __func__, index, |
840 | cumul_size); | 863 | cumul_size); |
864 | |||
841 | if (cumul_size == last_cumul_size) | 865 | if (cumul_size == last_cumul_size) |
842 | continue; /* not populated */ | 866 | continue; /* not populated */ |
843 | 867 | ||
844 | csrow->first_page = last_cumul_size; | 868 | csrow->first_page = last_cumul_size; |
845 | csrow->last_page = cumul_size - 1; | 869 | csrow->last_page = cumul_size - 1; |
846 | csrow->nr_pages = cumul_size - last_cumul_size; | 870 | csrow->nr_pages = cumul_size - last_cumul_size; |
847 | last_cumul_size = cumul_size; | 871 | last_cumul_size = cumul_size; |
848 | csrow->grain = 1 << 12; /* 4KiB - resolution of CELOG */ | 872 | csrow->grain = 1 << 12; /* 4KiB - resolution of CELOG */ |
849 | csrow->mtype = MEM_RDDR; /* only one type supported */ | 873 | csrow->mtype = MEM_RDDR; /* only one type supported */ |
850 | csrow->dtype = mem_dev ? DEV_X4 : DEV_X8; | 874 | csrow->dtype = mem_dev ? DEV_X4 : DEV_X8; |
851 | 875 | ||
852 | /* | 876 | /* |
@@ -870,29 +894,32 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx) | |||
870 | u8 value; | 894 | u8 value; |
871 | u8 last = 0; | 895 | u8 last = 0; |
872 | u8 row = 0; | 896 | u8 row = 0; |
873 | for (index = 0; index < 8; index += 2) { | ||
874 | 897 | ||
898 | for (index = 0; index < 8; index += 2) { | ||
875 | pci_read_config_byte(mci->pdev, E752X_DRB + index, | 899 | pci_read_config_byte(mci->pdev, E752X_DRB + index, |
876 | &value); | 900 | &value); |
901 | |||
877 | /* test if there is a dimm in this slot */ | 902 | /* test if there is a dimm in this slot */ |
878 | if (value == last) { | 903 | if (value == last) { |
879 | /* no dimm in the slot, so flag it as empty */ | 904 | /* no dimm in the slot, so flag it as empty */ |
880 | pvt->map[index] = 0xff; | 905 | pvt->map[index] = 0xff; |
881 | pvt->map[index + 1] = 0xff; | 906 | pvt->map[index + 1] = 0xff; |
882 | } else { /* there is a dimm in the slot */ | 907 | } else { /* there is a dimm in the slot */ |
883 | pvt->map[index] = row; | 908 | pvt->map[index] = row; |
884 | row++; | 909 | row++; |
885 | last = value; | 910 | last = value; |
886 | /* test the next value to see if the dimm is | 911 | /* test the next value to see if the dimm is |
887 | double sided */ | 912 | double sided */ |
888 | pci_read_config_byte(mci->pdev, | 913 | pci_read_config_byte(mci->pdev, |
889 | E752X_DRB + index + 1, | 914 | E752X_DRB + index + 1, |
890 | &value); | 915 | &value); |
891 | pvt->map[index + 1] = (value == last) ? | 916 | pvt->map[index + 1] = (value == last) ? |
892 | 0xff : /* the dimm is single sided, | 917 | 0xff : /* the dimm is single sided, |
893 | so flag as empty */ | 918 | * so flag as empty |
894 | row; /* this is a double sided dimm | 919 | */ |
895 | to save the next row # */ | 920 | row; /* this is a double sided dimm |
921 | * to save the next row # | ||
922 | */ | ||
896 | row++; | 923 | row++; |
897 | last = value; | 924 | last = value; |
898 | } | 925 | } |
@@ -904,8 +931,8 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx) | |||
904 | pvt->map_type = ((stat8 & 0x0f) > ((stat8 >> 4) & 0x0f)); | 931 | pvt->map_type = ((stat8 & 0x0f) > ((stat8 >> 4) & 0x0f)); |
905 | 932 | ||
906 | mci->edac_cap |= EDAC_FLAG_NONE; | 933 | mci->edac_cap |= EDAC_FLAG_NONE; |
907 | |||
908 | debugf3("%s(): tolm, remapbase, remaplimit\n", __func__); | 934 | debugf3("%s(): tolm, remapbase, remaplimit\n", __func__); |
935 | |||
909 | /* load the top of low memory, remap base, and remap limit vars */ | 936 | /* load the top of low memory, remap base, and remap limit vars */ |
910 | pci_read_config_word(mci->pdev, E752X_TOLM, &pci_data); | 937 | pci_read_config_word(mci->pdev, E752X_TOLM, &pci_data); |
911 | pvt->tolm = ((u32) pci_data) << 4; | 938 | pvt->tolm = ((u32) pci_data) << 4; |
@@ -914,8 +941,8 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx) | |||
914 | pci_read_config_word(mci->pdev, E752X_REMAPLIMIT, &pci_data); | 941 | pci_read_config_word(mci->pdev, E752X_REMAPLIMIT, &pci_data); |
915 | pvt->remaplimit = ((u32) pci_data) << 14; | 942 | pvt->remaplimit = ((u32) pci_data) << 14; |
916 | e752x_printk(KERN_INFO, | 943 | e752x_printk(KERN_INFO, |
917 | "tolm = %x, remapbase = %x, remaplimit = %x\n", | 944 | "tolm = %x, remapbase = %x, remaplimit = %x\n", pvt->tolm, |
918 | pvt->tolm, pvt->remapbase, pvt->remaplimit); | 945 | pvt->remapbase, pvt->remaplimit); |
919 | 946 | ||
920 | if (edac_mc_add_mc(mci)) { | 947 | if (edac_mc_add_mc(mci)) { |
921 | debugf3("%s(): failed edac_mc_add_mc()\n", __func__); | 948 | debugf3("%s(): failed edac_mc_add_mc()\n", __func__); |
@@ -923,7 +950,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx) | |||
923 | } | 950 | } |
924 | 951 | ||
925 | dev = pci_get_device(PCI_VENDOR_ID_INTEL, e752x_devs[dev_idx].ctl_dev, | 952 | dev = pci_get_device(PCI_VENDOR_ID_INTEL, e752x_devs[dev_idx].ctl_dev, |
926 | NULL); | 953 | NULL); |
927 | pvt->dev_d0f0 = dev; | 954 | pvt->dev_d0f0 = dev; |
928 | /* find the error reporting device and clear errors */ | 955 | /* find the error reporting device and clear errors */ |
929 | dev = pvt->dev_d0f1 = pci_dev_get(pvt->bridge_ck); | 956 | dev = pvt->dev_d0f1 = pci_dev_get(pvt->bridge_ck); |
@@ -936,8 +963,8 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx) | |||
936 | pci_write_config_byte(dev, E752X_BUF_SMICMD, 0x00); | 963 | pci_write_config_byte(dev, E752X_BUF_SMICMD, 0x00); |
937 | pci_write_config_byte(dev, E752X_DRAM_ERRMASK, 0x00); | 964 | pci_write_config_byte(dev, E752X_DRAM_ERRMASK, 0x00); |
938 | pci_write_config_byte(dev, E752X_DRAM_SMICMD, 0x00); | 965 | pci_write_config_byte(dev, E752X_DRAM_SMICMD, 0x00); |
939 | /* clear other MCH errors */ | 966 | |
940 | e752x_get_error_info(mci, &discard); | 967 | e752x_get_error_info(mci, &discard); /* clear other MCH errors */ |
941 | 968 | ||
942 | /* get this far and it's successful */ | 969 | /* get this far and it's successful */ |
943 | debugf3("%s(): success\n", __func__); | 970 | debugf3("%s(): success\n", __func__); |
@@ -947,28 +974,32 @@ fail: | |||
947 | if (mci) { | 974 | if (mci) { |
948 | if (pvt->dev_d0f0) | 975 | if (pvt->dev_d0f0) |
949 | pci_dev_put(pvt->dev_d0f0); | 976 | pci_dev_put(pvt->dev_d0f0); |
977 | |||
950 | if (pvt->dev_d0f1) | 978 | if (pvt->dev_d0f1) |
951 | pci_dev_put(pvt->dev_d0f1); | 979 | pci_dev_put(pvt->dev_d0f1); |
980 | |||
952 | if (pvt->bridge_ck) | 981 | if (pvt->bridge_ck) |
953 | pci_dev_put(pvt->bridge_ck); | 982 | pci_dev_put(pvt->bridge_ck); |
983 | |||
954 | edac_mc_free(mci); | 984 | edac_mc_free(mci); |
955 | } | 985 | } |
986 | |||
956 | return rc; | 987 | return rc; |
957 | } | 988 | } |
958 | 989 | ||
959 | /* returns count (>= 0), or negative on error */ | 990 | /* returns count (>= 0), or negative on error */ |
960 | static int __devinit e752x_init_one(struct pci_dev *pdev, | 991 | static int __devinit e752x_init_one(struct pci_dev *pdev, |
961 | const struct pci_device_id *ent) | 992 | const struct pci_device_id *ent) |
962 | { | 993 | { |
963 | debugf0("%s()\n", __func__); | 994 | debugf0("%s()\n", __func__); |
964 | 995 | ||
965 | /* wake up and enable device */ | 996 | /* wake up and enable device */ |
966 | if(pci_enable_device(pdev) < 0) | 997 | if(pci_enable_device(pdev) < 0) |
967 | return -EIO; | 998 | return -EIO; |
999 | |||
968 | return e752x_probe1(pdev, ent->driver_data); | 1000 | return e752x_probe1(pdev, ent->driver_data); |
969 | } | 1001 | } |
970 | 1002 | ||
971 | |||
972 | static void __devexit e752x_remove_one(struct pci_dev *pdev) | 1003 | static void __devexit e752x_remove_one(struct pci_dev *pdev) |
973 | { | 1004 | { |
974 | struct mem_ctl_info *mci; | 1005 | struct mem_ctl_info *mci; |
@@ -986,20 +1017,26 @@ static void __devexit e752x_remove_one(struct pci_dev *pdev) | |||
986 | edac_mc_free(mci); | 1017 | edac_mc_free(mci); |
987 | } | 1018 | } |
988 | 1019 | ||
989 | |||
990 | static const struct pci_device_id e752x_pci_tbl[] __devinitdata = { | 1020 | static const struct pci_device_id e752x_pci_tbl[] __devinitdata = { |
991 | {PCI_VEND_DEV(INTEL, 7520_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 1021 | { |
992 | E7520}, | 1022 | PCI_VEND_DEV(INTEL, 7520_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
993 | {PCI_VEND_DEV(INTEL, 7525_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 1023 | E7520 |
994 | E7525}, | 1024 | }, |
995 | {PCI_VEND_DEV(INTEL, 7320_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 1025 | { |
996 | E7320}, | 1026 | PCI_VEND_DEV(INTEL, 7525_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
997 | {0,} /* 0 terminated list. */ | 1027 | E7525 |
1028 | }, | ||
1029 | { | ||
1030 | PCI_VEND_DEV(INTEL, 7320_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
1031 | E7320 | ||
1032 | }, | ||
1033 | { | ||
1034 | 0, | ||
1035 | } /* 0 terminated list. */ | ||
998 | }; | 1036 | }; |
999 | 1037 | ||
1000 | MODULE_DEVICE_TABLE(pci, e752x_pci_tbl); | 1038 | MODULE_DEVICE_TABLE(pci, e752x_pci_tbl); |
1001 | 1039 | ||
1002 | |||
1003 | static struct pci_driver e752x_driver = { | 1040 | static struct pci_driver e752x_driver = { |
1004 | .name = EDAC_MOD_STR, | 1041 | .name = EDAC_MOD_STR, |
1005 | .probe = e752x_init_one, | 1042 | .probe = e752x_init_one, |
@@ -1007,7 +1044,6 @@ static struct pci_driver e752x_driver = { | |||
1007 | .id_table = e752x_pci_tbl, | 1044 | .id_table = e752x_pci_tbl, |
1008 | }; | 1045 | }; |
1009 | 1046 | ||
1010 | |||
1011 | static int __init e752x_init(void) | 1047 | static int __init e752x_init(void) |
1012 | { | 1048 | { |
1013 | int pci_rc; | 1049 | int pci_rc; |
@@ -1017,14 +1053,12 @@ static int __init e752x_init(void) | |||
1017 | return (pci_rc < 0) ? pci_rc : 0; | 1053 | return (pci_rc < 0) ? pci_rc : 0; |
1018 | } | 1054 | } |
1019 | 1055 | ||
1020 | |||
1021 | static void __exit e752x_exit(void) | 1056 | static void __exit e752x_exit(void) |
1022 | { | 1057 | { |
1023 | debugf3("%s()\n", __func__); | 1058 | debugf3("%s()\n", __func__); |
1024 | pci_unregister_driver(&e752x_driver); | 1059 | pci_unregister_driver(&e752x_driver); |
1025 | } | 1060 | } |
1026 | 1061 | ||
1027 | |||
1028 | module_init(e752x_init); | 1062 | module_init(e752x_init); |
1029 | module_exit(e752x_exit); | 1063 | module_exit(e752x_exit); |
1030 | 1064 | ||