diff options
Diffstat (limited to 'drivers/edac/i5400_edac.c')
-rw-r--r-- | drivers/edac/i5400_edac.c | 201 |
1 files changed, 97 insertions, 104 deletions
diff --git a/drivers/edac/i5400_edac.c b/drivers/edac/i5400_edac.c index 6640c29e1885..277246998b80 100644 --- a/drivers/edac/i5400_edac.c +++ b/drivers/edac/i5400_edac.c | |||
@@ -300,24 +300,6 @@ static inline int extract_fbdchan_indx(u32 x) | |||
300 | return (x>>28) & 0x3; | 300 | return (x>>28) & 0x3; |
301 | } | 301 | } |
302 | 302 | ||
303 | #ifdef CONFIG_EDAC_DEBUG | ||
304 | /* MTR NUMROW */ | ||
305 | static const char *numrow_toString[] = { | ||
306 | "8,192 - 13 rows", | ||
307 | "16,384 - 14 rows", | ||
308 | "32,768 - 15 rows", | ||
309 | "65,536 - 16 rows" | ||
310 | }; | ||
311 | |||
312 | /* MTR NUMCOL */ | ||
313 | static const char *numcol_toString[] = { | ||
314 | "1,024 - 10 columns", | ||
315 | "2,048 - 11 columns", | ||
316 | "4,096 - 12 columns", | ||
317 | "reserved" | ||
318 | }; | ||
319 | #endif | ||
320 | |||
321 | /* Device name and register DID (Device ID) */ | 303 | /* Device name and register DID (Device ID) */ |
322 | struct i5400_dev_info { | 304 | struct i5400_dev_info { |
323 | const char *ctl_name; /* name for this device */ | 305 | const char *ctl_name; /* name for this device */ |
@@ -345,7 +327,13 @@ struct i5400_pvt { | |||
345 | struct pci_dev *branch_1; /* 22.0 */ | 327 | struct pci_dev *branch_1; /* 22.0 */ |
346 | 328 | ||
347 | u16 tolm; /* top of low memory */ | 329 | u16 tolm; /* top of low memory */ |
348 | u64 ambase; /* AMB BAR */ | 330 | union { |
331 | u64 ambase; /* AMB BAR */ | ||
332 | struct { | ||
333 | u32 ambase_bottom; | ||
334 | u32 ambase_top; | ||
335 | } u __packed; | ||
336 | }; | ||
349 | 337 | ||
350 | u16 mir0, mir1; | 338 | u16 mir0, mir1; |
351 | 339 | ||
@@ -560,10 +548,9 @@ static void i5400_proccess_non_recoverable_info(struct mem_ctl_info *mci, | |||
560 | ras = nrec_ras(info); | 548 | ras = nrec_ras(info); |
561 | cas = nrec_cas(info); | 549 | cas = nrec_cas(info); |
562 | 550 | ||
563 | debugf0("\t\tDIMM= %d Channels= %d,%d (Branch= %d " | 551 | edac_dbg(0, "\t\tDIMM= %d Channels= %d,%d (Branch= %d DRAM Bank= %d Buffer ID = %d rdwr= %s ras= %d cas= %d)\n", |
564 | "DRAM Bank= %d Buffer ID = %d rdwr= %s ras= %d cas= %d)\n", | 552 | rank, channel, channel + 1, branch >> 1, bank, |
565 | rank, channel, channel + 1, branch >> 1, bank, | 553 | buf_id, rdwr_str(rdwr), ras, cas); |
566 | buf_id, rdwr_str(rdwr), ras, cas); | ||
567 | 554 | ||
568 | /* Only 1 bit will be on */ | 555 | /* Only 1 bit will be on */ |
569 | errnum = find_first_bit(&allErrors, ARRAY_SIZE(error_name)); | 556 | errnum = find_first_bit(&allErrors, ARRAY_SIZE(error_name)); |
@@ -573,10 +560,10 @@ static void i5400_proccess_non_recoverable_info(struct mem_ctl_info *mci, | |||
573 | "Bank=%d Buffer ID = %d RAS=%d CAS=%d Err=0x%lx (%s)", | 560 | "Bank=%d Buffer ID = %d RAS=%d CAS=%d Err=0x%lx (%s)", |
574 | bank, buf_id, ras, cas, allErrors, error_name[errnum]); | 561 | bank, buf_id, ras, cas, allErrors, error_name[errnum]); |
575 | 562 | ||
576 | edac_mc_handle_error(tp_event, mci, 0, 0, 0, | 563 | edac_mc_handle_error(tp_event, mci, 1, 0, 0, 0, |
577 | branch >> 1, -1, rank, | 564 | branch >> 1, -1, rank, |
578 | rdwr ? "Write error" : "Read error", | 565 | rdwr ? "Write error" : "Read error", |
579 | msg, NULL); | 566 | msg); |
580 | } | 567 | } |
581 | 568 | ||
582 | /* | 569 | /* |
@@ -613,7 +600,7 @@ static void i5400_process_nonfatal_error_info(struct mem_ctl_info *mci, | |||
613 | 600 | ||
614 | /* Correctable errors */ | 601 | /* Correctable errors */ |
615 | if (allErrors & ERROR_NF_CORRECTABLE) { | 602 | if (allErrors & ERROR_NF_CORRECTABLE) { |
616 | debugf0("\tCorrected bits= 0x%lx\n", allErrors); | 603 | edac_dbg(0, "\tCorrected bits= 0x%lx\n", allErrors); |
617 | 604 | ||
618 | branch = extract_fbdchan_indx(info->ferr_nf_fbd); | 605 | branch = extract_fbdchan_indx(info->ferr_nf_fbd); |
619 | 606 | ||
@@ -634,10 +621,9 @@ static void i5400_process_nonfatal_error_info(struct mem_ctl_info *mci, | |||
634 | /* Only 1 bit will be on */ | 621 | /* Only 1 bit will be on */ |
635 | errnum = find_first_bit(&allErrors, ARRAY_SIZE(error_name)); | 622 | errnum = find_first_bit(&allErrors, ARRAY_SIZE(error_name)); |
636 | 623 | ||
637 | debugf0("\t\tDIMM= %d Channel= %d (Branch %d " | 624 | edac_dbg(0, "\t\tDIMM= %d Channel= %d (Branch %d DRAM Bank= %d rdwr= %s ras= %d cas= %d)\n", |
638 | "DRAM Bank= %d rdwr= %s ras= %d cas= %d)\n", | 625 | rank, channel, branch >> 1, bank, |
639 | rank, channel, branch >> 1, bank, | 626 | rdwr_str(rdwr), ras, cas); |
640 | rdwr_str(rdwr), ras, cas); | ||
641 | 627 | ||
642 | /* Form out message */ | 628 | /* Form out message */ |
643 | snprintf(msg, sizeof(msg), | 629 | snprintf(msg, sizeof(msg), |
@@ -646,10 +632,10 @@ static void i5400_process_nonfatal_error_info(struct mem_ctl_info *mci, | |||
646 | branch >> 1, bank, rdwr_str(rdwr), ras, cas, | 632 | branch >> 1, bank, rdwr_str(rdwr), ras, cas, |
647 | allErrors, error_name[errnum]); | 633 | allErrors, error_name[errnum]); |
648 | 634 | ||
649 | edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 0, 0, 0, | 635 | edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 1, 0, 0, 0, |
650 | branch >> 1, channel % 2, rank, | 636 | branch >> 1, channel % 2, rank, |
651 | rdwr ? "Write error" : "Read error", | 637 | rdwr ? "Write error" : "Read error", |
652 | msg, NULL); | 638 | msg); |
653 | 639 | ||
654 | return; | 640 | return; |
655 | } | 641 | } |
@@ -700,7 +686,7 @@ static void i5400_clear_error(struct mem_ctl_info *mci) | |||
700 | static void i5400_check_error(struct mem_ctl_info *mci) | 686 | static void i5400_check_error(struct mem_ctl_info *mci) |
701 | { | 687 | { |
702 | struct i5400_error_info info; | 688 | struct i5400_error_info info; |
703 | debugf4("MC%d: %s: %s()\n", mci->mc_idx, __FILE__, __func__); | 689 | edac_dbg(4, "MC%d\n", mci->mc_idx); |
704 | i5400_get_error_info(mci, &info); | 690 | i5400_get_error_info(mci, &info); |
705 | i5400_process_error_info(mci, &info); | 691 | i5400_process_error_info(mci, &info); |
706 | } | 692 | } |
@@ -786,15 +772,16 @@ static int i5400_get_devices(struct mem_ctl_info *mci, int dev_idx) | |||
786 | } | 772 | } |
787 | pvt->fsb_error_regs = pdev; | 773 | pvt->fsb_error_regs = pdev; |
788 | 774 | ||
789 | debugf1("System Address, processor bus- PCI Bus ID: %s %x:%x\n", | 775 | edac_dbg(1, "System Address, processor bus- PCI Bus ID: %s %x:%x\n", |
790 | pci_name(pvt->system_address), | 776 | pci_name(pvt->system_address), |
791 | pvt->system_address->vendor, pvt->system_address->device); | 777 | pvt->system_address->vendor, pvt->system_address->device); |
792 | debugf1("Branchmap, control and errors - PCI Bus ID: %s %x:%x\n", | 778 | edac_dbg(1, "Branchmap, control and errors - PCI Bus ID: %s %x:%x\n", |
793 | pci_name(pvt->branchmap_werrors), | 779 | pci_name(pvt->branchmap_werrors), |
794 | pvt->branchmap_werrors->vendor, pvt->branchmap_werrors->device); | 780 | pvt->branchmap_werrors->vendor, |
795 | debugf1("FSB Error Regs - PCI Bus ID: %s %x:%x\n", | 781 | pvt->branchmap_werrors->device); |
796 | pci_name(pvt->fsb_error_regs), | 782 | edac_dbg(1, "FSB Error Regs - PCI Bus ID: %s %x:%x\n", |
797 | pvt->fsb_error_regs->vendor, pvt->fsb_error_regs->device); | 783 | pci_name(pvt->fsb_error_regs), |
784 | pvt->fsb_error_regs->vendor, pvt->fsb_error_regs->device); | ||
798 | 785 | ||
799 | pvt->branch_0 = pci_get_device(PCI_VENDOR_ID_INTEL, | 786 | pvt->branch_0 = pci_get_device(PCI_VENDOR_ID_INTEL, |
800 | PCI_DEVICE_ID_INTEL_5400_FBD0, NULL); | 787 | PCI_DEVICE_ID_INTEL_5400_FBD0, NULL); |
@@ -882,8 +869,8 @@ static int determine_mtr(struct i5400_pvt *pvt, int dimm, int channel) | |||
882 | n = dimm; | 869 | n = dimm; |
883 | 870 | ||
884 | if (n >= DIMMS_PER_CHANNEL) { | 871 | if (n >= DIMMS_PER_CHANNEL) { |
885 | debugf0("ERROR: trying to access an invalid dimm: %d\n", | 872 | edac_dbg(0, "ERROR: trying to access an invalid dimm: %d\n", |
886 | dimm); | 873 | dimm); |
887 | return 0; | 874 | return 0; |
888 | } | 875 | } |
889 | 876 | ||
@@ -903,20 +890,29 @@ static void decode_mtr(int slot_row, u16 mtr) | |||
903 | 890 | ||
904 | ans = MTR_DIMMS_PRESENT(mtr); | 891 | ans = MTR_DIMMS_PRESENT(mtr); |
905 | 892 | ||
906 | debugf2("\tMTR%d=0x%x: DIMMs are %s\n", slot_row, mtr, | 893 | edac_dbg(2, "\tMTR%d=0x%x: DIMMs are %sPresent\n", |
907 | ans ? "Present" : "NOT Present"); | 894 | slot_row, mtr, ans ? "" : "NOT "); |
908 | if (!ans) | 895 | if (!ans) |
909 | return; | 896 | return; |
910 | 897 | ||
911 | debugf2("\t\tWIDTH: x%d\n", MTR_DRAM_WIDTH(mtr)); | 898 | edac_dbg(2, "\t\tWIDTH: x%d\n", MTR_DRAM_WIDTH(mtr)); |
912 | 899 | ||
913 | debugf2("\t\tELECTRICAL THROTTLING is %s\n", | 900 | edac_dbg(2, "\t\tELECTRICAL THROTTLING is %s\n", |
914 | MTR_DIMMS_ETHROTTLE(mtr) ? "enabled" : "disabled"); | 901 | MTR_DIMMS_ETHROTTLE(mtr) ? "enabled" : "disabled"); |
915 | 902 | ||
916 | debugf2("\t\tNUMBANK: %d bank(s)\n", MTR_DRAM_BANKS(mtr)); | 903 | edac_dbg(2, "\t\tNUMBANK: %d bank(s)\n", MTR_DRAM_BANKS(mtr)); |
917 | debugf2("\t\tNUMRANK: %s\n", MTR_DIMM_RANK(mtr) ? "double" : "single"); | 904 | edac_dbg(2, "\t\tNUMRANK: %s\n", |
918 | debugf2("\t\tNUMROW: %s\n", numrow_toString[MTR_DIMM_ROWS(mtr)]); | 905 | MTR_DIMM_RANK(mtr) ? "double" : "single"); |
919 | debugf2("\t\tNUMCOL: %s\n", numcol_toString[MTR_DIMM_COLS(mtr)]); | 906 | edac_dbg(2, "\t\tNUMROW: %s\n", |
907 | MTR_DIMM_ROWS(mtr) == 0 ? "8,192 - 13 rows" : | ||
908 | MTR_DIMM_ROWS(mtr) == 1 ? "16,384 - 14 rows" : | ||
909 | MTR_DIMM_ROWS(mtr) == 2 ? "32,768 - 15 rows" : | ||
910 | "65,536 - 16 rows"); | ||
911 | edac_dbg(2, "\t\tNUMCOL: %s\n", | ||
912 | MTR_DIMM_COLS(mtr) == 0 ? "1,024 - 10 columns" : | ||
913 | MTR_DIMM_COLS(mtr) == 1 ? "2,048 - 11 columns" : | ||
914 | MTR_DIMM_COLS(mtr) == 2 ? "4,096 - 12 columns" : | ||
915 | "reserved"); | ||
920 | } | 916 | } |
921 | 917 | ||
922 | static void handle_channel(struct i5400_pvt *pvt, int dimm, int channel, | 918 | static void handle_channel(struct i5400_pvt *pvt, int dimm, int channel, |
@@ -989,7 +985,7 @@ static void calculate_dimm_size(struct i5400_pvt *pvt) | |||
989 | "-------------------------------"); | 985 | "-------------------------------"); |
990 | p += n; | 986 | p += n; |
991 | space -= n; | 987 | space -= n; |
992 | debugf2("%s\n", mem_buffer); | 988 | edac_dbg(2, "%s\n", mem_buffer); |
993 | p = mem_buffer; | 989 | p = mem_buffer; |
994 | space = PAGE_SIZE; | 990 | space = PAGE_SIZE; |
995 | } | 991 | } |
@@ -1004,7 +1000,7 @@ static void calculate_dimm_size(struct i5400_pvt *pvt) | |||
1004 | p += n; | 1000 | p += n; |
1005 | space -= n; | 1001 | space -= n; |
1006 | } | 1002 | } |
1007 | debugf2("%s\n", mem_buffer); | 1003 | edac_dbg(2, "%s\n", mem_buffer); |
1008 | p = mem_buffer; | 1004 | p = mem_buffer; |
1009 | space = PAGE_SIZE; | 1005 | space = PAGE_SIZE; |
1010 | } | 1006 | } |
@@ -1014,7 +1010,7 @@ static void calculate_dimm_size(struct i5400_pvt *pvt) | |||
1014 | "-------------------------------"); | 1010 | "-------------------------------"); |
1015 | p += n; | 1011 | p += n; |
1016 | space -= n; | 1012 | space -= n; |
1017 | debugf2("%s\n", mem_buffer); | 1013 | edac_dbg(2, "%s\n", mem_buffer); |
1018 | p = mem_buffer; | 1014 | p = mem_buffer; |
1019 | space = PAGE_SIZE; | 1015 | space = PAGE_SIZE; |
1020 | 1016 | ||
@@ -1029,7 +1025,7 @@ static void calculate_dimm_size(struct i5400_pvt *pvt) | |||
1029 | } | 1025 | } |
1030 | 1026 | ||
1031 | space -= n; | 1027 | space -= n; |
1032 | debugf2("%s\n", mem_buffer); | 1028 | edac_dbg(2, "%s\n", mem_buffer); |
1033 | p = mem_buffer; | 1029 | p = mem_buffer; |
1034 | space = PAGE_SIZE; | 1030 | space = PAGE_SIZE; |
1035 | 1031 | ||
@@ -1042,7 +1038,7 @@ static void calculate_dimm_size(struct i5400_pvt *pvt) | |||
1042 | } | 1038 | } |
1043 | 1039 | ||
1044 | /* output the last message and free buffer */ | 1040 | /* output the last message and free buffer */ |
1045 | debugf2("%s\n", mem_buffer); | 1041 | edac_dbg(2, "%s\n", mem_buffer); |
1046 | kfree(mem_buffer); | 1042 | kfree(mem_buffer); |
1047 | } | 1043 | } |
1048 | 1044 | ||
@@ -1065,25 +1061,25 @@ static void i5400_get_mc_regs(struct mem_ctl_info *mci) | |||
1065 | pvt = mci->pvt_info; | 1061 | pvt = mci->pvt_info; |
1066 | 1062 | ||
1067 | pci_read_config_dword(pvt->system_address, AMBASE, | 1063 | pci_read_config_dword(pvt->system_address, AMBASE, |
1068 | (u32 *) &pvt->ambase); | 1064 | &pvt->u.ambase_bottom); |
1069 | pci_read_config_dword(pvt->system_address, AMBASE + sizeof(u32), | 1065 | pci_read_config_dword(pvt->system_address, AMBASE + sizeof(u32), |
1070 | ((u32 *) &pvt->ambase) + sizeof(u32)); | 1066 | &pvt->u.ambase_top); |
1071 | 1067 | ||
1072 | maxdimmperch = pvt->maxdimmperch; | 1068 | maxdimmperch = pvt->maxdimmperch; |
1073 | maxch = pvt->maxch; | 1069 | maxch = pvt->maxch; |
1074 | 1070 | ||
1075 | debugf2("AMBASE= 0x%lx MAXCH= %d MAX-DIMM-Per-CH= %d\n", | 1071 | edac_dbg(2, "AMBASE= 0x%lx MAXCH= %d MAX-DIMM-Per-CH= %d\n", |
1076 | (long unsigned int)pvt->ambase, pvt->maxch, pvt->maxdimmperch); | 1072 | (long unsigned int)pvt->ambase, pvt->maxch, pvt->maxdimmperch); |
1077 | 1073 | ||
1078 | /* Get the Branch Map regs */ | 1074 | /* Get the Branch Map regs */ |
1079 | pci_read_config_word(pvt->branchmap_werrors, TOLM, &pvt->tolm); | 1075 | pci_read_config_word(pvt->branchmap_werrors, TOLM, &pvt->tolm); |
1080 | pvt->tolm >>= 12; | 1076 | pvt->tolm >>= 12; |
1081 | debugf2("\nTOLM (number of 256M regions) =%u (0x%x)\n", pvt->tolm, | 1077 | edac_dbg(2, "\nTOLM (number of 256M regions) =%u (0x%x)\n", |
1082 | pvt->tolm); | 1078 | pvt->tolm, pvt->tolm); |
1083 | 1079 | ||
1084 | actual_tolm = (u32) ((1000l * pvt->tolm) >> (30 - 28)); | 1080 | actual_tolm = (u32) ((1000l * pvt->tolm) >> (30 - 28)); |
1085 | debugf2("Actual TOLM byte addr=%u.%03u GB (0x%x)\n", | 1081 | edac_dbg(2, "Actual TOLM byte addr=%u.%03u GB (0x%x)\n", |
1086 | actual_tolm/1000, actual_tolm % 1000, pvt->tolm << 28); | 1082 | actual_tolm/1000, actual_tolm % 1000, pvt->tolm << 28); |
1087 | 1083 | ||
1088 | pci_read_config_word(pvt->branchmap_werrors, MIR0, &pvt->mir0); | 1084 | pci_read_config_word(pvt->branchmap_werrors, MIR0, &pvt->mir0); |
1089 | pci_read_config_word(pvt->branchmap_werrors, MIR1, &pvt->mir1); | 1085 | pci_read_config_word(pvt->branchmap_werrors, MIR1, &pvt->mir1); |
@@ -1092,11 +1088,13 @@ static void i5400_get_mc_regs(struct mem_ctl_info *mci) | |||
1092 | limit = (pvt->mir0 >> 4) & 0x0fff; | 1088 | limit = (pvt->mir0 >> 4) & 0x0fff; |
1093 | way0 = pvt->mir0 & 0x1; | 1089 | way0 = pvt->mir0 & 0x1; |
1094 | way1 = pvt->mir0 & 0x2; | 1090 | way1 = pvt->mir0 & 0x2; |
1095 | debugf2("MIR0: limit= 0x%x WAY1= %u WAY0= %x\n", limit, way1, way0); | 1091 | edac_dbg(2, "MIR0: limit= 0x%x WAY1= %u WAY0= %x\n", |
1092 | limit, way1, way0); | ||
1096 | limit = (pvt->mir1 >> 4) & 0xfff; | 1093 | limit = (pvt->mir1 >> 4) & 0xfff; |
1097 | way0 = pvt->mir1 & 0x1; | 1094 | way0 = pvt->mir1 & 0x1; |
1098 | way1 = pvt->mir1 & 0x2; | 1095 | way1 = pvt->mir1 & 0x2; |
1099 | debugf2("MIR1: limit= 0x%x WAY1= %u WAY0= %x\n", limit, way1, way0); | 1096 | edac_dbg(2, "MIR1: limit= 0x%x WAY1= %u WAY0= %x\n", |
1097 | limit, way1, way0); | ||
1100 | 1098 | ||
1101 | /* Get the set of MTR[0-3] regs by each branch */ | 1099 | /* Get the set of MTR[0-3] regs by each branch */ |
1102 | for (slot_row = 0; slot_row < DIMMS_PER_CHANNEL; slot_row++) { | 1100 | for (slot_row = 0; slot_row < DIMMS_PER_CHANNEL; slot_row++) { |
@@ -1106,8 +1104,8 @@ static void i5400_get_mc_regs(struct mem_ctl_info *mci) | |||
1106 | pci_read_config_word(pvt->branch_0, where, | 1104 | pci_read_config_word(pvt->branch_0, where, |
1107 | &pvt->b0_mtr[slot_row]); | 1105 | &pvt->b0_mtr[slot_row]); |
1108 | 1106 | ||
1109 | debugf2("MTR%d where=0x%x B0 value=0x%x\n", slot_row, where, | 1107 | edac_dbg(2, "MTR%d where=0x%x B0 value=0x%x\n", |
1110 | pvt->b0_mtr[slot_row]); | 1108 | slot_row, where, pvt->b0_mtr[slot_row]); |
1111 | 1109 | ||
1112 | if (pvt->maxch < CHANNELS_PER_BRANCH) { | 1110 | if (pvt->maxch < CHANNELS_PER_BRANCH) { |
1113 | pvt->b1_mtr[slot_row] = 0; | 1111 | pvt->b1_mtr[slot_row] = 0; |
@@ -1117,22 +1115,22 @@ static void i5400_get_mc_regs(struct mem_ctl_info *mci) | |||
1117 | /* Branch 1 set of MTR registers */ | 1115 | /* Branch 1 set of MTR registers */ |
1118 | pci_read_config_word(pvt->branch_1, where, | 1116 | pci_read_config_word(pvt->branch_1, where, |
1119 | &pvt->b1_mtr[slot_row]); | 1117 | &pvt->b1_mtr[slot_row]); |
1120 | debugf2("MTR%d where=0x%x B1 value=0x%x\n", slot_row, where, | 1118 | edac_dbg(2, "MTR%d where=0x%x B1 value=0x%x\n", |
1121 | pvt->b1_mtr[slot_row]); | 1119 | slot_row, where, pvt->b1_mtr[slot_row]); |
1122 | } | 1120 | } |
1123 | 1121 | ||
1124 | /* Read and dump branch 0's MTRs */ | 1122 | /* Read and dump branch 0's MTRs */ |
1125 | debugf2("\nMemory Technology Registers:\n"); | 1123 | edac_dbg(2, "Memory Technology Registers:\n"); |
1126 | debugf2(" Branch 0:\n"); | 1124 | edac_dbg(2, " Branch 0:\n"); |
1127 | for (slot_row = 0; slot_row < DIMMS_PER_CHANNEL; slot_row++) | 1125 | for (slot_row = 0; slot_row < DIMMS_PER_CHANNEL; slot_row++) |
1128 | decode_mtr(slot_row, pvt->b0_mtr[slot_row]); | 1126 | decode_mtr(slot_row, pvt->b0_mtr[slot_row]); |
1129 | 1127 | ||
1130 | pci_read_config_word(pvt->branch_0, AMBPRESENT_0, | 1128 | pci_read_config_word(pvt->branch_0, AMBPRESENT_0, |
1131 | &pvt->b0_ambpresent0); | 1129 | &pvt->b0_ambpresent0); |
1132 | debugf2("\t\tAMB-Branch 0-present0 0x%x:\n", pvt->b0_ambpresent0); | 1130 | edac_dbg(2, "\t\tAMB-Branch 0-present0 0x%x:\n", pvt->b0_ambpresent0); |
1133 | pci_read_config_word(pvt->branch_0, AMBPRESENT_1, | 1131 | pci_read_config_word(pvt->branch_0, AMBPRESENT_1, |
1134 | &pvt->b0_ambpresent1); | 1132 | &pvt->b0_ambpresent1); |
1135 | debugf2("\t\tAMB-Branch 0-present1 0x%x:\n", pvt->b0_ambpresent1); | 1133 | edac_dbg(2, "\t\tAMB-Branch 0-present1 0x%x:\n", pvt->b0_ambpresent1); |
1136 | 1134 | ||
1137 | /* Only if we have 2 branchs (4 channels) */ | 1135 | /* Only if we have 2 branchs (4 channels) */ |
1138 | if (pvt->maxch < CHANNELS_PER_BRANCH) { | 1136 | if (pvt->maxch < CHANNELS_PER_BRANCH) { |
@@ -1140,18 +1138,18 @@ static void i5400_get_mc_regs(struct mem_ctl_info *mci) | |||
1140 | pvt->b1_ambpresent1 = 0; | 1138 | pvt->b1_ambpresent1 = 0; |
1141 | } else { | 1139 | } else { |
1142 | /* Read and dump branch 1's MTRs */ | 1140 | /* Read and dump branch 1's MTRs */ |
1143 | debugf2(" Branch 1:\n"); | 1141 | edac_dbg(2, " Branch 1:\n"); |
1144 | for (slot_row = 0; slot_row < DIMMS_PER_CHANNEL; slot_row++) | 1142 | for (slot_row = 0; slot_row < DIMMS_PER_CHANNEL; slot_row++) |
1145 | decode_mtr(slot_row, pvt->b1_mtr[slot_row]); | 1143 | decode_mtr(slot_row, pvt->b1_mtr[slot_row]); |
1146 | 1144 | ||
1147 | pci_read_config_word(pvt->branch_1, AMBPRESENT_0, | 1145 | pci_read_config_word(pvt->branch_1, AMBPRESENT_0, |
1148 | &pvt->b1_ambpresent0); | 1146 | &pvt->b1_ambpresent0); |
1149 | debugf2("\t\tAMB-Branch 1-present0 0x%x:\n", | 1147 | edac_dbg(2, "\t\tAMB-Branch 1-present0 0x%x:\n", |
1150 | pvt->b1_ambpresent0); | 1148 | pvt->b1_ambpresent0); |
1151 | pci_read_config_word(pvt->branch_1, AMBPRESENT_1, | 1149 | pci_read_config_word(pvt->branch_1, AMBPRESENT_1, |
1152 | &pvt->b1_ambpresent1); | 1150 | &pvt->b1_ambpresent1); |
1153 | debugf2("\t\tAMB-Branch 1-present1 0x%x:\n", | 1151 | edac_dbg(2, "\t\tAMB-Branch 1-present1 0x%x:\n", |
1154 | pvt->b1_ambpresent1); | 1152 | pvt->b1_ambpresent1); |
1155 | } | 1153 | } |
1156 | 1154 | ||
1157 | /* Go and determine the size of each DIMM and place in an | 1155 | /* Go and determine the size of each DIMM and place in an |
@@ -1203,10 +1201,9 @@ static int i5400_init_dimms(struct mem_ctl_info *mci) | |||
1203 | 1201 | ||
1204 | size_mb = pvt->dimm_info[slot][channel].megabytes; | 1202 | size_mb = pvt->dimm_info[slot][channel].megabytes; |
1205 | 1203 | ||
1206 | debugf2("%s: dimm%zd (branch %d channel %d slot %d): %d.%03d GB\n", | 1204 | edac_dbg(2, "dimm (branch %d channel %d slot %d): %d.%03d GB\n", |
1207 | __func__, dimm - mci->dimms, | 1205 | channel / 2, channel % 2, slot, |
1208 | channel / 2, channel % 2, slot, | 1206 | size_mb / 1000, size_mb % 1000); |
1209 | size_mb / 1000, size_mb % 1000); | ||
1210 | 1207 | ||
1211 | dimm->nr_pages = size_mb << 8; | 1208 | dimm->nr_pages = size_mb << 8; |
1212 | dimm->grain = 8; | 1209 | dimm->grain = 8; |
@@ -1227,7 +1224,7 @@ static int i5400_init_dimms(struct mem_ctl_info *mci) | |||
1227 | * With such single-DIMM mode, the SDCC algorithm degrades to SECDEC+. | 1224 | * With such single-DIMM mode, the SDCC algorithm degrades to SECDEC+. |
1228 | */ | 1225 | */ |
1229 | if (ndimms == 1) | 1226 | if (ndimms == 1) |
1230 | mci->dimms[0].edac_mode = EDAC_SECDED; | 1227 | mci->dimms[0]->edac_mode = EDAC_SECDED; |
1231 | 1228 | ||
1232 | return (ndimms == 0); | 1229 | return (ndimms == 0); |
1233 | } | 1230 | } |
@@ -1270,10 +1267,9 @@ static int i5400_probe1(struct pci_dev *pdev, int dev_idx) | |||
1270 | if (dev_idx >= ARRAY_SIZE(i5400_devs)) | 1267 | if (dev_idx >= ARRAY_SIZE(i5400_devs)) |
1271 | return -EINVAL; | 1268 | return -EINVAL; |
1272 | 1269 | ||
1273 | debugf0("MC: %s: %s(), pdev bus %u dev=0x%x fn=0x%x\n", | 1270 | edac_dbg(0, "MC: pdev bus %u dev=0x%x fn=0x%x\n", |
1274 | __FILE__, __func__, | 1271 | pdev->bus->number, |
1275 | pdev->bus->number, | 1272 | PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn)); |
1276 | PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn)); | ||
1277 | 1273 | ||
1278 | /* We only are looking for func 0 of the set */ | 1274 | /* We only are looking for func 0 of the set */ |
1279 | if (PCI_FUNC(pdev->devfn) != 0) | 1275 | if (PCI_FUNC(pdev->devfn) != 0) |
@@ -1297,9 +1293,9 @@ static int i5400_probe1(struct pci_dev *pdev, int dev_idx) | |||
1297 | if (mci == NULL) | 1293 | if (mci == NULL) |
1298 | return -ENOMEM; | 1294 | return -ENOMEM; |
1299 | 1295 | ||
1300 | debugf0("MC: %s: %s(): mci = %p\n", __FILE__, __func__, mci); | 1296 | edac_dbg(0, "MC: mci = %p\n", mci); |
1301 | 1297 | ||
1302 | mci->dev = &pdev->dev; /* record ptr to the generic device */ | 1298 | mci->pdev = &pdev->dev; /* record ptr to the generic device */ |
1303 | 1299 | ||
1304 | pvt = mci->pvt_info; | 1300 | pvt = mci->pvt_info; |
1305 | pvt->system_address = pdev; /* Record this device in our private */ | 1301 | pvt->system_address = pdev; /* Record this device in our private */ |
@@ -1329,19 +1325,16 @@ static int i5400_probe1(struct pci_dev *pdev, int dev_idx) | |||
1329 | /* initialize the MC control structure 'dimms' table | 1325 | /* initialize the MC control structure 'dimms' table |
1330 | * with the mapping and control information */ | 1326 | * with the mapping and control information */ |
1331 | if (i5400_init_dimms(mci)) { | 1327 | if (i5400_init_dimms(mci)) { |
1332 | debugf0("MC: Setting mci->edac_cap to EDAC_FLAG_NONE\n" | 1328 | edac_dbg(0, "MC: Setting mci->edac_cap to EDAC_FLAG_NONE because i5400_init_dimms() returned nonzero value\n"); |
1333 | " because i5400_init_dimms() returned nonzero " | ||
1334 | "value\n"); | ||
1335 | mci->edac_cap = EDAC_FLAG_NONE; /* no dimms found */ | 1329 | mci->edac_cap = EDAC_FLAG_NONE; /* no dimms found */ |
1336 | } else { | 1330 | } else { |
1337 | debugf1("MC: Enable error reporting now\n"); | 1331 | edac_dbg(1, "MC: Enable error reporting now\n"); |
1338 | i5400_enable_error_reporting(mci); | 1332 | i5400_enable_error_reporting(mci); |
1339 | } | 1333 | } |
1340 | 1334 | ||
1341 | /* add this new MC control structure to EDAC's list of MCs */ | 1335 | /* add this new MC control structure to EDAC's list of MCs */ |
1342 | if (edac_mc_add_mc(mci)) { | 1336 | if (edac_mc_add_mc(mci)) { |
1343 | debugf0("MC: %s: %s(): failed edac_mc_add_mc()\n", | 1337 | edac_dbg(0, "MC: failed edac_mc_add_mc()\n"); |
1344 | __FILE__, __func__); | ||
1345 | /* FIXME: perhaps some code should go here that disables error | 1338 | /* FIXME: perhaps some code should go here that disables error |
1346 | * reporting if we just enabled it | 1339 | * reporting if we just enabled it |
1347 | */ | 1340 | */ |
@@ -1385,7 +1378,7 @@ static int __devinit i5400_init_one(struct pci_dev *pdev, | |||
1385 | { | 1378 | { |
1386 | int rc; | 1379 | int rc; |
1387 | 1380 | ||
1388 | debugf0("MC: %s: %s()\n", __FILE__, __func__); | 1381 | edac_dbg(0, "MC:\n"); |
1389 | 1382 | ||
1390 | /* wake up device */ | 1383 | /* wake up device */ |
1391 | rc = pci_enable_device(pdev); | 1384 | rc = pci_enable_device(pdev); |
@@ -1404,7 +1397,7 @@ static void __devexit i5400_remove_one(struct pci_dev *pdev) | |||
1404 | { | 1397 | { |
1405 | struct mem_ctl_info *mci; | 1398 | struct mem_ctl_info *mci; |
1406 | 1399 | ||
1407 | debugf0("%s: %s()\n", __FILE__, __func__); | 1400 | edac_dbg(0, "\n"); |
1408 | 1401 | ||
1409 | if (i5400_pci) | 1402 | if (i5400_pci) |
1410 | edac_pci_release_generic_ctl(i5400_pci); | 1403 | edac_pci_release_generic_ctl(i5400_pci); |
@@ -1450,7 +1443,7 @@ static int __init i5400_init(void) | |||
1450 | { | 1443 | { |
1451 | int pci_rc; | 1444 | int pci_rc; |
1452 | 1445 | ||
1453 | debugf2("MC: %s: %s()\n", __FILE__, __func__); | 1446 | edac_dbg(2, "MC:\n"); |
1454 | 1447 | ||
1455 | /* Ensure that the OPSTATE is set correctly for POLL or NMI */ | 1448 | /* Ensure that the OPSTATE is set correctly for POLL or NMI */ |
1456 | opstate_init(); | 1449 | opstate_init(); |
@@ -1466,7 +1459,7 @@ static int __init i5400_init(void) | |||
1466 | */ | 1459 | */ |
1467 | static void __exit i5400_exit(void) | 1460 | static void __exit i5400_exit(void) |
1468 | { | 1461 | { |
1469 | debugf2("MC: %s: %s()\n", __FILE__, __func__); | 1462 | edac_dbg(2, "MC:\n"); |
1470 | pci_unregister_driver(&i5400_driver); | 1463 | pci_unregister_driver(&i5400_driver); |
1471 | } | 1464 | } |
1472 | 1465 | ||