diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-06-13 13:09:11 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-11-01 08:01:53 -0400 |
commit | 5f032119d6f1cc48d0d1a28b8014f270ca4c4e47 (patch) | |
tree | 29a6389b22a4c35fa5488be546c6542d99b452aa /drivers/edac/i7300_edac.c | |
parent | 767ba4a52a6de7ea2875a8af79bf11452a2a0c44 (diff) |
i7300_edac: Fix error cleanup logic
The error cleanup logic was broken. Due to that, one error is generated for
every error polling.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/edac/i7300_edac.c')
-rw-r--r-- | drivers/edac/i7300_edac.c | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/drivers/edac/i7300_edac.c b/drivers/edac/i7300_edac.c index a76fe8366b68..6104dba380b6 100644 --- a/drivers/edac/i7300_edac.c +++ b/drivers/edac/i7300_edac.c | |||
@@ -372,7 +372,7 @@ static const char *get_err_from_table(const char *table[], int size, int pos) | |||
372 | static void i7300_process_error_global(struct mem_ctl_info *mci) | 372 | static void i7300_process_error_global(struct mem_ctl_info *mci) |
373 | { | 373 | { |
374 | struct i7300_pvt *pvt; | 374 | struct i7300_pvt *pvt; |
375 | u32 errnum, value; | 375 | u32 errnum, error_reg; |
376 | unsigned long errors; | 376 | unsigned long errors; |
377 | const char *specific; | 377 | const char *specific; |
378 | bool is_fatal; | 378 | bool is_fatal; |
@@ -381,9 +381,9 @@ static void i7300_process_error_global(struct mem_ctl_info *mci) | |||
381 | 381 | ||
382 | /* read in the 1st FATAL error register */ | 382 | /* read in the 1st FATAL error register */ |
383 | pci_read_config_dword(pvt->pci_dev_16_2_fsb_err_regs, | 383 | pci_read_config_dword(pvt->pci_dev_16_2_fsb_err_regs, |
384 | FERR_GLOBAL_HI, &value); | 384 | FERR_GLOBAL_HI, &error_reg); |
385 | if (unlikely(value)) { | 385 | if (unlikely(error_reg)) { |
386 | errors = value; | 386 | errors = error_reg; |
387 | errnum = find_first_bit(&errors, | 387 | errnum = find_first_bit(&errors, |
388 | ARRAY_SIZE(ferr_global_hi_name)); | 388 | ARRAY_SIZE(ferr_global_hi_name)); |
389 | specific = GET_ERR_FROM_TABLE(ferr_global_hi_name, errnum); | 389 | specific = GET_ERR_FROM_TABLE(ferr_global_hi_name, errnum); |
@@ -391,15 +391,15 @@ static void i7300_process_error_global(struct mem_ctl_info *mci) | |||
391 | 391 | ||
392 | /* Clear the error bit */ | 392 | /* Clear the error bit */ |
393 | pci_write_config_dword(pvt->pci_dev_16_2_fsb_err_regs, | 393 | pci_write_config_dword(pvt->pci_dev_16_2_fsb_err_regs, |
394 | FERR_GLOBAL_HI, value); | 394 | FERR_GLOBAL_HI, error_reg); |
395 | 395 | ||
396 | goto error_global; | 396 | goto error_global; |
397 | } | 397 | } |
398 | 398 | ||
399 | pci_read_config_dword(pvt->pci_dev_16_2_fsb_err_regs, | 399 | pci_read_config_dword(pvt->pci_dev_16_2_fsb_err_regs, |
400 | FERR_GLOBAL_LO, &value); | 400 | FERR_GLOBAL_LO, &error_reg); |
401 | if (unlikely(value)) { | 401 | if (unlikely(error_reg)) { |
402 | errors = value; | 402 | errors = error_reg; |
403 | errnum = find_first_bit(&errors, | 403 | errnum = find_first_bit(&errors, |
404 | ARRAY_SIZE(ferr_global_lo_name)); | 404 | ARRAY_SIZE(ferr_global_lo_name)); |
405 | specific = GET_ERR_FROM_TABLE(ferr_global_lo_name, errnum); | 405 | specific = GET_ERR_FROM_TABLE(ferr_global_lo_name, errnum); |
@@ -407,7 +407,7 @@ static void i7300_process_error_global(struct mem_ctl_info *mci) | |||
407 | 407 | ||
408 | /* Clear the error bit */ | 408 | /* Clear the error bit */ |
409 | pci_write_config_dword(pvt->pci_dev_16_2_fsb_err_regs, | 409 | pci_write_config_dword(pvt->pci_dev_16_2_fsb_err_regs, |
410 | FERR_GLOBAL_LO, value); | 410 | FERR_GLOBAL_LO, error_reg); |
411 | 411 | ||
412 | goto error_global; | 412 | goto error_global; |
413 | } | 413 | } |
@@ -427,7 +427,7 @@ error_global: | |||
427 | static void i7300_process_fbd_error(struct mem_ctl_info *mci) | 427 | static void i7300_process_fbd_error(struct mem_ctl_info *mci) |
428 | { | 428 | { |
429 | struct i7300_pvt *pvt; | 429 | struct i7300_pvt *pvt; |
430 | u32 errnum, value; | 430 | u32 errnum, value, error_reg; |
431 | u16 val16; | 431 | u16 val16; |
432 | unsigned branch, channel, bank, rank, cas, ras; | 432 | unsigned branch, channel, bank, rank, cas, ras; |
433 | u32 syndrome; | 433 | u32 syndrome; |
@@ -440,14 +440,14 @@ static void i7300_process_fbd_error(struct mem_ctl_info *mci) | |||
440 | 440 | ||
441 | /* read in the 1st FATAL error register */ | 441 | /* read in the 1st FATAL error register */ |
442 | pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map, | 442 | pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map, |
443 | FERR_FAT_FBD, &value); | 443 | FERR_FAT_FBD, &error_reg); |
444 | if (unlikely(value & FERR_FAT_FBD_ERR_MASK)) { | 444 | if (unlikely(error_reg & FERR_FAT_FBD_ERR_MASK)) { |
445 | errors = value & FERR_FAT_FBD_ERR_MASK ; | 445 | errors = error_reg & FERR_FAT_FBD_ERR_MASK ; |
446 | errnum = find_first_bit(&errors, | 446 | errnum = find_first_bit(&errors, |
447 | ARRAY_SIZE(ferr_fat_fbd_name)); | 447 | ARRAY_SIZE(ferr_fat_fbd_name)); |
448 | specific = GET_ERR_FROM_TABLE(ferr_fat_fbd_name, errnum); | 448 | specific = GET_ERR_FROM_TABLE(ferr_fat_fbd_name, errnum); |
449 | branch = (GET_FBD_FAT_IDX(error_reg) == 2) ? 1 : 0; | ||
449 | 450 | ||
450 | branch = (GET_FBD_FAT_IDX(value) == 2) ? 1 : 0; | ||
451 | pci_read_config_word(pvt->pci_dev_16_1_fsb_addr_map, | 451 | pci_read_config_word(pvt->pci_dev_16_1_fsb_addr_map, |
452 | NRECMEMA, &val16); | 452 | NRECMEMA, &val16); |
453 | bank = NRECMEMA_BANK(val16); | 453 | bank = NRECMEMA_BANK(val16); |
@@ -455,11 +455,14 @@ static void i7300_process_fbd_error(struct mem_ctl_info *mci) | |||
455 | 455 | ||
456 | pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map, | 456 | pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map, |
457 | NRECMEMB, &value); | 457 | NRECMEMB, &value); |
458 | |||
459 | is_wr = NRECMEMB_IS_WR(value); | 458 | is_wr = NRECMEMB_IS_WR(value); |
460 | cas = NRECMEMB_CAS(value); | 459 | cas = NRECMEMB_CAS(value); |
461 | ras = NRECMEMB_RAS(value); | 460 | ras = NRECMEMB_RAS(value); |
462 | 461 | ||
462 | /* Clean the error register */ | ||
463 | pci_write_config_dword(pvt->pci_dev_16_1_fsb_addr_map, | ||
464 | FERR_FAT_FBD, error_reg); | ||
465 | |||
463 | snprintf(pvt->tmp_prt_buffer, PAGE_SIZE, | 466 | snprintf(pvt->tmp_prt_buffer, PAGE_SIZE, |
464 | "FATAL (Branch=%d DRAM-Bank=%d %s " | 467 | "FATAL (Branch=%d DRAM-Bank=%d %s " |
465 | "RAS=%d CAS=%d Err=0x%lx (%s))", | 468 | "RAS=%d CAS=%d Err=0x%lx (%s))", |
@@ -476,21 +479,17 @@ static void i7300_process_fbd_error(struct mem_ctl_info *mci) | |||
476 | 479 | ||
477 | /* read in the 1st NON-FATAL error register */ | 480 | /* read in the 1st NON-FATAL error register */ |
478 | pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map, | 481 | pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map, |
479 | FERR_NF_FBD, &value); | 482 | FERR_NF_FBD, &error_reg); |
480 | if (unlikely(value & FERR_NF_FBD_ERR_MASK)) { | 483 | if (unlikely(error_reg & FERR_NF_FBD_ERR_MASK)) { |
481 | errors = value & FERR_NF_FBD_ERR_MASK; | 484 | errors = error_reg & FERR_NF_FBD_ERR_MASK; |
482 | errnum = find_first_bit(&errors, | 485 | errnum = find_first_bit(&errors, |
483 | ARRAY_SIZE(ferr_nf_fbd_name)); | 486 | ARRAY_SIZE(ferr_nf_fbd_name)); |
484 | specific = GET_ERR_FROM_TABLE(ferr_nf_fbd_name, errnum); | 487 | specific = GET_ERR_FROM_TABLE(ferr_nf_fbd_name, errnum); |
485 | 488 | branch = (GET_FBD_FAT_IDX(error_reg) == 2) ? 1 : 0; | |
486 | /* Clear the error bit */ | ||
487 | pci_write_config_dword(pvt->pci_dev_16_2_fsb_err_regs, | ||
488 | FERR_GLOBAL_LO, value); | ||
489 | 489 | ||
490 | pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map, | 490 | pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map, |
491 | REDMEMA, &syndrome); | 491 | REDMEMA, &syndrome); |
492 | 492 | ||
493 | branch = (GET_FBD_FAT_IDX(value) == 2) ? 1 : 0; | ||
494 | pci_read_config_word(pvt->pci_dev_16_1_fsb_addr_map, | 493 | pci_read_config_word(pvt->pci_dev_16_1_fsb_addr_map, |
495 | RECMEMA, &val16); | 494 | RECMEMA, &val16); |
496 | bank = RECMEMA_BANK(val16); | 495 | bank = RECMEMA_BANK(val16); |
@@ -498,18 +497,20 @@ static void i7300_process_fbd_error(struct mem_ctl_info *mci) | |||
498 | 497 | ||
499 | pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map, | 498 | pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map, |
500 | RECMEMB, &value); | 499 | RECMEMB, &value); |
501 | |||
502 | is_wr = RECMEMB_IS_WR(value); | 500 | is_wr = RECMEMB_IS_WR(value); |
503 | cas = RECMEMB_CAS(value); | 501 | cas = RECMEMB_CAS(value); |
504 | ras = RECMEMB_RAS(value); | 502 | ras = RECMEMB_RAS(value); |
505 | 503 | ||
506 | pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map, | 504 | pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map, |
507 | REDMEMB, &value); | 505 | REDMEMB, &value); |
508 | |||
509 | channel = (branch << 1); | 506 | channel = (branch << 1); |
510 | if (IS_SECOND_CH(value)) | 507 | if (IS_SECOND_CH(value)) |
511 | channel++; | 508 | channel++; |
512 | 509 | ||
510 | /* Clear the error bit */ | ||
511 | pci_write_config_dword(pvt->pci_dev_16_1_fsb_addr_map, | ||
512 | FERR_NF_FBD, error_reg); | ||
513 | |||
513 | /* Form out message */ | 514 | /* Form out message */ |
514 | snprintf(pvt->tmp_prt_buffer, PAGE_SIZE, | 515 | snprintf(pvt->tmp_prt_buffer, PAGE_SIZE, |
515 | "Corrected error (Branch=%d, Channel %d), " | 516 | "Corrected error (Branch=%d, Channel %d), " |