diff options
Diffstat (limited to 'drivers/edac/i5000_edac.c')
-rw-r--r-- | drivers/edac/i5000_edac.c | 207 |
1 files changed, 100 insertions, 107 deletions
diff --git a/drivers/edac/i5000_edac.c b/drivers/edac/i5000_edac.c index 11ea835f155a..39c63757c2a1 100644 --- a/drivers/edac/i5000_edac.c +++ b/drivers/edac/i5000_edac.c | |||
@@ -273,7 +273,7 @@ | |||
273 | #define CHANNELS_PER_BRANCH 2 | 273 | #define CHANNELS_PER_BRANCH 2 |
274 | #define MAX_BRANCHES 2 | 274 | #define MAX_BRANCHES 2 |
275 | 275 | ||
276 | /* Defines to extract the vaious fields from the | 276 | /* Defines to extract the various fields from the |
277 | * MTRx - Memory Technology Registers | 277 | * MTRx - Memory Technology Registers |
278 | */ | 278 | */ |
279 | #define MTR_DIMMS_PRESENT(mtr) ((mtr) & (0x1 << 8)) | 279 | #define MTR_DIMMS_PRESENT(mtr) ((mtr) & (0x1 << 8)) |
@@ -287,22 +287,6 @@ | |||
287 | #define MTR_DIMM_COLS(mtr) ((mtr) & 0x3) | 287 | #define MTR_DIMM_COLS(mtr) ((mtr) & 0x3) |
288 | #define MTR_DIMM_COLS_ADDR_BITS(mtr) (MTR_DIMM_COLS(mtr) + 10) | 288 | #define MTR_DIMM_COLS_ADDR_BITS(mtr) (MTR_DIMM_COLS(mtr) + 10) |
289 | 289 | ||
290 | #ifdef CONFIG_EDAC_DEBUG | ||
291 | static char *numrow_toString[] = { | ||
292 | "8,192 - 13 rows", | ||
293 | "16,384 - 14 rows", | ||
294 | "32,768 - 15 rows", | ||
295 | "reserved" | ||
296 | }; | ||
297 | |||
298 | static char *numcol_toString[] = { | ||
299 | "1,024 - 10 columns", | ||
300 | "2,048 - 11 columns", | ||
301 | "4,096 - 12 columns", | ||
302 | "reserved" | ||
303 | }; | ||
304 | #endif | ||
305 | |||
306 | /* enables the report of miscellaneous messages as CE errors - default off */ | 290 | /* enables the report of miscellaneous messages as CE errors - default off */ |
307 | static int misc_messages; | 291 | static int misc_messages; |
308 | 292 | ||
@@ -344,7 +328,13 @@ struct i5000_pvt { | |||
344 | struct pci_dev *branch_1; /* 22.0 */ | 328 | struct pci_dev *branch_1; /* 22.0 */ |
345 | 329 | ||
346 | u16 tolm; /* top of low memory */ | 330 | u16 tolm; /* top of low memory */ |
347 | u64 ambase; /* AMB BAR */ | 331 | union { |
332 | u64 ambase; /* AMB BAR */ | ||
333 | struct { | ||
334 | u32 ambase_bottom; | ||
335 | u32 ambase_top; | ||
336 | } u __packed; | ||
337 | }; | ||
348 | 338 | ||
349 | u16 mir0, mir1, mir2; | 339 | u16 mir0, mir1, mir2; |
350 | 340 | ||
@@ -494,10 +484,9 @@ static void i5000_process_fatal_error_info(struct mem_ctl_info *mci, | |||
494 | ras = NREC_RAS(info->nrecmemb); | 484 | ras = NREC_RAS(info->nrecmemb); |
495 | cas = NREC_CAS(info->nrecmemb); | 485 | cas = NREC_CAS(info->nrecmemb); |
496 | 486 | ||
497 | debugf0("\t\tCSROW= %d Channel= %d " | 487 | edac_dbg(0, "\t\tCSROW= %d Channel= %d (DRAM Bank= %d rdwr= %s ras= %d cas= %d)\n", |
498 | "(DRAM Bank= %d rdwr= %s ras= %d cas= %d)\n", | 488 | rank, channel, bank, |
499 | rank, channel, bank, | 489 | rdwr ? "Write" : "Read", ras, cas); |
500 | rdwr ? "Write" : "Read", ras, cas); | ||
501 | 490 | ||
502 | /* Only 1 bit will be on */ | 491 | /* Only 1 bit will be on */ |
503 | switch (allErrors) { | 492 | switch (allErrors) { |
@@ -536,10 +525,10 @@ static void i5000_process_fatal_error_info(struct mem_ctl_info *mci, | |||
536 | bank, ras, cas, allErrors, specific); | 525 | bank, ras, cas, allErrors, specific); |
537 | 526 | ||
538 | /* Call the helper to output message */ | 527 | /* Call the helper to output message */ |
539 | edac_mc_handle_error(HW_EVENT_ERR_FATAL, mci, 0, 0, 0, | 528 | edac_mc_handle_error(HW_EVENT_ERR_FATAL, mci, 1, 0, 0, 0, |
540 | channel >> 1, channel & 1, rank, | 529 | channel >> 1, channel & 1, rank, |
541 | rdwr ? "Write error" : "Read error", | 530 | rdwr ? "Write error" : "Read error", |
542 | msg, NULL); | 531 | msg); |
543 | } | 532 | } |
544 | 533 | ||
545 | /* | 534 | /* |
@@ -574,7 +563,7 @@ static void i5000_process_nonfatal_error_info(struct mem_ctl_info *mci, | |||
574 | /* ONLY ONE of the possible error bits will be set, as per the docs */ | 563 | /* ONLY ONE of the possible error bits will be set, as per the docs */ |
575 | ue_errors = allErrors & FERR_NF_UNCORRECTABLE; | 564 | ue_errors = allErrors & FERR_NF_UNCORRECTABLE; |
576 | if (ue_errors) { | 565 | if (ue_errors) { |
577 | debugf0("\tUncorrected bits= 0x%x\n", ue_errors); | 566 | edac_dbg(0, "\tUncorrected bits= 0x%x\n", ue_errors); |
578 | 567 | ||
579 | branch = EXTRACT_FBDCHAN_INDX(info->ferr_nf_fbd); | 568 | branch = EXTRACT_FBDCHAN_INDX(info->ferr_nf_fbd); |
580 | 569 | ||
@@ -590,11 +579,9 @@ static void i5000_process_nonfatal_error_info(struct mem_ctl_info *mci, | |||
590 | ras = NREC_RAS(info->nrecmemb); | 579 | ras = NREC_RAS(info->nrecmemb); |
591 | cas = NREC_CAS(info->nrecmemb); | 580 | cas = NREC_CAS(info->nrecmemb); |
592 | 581 | ||
593 | debugf0 | 582 | edac_dbg(0, "\t\tCSROW= %d Channels= %d,%d (Branch= %d DRAM Bank= %d rdwr= %s ras= %d cas= %d)\n", |
594 | ("\t\tCSROW= %d Channels= %d,%d (Branch= %d " | 583 | rank, channel, channel + 1, branch >> 1, bank, |
595 | "DRAM Bank= %d rdwr= %s ras= %d cas= %d)\n", | 584 | rdwr ? "Write" : "Read", ras, cas); |
596 | rank, channel, channel + 1, branch >> 1, bank, | ||
597 | rdwr ? "Write" : "Read", ras, cas); | ||
598 | 585 | ||
599 | switch (ue_errors) { | 586 | switch (ue_errors) { |
600 | case FERR_NF_M12ERR: | 587 | case FERR_NF_M12ERR: |
@@ -637,16 +624,16 @@ static void i5000_process_nonfatal_error_info(struct mem_ctl_info *mci, | |||
637 | rank, bank, ras, cas, ue_errors, specific); | 624 | rank, bank, ras, cas, ue_errors, specific); |
638 | 625 | ||
639 | /* Call the helper to output message */ | 626 | /* Call the helper to output message */ |
640 | edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, 0, 0, 0, | 627 | edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, 1, 0, 0, 0, |
641 | channel >> 1, -1, rank, | 628 | channel >> 1, -1, rank, |
642 | rdwr ? "Write error" : "Read error", | 629 | rdwr ? "Write error" : "Read error", |
643 | msg, NULL); | 630 | msg); |
644 | } | 631 | } |
645 | 632 | ||
646 | /* Check correctable errors */ | 633 | /* Check correctable errors */ |
647 | ce_errors = allErrors & FERR_NF_CORRECTABLE; | 634 | ce_errors = allErrors & FERR_NF_CORRECTABLE; |
648 | if (ce_errors) { | 635 | if (ce_errors) { |
649 | debugf0("\tCorrected bits= 0x%x\n", ce_errors); | 636 | edac_dbg(0, "\tCorrected bits= 0x%x\n", ce_errors); |
650 | 637 | ||
651 | branch = EXTRACT_FBDCHAN_INDX(info->ferr_nf_fbd); | 638 | branch = EXTRACT_FBDCHAN_INDX(info->ferr_nf_fbd); |
652 | 639 | ||
@@ -664,10 +651,9 @@ static void i5000_process_nonfatal_error_info(struct mem_ctl_info *mci, | |||
664 | ras = REC_RAS(info->recmemb); | 651 | ras = REC_RAS(info->recmemb); |
665 | cas = REC_CAS(info->recmemb); | 652 | cas = REC_CAS(info->recmemb); |
666 | 653 | ||
667 | debugf0("\t\tCSROW= %d Channel= %d (Branch %d " | 654 | edac_dbg(0, "\t\tCSROW= %d Channel= %d (Branch %d DRAM Bank= %d rdwr= %s ras= %d cas= %d)\n", |
668 | "DRAM Bank= %d rdwr= %s ras= %d cas= %d)\n", | 655 | rank, channel, branch >> 1, bank, |
669 | rank, channel, branch >> 1, bank, | 656 | rdwr ? "Write" : "Read", ras, cas); |
670 | rdwr ? "Write" : "Read", ras, cas); | ||
671 | 657 | ||
672 | switch (ce_errors) { | 658 | switch (ce_errors) { |
673 | case FERR_NF_M17ERR: | 659 | case FERR_NF_M17ERR: |
@@ -692,10 +678,10 @@ static void i5000_process_nonfatal_error_info(struct mem_ctl_info *mci, | |||
692 | specific); | 678 | specific); |
693 | 679 | ||
694 | /* Call the helper to output message */ | 680 | /* Call the helper to output message */ |
695 | edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 0, 0, 0, | 681 | edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 1, 0, 0, 0, |
696 | channel >> 1, channel % 2, rank, | 682 | channel >> 1, channel % 2, rank, |
697 | rdwr ? "Write error" : "Read error", | 683 | rdwr ? "Write error" : "Read error", |
698 | msg, NULL); | 684 | msg); |
699 | } | 685 | } |
700 | 686 | ||
701 | if (!misc_messages) | 687 | if (!misc_messages) |
@@ -738,9 +724,9 @@ static void i5000_process_nonfatal_error_info(struct mem_ctl_info *mci, | |||
738 | "Err=%#x (%s)", misc_errors, specific); | 724 | "Err=%#x (%s)", misc_errors, specific); |
739 | 725 | ||
740 | /* Call the helper to output message */ | 726 | /* Call the helper to output message */ |
741 | edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 0, 0, 0, | 727 | edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 1, 0, 0, 0, |
742 | branch >> 1, -1, -1, | 728 | branch >> 1, -1, -1, |
743 | "Misc error", msg, NULL); | 729 | "Misc error", msg); |
744 | } | 730 | } |
745 | } | 731 | } |
746 | 732 | ||
@@ -779,7 +765,7 @@ static void i5000_clear_error(struct mem_ctl_info *mci) | |||
779 | static void i5000_check_error(struct mem_ctl_info *mci) | 765 | static void i5000_check_error(struct mem_ctl_info *mci) |
780 | { | 766 | { |
781 | struct i5000_error_info info; | 767 | struct i5000_error_info info; |
782 | debugf4("MC%d: %s: %s()\n", mci->mc_idx, __FILE__, __func__); | 768 | edac_dbg(4, "MC%d\n", mci->mc_idx); |
783 | i5000_get_error_info(mci, &info); | 769 | i5000_get_error_info(mci, &info); |
784 | i5000_process_error_info(mci, &info, 1); | 770 | i5000_process_error_info(mci, &info, 1); |
785 | } | 771 | } |
@@ -850,15 +836,16 @@ static int i5000_get_devices(struct mem_ctl_info *mci, int dev_idx) | |||
850 | 836 | ||
851 | pvt->fsb_error_regs = pdev; | 837 | pvt->fsb_error_regs = pdev; |
852 | 838 | ||
853 | debugf1("System Address, processor bus- PCI Bus ID: %s %x:%x\n", | 839 | edac_dbg(1, "System Address, processor bus- PCI Bus ID: %s %x:%x\n", |
854 | pci_name(pvt->system_address), | 840 | pci_name(pvt->system_address), |
855 | pvt->system_address->vendor, pvt->system_address->device); | 841 | pvt->system_address->vendor, pvt->system_address->device); |
856 | debugf1("Branchmap, control and errors - PCI Bus ID: %s %x:%x\n", | 842 | edac_dbg(1, "Branchmap, control and errors - PCI Bus ID: %s %x:%x\n", |
857 | pci_name(pvt->branchmap_werrors), | 843 | pci_name(pvt->branchmap_werrors), |
858 | pvt->branchmap_werrors->vendor, pvt->branchmap_werrors->device); | 844 | pvt->branchmap_werrors->vendor, |
859 | debugf1("FSB Error Regs - PCI Bus ID: %s %x:%x\n", | 845 | pvt->branchmap_werrors->device); |
860 | pci_name(pvt->fsb_error_regs), | 846 | edac_dbg(1, "FSB Error Regs - PCI Bus ID: %s %x:%x\n", |
861 | pvt->fsb_error_regs->vendor, pvt->fsb_error_regs->device); | 847 | pci_name(pvt->fsb_error_regs), |
848 | pvt->fsb_error_regs->vendor, pvt->fsb_error_regs->device); | ||
862 | 849 | ||
863 | pdev = NULL; | 850 | pdev = NULL; |
864 | pdev = pci_get_device(PCI_VENDOR_ID_INTEL, | 851 | pdev = pci_get_device(PCI_VENDOR_ID_INTEL, |
@@ -981,16 +968,25 @@ static void decode_mtr(int slot_row, u16 mtr) | |||
981 | 968 | ||
982 | ans = MTR_DIMMS_PRESENT(mtr); | 969 | ans = MTR_DIMMS_PRESENT(mtr); |
983 | 970 | ||
984 | debugf2("\tMTR%d=0x%x: DIMMs are %s\n", slot_row, mtr, | 971 | edac_dbg(2, "\tMTR%d=0x%x: DIMMs are %sPresent\n", |
985 | ans ? "Present" : "NOT Present"); | 972 | slot_row, mtr, ans ? "" : "NOT "); |
986 | if (!ans) | 973 | if (!ans) |
987 | return; | 974 | return; |
988 | 975 | ||
989 | debugf2("\t\tWIDTH: x%d\n", MTR_DRAM_WIDTH(mtr)); | 976 | edac_dbg(2, "\t\tWIDTH: x%d\n", MTR_DRAM_WIDTH(mtr)); |
990 | debugf2("\t\tNUMBANK: %d bank(s)\n", MTR_DRAM_BANKS(mtr)); | 977 | edac_dbg(2, "\t\tNUMBANK: %d bank(s)\n", MTR_DRAM_BANKS(mtr)); |
991 | debugf2("\t\tNUMRANK: %s\n", MTR_DIMM_RANK(mtr) ? "double" : "single"); | 978 | edac_dbg(2, "\t\tNUMRANK: %s\n", |
992 | debugf2("\t\tNUMROW: %s\n", numrow_toString[MTR_DIMM_ROWS(mtr)]); | 979 | MTR_DIMM_RANK(mtr) ? "double" : "single"); |
993 | debugf2("\t\tNUMCOL: %s\n", numcol_toString[MTR_DIMM_COLS(mtr)]); | 980 | edac_dbg(2, "\t\tNUMROW: %s\n", |
981 | MTR_DIMM_ROWS(mtr) == 0 ? "8,192 - 13 rows" : | ||
982 | MTR_DIMM_ROWS(mtr) == 1 ? "16,384 - 14 rows" : | ||
983 | MTR_DIMM_ROWS(mtr) == 2 ? "32,768 - 15 rows" : | ||
984 | "reserved"); | ||
985 | edac_dbg(2, "\t\tNUMCOL: %s\n", | ||
986 | MTR_DIMM_COLS(mtr) == 0 ? "1,024 - 10 columns" : | ||
987 | MTR_DIMM_COLS(mtr) == 1 ? "2,048 - 11 columns" : | ||
988 | MTR_DIMM_COLS(mtr) == 2 ? "4,096 - 12 columns" : | ||
989 | "reserved"); | ||
994 | } | 990 | } |
995 | 991 | ||
996 | static void handle_channel(struct i5000_pvt *pvt, int slot, int channel, | 992 | static void handle_channel(struct i5000_pvt *pvt, int slot, int channel, |
@@ -1061,7 +1057,7 @@ static void calculate_dimm_size(struct i5000_pvt *pvt) | |||
1061 | "--------------------------------"); | 1057 | "--------------------------------"); |
1062 | p += n; | 1058 | p += n; |
1063 | space -= n; | 1059 | space -= n; |
1064 | debugf2("%s\n", mem_buffer); | 1060 | edac_dbg(2, "%s\n", mem_buffer); |
1065 | p = mem_buffer; | 1061 | p = mem_buffer; |
1066 | space = PAGE_SIZE; | 1062 | space = PAGE_SIZE; |
1067 | } | 1063 | } |
@@ -1082,7 +1078,7 @@ static void calculate_dimm_size(struct i5000_pvt *pvt) | |||
1082 | } | 1078 | } |
1083 | p += n; | 1079 | p += n; |
1084 | space -= n; | 1080 | space -= n; |
1085 | debugf2("%s\n", mem_buffer); | 1081 | edac_dbg(2, "%s\n", mem_buffer); |
1086 | p = mem_buffer; | 1082 | p = mem_buffer; |
1087 | space = PAGE_SIZE; | 1083 | space = PAGE_SIZE; |
1088 | } | 1084 | } |
@@ -1092,7 +1088,7 @@ static void calculate_dimm_size(struct i5000_pvt *pvt) | |||
1092 | "--------------------------------"); | 1088 | "--------------------------------"); |
1093 | p += n; | 1089 | p += n; |
1094 | space -= n; | 1090 | space -= n; |
1095 | debugf2("%s\n", mem_buffer); | 1091 | edac_dbg(2, "%s\n", mem_buffer); |
1096 | p = mem_buffer; | 1092 | p = mem_buffer; |
1097 | space = PAGE_SIZE; | 1093 | space = PAGE_SIZE; |
1098 | 1094 | ||
@@ -1105,7 +1101,7 @@ static void calculate_dimm_size(struct i5000_pvt *pvt) | |||
1105 | p += n; | 1101 | p += n; |
1106 | space -= n; | 1102 | space -= n; |
1107 | } | 1103 | } |
1108 | debugf2("%s\n", mem_buffer); | 1104 | edac_dbg(2, "%s\n", mem_buffer); |
1109 | p = mem_buffer; | 1105 | p = mem_buffer; |
1110 | space = PAGE_SIZE; | 1106 | space = PAGE_SIZE; |
1111 | 1107 | ||
@@ -1118,7 +1114,7 @@ static void calculate_dimm_size(struct i5000_pvt *pvt) | |||
1118 | } | 1114 | } |
1119 | 1115 | ||
1120 | /* output the last message and free buffer */ | 1116 | /* output the last message and free buffer */ |
1121 | debugf2("%s\n", mem_buffer); | 1117 | edac_dbg(2, "%s\n", mem_buffer); |
1122 | kfree(mem_buffer); | 1118 | kfree(mem_buffer); |
1123 | } | 1119 | } |
1124 | 1120 | ||
@@ -1141,24 +1137,25 @@ static void i5000_get_mc_regs(struct mem_ctl_info *mci) | |||
1141 | pvt = mci->pvt_info; | 1137 | pvt = mci->pvt_info; |
1142 | 1138 | ||
1143 | pci_read_config_dword(pvt->system_address, AMBASE, | 1139 | pci_read_config_dword(pvt->system_address, AMBASE, |
1144 | (u32 *) & pvt->ambase); | 1140 | &pvt->u.ambase_bottom); |
1145 | pci_read_config_dword(pvt->system_address, AMBASE + sizeof(u32), | 1141 | pci_read_config_dword(pvt->system_address, AMBASE + sizeof(u32), |
1146 | ((u32 *) & pvt->ambase) + sizeof(u32)); | 1142 | &pvt->u.ambase_top); |
1147 | 1143 | ||
1148 | maxdimmperch = pvt->maxdimmperch; | 1144 | maxdimmperch = pvt->maxdimmperch; |
1149 | maxch = pvt->maxch; | 1145 | maxch = pvt->maxch; |
1150 | 1146 | ||
1151 | debugf2("AMBASE= 0x%lx MAXCH= %d MAX-DIMM-Per-CH= %d\n", | 1147 | edac_dbg(2, "AMBASE= 0x%lx MAXCH= %d MAX-DIMM-Per-CH= %d\n", |
1152 | (long unsigned int)pvt->ambase, pvt->maxch, pvt->maxdimmperch); | 1148 | (long unsigned int)pvt->ambase, pvt->maxch, pvt->maxdimmperch); |
1153 | 1149 | ||
1154 | /* Get the Branch Map regs */ | 1150 | /* Get the Branch Map regs */ |
1155 | pci_read_config_word(pvt->branchmap_werrors, TOLM, &pvt->tolm); | 1151 | pci_read_config_word(pvt->branchmap_werrors, TOLM, &pvt->tolm); |
1156 | pvt->tolm >>= 12; | 1152 | pvt->tolm >>= 12; |
1157 | debugf2("\nTOLM (number of 256M regions) =%u (0x%x)\n", pvt->tolm, | 1153 | edac_dbg(2, "TOLM (number of 256M regions) =%u (0x%x)\n", |
1158 | pvt->tolm); | 1154 | pvt->tolm, pvt->tolm); |
1159 | 1155 | ||
1160 | actual_tolm = pvt->tolm << 28; | 1156 | actual_tolm = pvt->tolm << 28; |
1161 | debugf2("Actual TOLM byte addr=%u (0x%x)\n", actual_tolm, actual_tolm); | 1157 | edac_dbg(2, "Actual TOLM byte addr=%u (0x%x)\n", |
1158 | actual_tolm, actual_tolm); | ||
1162 | 1159 | ||
1163 | pci_read_config_word(pvt->branchmap_werrors, MIR0, &pvt->mir0); | 1160 | pci_read_config_word(pvt->branchmap_werrors, MIR0, &pvt->mir0); |
1164 | pci_read_config_word(pvt->branchmap_werrors, MIR1, &pvt->mir1); | 1161 | pci_read_config_word(pvt->branchmap_werrors, MIR1, &pvt->mir1); |
@@ -1168,15 +1165,18 @@ static void i5000_get_mc_regs(struct mem_ctl_info *mci) | |||
1168 | limit = (pvt->mir0 >> 4) & 0x0FFF; | 1165 | limit = (pvt->mir0 >> 4) & 0x0FFF; |
1169 | way0 = pvt->mir0 & 0x1; | 1166 | way0 = pvt->mir0 & 0x1; |
1170 | way1 = pvt->mir0 & 0x2; | 1167 | way1 = pvt->mir0 & 0x2; |
1171 | debugf2("MIR0: limit= 0x%x WAY1= %u WAY0= %x\n", limit, way1, way0); | 1168 | edac_dbg(2, "MIR0: limit= 0x%x WAY1= %u WAY0= %x\n", |
1169 | limit, way1, way0); | ||
1172 | limit = (pvt->mir1 >> 4) & 0x0FFF; | 1170 | limit = (pvt->mir1 >> 4) & 0x0FFF; |
1173 | way0 = pvt->mir1 & 0x1; | 1171 | way0 = pvt->mir1 & 0x1; |
1174 | way1 = pvt->mir1 & 0x2; | 1172 | way1 = pvt->mir1 & 0x2; |
1175 | debugf2("MIR1: limit= 0x%x WAY1= %u WAY0= %x\n", limit, way1, way0); | 1173 | edac_dbg(2, "MIR1: limit= 0x%x WAY1= %u WAY0= %x\n", |
1174 | limit, way1, way0); | ||
1176 | limit = (pvt->mir2 >> 4) & 0x0FFF; | 1175 | limit = (pvt->mir2 >> 4) & 0x0FFF; |
1177 | way0 = pvt->mir2 & 0x1; | 1176 | way0 = pvt->mir2 & 0x1; |
1178 | way1 = pvt->mir2 & 0x2; | 1177 | way1 = pvt->mir2 & 0x2; |
1179 | debugf2("MIR2: limit= 0x%x WAY1= %u WAY0= %x\n", limit, way1, way0); | 1178 | edac_dbg(2, "MIR2: limit= 0x%x WAY1= %u WAY0= %x\n", |
1179 | limit, way1, way0); | ||
1180 | 1180 | ||
1181 | /* Get the MTR[0-3] regs */ | 1181 | /* Get the MTR[0-3] regs */ |
1182 | for (slot_row = 0; slot_row < NUM_MTRS; slot_row++) { | 1182 | for (slot_row = 0; slot_row < NUM_MTRS; slot_row++) { |
@@ -1185,31 +1185,31 @@ static void i5000_get_mc_regs(struct mem_ctl_info *mci) | |||
1185 | pci_read_config_word(pvt->branch_0, where, | 1185 | pci_read_config_word(pvt->branch_0, where, |
1186 | &pvt->b0_mtr[slot_row]); | 1186 | &pvt->b0_mtr[slot_row]); |
1187 | 1187 | ||
1188 | debugf2("MTR%d where=0x%x B0 value=0x%x\n", slot_row, where, | 1188 | edac_dbg(2, "MTR%d where=0x%x B0 value=0x%x\n", |
1189 | pvt->b0_mtr[slot_row]); | 1189 | slot_row, where, pvt->b0_mtr[slot_row]); |
1190 | 1190 | ||
1191 | if (pvt->maxch >= CHANNELS_PER_BRANCH) { | 1191 | if (pvt->maxch >= CHANNELS_PER_BRANCH) { |
1192 | pci_read_config_word(pvt->branch_1, where, | 1192 | pci_read_config_word(pvt->branch_1, where, |
1193 | &pvt->b1_mtr[slot_row]); | 1193 | &pvt->b1_mtr[slot_row]); |
1194 | debugf2("MTR%d where=0x%x B1 value=0x%x\n", slot_row, | 1194 | edac_dbg(2, "MTR%d where=0x%x B1 value=0x%x\n", |
1195 | where, pvt->b1_mtr[slot_row]); | 1195 | slot_row, where, pvt->b1_mtr[slot_row]); |
1196 | } else { | 1196 | } else { |
1197 | pvt->b1_mtr[slot_row] = 0; | 1197 | pvt->b1_mtr[slot_row] = 0; |
1198 | } | 1198 | } |
1199 | } | 1199 | } |
1200 | 1200 | ||
1201 | /* Read and dump branch 0's MTRs */ | 1201 | /* Read and dump branch 0's MTRs */ |
1202 | debugf2("\nMemory Technology Registers:\n"); | 1202 | edac_dbg(2, "Memory Technology Registers:\n"); |
1203 | debugf2(" Branch 0:\n"); | 1203 | edac_dbg(2, " Branch 0:\n"); |
1204 | for (slot_row = 0; slot_row < NUM_MTRS; slot_row++) { | 1204 | for (slot_row = 0; slot_row < NUM_MTRS; slot_row++) { |
1205 | decode_mtr(slot_row, pvt->b0_mtr[slot_row]); | 1205 | decode_mtr(slot_row, pvt->b0_mtr[slot_row]); |
1206 | } | 1206 | } |
1207 | pci_read_config_word(pvt->branch_0, AMB_PRESENT_0, | 1207 | pci_read_config_word(pvt->branch_0, AMB_PRESENT_0, |
1208 | &pvt->b0_ambpresent0); | 1208 | &pvt->b0_ambpresent0); |
1209 | debugf2("\t\tAMB-Branch 0-present0 0x%x:\n", pvt->b0_ambpresent0); | 1209 | edac_dbg(2, "\t\tAMB-Branch 0-present0 0x%x:\n", pvt->b0_ambpresent0); |
1210 | pci_read_config_word(pvt->branch_0, AMB_PRESENT_1, | 1210 | pci_read_config_word(pvt->branch_0, AMB_PRESENT_1, |
1211 | &pvt->b0_ambpresent1); | 1211 | &pvt->b0_ambpresent1); |
1212 | debugf2("\t\tAMB-Branch 0-present1 0x%x:\n", pvt->b0_ambpresent1); | 1212 | edac_dbg(2, "\t\tAMB-Branch 0-present1 0x%x:\n", pvt->b0_ambpresent1); |
1213 | 1213 | ||
1214 | /* Only if we have 2 branchs (4 channels) */ | 1214 | /* Only if we have 2 branchs (4 channels) */ |
1215 | if (pvt->maxch < CHANNELS_PER_BRANCH) { | 1215 | if (pvt->maxch < CHANNELS_PER_BRANCH) { |
@@ -1217,18 +1217,18 @@ static void i5000_get_mc_regs(struct mem_ctl_info *mci) | |||
1217 | pvt->b1_ambpresent1 = 0; | 1217 | pvt->b1_ambpresent1 = 0; |
1218 | } else { | 1218 | } else { |
1219 | /* Read and dump branch 1's MTRs */ | 1219 | /* Read and dump branch 1's MTRs */ |
1220 | debugf2(" Branch 1:\n"); | 1220 | edac_dbg(2, " Branch 1:\n"); |
1221 | for (slot_row = 0; slot_row < NUM_MTRS; slot_row++) { | 1221 | for (slot_row = 0; slot_row < NUM_MTRS; slot_row++) { |
1222 | decode_mtr(slot_row, pvt->b1_mtr[slot_row]); | 1222 | decode_mtr(slot_row, pvt->b1_mtr[slot_row]); |
1223 | } | 1223 | } |
1224 | pci_read_config_word(pvt->branch_1, AMB_PRESENT_0, | 1224 | pci_read_config_word(pvt->branch_1, AMB_PRESENT_0, |
1225 | &pvt->b1_ambpresent0); | 1225 | &pvt->b1_ambpresent0); |
1226 | debugf2("\t\tAMB-Branch 1-present0 0x%x:\n", | 1226 | edac_dbg(2, "\t\tAMB-Branch 1-present0 0x%x:\n", |
1227 | pvt->b1_ambpresent0); | 1227 | pvt->b1_ambpresent0); |
1228 | pci_read_config_word(pvt->branch_1, AMB_PRESENT_1, | 1228 | pci_read_config_word(pvt->branch_1, AMB_PRESENT_1, |
1229 | &pvt->b1_ambpresent1); | 1229 | &pvt->b1_ambpresent1); |
1230 | debugf2("\t\tAMB-Branch 1-present1 0x%x:\n", | 1230 | edac_dbg(2, "\t\tAMB-Branch 1-present1 0x%x:\n", |
1231 | pvt->b1_ambpresent1); | 1231 | pvt->b1_ambpresent1); |
1232 | } | 1232 | } |
1233 | 1233 | ||
1234 | /* Go and determine the size of each DIMM and place in an | 1234 | /* Go and determine the size of each DIMM and place in an |
@@ -1363,10 +1363,9 @@ static int i5000_probe1(struct pci_dev *pdev, int dev_idx) | |||
1363 | int num_channels; | 1363 | int num_channels; |
1364 | int num_dimms_per_channel; | 1364 | int num_dimms_per_channel; |
1365 | 1365 | ||
1366 | debugf0("MC: %s: %s(), pdev bus %u dev=0x%x fn=0x%x\n", | 1366 | edac_dbg(0, "MC: pdev bus %u dev=0x%x fn=0x%x\n", |
1367 | __FILE__, __func__, | 1367 | pdev->bus->number, |
1368 | pdev->bus->number, | 1368 | PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn)); |
1369 | PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn)); | ||
1370 | 1369 | ||
1371 | /* We only are looking for func 0 of the set */ | 1370 | /* We only are looking for func 0 of the set */ |
1372 | if (PCI_FUNC(pdev->devfn) != 0) | 1371 | if (PCI_FUNC(pdev->devfn) != 0) |
@@ -1388,8 +1387,8 @@ static int i5000_probe1(struct pci_dev *pdev, int dev_idx) | |||
1388 | i5000_get_dimm_and_channel_counts(pdev, &num_dimms_per_channel, | 1387 | i5000_get_dimm_and_channel_counts(pdev, &num_dimms_per_channel, |
1389 | &num_channels); | 1388 | &num_channels); |
1390 | 1389 | ||
1391 | debugf0("MC: %s(): Number of Branches=2 Channels= %d DIMMS= %d\n", | 1390 | edac_dbg(0, "MC: Number of Branches=2 Channels= %d DIMMS= %d\n", |
1392 | __func__, num_channels, num_dimms_per_channel); | 1391 | num_channels, num_dimms_per_channel); |
1393 | 1392 | ||
1394 | /* allocate a new MC control structure */ | 1393 | /* allocate a new MC control structure */ |
1395 | 1394 | ||
@@ -1406,10 +1405,9 @@ static int i5000_probe1(struct pci_dev *pdev, int dev_idx) | |||
1406 | if (mci == NULL) | 1405 | if (mci == NULL) |
1407 | return -ENOMEM; | 1406 | return -ENOMEM; |
1408 | 1407 | ||
1409 | kobject_get(&mci->edac_mci_kobj); | 1408 | edac_dbg(0, "MC: mci = %p\n", mci); |
1410 | debugf0("MC: %s: %s(): mci = %p\n", __FILE__, __func__, mci); | ||
1411 | 1409 | ||
1412 | mci->dev = &pdev->dev; /* record ptr to the generic device */ | 1410 | mci->pdev = &pdev->dev; /* record ptr to the generic device */ |
1413 | 1411 | ||
1414 | pvt = mci->pvt_info; | 1412 | pvt = mci->pvt_info; |
1415 | pvt->system_address = pdev; /* Record this device in our private */ | 1413 | pvt->system_address = pdev; /* Record this device in our private */ |
@@ -1439,19 +1437,16 @@ static int i5000_probe1(struct pci_dev *pdev, int dev_idx) | |||
1439 | /* initialize the MC control structure 'csrows' table | 1437 | /* initialize the MC control structure 'csrows' table |
1440 | * with the mapping and control information */ | 1438 | * with the mapping and control information */ |
1441 | if (i5000_init_csrows(mci)) { | 1439 | if (i5000_init_csrows(mci)) { |
1442 | debugf0("MC: Setting mci->edac_cap to EDAC_FLAG_NONE\n" | 1440 | edac_dbg(0, "MC: Setting mci->edac_cap to EDAC_FLAG_NONE because i5000_init_csrows() returned nonzero value\n"); |
1443 | " because i5000_init_csrows() returned nonzero " | ||
1444 | "value\n"); | ||
1445 | mci->edac_cap = EDAC_FLAG_NONE; /* no csrows found */ | 1441 | mci->edac_cap = EDAC_FLAG_NONE; /* no csrows found */ |
1446 | } else { | 1442 | } else { |
1447 | debugf1("MC: Enable error reporting now\n"); | 1443 | edac_dbg(1, "MC: Enable error reporting now\n"); |
1448 | i5000_enable_error_reporting(mci); | 1444 | i5000_enable_error_reporting(mci); |
1449 | } | 1445 | } |
1450 | 1446 | ||
1451 | /* add this new MC control structure to EDAC's list of MCs */ | 1447 | /* add this new MC control structure to EDAC's list of MCs */ |
1452 | if (edac_mc_add_mc(mci)) { | 1448 | if (edac_mc_add_mc(mci)) { |
1453 | debugf0("MC: %s: %s(): failed edac_mc_add_mc()\n", | 1449 | edac_dbg(0, "MC: failed edac_mc_add_mc()\n"); |
1454 | __FILE__, __func__); | ||
1455 | /* FIXME: perhaps some code should go here that disables error | 1450 | /* FIXME: perhaps some code should go here that disables error |
1456 | * reporting if we just enabled it | 1451 | * reporting if we just enabled it |
1457 | */ | 1452 | */ |
@@ -1479,7 +1474,6 @@ fail1: | |||
1479 | i5000_put_devices(mci); | 1474 | i5000_put_devices(mci); |
1480 | 1475 | ||
1481 | fail0: | 1476 | fail0: |
1482 | kobject_put(&mci->edac_mci_kobj); | ||
1483 | edac_mc_free(mci); | 1477 | edac_mc_free(mci); |
1484 | return -ENODEV; | 1478 | return -ENODEV; |
1485 | } | 1479 | } |
@@ -1496,7 +1490,7 @@ static int __devinit i5000_init_one(struct pci_dev *pdev, | |||
1496 | { | 1490 | { |
1497 | int rc; | 1491 | int rc; |
1498 | 1492 | ||
1499 | debugf0("MC: %s: %s()\n", __FILE__, __func__); | 1493 | edac_dbg(0, "MC:\n"); |
1500 | 1494 | ||
1501 | /* wake up device */ | 1495 | /* wake up device */ |
1502 | rc = pci_enable_device(pdev); | 1496 | rc = pci_enable_device(pdev); |
@@ -1515,7 +1509,7 @@ static void __devexit i5000_remove_one(struct pci_dev *pdev) | |||
1515 | { | 1509 | { |
1516 | struct mem_ctl_info *mci; | 1510 | struct mem_ctl_info *mci; |
1517 | 1511 | ||
1518 | debugf0("%s: %s()\n", __FILE__, __func__); | 1512 | edac_dbg(0, "\n"); |
1519 | 1513 | ||
1520 | if (i5000_pci) | 1514 | if (i5000_pci) |
1521 | edac_pci_release_generic_ctl(i5000_pci); | 1515 | edac_pci_release_generic_ctl(i5000_pci); |
@@ -1525,7 +1519,6 @@ static void __devexit i5000_remove_one(struct pci_dev *pdev) | |||
1525 | 1519 | ||
1526 | /* retrieve references to resources, and free those resources */ | 1520 | /* retrieve references to resources, and free those resources */ |
1527 | i5000_put_devices(mci); | 1521 | i5000_put_devices(mci); |
1528 | kobject_put(&mci->edac_mci_kobj); | ||
1529 | edac_mc_free(mci); | 1522 | edac_mc_free(mci); |
1530 | } | 1523 | } |
1531 | 1524 | ||
@@ -1562,7 +1555,7 @@ static int __init i5000_init(void) | |||
1562 | { | 1555 | { |
1563 | int pci_rc; | 1556 | int pci_rc; |
1564 | 1557 | ||
1565 | debugf2("MC: %s: %s()\n", __FILE__, __func__); | 1558 | edac_dbg(2, "MC:\n"); |
1566 | 1559 | ||
1567 | /* Ensure that the OPSTATE is set correctly for POLL or NMI */ | 1560 | /* Ensure that the OPSTATE is set correctly for POLL or NMI */ |
1568 | opstate_init(); | 1561 | opstate_init(); |
@@ -1578,7 +1571,7 @@ static int __init i5000_init(void) | |||
1578 | */ | 1571 | */ |
1579 | static void __exit i5000_exit(void) | 1572 | static void __exit i5000_exit(void) |
1580 | { | 1573 | { |
1581 | debugf2("MC: %s: %s()\n", __FILE__, __func__); | 1574 | edac_dbg(2, "MC:\n"); |
1582 | pci_unregister_driver(&i5000_driver); | 1575 | pci_unregister_driver(&i5000_driver); |
1583 | } | 1576 | } |
1584 | 1577 | ||