diff options
Diffstat (limited to 'drivers/edac')
-rw-r--r-- | drivers/edac/e752x_edac.c | 117 | ||||
-rw-r--r-- | drivers/edac/edac_device_sysfs.c | 6 | ||||
-rw-r--r-- | drivers/edac/edac_mc_sysfs.c | 4 | ||||
-rw-r--r-- | drivers/edac/edac_pci_sysfs.c | 4 | ||||
-rw-r--r-- | drivers/edac/mpc85xx_edac.c | 163 | ||||
-rw-r--r-- | drivers/edac/mpc85xx_edac.h | 3 |
6 files changed, 270 insertions, 27 deletions
diff --git a/drivers/edac/e752x_edac.c b/drivers/edac/e752x_edac.c index d205d493a68..243e9aacad6 100644 --- a/drivers/edac/e752x_edac.c +++ b/drivers/edac/e752x_edac.c | |||
@@ -75,6 +75,14 @@ static struct edac_pci_ctl_info *e752x_pci; | |||
75 | #define E752X_NR_CSROWS 8 /* number of csrows */ | 75 | #define E752X_NR_CSROWS 8 /* number of csrows */ |
76 | 76 | ||
77 | /* E752X register addresses - device 0 function 0 */ | 77 | /* E752X register addresses - device 0 function 0 */ |
78 | #define E752X_MCHSCRB 0x52 /* Memory Scrub register (16b) */ | ||
79 | /* | ||
80 | * 6:5 Scrub Completion Count | ||
81 | * 3:2 Scrub Rate (i3100 only) | ||
82 | * 01=fast 10=normal | ||
83 | * 1:0 Scrub Mode enable | ||
84 | * 00=off 10=on | ||
85 | */ | ||
78 | #define E752X_DRB 0x60 /* DRAM row boundary register (8b) */ | 86 | #define E752X_DRB 0x60 /* DRAM row boundary register (8b) */ |
79 | #define E752X_DRA 0x70 /* DRAM row attribute register (8b) */ | 87 | #define E752X_DRA 0x70 /* DRAM row attribute register (8b) */ |
80 | /* | 88 | /* |
@@ -240,6 +248,41 @@ static const struct e752x_dev_info e752x_devs[] = { | |||
240 | .ctl_name = "3100"}, | 248 | .ctl_name = "3100"}, |
241 | }; | 249 | }; |
242 | 250 | ||
251 | /* Valid scrub rates for the e752x/3100 hardware memory scrubber. We | ||
252 | * map the scrubbing bandwidth to a hardware register value. The 'set' | ||
253 | * operation finds the 'matching or higher value'. Note that scrubbing | ||
254 | * on the e752x can only be enabled/disabled. The 3100 supports | ||
255 | * a normal and fast mode. | ||
256 | */ | ||
257 | |||
258 | #define SDRATE_EOT 0xFFFFFFFF | ||
259 | |||
260 | struct scrubrate { | ||
261 | u32 bandwidth; /* bandwidth consumed by scrubbing in bytes/sec */ | ||
262 | u16 scrubval; /* register value for scrub rate */ | ||
263 | }; | ||
264 | |||
265 | /* Rate below assumes same performance as i3100 using PC3200 DDR2 in | ||
266 | * normal mode. e752x bridges don't support choosing normal or fast mode, | ||
267 | * so the scrubbing bandwidth value isn't all that important - scrubbing is | ||
268 | * either on or off. | ||
269 | */ | ||
270 | static const struct scrubrate scrubrates_e752x[] = { | ||
271 | {0, 0x00}, /* Scrubbing Off */ | ||
272 | {500000, 0x02}, /* Scrubbing On */ | ||
273 | {SDRATE_EOT, 0x00} /* End of Table */ | ||
274 | }; | ||
275 | |||
276 | /* Fast mode: 2 GByte PC3200 DDR2 scrubbed in 33s = 63161283 bytes/s | ||
277 | * Normal mode: 125 (32000 / 256) times slower than fast mode. | ||
278 | */ | ||
279 | static const struct scrubrate scrubrates_i3100[] = { | ||
280 | {0, 0x00}, /* Scrubbing Off */ | ||
281 | {500000, 0x0a}, /* Normal mode - 32k clocks */ | ||
282 | {62500000, 0x06}, /* Fast mode - 256 clocks */ | ||
283 | {SDRATE_EOT, 0x00} /* End of Table */ | ||
284 | }; | ||
285 | |||
243 | static unsigned long ctl_page_to_phys(struct mem_ctl_info *mci, | 286 | static unsigned long ctl_page_to_phys(struct mem_ctl_info *mci, |
244 | unsigned long page) | 287 | unsigned long page) |
245 | { | 288 | { |
@@ -915,6 +958,68 @@ static void e752x_check(struct mem_ctl_info *mci) | |||
915 | e752x_process_error_info(mci, &info, 1); | 958 | e752x_process_error_info(mci, &info, 1); |
916 | } | 959 | } |
917 | 960 | ||
961 | /* Program byte/sec bandwidth scrub rate to hardware */ | ||
962 | static int set_sdram_scrub_rate(struct mem_ctl_info *mci, u32 *new_bw) | ||
963 | { | ||
964 | const struct scrubrate *scrubrates; | ||
965 | struct e752x_pvt *pvt = (struct e752x_pvt *) mci->pvt_info; | ||
966 | struct pci_dev *pdev = pvt->dev_d0f0; | ||
967 | int i; | ||
968 | |||
969 | if (pvt->dev_info->ctl_dev == PCI_DEVICE_ID_INTEL_3100_0) | ||
970 | scrubrates = scrubrates_i3100; | ||
971 | else | ||
972 | scrubrates = scrubrates_e752x; | ||
973 | |||
974 | /* Translate the desired scrub rate to a e752x/3100 register value. | ||
975 | * Search for the bandwidth that is equal or greater than the | ||
976 | * desired rate and program the cooresponding register value. | ||
977 | */ | ||
978 | for (i = 0; scrubrates[i].bandwidth != SDRATE_EOT; i++) | ||
979 | if (scrubrates[i].bandwidth >= *new_bw) | ||
980 | break; | ||
981 | |||
982 | if (scrubrates[i].bandwidth == SDRATE_EOT) | ||
983 | return -1; | ||
984 | |||
985 | pci_write_config_word(pdev, E752X_MCHSCRB, scrubrates[i].scrubval); | ||
986 | |||
987 | return 0; | ||
988 | } | ||
989 | |||
990 | /* Convert current scrub rate value into byte/sec bandwidth */ | ||
991 | static int get_sdram_scrub_rate(struct mem_ctl_info *mci, u32 *bw) | ||
992 | { | ||
993 | const struct scrubrate *scrubrates; | ||
994 | struct e752x_pvt *pvt = (struct e752x_pvt *) mci->pvt_info; | ||
995 | struct pci_dev *pdev = pvt->dev_d0f0; | ||
996 | u16 scrubval; | ||
997 | int i; | ||
998 | |||
999 | if (pvt->dev_info->ctl_dev == PCI_DEVICE_ID_INTEL_3100_0) | ||
1000 | scrubrates = scrubrates_i3100; | ||
1001 | else | ||
1002 | scrubrates = scrubrates_e752x; | ||
1003 | |||
1004 | /* Find the bandwidth matching the memory scrubber configuration */ | ||
1005 | pci_read_config_word(pdev, E752X_MCHSCRB, &scrubval); | ||
1006 | scrubval = scrubval & 0x0f; | ||
1007 | |||
1008 | for (i = 0; scrubrates[i].bandwidth != SDRATE_EOT; i++) | ||
1009 | if (scrubrates[i].scrubval == scrubval) | ||
1010 | break; | ||
1011 | |||
1012 | if (scrubrates[i].bandwidth == SDRATE_EOT) { | ||
1013 | e752x_printk(KERN_WARNING, | ||
1014 | "Invalid sdram scrub control value: 0x%x\n", scrubval); | ||
1015 | return -1; | ||
1016 | } | ||
1017 | |||
1018 | *bw = scrubrates[i].bandwidth; | ||
1019 | |||
1020 | return 0; | ||
1021 | } | ||
1022 | |||
918 | /* Return 1 if dual channel mode is active. Else return 0. */ | 1023 | /* Return 1 if dual channel mode is active. Else return 0. */ |
919 | static inline int dual_channel_active(u16 ddrcsr) | 1024 | static inline int dual_channel_active(u16 ddrcsr) |
920 | { | 1025 | { |
@@ -1073,10 +1178,7 @@ fail: | |||
1073 | 1178 | ||
1074 | /* Setup system bus parity mask register. | 1179 | /* Setup system bus parity mask register. |
1075 | * Sysbus parity supported on: | 1180 | * Sysbus parity supported on: |
1076 | * e7320/e7520/e7525 + Xeon | 1181 | * e7320/e7520/e7525 + Xeon |
1077 | * i3100 + Xeon/Celeron | ||
1078 | * Sysbus parity not supported on: | ||
1079 | * i3100 + Pentium M/Celeron M/Core Duo/Core2 Duo | ||
1080 | */ | 1182 | */ |
1081 | static void e752x_init_sysbus_parity_mask(struct e752x_pvt *pvt) | 1183 | static void e752x_init_sysbus_parity_mask(struct e752x_pvt *pvt) |
1082 | { | 1184 | { |
@@ -1087,10 +1189,7 @@ static void e752x_init_sysbus_parity_mask(struct e752x_pvt *pvt) | |||
1087 | /* Allow module parameter override, else see if CPU supports parity */ | 1189 | /* Allow module parameter override, else see if CPU supports parity */ |
1088 | if (sysbus_parity != -1) { | 1190 | if (sysbus_parity != -1) { |
1089 | enable = sysbus_parity; | 1191 | enable = sysbus_parity; |
1090 | } else if (cpu_id[0] && | 1192 | } else if (cpu_id[0] && !strstr(cpu_id, "Xeon")) { |
1091 | ((strstr(cpu_id, "Pentium") && strstr(cpu_id, " M ")) || | ||
1092 | (strstr(cpu_id, "Celeron") && strstr(cpu_id, " M ")) || | ||
1093 | (strstr(cpu_id, "Core") && strstr(cpu_id, "Duo")))) { | ||
1094 | e752x_printk(KERN_INFO, "System Bus Parity not " | 1193 | e752x_printk(KERN_INFO, "System Bus Parity not " |
1095 | "supported by CPU, disabling\n"); | 1194 | "supported by CPU, disabling\n"); |
1096 | enable = 0; | 1195 | enable = 0; |
@@ -1187,6 +1286,8 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx) | |||
1187 | mci->dev_name = pci_name(pdev); | 1286 | mci->dev_name = pci_name(pdev); |
1188 | mci->edac_check = e752x_check; | 1287 | mci->edac_check = e752x_check; |
1189 | mci->ctl_page_to_phys = ctl_page_to_phys; | 1288 | mci->ctl_page_to_phys = ctl_page_to_phys; |
1289 | mci->set_sdram_scrub_rate = set_sdram_scrub_rate; | ||
1290 | mci->get_sdram_scrub_rate = get_sdram_scrub_rate; | ||
1190 | 1291 | ||
1191 | /* set the map type. 1 = normal, 0 = reversed | 1292 | /* set the map type. 1 = normal, 0 = reversed |
1192 | * Must be set before e752x_init_csrows in case csrow mapping | 1293 | * Must be set before e752x_init_csrows in case csrow mapping |
diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c index 53764577035..5fdedbc0f54 100644 --- a/drivers/edac/edac_device_sysfs.c +++ b/drivers/edac/edac_device_sysfs.c | |||
@@ -137,7 +137,7 @@ static ssize_t edac_dev_ctl_info_store(struct kobject *kobj, | |||
137 | } | 137 | } |
138 | 138 | ||
139 | /* edac_dev file operations for an 'ctl_info' */ | 139 | /* edac_dev file operations for an 'ctl_info' */ |
140 | static struct sysfs_ops device_ctl_info_ops = { | 140 | static const struct sysfs_ops device_ctl_info_ops = { |
141 | .show = edac_dev_ctl_info_show, | 141 | .show = edac_dev_ctl_info_show, |
142 | .store = edac_dev_ctl_info_store | 142 | .store = edac_dev_ctl_info_store |
143 | }; | 143 | }; |
@@ -373,7 +373,7 @@ static ssize_t edac_dev_instance_store(struct kobject *kobj, | |||
373 | } | 373 | } |
374 | 374 | ||
375 | /* edac_dev file operations for an 'instance' */ | 375 | /* edac_dev file operations for an 'instance' */ |
376 | static struct sysfs_ops device_instance_ops = { | 376 | static const struct sysfs_ops device_instance_ops = { |
377 | .show = edac_dev_instance_show, | 377 | .show = edac_dev_instance_show, |
378 | .store = edac_dev_instance_store | 378 | .store = edac_dev_instance_store |
379 | }; | 379 | }; |
@@ -476,7 +476,7 @@ static ssize_t edac_dev_block_store(struct kobject *kobj, | |||
476 | } | 476 | } |
477 | 477 | ||
478 | /* edac_dev file operations for a 'block' */ | 478 | /* edac_dev file operations for a 'block' */ |
479 | static struct sysfs_ops device_block_ops = { | 479 | static const struct sysfs_ops device_block_ops = { |
480 | .show = edac_dev_block_show, | 480 | .show = edac_dev_block_show, |
481 | .store = edac_dev_block_store | 481 | .store = edac_dev_block_store |
482 | }; | 482 | }; |
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c index e1d4ce08348..88840e9fa3e 100644 --- a/drivers/edac/edac_mc_sysfs.c +++ b/drivers/edac/edac_mc_sysfs.c | |||
@@ -245,7 +245,7 @@ static ssize_t csrowdev_store(struct kobject *kobj, struct attribute *attr, | |||
245 | return -EIO; | 245 | return -EIO; |
246 | } | 246 | } |
247 | 247 | ||
248 | static struct sysfs_ops csrowfs_ops = { | 248 | static const struct sysfs_ops csrowfs_ops = { |
249 | .show = csrowdev_show, | 249 | .show = csrowdev_show, |
250 | .store = csrowdev_store | 250 | .store = csrowdev_store |
251 | }; | 251 | }; |
@@ -575,7 +575,7 @@ static ssize_t mcidev_store(struct kobject *kobj, struct attribute *attr, | |||
575 | } | 575 | } |
576 | 576 | ||
577 | /* Intermediate show/store table */ | 577 | /* Intermediate show/store table */ |
578 | static struct sysfs_ops mci_ops = { | 578 | static const struct sysfs_ops mci_ops = { |
579 | .show = mcidev_show, | 579 | .show = mcidev_show, |
580 | .store = mcidev_store | 580 | .store = mcidev_store |
581 | }; | 581 | }; |
diff --git a/drivers/edac/edac_pci_sysfs.c b/drivers/edac/edac_pci_sysfs.c index fb60a877d76..bef94e3d994 100644 --- a/drivers/edac/edac_pci_sysfs.c +++ b/drivers/edac/edac_pci_sysfs.c | |||
@@ -121,7 +121,7 @@ static ssize_t edac_pci_instance_store(struct kobject *kobj, | |||
121 | } | 121 | } |
122 | 122 | ||
123 | /* fs_ops table */ | 123 | /* fs_ops table */ |
124 | static struct sysfs_ops pci_instance_ops = { | 124 | static const struct sysfs_ops pci_instance_ops = { |
125 | .show = edac_pci_instance_show, | 125 | .show = edac_pci_instance_show, |
126 | .store = edac_pci_instance_store | 126 | .store = edac_pci_instance_store |
127 | }; | 127 | }; |
@@ -261,7 +261,7 @@ static ssize_t edac_pci_dev_store(struct kobject *kobj, | |||
261 | return -EIO; | 261 | return -EIO; |
262 | } | 262 | } |
263 | 263 | ||
264 | static struct sysfs_ops edac_pci_sysfs_ops = { | 264 | static const struct sysfs_ops edac_pci_sysfs_ops = { |
265 | .show = edac_pci_dev_show, | 265 | .show = edac_pci_dev_show, |
266 | .store = edac_pci_dev_store | 266 | .store = edac_pci_dev_store |
267 | }; | 267 | }; |
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c index ecd5928d711..94cac0aacea 100644 --- a/drivers/edac/mpc85xx_edac.c +++ b/drivers/edac/mpc85xx_edac.c | |||
@@ -239,16 +239,15 @@ static int __devinit mpc85xx_pci_err_probe(struct of_device *op, | |||
239 | /* we only need the error registers */ | 239 | /* we only need the error registers */ |
240 | r.start += 0xe00; | 240 | r.start += 0xe00; |
241 | 241 | ||
242 | if (!devm_request_mem_region(&op->dev, r.start, | 242 | if (!devm_request_mem_region(&op->dev, r.start, resource_size(&r), |
243 | r.end - r.start + 1, pdata->name)) { | 243 | pdata->name)) { |
244 | printk(KERN_ERR "%s: Error while requesting mem region\n", | 244 | printk(KERN_ERR "%s: Error while requesting mem region\n", |
245 | __func__); | 245 | __func__); |
246 | res = -EBUSY; | 246 | res = -EBUSY; |
247 | goto err; | 247 | goto err; |
248 | } | 248 | } |
249 | 249 | ||
250 | pdata->pci_vbase = devm_ioremap(&op->dev, r.start, | 250 | pdata->pci_vbase = devm_ioremap(&op->dev, r.start, resource_size(&r)); |
251 | r.end - r.start + 1); | ||
252 | if (!pdata->pci_vbase) { | 251 | if (!pdata->pci_vbase) { |
253 | printk(KERN_ERR "%s: Unable to setup PCI err regs\n", __func__); | 252 | printk(KERN_ERR "%s: Unable to setup PCI err regs\n", __func__); |
254 | res = -ENOMEM; | 253 | res = -ENOMEM; |
@@ -668,15 +667,125 @@ static struct of_platform_driver mpc85xx_l2_err_driver = { | |||
668 | 667 | ||
669 | /**************************** MC Err device ***************************/ | 668 | /**************************** MC Err device ***************************/ |
670 | 669 | ||
670 | /* | ||
671 | * Taken from table 8-55 in the MPC8641 User's Manual and/or 9-61 in the | ||
672 | * MPC8572 User's Manual. Each line represents a syndrome bit column as a | ||
673 | * 64-bit value, but split into an upper and lower 32-bit chunk. The labels | ||
674 | * below correspond to Freescale's manuals. | ||
675 | */ | ||
676 | static unsigned int ecc_table[16] = { | ||
677 | /* MSB LSB */ | ||
678 | /* [0:31] [32:63] */ | ||
679 | 0xf00fe11e, 0xc33c0ff7, /* Syndrome bit 7 */ | ||
680 | 0x00ff00ff, 0x00fff0ff, | ||
681 | 0x0f0f0f0f, 0x0f0fff00, | ||
682 | 0x11113333, 0x7777000f, | ||
683 | 0x22224444, 0x8888222f, | ||
684 | 0x44448888, 0xffff4441, | ||
685 | 0x8888ffff, 0x11118882, | ||
686 | 0xffff1111, 0x22221114, /* Syndrome bit 0 */ | ||
687 | }; | ||
688 | |||
689 | /* | ||
690 | * Calculate the correct ECC value for a 64-bit value specified by high:low | ||
691 | */ | ||
692 | static u8 calculate_ecc(u32 high, u32 low) | ||
693 | { | ||
694 | u32 mask_low; | ||
695 | u32 mask_high; | ||
696 | int bit_cnt; | ||
697 | u8 ecc = 0; | ||
698 | int i; | ||
699 | int j; | ||
700 | |||
701 | for (i = 0; i < 8; i++) { | ||
702 | mask_high = ecc_table[i * 2]; | ||
703 | mask_low = ecc_table[i * 2 + 1]; | ||
704 | bit_cnt = 0; | ||
705 | |||
706 | for (j = 0; j < 32; j++) { | ||
707 | if ((mask_high >> j) & 1) | ||
708 | bit_cnt ^= (high >> j) & 1; | ||
709 | if ((mask_low >> j) & 1) | ||
710 | bit_cnt ^= (low >> j) & 1; | ||
711 | } | ||
712 | |||
713 | ecc |= bit_cnt << i; | ||
714 | } | ||
715 | |||
716 | return ecc; | ||
717 | } | ||
718 | |||
719 | /* | ||
720 | * Create the syndrome code which is generated if the data line specified by | ||
721 | * 'bit' failed. Eg generate an 8-bit codes seen in Table 8-55 in the MPC8641 | ||
722 | * User's Manual and 9-61 in the MPC8572 User's Manual. | ||
723 | */ | ||
724 | static u8 syndrome_from_bit(unsigned int bit) { | ||
725 | int i; | ||
726 | u8 syndrome = 0; | ||
727 | |||
728 | /* | ||
729 | * Cycle through the upper or lower 32-bit portion of each value in | ||
730 | * ecc_table depending on if 'bit' is in the upper or lower half of | ||
731 | * 64-bit data. | ||
732 | */ | ||
733 | for (i = bit < 32; i < 16; i += 2) | ||
734 | syndrome |= ((ecc_table[i] >> (bit % 32)) & 1) << (i / 2); | ||
735 | |||
736 | return syndrome; | ||
737 | } | ||
738 | |||
739 | /* | ||
740 | * Decode data and ecc syndrome to determine what went wrong | ||
741 | * Note: This can only decode single-bit errors | ||
742 | */ | ||
743 | static void sbe_ecc_decode(u32 cap_high, u32 cap_low, u32 cap_ecc, | ||
744 | int *bad_data_bit, int *bad_ecc_bit) | ||
745 | { | ||
746 | int i; | ||
747 | u8 syndrome; | ||
748 | |||
749 | *bad_data_bit = -1; | ||
750 | *bad_ecc_bit = -1; | ||
751 | |||
752 | /* | ||
753 | * Calculate the ECC of the captured data and XOR it with the captured | ||
754 | * ECC to find an ECC syndrome value we can search for | ||
755 | */ | ||
756 | syndrome = calculate_ecc(cap_high, cap_low) ^ cap_ecc; | ||
757 | |||
758 | /* Check if a data line is stuck... */ | ||
759 | for (i = 0; i < 64; i++) { | ||
760 | if (syndrome == syndrome_from_bit(i)) { | ||
761 | *bad_data_bit = i; | ||
762 | return; | ||
763 | } | ||
764 | } | ||
765 | |||
766 | /* If data is correct, check ECC bits for errors... */ | ||
767 | for (i = 0; i < 8; i++) { | ||
768 | if ((syndrome >> i) & 0x1) { | ||
769 | *bad_ecc_bit = i; | ||
770 | return; | ||
771 | } | ||
772 | } | ||
773 | } | ||
774 | |||
671 | static void mpc85xx_mc_check(struct mem_ctl_info *mci) | 775 | static void mpc85xx_mc_check(struct mem_ctl_info *mci) |
672 | { | 776 | { |
673 | struct mpc85xx_mc_pdata *pdata = mci->pvt_info; | 777 | struct mpc85xx_mc_pdata *pdata = mci->pvt_info; |
674 | struct csrow_info *csrow; | 778 | struct csrow_info *csrow; |
779 | u32 bus_width; | ||
675 | u32 err_detect; | 780 | u32 err_detect; |
676 | u32 syndrome; | 781 | u32 syndrome; |
677 | u32 err_addr; | 782 | u32 err_addr; |
678 | u32 pfn; | 783 | u32 pfn; |
679 | int row_index; | 784 | int row_index; |
785 | u32 cap_high; | ||
786 | u32 cap_low; | ||
787 | int bad_data_bit; | ||
788 | int bad_ecc_bit; | ||
680 | 789 | ||
681 | err_detect = in_be32(pdata->mc_vbase + MPC85XX_MC_ERR_DETECT); | 790 | err_detect = in_be32(pdata->mc_vbase + MPC85XX_MC_ERR_DETECT); |
682 | if (!err_detect) | 791 | if (!err_detect) |
@@ -692,6 +801,15 @@ static void mpc85xx_mc_check(struct mem_ctl_info *mci) | |||
692 | } | 801 | } |
693 | 802 | ||
694 | syndrome = in_be32(pdata->mc_vbase + MPC85XX_MC_CAPTURE_ECC); | 803 | syndrome = in_be32(pdata->mc_vbase + MPC85XX_MC_CAPTURE_ECC); |
804 | |||
805 | /* Mask off appropriate bits of syndrome based on bus width */ | ||
806 | bus_width = (in_be32(pdata->mc_vbase + MPC85XX_MC_DDR_SDRAM_CFG) & | ||
807 | DSC_DBW_MASK) ? 32 : 64; | ||
808 | if (bus_width == 64) | ||
809 | syndrome &= 0xff; | ||
810 | else | ||
811 | syndrome &= 0xffff; | ||
812 | |||
695 | err_addr = in_be32(pdata->mc_vbase + MPC85XX_MC_CAPTURE_ADDRESS); | 813 | err_addr = in_be32(pdata->mc_vbase + MPC85XX_MC_CAPTURE_ADDRESS); |
696 | pfn = err_addr >> PAGE_SHIFT; | 814 | pfn = err_addr >> PAGE_SHIFT; |
697 | 815 | ||
@@ -701,14 +819,35 @@ static void mpc85xx_mc_check(struct mem_ctl_info *mci) | |||
701 | break; | 819 | break; |
702 | } | 820 | } |
703 | 821 | ||
704 | mpc85xx_mc_printk(mci, KERN_ERR, "Capture Data High: %#8.8x\n", | 822 | cap_high = in_be32(pdata->mc_vbase + MPC85XX_MC_CAPTURE_DATA_HI); |
705 | in_be32(pdata->mc_vbase + | 823 | cap_low = in_be32(pdata->mc_vbase + MPC85XX_MC_CAPTURE_DATA_LO); |
706 | MPC85XX_MC_CAPTURE_DATA_HI)); | 824 | |
707 | mpc85xx_mc_printk(mci, KERN_ERR, "Capture Data Low: %#8.8x\n", | 825 | /* |
708 | in_be32(pdata->mc_vbase + | 826 | * Analyze single-bit errors on 64-bit wide buses |
709 | MPC85XX_MC_CAPTURE_DATA_LO)); | 827 | * TODO: Add support for 32-bit wide buses |
710 | mpc85xx_mc_printk(mci, KERN_ERR, "syndrome: %#8.8x\n", syndrome); | 828 | */ |
711 | mpc85xx_mc_printk(mci, KERN_ERR, "err addr: %#8.8x\n", err_addr); | 829 | if ((err_detect & DDR_EDE_SBE) && (bus_width == 64)) { |
830 | sbe_ecc_decode(cap_high, cap_low, syndrome, | ||
831 | &bad_data_bit, &bad_ecc_bit); | ||
832 | |||
833 | if (bad_data_bit != -1) | ||
834 | mpc85xx_mc_printk(mci, KERN_ERR, | ||
835 | "Faulty Data bit: %d\n", bad_data_bit); | ||
836 | if (bad_ecc_bit != -1) | ||
837 | mpc85xx_mc_printk(mci, KERN_ERR, | ||
838 | "Faulty ECC bit: %d\n", bad_ecc_bit); | ||
839 | |||
840 | mpc85xx_mc_printk(mci, KERN_ERR, | ||
841 | "Expected Data / ECC:\t%#8.8x_%08x / %#2.2x\n", | ||
842 | cap_high ^ (1 << (bad_data_bit - 32)), | ||
843 | cap_low ^ (1 << bad_data_bit), | ||
844 | syndrome ^ (1 << bad_ecc_bit)); | ||
845 | } | ||
846 | |||
847 | mpc85xx_mc_printk(mci, KERN_ERR, | ||
848 | "Captured Data / ECC:\t%#8.8x_%08x / %#2.2x\n", | ||
849 | cap_high, cap_low, syndrome); | ||
850 | mpc85xx_mc_printk(mci, KERN_ERR, "Err addr: %#8.8x\n", err_addr); | ||
712 | mpc85xx_mc_printk(mci, KERN_ERR, "PFN: %#8.8x\n", pfn); | 851 | mpc85xx_mc_printk(mci, KERN_ERR, "PFN: %#8.8x\n", pfn); |
713 | 852 | ||
714 | /* we are out of range */ | 853 | /* we are out of range */ |
diff --git a/drivers/edac/mpc85xx_edac.h b/drivers/edac/mpc85xx_edac.h index 52432ee7c4b..cb24df83946 100644 --- a/drivers/edac/mpc85xx_edac.h +++ b/drivers/edac/mpc85xx_edac.h | |||
@@ -48,6 +48,9 @@ | |||
48 | #define DSC_MEM_EN 0x80000000 | 48 | #define DSC_MEM_EN 0x80000000 |
49 | #define DSC_ECC_EN 0x20000000 | 49 | #define DSC_ECC_EN 0x20000000 |
50 | #define DSC_RD_EN 0x10000000 | 50 | #define DSC_RD_EN 0x10000000 |
51 | #define DSC_DBW_MASK 0x00180000 | ||
52 | #define DSC_DBW_32 0x00080000 | ||
53 | #define DSC_DBW_64 0x00000000 | ||
51 | 54 | ||
52 | #define DSC_SDTYPE_MASK 0x07000000 | 55 | #define DSC_SDTYPE_MASK 0x07000000 |
53 | 56 | ||