aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/e752x_edac.c
diff options
context:
space:
mode:
authorDave Peterson <dsp@llnl.gov>2006-03-26 04:38:40 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-26 11:57:06 -0500
commit537fba28928c01b7db1580627450691a4bb0b9b3 (patch)
tree1fd5adaa38ba639e28b56e014bfb309c0d1e181e /drivers/edac/e752x_edac.c
parentf2fe42abbf0d99a8c4b96f1cc55db10ac35d2fb9 (diff)
[PATCH] EDAC: printk cleanup
This implements the following idea: On Monday 30 January 2006 19:22, Eric W. Biederman wrote: > One piece missing from this conversation is the issue that we need errors > in a uniform format. That is why edac_mc has helper functions. > > However there will always be errors that don't fit any particular model. > Could we add a edac_printk(dev, ); That is similar to dev_printk but > prints out an EDAC header and the device on which the error was found? > Letting the rest of the string be user specified. > > For actual control that interface may be to blunt, but at least for people > looking in the logs it allows all of the errors to be detected and > harvested. Signed-off-by: David S. Peterson <dsp@llnl.gov> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/edac/e752x_edac.c')
-rw-r--r--drivers/edac/e752x_edac.c90
1 files changed, 47 insertions, 43 deletions
diff --git a/drivers/edac/e752x_edac.c b/drivers/edac/e752x_edac.c
index c454ded2b060..25edba55b18c 100644
--- a/drivers/edac/e752x_edac.c
+++ b/drivers/edac/e752x_edac.c
@@ -30,6 +30,14 @@
30#include "edac_mc.h" 30#include "edac_mc.h"
31 31
32 32
33#define e752x_printk(level, fmt, arg...) \
34 edac_printk(level, "e752x", fmt, ##arg)
35
36
37#define e752x_mc_printk(mci, level, fmt, arg...) \
38 edac_mc_chipset_printk(mci, level, "e752x", fmt, ##arg)
39
40
33#ifndef PCI_DEVICE_ID_INTEL_7520_0 41#ifndef PCI_DEVICE_ID_INTEL_7520_0
34#define PCI_DEVICE_ID_INTEL_7520_0 0x3590 42#define PCI_DEVICE_ID_INTEL_7520_0 0x3590
35#endif /* PCI_DEVICE_ID_INTEL_7520_0 */ 43#endif /* PCI_DEVICE_ID_INTEL_7520_0 */
@@ -215,7 +223,7 @@ static unsigned long ctl_page_to_phys(struct mem_ctl_info *mci,
215 u32 remap; 223 u32 remap;
216 struct e752x_pvt *pvt = (struct e752x_pvt *) mci->pvt_info; 224 struct e752x_pvt *pvt = (struct e752x_pvt *) mci->pvt_info;
217 225
218 debugf3("MC: " __FILE__ ": %s()\n", __func__); 226 debugf3("%s()\n", __func__);
219 227
220 if (page < pvt->tolm) 228 if (page < pvt->tolm)
221 return page; 229 return page;
@@ -224,7 +232,7 @@ static unsigned long ctl_page_to_phys(struct mem_ctl_info *mci,
224 remap = (page - pvt->tolm) + pvt->remapbase; 232 remap = (page - pvt->tolm) + pvt->remapbase;
225 if (remap < pvt->remaplimit) 233 if (remap < pvt->remaplimit)
226 return remap; 234 return remap;
227 printk(KERN_ERR "Invalid page %lx - out of range\n", page); 235 e752x_printk(KERN_ERR, "Invalid page %lx - out of range\n", page);
228 return pvt->tolm - 1; 236 return pvt->tolm - 1;
229} 237}
230 238
@@ -237,7 +245,7 @@ static void do_process_ce(struct mem_ctl_info *mci, u16 error_one,
237 int i; 245 int i;
238 struct e752x_pvt *pvt = (struct e752x_pvt *) mci->pvt_info; 246 struct e752x_pvt *pvt = (struct e752x_pvt *) mci->pvt_info;
239 247
240 debugf3("MC: " __FILE__ ": %s()\n", __func__); 248 debugf3("%s()\n", __func__);
241 249
242 /* convert the addr to 4k page */ 250 /* convert the addr to 4k page */
243 page = sec1_add >> (PAGE_SHIFT - 4); 251 page = sec1_add >> (PAGE_SHIFT - 4);
@@ -246,24 +254,23 @@ static void do_process_ce(struct mem_ctl_info *mci, u16 error_one,
246 if (pvt->mc_symmetric) { 254 if (pvt->mc_symmetric) {
247 /* chip select are bits 14 & 13 */ 255 /* chip select are bits 14 & 13 */
248 row = ((page >> 1) & 3); 256 row = ((page >> 1) & 3);
249 printk(KERN_WARNING 257 e752x_printk(KERN_WARNING,
250 "Test row %d Table %d %d %d %d %d %d %d %d\n", 258 "Test row %d Table %d %d %d %d %d %d %d %d\n",
251 row, pvt->map[0], pvt->map[1], pvt->map[2], 259 row, pvt->map[0], pvt->map[1], pvt->map[2],
252 pvt->map[3], pvt->map[4], pvt->map[5], 260 pvt->map[3], pvt->map[4], pvt->map[5],
253 pvt->map[6], pvt->map[7]); 261 pvt->map[6], pvt->map[7]);
254 262
255 /* test for channel remapping */ 263 /* test for channel remapping */
256 for (i = 0; i < 8; i++) { 264 for (i = 0; i < 8; i++) {
257 if (pvt->map[i] == row) 265 if (pvt->map[i] == row)
258 break; 266 break;
259 } 267 }
260 printk(KERN_WARNING "Test computed row %d\n", i); 268 e752x_printk(KERN_WARNING, "Test computed row %d\n", i);
261 if (i < 8) 269 if (i < 8)
262 row = i; 270 row = i;
263 else 271 else
264 printk(KERN_WARNING 272 e752x_mc_printk(mci, KERN_WARNING,
265 "MC%d: row %d not found in remap table\n", 273 "row %d not found in remap table\n", row);
266 mci->mc_idx, row);
267 } else 274 } else
268 row = edac_mc_find_csrow_by_page(mci, page); 275 row = edac_mc_find_csrow_by_page(mci, page);
269 /* 0 = channel A, 1 = channel B */ 276 /* 0 = channel A, 1 = channel B */
@@ -293,7 +300,7 @@ static void do_process_ue(struct mem_ctl_info *mci, u16 error_one, u32 ded_add,
293 int row; 300 int row;
294 struct e752x_pvt *pvt = (struct e752x_pvt *) mci->pvt_info; 301 struct e752x_pvt *pvt = (struct e752x_pvt *) mci->pvt_info;
295 302
296 debugf3("MC: " __FILE__ ": %s()\n", __func__); 303 debugf3("%s()\n", __func__);
297 304
298 if (error_one & 0x0202) { 305 if (error_one & 0x0202) {
299 error_2b = ded_add; 306 error_2b = ded_add;
@@ -336,7 +343,7 @@ static inline void process_ue_no_info_wr(struct mem_ctl_info *mci,
336 if (!handle_error) 343 if (!handle_error)
337 return; 344 return;
338 345
339 debugf3("MC: " __FILE__ ": %s()\n", __func__); 346 debugf3("%s()\n", __func__);
340 edac_mc_handle_ue_no_info(mci, "e752x UE log memory write"); 347 edac_mc_handle_ue_no_info(mci, "e752x UE log memory write");
341} 348}
342 349
@@ -352,9 +359,9 @@ static void do_process_ded_retry(struct mem_ctl_info *mci, u16 error,
352 row = pvt->mc_symmetric ? 359 row = pvt->mc_symmetric ?
353 ((page >> 1) & 3) : /* chip select are bits 14 & 13 */ 360 ((page >> 1) & 3) : /* chip select are bits 14 & 13 */
354 edac_mc_find_csrow_by_page(mci, page); 361 edac_mc_find_csrow_by_page(mci, page);
355 printk(KERN_WARNING 362 e752x_mc_printk(mci, KERN_WARNING,
356 "MC%d: CE page 0x%lx, row %d : Memory read retry\n", 363 "CE page 0x%lx, row %d : Memory read retry\n",
357 mci->mc_idx, (long unsigned int) page, row); 364 (long unsigned int) page, row);
358} 365}
359 366
360static inline void process_ded_retry(struct mem_ctl_info *mci, u16 error, 367static inline void process_ded_retry(struct mem_ctl_info *mci, u16 error,
@@ -372,8 +379,7 @@ static inline void process_threshold_ce(struct mem_ctl_info *mci, u16 error,
372 *error_found = 1; 379 *error_found = 1;
373 380
374 if (handle_error) 381 if (handle_error)
375 printk(KERN_WARNING "MC%d: Memory threshold CE\n", 382 e752x_mc_printk(mci, KERN_WARNING, "Memory threshold CE\n");
376 mci->mc_idx);
377} 383}
378 384
379static char *global_message[11] = { 385static char *global_message[11] = {
@@ -391,7 +397,7 @@ static void do_global_error(int fatal, u32 errors)
391 397
392 for (i = 0; i < 11; i++) { 398 for (i = 0; i < 11; i++) {
393 if (errors & (1 << i)) 399 if (errors & (1 << i))
394 printk(KERN_WARNING "%sError %s\n", 400 e752x_printk(KERN_WARNING, "%sError %s\n",
395 fatal_message[fatal], global_message[i]); 401 fatal_message[fatal], global_message[i]);
396 } 402 }
397} 403}
@@ -418,7 +424,7 @@ static void do_hub_error(int fatal, u8 errors)
418 424
419 for (i = 0; i < 7; i++) { 425 for (i = 0; i < 7; i++) {
420 if (errors & (1 << i)) 426 if (errors & (1 << i))
421 printk(KERN_WARNING "%sError %s\n", 427 e752x_printk(KERN_WARNING, "%sError %s\n",
422 fatal_message[fatal], hub_message[i]); 428 fatal_message[fatal], hub_message[i]);
423 } 429 }
424} 430}
@@ -445,7 +451,7 @@ static void do_membuf_error(u8 errors)
445 451
446 for (i = 0; i < 4; i++) { 452 for (i = 0; i < 4; i++) {
447 if (errors & (1 << i)) 453 if (errors & (1 << i))
448 printk(KERN_WARNING "Non-Fatal Error %s\n", 454 e752x_printk(KERN_WARNING, "Non-Fatal Error %s\n",
449 membuf_message[i]); 455 membuf_message[i]);
450 } 456 }
451} 457}
@@ -478,7 +484,7 @@ static void do_sysbus_error(int fatal, u32 errors)
478 484
479 for (i = 0; i < 10; i++) { 485 for (i = 0; i < 10; i++) {
480 if (errors & (1 << i)) 486 if (errors & (1 << i))
481 printk(KERN_WARNING "%sError System Bus %s\n", 487 e752x_printk(KERN_WARNING, "%sError System Bus %s\n",
482 fatal_message[fatal], global_message[i]); 488 fatal_message[fatal], global_message[i]);
483 } 489 }
484} 490}
@@ -727,7 +733,7 @@ static int e752x_process_error_info (struct mem_ctl_info *mci,
727static void e752x_check(struct mem_ctl_info *mci) 733static void e752x_check(struct mem_ctl_info *mci)
728{ 734{
729 struct e752x_error_info info; 735 struct e752x_error_info info;
730 debugf3("MC: " __FILE__ ": %s()\n", __func__); 736 debugf3("%s()\n", __func__);
731 e752x_get_error_info(mci, &info); 737 e752x_get_error_info(mci, &info);
732 e752x_process_error_info(mci, &info, 1); 738 e752x_process_error_info(mci, &info, 1);
733} 739}
@@ -752,7 +758,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
752 struct pci_dev *pres_dev; 758 struct pci_dev *pres_dev;
753 struct pci_dev *dev = NULL; 759 struct pci_dev *dev = NULL;
754 760
755 debugf0("MC: " __FILE__ ": %s(): mci\n", __func__); 761 debugf0("%s(): mci\n", __func__);
756 debugf0("Starting Probe1\n"); 762 debugf0("Starting Probe1\n");
757 763
758 /* enable device 0 function 1 */ 764 /* enable device 0 function 1 */
@@ -776,7 +782,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
776 goto fail; 782 goto fail;
777 } 783 }
778 784
779 debugf3("MC: " __FILE__ ": %s(): init mci\n", __func__); 785 debugf3("%s(): init mci\n", __func__);
780 786
781 mci->mtype_cap = MEM_FLAG_RDDR; 787 mci->mtype_cap = MEM_FLAG_RDDR;
782 mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_SECDED | 788 mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_SECDED |
@@ -786,7 +792,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
786 mci->mod_ver = "$Revision: 1.5.2.11 $"; 792 mci->mod_ver = "$Revision: 1.5.2.11 $";
787 mci->pdev = pdev; 793 mci->pdev = pdev;
788 794
789 debugf3("MC: " __FILE__ ": %s(): init pvt\n", __func__); 795 debugf3("%s(): init pvt\n", __func__);
790 pvt = (struct e752x_pvt *) mci->pvt_info; 796 pvt = (struct e752x_pvt *) mci->pvt_info;
791 pvt->dev_info = &e752x_devs[dev_idx]; 797 pvt->dev_info = &e752x_devs[dev_idx];
792 pvt->bridge_ck = pci_get_device(PCI_VENDOR_ID_INTEL, 798 pvt->bridge_ck = pci_get_device(PCI_VENDOR_ID_INTEL,
@@ -796,14 +802,14 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
796 pvt->bridge_ck = pci_scan_single_device(pdev->bus, 802 pvt->bridge_ck = pci_scan_single_device(pdev->bus,
797 PCI_DEVFN(0, 1)); 803 PCI_DEVFN(0, 1));
798 if (pvt->bridge_ck == NULL) { 804 if (pvt->bridge_ck == NULL) {
799 printk(KERN_ERR "MC: error reporting device not found:" 805 e752x_printk(KERN_ERR, "error reporting device not found:"
800 "vendor %x device 0x%x (broken BIOS?)\n", 806 "vendor %x device 0x%x (broken BIOS?)\n",
801 PCI_VENDOR_ID_INTEL, e752x_devs[dev_idx].err_dev); 807 PCI_VENDOR_ID_INTEL, e752x_devs[dev_idx].err_dev);
802 goto fail; 808 goto fail;
803 } 809 }
804 pvt->mc_symmetric = ((ddrcsr & 0x10) != 0); 810 pvt->mc_symmetric = ((ddrcsr & 0x10) != 0);
805 811
806 debugf3("MC: " __FILE__ ": %s(): more mci init\n", __func__); 812 debugf3("%s(): more mci init\n", __func__);
807 mci->ctl_name = pvt->dev_info->ctl_name; 813 mci->ctl_name = pvt->dev_info->ctl_name;
808 mci->edac_check = e752x_check; 814 mci->edac_check = e752x_check;
809 mci->ctl_page_to_phys = ctl_page_to_phys; 815 mci->ctl_page_to_phys = ctl_page_to_phys;
@@ -828,8 +834,8 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
828 pci_read_config_byte(mci->pdev, E752X_DRB + index, &value); 834 pci_read_config_byte(mci->pdev, E752X_DRB + index, &value);
829 /* convert a 128 or 64 MiB DRB to a page size. */ 835 /* convert a 128 or 64 MiB DRB to a page size. */
830 cumul_size = value << (25 + drc_drbg - PAGE_SHIFT); 836 cumul_size = value << (25 + drc_drbg - PAGE_SHIFT);
831 debugf3("MC: " __FILE__ ": %s(): (%d) cumul_size 0x%x\n", 837 debugf3("%s(): (%d) cumul_size 0x%x\n", __func__, index,
832 __func__, index, cumul_size); 838 cumul_size);
833 if (cumul_size == last_cumul_size) 839 if (cumul_size == last_cumul_size)
834 continue; /* not populated */ 840 continue; /* not populated */
835 841
@@ -897,8 +903,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
897 903
898 mci->edac_cap |= EDAC_FLAG_NONE; 904 mci->edac_cap |= EDAC_FLAG_NONE;
899 905
900 debugf3("MC: " __FILE__ ": %s(): tolm, remapbase, remaplimit\n", 906 debugf3("%s(): tolm, remapbase, remaplimit\n", __func__);
901 __func__);
902 /* load the top of low memory, remap base, and remap limit vars */ 907 /* load the top of low memory, remap base, and remap limit vars */
903 pci_read_config_word(mci->pdev, E752X_TOLM, &pci_data); 908 pci_read_config_word(mci->pdev, E752X_TOLM, &pci_data);
904 pvt->tolm = ((u32) pci_data) << 4; 909 pvt->tolm = ((u32) pci_data) << 4;
@@ -906,13 +911,12 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
906 pvt->remapbase = ((u32) pci_data) << 14; 911 pvt->remapbase = ((u32) pci_data) << 14;
907 pci_read_config_word(mci->pdev, E752X_REMAPLIMIT, &pci_data); 912 pci_read_config_word(mci->pdev, E752X_REMAPLIMIT, &pci_data);
908 pvt->remaplimit = ((u32) pci_data) << 14; 913 pvt->remaplimit = ((u32) pci_data) << 14;
909 printk("tolm = %x, remapbase = %x, remaplimit = %x\n", pvt->tolm, 914 e752x_printk(KERN_INFO,
910 pvt->remapbase, pvt->remaplimit); 915 "tolm = %x, remapbase = %x, remaplimit = %x\n",
916 pvt->tolm, pvt->remapbase, pvt->remaplimit);
911 917
912 if (edac_mc_add_mc(mci)) { 918 if (edac_mc_add_mc(mci)) {
913 debugf3("MC: " __FILE__ 919 debugf3("%s(): failed edac_mc_add_mc()\n", __func__);
914 ": %s(): failed edac_mc_add_mc()\n",
915 __func__);
916 goto fail; 920 goto fail;
917 } 921 }
918 922
@@ -975,7 +979,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
975 pci_write_config_word(dev, E752X_DRAM_NERR, stat16); 979 pci_write_config_word(dev, E752X_DRAM_NERR, stat16);
976 980
977 /* get this far and it's successful */ 981 /* get this far and it's successful */
978 debugf3("MC: " __FILE__ ": %s(): success\n", __func__); 982 debugf3("%s(): success\n", __func__);
979 return 0; 983 return 0;
980 984
981fail: 985fail:
@@ -995,7 +999,7 @@ fail:
995static int __devinit e752x_init_one(struct pci_dev *pdev, 999static int __devinit e752x_init_one(struct pci_dev *pdev,
996 const struct pci_device_id *ent) 1000 const struct pci_device_id *ent)
997{ 1001{
998 debugf0("MC: " __FILE__ ": %s()\n", __func__); 1002 debugf0("%s()\n", __func__);
999 1003
1000 /* wake up and enable device */ 1004 /* wake up and enable device */
1001 if(pci_enable_device(pdev) < 0) 1005 if(pci_enable_device(pdev) < 0)
@@ -1009,7 +1013,7 @@ static void __devexit e752x_remove_one(struct pci_dev *pdev)
1009 struct mem_ctl_info *mci; 1013 struct mem_ctl_info *mci;
1010 struct e752x_pvt *pvt; 1014 struct e752x_pvt *pvt;
1011 1015
1012 debugf0(__FILE__ ": %s()\n", __func__); 1016 debugf0("%s()\n", __func__);
1013 1017
1014 if ((mci = edac_mc_find_mci_by_pdev(pdev)) == NULL) 1018 if ((mci = edac_mc_find_mci_by_pdev(pdev)) == NULL)
1015 return; 1019 return;
@@ -1050,7 +1054,7 @@ static int __init e752x_init(void)
1050{ 1054{
1051 int pci_rc; 1055 int pci_rc;
1052 1056
1053 debugf3("MC: " __FILE__ ": %s()\n", __func__); 1057 debugf3("%s()\n", __func__);
1054 pci_rc = pci_register_driver(&e752x_driver); 1058 pci_rc = pci_register_driver(&e752x_driver);
1055 return (pci_rc < 0) ? pci_rc : 0; 1059 return (pci_rc < 0) ? pci_rc : 0;
1056} 1060}
@@ -1058,7 +1062,7 @@ static int __init e752x_init(void)
1058 1062
1059static void __exit e752x_exit(void) 1063static void __exit e752x_exit(void)
1060{ 1064{
1061 debugf3("MC: " __FILE__ ": %s()\n", __func__); 1065 debugf3("%s()\n", __func__);
1062 pci_unregister_driver(&e752x_driver); 1066 pci_unregister_driver(&e752x_driver);
1063} 1067}
1064 1068