aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/edac_mc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/edac/edac_mc.c')
-rw-r--r--drivers/edac/edac_mc.c144
1 files changed, 72 insertions, 72 deletions
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index ce12d9b5ab18..219e861eb3f9 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -129,7 +129,7 @@ char *edac_align_ptr(void *ptr, unsigned size)
129 * struct mem_ctl_info pointer 129 * struct mem_ctl_info pointer
130 */ 130 */
131struct mem_ctl_info *edac_mc_alloc(unsigned sz_pvt, unsigned nr_csrows, 131struct mem_ctl_info *edac_mc_alloc(unsigned sz_pvt, unsigned nr_csrows,
132 unsigned nr_chans) 132 unsigned nr_chans)
133{ 133{
134 struct mem_ctl_info *mci; 134 struct mem_ctl_info *mci;
135 struct csrow_info *csi, *csrow; 135 struct csrow_info *csi, *csrow;
@@ -146,7 +146,7 @@ struct mem_ctl_info *edac_mc_alloc(unsigned sz_pvt, unsigned nr_csrows,
146 mci = (struct mem_ctl_info *)0; 146 mci = (struct mem_ctl_info *)0;
147 csi = (struct csrow_info *)edac_align_ptr(&mci[1], sizeof(*csi)); 147 csi = (struct csrow_info *)edac_align_ptr(&mci[1], sizeof(*csi));
148 chi = (struct channel_info *) 148 chi = (struct channel_info *)
149 edac_align_ptr(&csi[nr_csrows], sizeof(*chi)); 149 edac_align_ptr(&csi[nr_csrows], sizeof(*chi));
150 pvt = edac_align_ptr(&chi[nr_chans * nr_csrows], sz_pvt); 150 pvt = edac_align_ptr(&chi[nr_chans * nr_csrows], sz_pvt);
151 size = ((unsigned long)pvt) + sz_pvt; 151 size = ((unsigned long)pvt) + sz_pvt;
152 152
@@ -256,7 +256,7 @@ static void edac_mc_workq_function(struct work_struct *work_req)
256 256
257 /* Reschedule */ 257 /* Reschedule */
258 queue_delayed_work(edac_workqueue, &mci->work, 258 queue_delayed_work(edac_workqueue, &mci->work,
259 msecs_to_jiffies(edac_mc_get_poll_msec())); 259 msecs_to_jiffies(edac_mc_get_poll_msec()));
260} 260}
261 261
262/* 262/*
@@ -334,16 +334,16 @@ static int add_mc_to_global_list(struct mem_ctl_info *mci)
334 atomic_inc(&edac_handlers); 334 atomic_inc(&edac_handlers);
335 return 0; 335 return 0;
336 336
337 fail0: 337fail0:
338 edac_printk(KERN_WARNING, EDAC_MC, 338 edac_printk(KERN_WARNING, EDAC_MC,
339 "%s (%s) %s %s already assigned %d\n", p->dev->bus_id, 339 "%s (%s) %s %s already assigned %d\n", p->dev->bus_id,
340 dev_name(mci), p->mod_name, p->ctl_name, p->mc_idx); 340 dev_name(mci), p->mod_name, p->ctl_name, p->mc_idx);
341 return 1; 341 return 1;
342 342
343 fail1: 343fail1:
344 edac_printk(KERN_WARNING, EDAC_MC, 344 edac_printk(KERN_WARNING, EDAC_MC,
345 "bug in low-level driver: attempt to assign\n" 345 "bug in low-level driver: attempt to assign\n"
346 " duplicate mc_idx %d in %s()\n", p->mc_idx, __func__); 346 " duplicate mc_idx %d in %s()\n", p->mc_idx, __func__);
347 return 1; 347 return 1;
348} 348}
349 349
@@ -423,7 +423,7 @@ int edac_mc_add_mc(struct mem_ctl_info *mci, int mc_idx)
423 edac_mc_dump_csrow(&mci->csrows[i]); 423 edac_mc_dump_csrow(&mci->csrows[i]);
424 for (j = 0; j < mci->csrows[i].nr_channels; j++) 424 for (j = 0; j < mci->csrows[i].nr_channels; j++)
425 edac_mc_dump_channel(&mci->csrows[i]. 425 edac_mc_dump_channel(&mci->csrows[i].
426 channels[j]); 426 channels[j]);
427 } 427 }
428 } 428 }
429#endif 429#endif
@@ -437,7 +437,7 @@ int edac_mc_add_mc(struct mem_ctl_info *mci, int mc_idx)
437 437
438 if (edac_create_sysfs_mci_device(mci)) { 438 if (edac_create_sysfs_mci_device(mci)) {
439 edac_mc_printk(mci, KERN_WARNING, 439 edac_mc_printk(mci, KERN_WARNING,
440 "failed to create sysfs device\n"); 440 "failed to create sysfs device\n");
441 goto fail1; 441 goto fail1;
442 } 442 }
443 443
@@ -453,15 +453,15 @@ int edac_mc_add_mc(struct mem_ctl_info *mci, int mc_idx)
453 453
454 /* Report action taken */ 454 /* Report action taken */
455 edac_mc_printk(mci, KERN_INFO, "Giving out device to %s %s: DEV %s\n", 455 edac_mc_printk(mci, KERN_INFO, "Giving out device to %s %s: DEV %s\n",
456 mci->mod_name, mci->ctl_name, dev_name(mci)); 456 mci->mod_name, mci->ctl_name, dev_name(mci));
457 457
458 mutex_unlock(&mem_ctls_mutex); 458 mutex_unlock(&mem_ctls_mutex);
459 return 0; 459 return 0;
460 460
461 fail1: 461fail1:
462 del_mc_from_global_list(mci); 462 del_mc_from_global_list(mci);
463 463
464 fail0: 464fail0:
465 mutex_unlock(&mem_ctls_mutex); 465 mutex_unlock(&mem_ctls_mutex);
466 return 1; 466 return 1;
467} 467}
@@ -497,8 +497,8 @@ struct mem_ctl_info *edac_mc_del_mc(struct device *dev)
497 del_mc_from_global_list(mci); 497 del_mc_from_global_list(mci);
498 mutex_unlock(&mem_ctls_mutex); 498 mutex_unlock(&mem_ctls_mutex);
499 edac_printk(KERN_INFO, EDAC_MC, 499 edac_printk(KERN_INFO, EDAC_MC,
500 "Removed device %d for %s %s: DEV %s\n", mci->mc_idx, 500 "Removed device %d for %s %s: DEV %s\n", mci->mc_idx,
501 mci->mod_name, mci->ctl_name, dev_name(mci)); 501 mci->mod_name, mci->ctl_name, dev_name(mci));
502 return mci; 502 return mci;
503} 503}
504 504
@@ -566,8 +566,8 @@ int edac_mc_find_csrow_by_page(struct mem_ctl_info *mci, unsigned long page)
566 566
567 if (row == -1) 567 if (row == -1)
568 edac_mc_printk(mci, KERN_ERR, 568 edac_mc_printk(mci, KERN_ERR,
569 "could not look up page error address %lx\n", 569 "could not look up page error address %lx\n",
570 (unsigned long)page); 570 (unsigned long)page);
571 571
572 return row; 572 return row;
573} 573}
@@ -577,9 +577,9 @@ EXPORT_SYMBOL_GPL(edac_mc_find_csrow_by_page);
577/* FIXME - setable log (warning/emerg) levels */ 577/* FIXME - setable log (warning/emerg) levels */
578/* FIXME - integrate with evlog: http://evlog.sourceforge.net/ */ 578/* FIXME - integrate with evlog: http://evlog.sourceforge.net/ */
579void edac_mc_handle_ce(struct mem_ctl_info *mci, 579void edac_mc_handle_ce(struct mem_ctl_info *mci,
580 unsigned long page_frame_number, 580 unsigned long page_frame_number,
581 unsigned long offset_in_page, unsigned long syndrome, 581 unsigned long offset_in_page, unsigned long syndrome,
582 int row, int channel, const char *msg) 582 int row, int channel, const char *msg)
583{ 583{
584 unsigned long remapped_page; 584 unsigned long remapped_page;
585 585
@@ -589,8 +589,8 @@ void edac_mc_handle_ce(struct mem_ctl_info *mci,
589 if (row >= mci->nr_csrows || row < 0) { 589 if (row >= mci->nr_csrows || row < 0) {
590 /* something is wrong */ 590 /* something is wrong */
591 edac_mc_printk(mci, KERN_ERR, 591 edac_mc_printk(mci, KERN_ERR,
592 "INTERNAL ERROR: row out of range " 592 "INTERNAL ERROR: row out of range "
593 "(%d >= %d)\n", row, mci->nr_csrows); 593 "(%d >= %d)\n", row, mci->nr_csrows);
594 edac_mc_handle_ce_no_info(mci, "INTERNAL ERROR"); 594 edac_mc_handle_ce_no_info(mci, "INTERNAL ERROR");
595 return; 595 return;
596 } 596 }
@@ -598,9 +598,9 @@ void edac_mc_handle_ce(struct mem_ctl_info *mci,
598 if (channel >= mci->csrows[row].nr_channels || channel < 0) { 598 if (channel >= mci->csrows[row].nr_channels || channel < 0) {
599 /* something is wrong */ 599 /* something is wrong */
600 edac_mc_printk(mci, KERN_ERR, 600 edac_mc_printk(mci, KERN_ERR,
601 "INTERNAL ERROR: channel out of range " 601 "INTERNAL ERROR: channel out of range "
602 "(%d >= %d)\n", channel, 602 "(%d >= %d)\n", channel,
603 mci->csrows[row].nr_channels); 603 mci->csrows[row].nr_channels);
604 edac_mc_handle_ce_no_info(mci, "INTERNAL ERROR"); 604 edac_mc_handle_ce_no_info(mci, "INTERNAL ERROR");
605 return; 605 return;
606 } 606 }
@@ -608,11 +608,11 @@ void edac_mc_handle_ce(struct mem_ctl_info *mci,
608 if (edac_mc_get_log_ce()) 608 if (edac_mc_get_log_ce())
609 /* FIXME - put in DIMM location */ 609 /* FIXME - put in DIMM location */
610 edac_mc_printk(mci, KERN_WARNING, 610 edac_mc_printk(mci, KERN_WARNING,
611 "CE page 0x%lx, offset 0x%lx, grain %d, syndrome " 611 "CE page 0x%lx, offset 0x%lx, grain %d, syndrome "
612 "0x%lx, row %d, channel %d, label \"%s\": %s\n", 612 "0x%lx, row %d, channel %d, label \"%s\": %s\n",
613 page_frame_number, offset_in_page, 613 page_frame_number, offset_in_page,
614 mci->csrows[row].grain, syndrome, row, channel, 614 mci->csrows[row].grain, syndrome, row, channel,
615 mci->csrows[row].channels[channel].label, msg); 615 mci->csrows[row].channels[channel].label, msg);
616 616
617 mci->ce_count++; 617 mci->ce_count++;
618 mci->csrows[row].ce_count++; 618 mci->csrows[row].ce_count++;
@@ -629,11 +629,11 @@ void edac_mc_handle_ce(struct mem_ctl_info *mci,
629 * page - which can then be scrubbed. 629 * page - which can then be scrubbed.
630 */ 630 */
631 remapped_page = mci->ctl_page_to_phys ? 631 remapped_page = mci->ctl_page_to_phys ?
632 mci->ctl_page_to_phys(mci, page_frame_number) : 632 mci->ctl_page_to_phys(mci, page_frame_number) :
633 page_frame_number; 633 page_frame_number;
634 634
635 edac_mc_scrub_block(remapped_page, offset_in_page, 635 edac_mc_scrub_block(remapped_page, offset_in_page,
636 mci->csrows[row].grain); 636 mci->csrows[row].grain);
637 } 637 }
638} 638}
639 639
@@ -643,7 +643,7 @@ void edac_mc_handle_ce_no_info(struct mem_ctl_info *mci, const char *msg)
643{ 643{
644 if (edac_mc_get_log_ce()) 644 if (edac_mc_get_log_ce())
645 edac_mc_printk(mci, KERN_WARNING, 645 edac_mc_printk(mci, KERN_WARNING,
646 "CE - no information available: %s\n", msg); 646 "CE - no information available: %s\n", msg);
647 647
648 mci->ce_noinfo_count++; 648 mci->ce_noinfo_count++;
649 mci->ce_count++; 649 mci->ce_count++;
@@ -652,8 +652,8 @@ void edac_mc_handle_ce_no_info(struct mem_ctl_info *mci, const char *msg)
652EXPORT_SYMBOL_GPL(edac_mc_handle_ce_no_info); 652EXPORT_SYMBOL_GPL(edac_mc_handle_ce_no_info);
653 653
654void edac_mc_handle_ue(struct mem_ctl_info *mci, 654void edac_mc_handle_ue(struct mem_ctl_info *mci,
655 unsigned long page_frame_number, 655 unsigned long page_frame_number,
656 unsigned long offset_in_page, int row, const char *msg) 656 unsigned long offset_in_page, int row, const char *msg)
657{ 657{
658 int len = EDAC_MC_LABEL_LEN * 4; 658 int len = EDAC_MC_LABEL_LEN * 4;
659 char labels[len + 1]; 659 char labels[len + 1];
@@ -667,8 +667,8 @@ void edac_mc_handle_ue(struct mem_ctl_info *mci,
667 if (row >= mci->nr_csrows || row < 0) { 667 if (row >= mci->nr_csrows || row < 0) {
668 /* something is wrong */ 668 /* something is wrong */
669 edac_mc_printk(mci, KERN_ERR, 669 edac_mc_printk(mci, KERN_ERR,
670 "INTERNAL ERROR: row out of range " 670 "INTERNAL ERROR: row out of range "
671 "(%d >= %d)\n", row, mci->nr_csrows); 671 "(%d >= %d)\n", row, mci->nr_csrows);
672 edac_mc_handle_ue_no_info(mci, "INTERNAL ERROR"); 672 edac_mc_handle_ue_no_info(mci, "INTERNAL ERROR");
673 return; 673 return;
674 } 674 }
@@ -679,7 +679,7 @@ void edac_mc_handle_ue(struct mem_ctl_info *mci,
679 pos += chars; 679 pos += chars;
680 680
681 for (chan = 1; (chan < mci->csrows[row].nr_channels) && (len > 0); 681 for (chan = 1; (chan < mci->csrows[row].nr_channels) && (len > 0);
682 chan++) { 682 chan++) {
683 chars = snprintf(pos, len + 1, ":%s", 683 chars = snprintf(pos, len + 1, ":%s",
684 mci->csrows[row].channels[chan].label); 684 mci->csrows[row].channels[chan].label);
685 len -= chars; 685 len -= chars;
@@ -688,16 +688,16 @@ void edac_mc_handle_ue(struct mem_ctl_info *mci,
688 688
689 if (edac_mc_get_log_ue()) 689 if (edac_mc_get_log_ue())
690 edac_mc_printk(mci, KERN_EMERG, 690 edac_mc_printk(mci, KERN_EMERG,
691 "UE page 0x%lx, offset 0x%lx, grain %d, row %d, " 691 "UE page 0x%lx, offset 0x%lx, grain %d, row %d, "
692 "labels \"%s\": %s\n", page_frame_number, 692 "labels \"%s\": %s\n", page_frame_number,
693 offset_in_page, mci->csrows[row].grain, row, 693 offset_in_page, mci->csrows[row].grain, row,
694 labels, msg); 694 labels, msg);
695 695
696 if (edac_mc_get_panic_on_ue()) 696 if (edac_mc_get_panic_on_ue())
697 panic("EDAC MC%d: UE page 0x%lx, offset 0x%lx, grain %d, " 697 panic("EDAC MC%d: UE page 0x%lx, offset 0x%lx, grain %d, "
698 "row %d, labels \"%s\": %s\n", mci->mc_idx, 698 "row %d, labels \"%s\": %s\n", mci->mc_idx,
699 page_frame_number, offset_in_page, 699 page_frame_number, offset_in_page,
700 mci->csrows[row].grain, row, labels, msg); 700 mci->csrows[row].grain, row, labels, msg);
701 701
702 mci->ue_count++; 702 mci->ue_count++;
703 mci->csrows[row].ue_count++; 703 mci->csrows[row].ue_count++;
@@ -712,7 +712,7 @@ void edac_mc_handle_ue_no_info(struct mem_ctl_info *mci, const char *msg)
712 712
713 if (edac_mc_get_log_ue()) 713 if (edac_mc_get_log_ue())
714 edac_mc_printk(mci, KERN_WARNING, 714 edac_mc_printk(mci, KERN_WARNING,
715 "UE - no information available: %s\n", msg); 715 "UE - no information available: %s\n", msg);
716 mci->ue_noinfo_count++; 716 mci->ue_noinfo_count++;
717 mci->ue_count++; 717 mci->ue_count++;
718} 718}
@@ -724,9 +724,9 @@ EXPORT_SYMBOL_GPL(edac_mc_handle_ue_no_info);
724 * called to process UE events 724 * called to process UE events
725 */ 725 */
726void edac_mc_handle_fbd_ue(struct mem_ctl_info *mci, 726void edac_mc_handle_fbd_ue(struct mem_ctl_info *mci,
727 unsigned int csrow, 727 unsigned int csrow,
728 unsigned int channela, 728 unsigned int channela,
729 unsigned int channelb, char *msg) 729 unsigned int channelb, char *msg)
730{ 730{
731 int len = EDAC_MC_LABEL_LEN * 4; 731 int len = EDAC_MC_LABEL_LEN * 4;
732 char labels[len + 1]; 732 char labels[len + 1];
@@ -736,8 +736,8 @@ void edac_mc_handle_fbd_ue(struct mem_ctl_info *mci,
736 if (csrow >= mci->nr_csrows) { 736 if (csrow >= mci->nr_csrows) {
737 /* something is wrong */ 737 /* something is wrong */
738 edac_mc_printk(mci, KERN_ERR, 738 edac_mc_printk(mci, KERN_ERR,
739 "INTERNAL ERROR: row out of range (%d >= %d)\n", 739 "INTERNAL ERROR: row out of range (%d >= %d)\n",
740 csrow, mci->nr_csrows); 740 csrow, mci->nr_csrows);
741 edac_mc_handle_ue_no_info(mci, "INTERNAL ERROR"); 741 edac_mc_handle_ue_no_info(mci, "INTERNAL ERROR");
742 return; 742 return;
743 } 743 }
@@ -745,9 +745,9 @@ void edac_mc_handle_fbd_ue(struct mem_ctl_info *mci,
745 if (channela >= mci->csrows[csrow].nr_channels) { 745 if (channela >= mci->csrows[csrow].nr_channels) {
746 /* something is wrong */ 746 /* something is wrong */
747 edac_mc_printk(mci, KERN_ERR, 747 edac_mc_printk(mci, KERN_ERR,
748 "INTERNAL ERROR: channel-a out of range " 748 "INTERNAL ERROR: channel-a out of range "
749 "(%d >= %d)\n", 749 "(%d >= %d)\n",
750 channela, mci->csrows[csrow].nr_channels); 750 channela, mci->csrows[csrow].nr_channels);
751 edac_mc_handle_ue_no_info(mci, "INTERNAL ERROR"); 751 edac_mc_handle_ue_no_info(mci, "INTERNAL ERROR");
752 return; 752 return;
753 } 753 }
@@ -755,9 +755,9 @@ void edac_mc_handle_fbd_ue(struct mem_ctl_info *mci,
755 if (channelb >= mci->csrows[csrow].nr_channels) { 755 if (channelb >= mci->csrows[csrow].nr_channels) {
756 /* something is wrong */ 756 /* something is wrong */
757 edac_mc_printk(mci, KERN_ERR, 757 edac_mc_printk(mci, KERN_ERR,
758 "INTERNAL ERROR: channel-b out of range " 758 "INTERNAL ERROR: channel-b out of range "
759 "(%d >= %d)\n", 759 "(%d >= %d)\n",
760 channelb, mci->csrows[csrow].nr_channels); 760 channelb, mci->csrows[csrow].nr_channels);
761 edac_mc_handle_ue_no_info(mci, "INTERNAL ERROR"); 761 edac_mc_handle_ue_no_info(mci, "INTERNAL ERROR");
762 return; 762 return;
763 } 763 }
@@ -775,14 +775,14 @@ void edac_mc_handle_fbd_ue(struct mem_ctl_info *mci,
775 775
776 if (edac_mc_get_log_ue()) 776 if (edac_mc_get_log_ue())
777 edac_mc_printk(mci, KERN_EMERG, 777 edac_mc_printk(mci, KERN_EMERG,
778 "UE row %d, channel-a= %d channel-b= %d " 778 "UE row %d, channel-a= %d channel-b= %d "
779 "labels \"%s\": %s\n", csrow, channela, channelb, 779 "labels \"%s\": %s\n", csrow, channela, channelb,
780 labels, msg); 780 labels, msg);
781 781
782 if (edac_mc_get_panic_on_ue()) 782 if (edac_mc_get_panic_on_ue())
783 panic("UE row %d, channel-a= %d channel-b= %d " 783 panic("UE row %d, channel-a= %d channel-b= %d "
784 "labels \"%s\": %s\n", csrow, channela, 784 "labels \"%s\": %s\n", csrow, channela,
785 channelb, labels, msg); 785 channelb, labels, msg);
786} 786}
787 787
788EXPORT_SYMBOL(edac_mc_handle_fbd_ue); 788EXPORT_SYMBOL(edac_mc_handle_fbd_ue);
@@ -792,23 +792,23 @@ EXPORT_SYMBOL(edac_mc_handle_fbd_ue);
792 * called to process CE events 792 * called to process CE events
793 */ 793 */
794void edac_mc_handle_fbd_ce(struct mem_ctl_info *mci, 794void edac_mc_handle_fbd_ce(struct mem_ctl_info *mci,
795 unsigned int csrow, unsigned int channel, char *msg) 795 unsigned int csrow, unsigned int channel, char *msg)
796{ 796{
797 797
798 /* Ensure boundary values */ 798 /* Ensure boundary values */
799 if (csrow >= mci->nr_csrows) { 799 if (csrow >= mci->nr_csrows) {
800 /* something is wrong */ 800 /* something is wrong */
801 edac_mc_printk(mci, KERN_ERR, 801 edac_mc_printk(mci, KERN_ERR,
802 "INTERNAL ERROR: row out of range (%d >= %d)\n", 802 "INTERNAL ERROR: row out of range (%d >= %d)\n",
803 csrow, mci->nr_csrows); 803 csrow, mci->nr_csrows);
804 edac_mc_handle_ce_no_info(mci, "INTERNAL ERROR"); 804 edac_mc_handle_ce_no_info(mci, "INTERNAL ERROR");
805 return; 805 return;
806 } 806 }
807 if (channel >= mci->csrows[csrow].nr_channels) { 807 if (channel >= mci->csrows[csrow].nr_channels) {
808 /* something is wrong */ 808 /* something is wrong */
809 edac_mc_printk(mci, KERN_ERR, 809 edac_mc_printk(mci, KERN_ERR,
810 "INTERNAL ERROR: channel out of range (%d >= %d)\n", 810 "INTERNAL ERROR: channel out of range (%d >= %d)\n",
811 channel, mci->csrows[csrow].nr_channels); 811 channel, mci->csrows[csrow].nr_channels);
812 edac_mc_handle_ce_no_info(mci, "INTERNAL ERROR"); 812 edac_mc_handle_ce_no_info(mci, "INTERNAL ERROR");
813 return; 813 return;
814 } 814 }
@@ -816,9 +816,9 @@ void edac_mc_handle_fbd_ce(struct mem_ctl_info *mci,
816 if (edac_mc_get_log_ce()) 816 if (edac_mc_get_log_ce())
817 /* FIXME - put in DIMM location */ 817 /* FIXME - put in DIMM location */
818 edac_mc_printk(mci, KERN_WARNING, 818 edac_mc_printk(mci, KERN_WARNING,
819 "CE row %d, channel %d, label \"%s\": %s\n", 819 "CE row %d, channel %d, label \"%s\": %s\n",
820 csrow, channel, 820 csrow, channel,
821 mci->csrows[csrow].channels[channel].label, msg); 821 mci->csrows[csrow].channels[channel].label, msg);
822 822
823 mci->ce_count++; 823 mci->ce_count++;
824 mci->csrows[csrow].ce_count++; 824 mci->csrows[csrow].ce_count++;