diff options
author | Dave Peterson <dsp@llnl.gov> | 2006-03-26 04:38:40 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-26 11:57:06 -0500 |
commit | 537fba28928c01b7db1580627450691a4bb0b9b3 (patch) | |
tree | 1fd5adaa38ba639e28b56e014bfb309c0d1e181e /drivers/edac/e7xxx_edac.c | |
parent | f2fe42abbf0d99a8c4b96f1cc55db10ac35d2fb9 (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/e7xxx_edac.c')
-rw-r--r-- | drivers/edac/e7xxx_edac.c | 62 |
1 files changed, 34 insertions, 28 deletions
diff --git a/drivers/edac/e7xxx_edac.c b/drivers/edac/e7xxx_edac.c index d5e320dfc66f..e7537413cad2 100644 --- a/drivers/edac/e7xxx_edac.c +++ b/drivers/edac/e7xxx_edac.c | |||
@@ -32,6 +32,14 @@ | |||
32 | #include "edac_mc.h" | 32 | #include "edac_mc.h" |
33 | 33 | ||
34 | 34 | ||
35 | #define e7xxx_printk(level, fmt, arg...) \ | ||
36 | edac_printk(level, "e7xxx", fmt, ##arg) | ||
37 | |||
38 | |||
39 | #define e7xxx_mc_printk(mci, level, fmt, arg...) \ | ||
40 | edac_mc_chipset_printk(mci, level, "e7xxx", fmt, ##arg) | ||
41 | |||
42 | |||
35 | #ifndef PCI_DEVICE_ID_INTEL_7205_0 | 43 | #ifndef PCI_DEVICE_ID_INTEL_7205_0 |
36 | #define PCI_DEVICE_ID_INTEL_7205_0 0x255d | 44 | #define PCI_DEVICE_ID_INTEL_7205_0 0x255d |
37 | #endif /* PCI_DEVICE_ID_INTEL_7205_0 */ | 45 | #endif /* PCI_DEVICE_ID_INTEL_7205_0 */ |
@@ -161,7 +169,7 @@ static const struct e7xxx_dev_info e7xxx_devs[] = { | |||
161 | /* FIXME - is this valid for both SECDED and S4ECD4ED? */ | 169 | /* FIXME - is this valid for both SECDED and S4ECD4ED? */ |
162 | static inline int e7xxx_find_channel(u16 syndrome) | 170 | static inline int e7xxx_find_channel(u16 syndrome) |
163 | { | 171 | { |
164 | debugf3("MC: " __FILE__ ": %s()\n", __func__); | 172 | debugf3("%s()\n", __func__); |
165 | 173 | ||
166 | if ((syndrome & 0xff00) == 0) | 174 | if ((syndrome & 0xff00) == 0) |
167 | return 0; | 175 | return 0; |
@@ -179,7 +187,7 @@ ctl_page_to_phys(struct mem_ctl_info *mci, unsigned long page) | |||
179 | u32 remap; | 187 | u32 remap; |
180 | struct e7xxx_pvt *pvt = (struct e7xxx_pvt *) mci->pvt_info; | 188 | struct e7xxx_pvt *pvt = (struct e7xxx_pvt *) mci->pvt_info; |
181 | 189 | ||
182 | debugf3("MC: " __FILE__ ": %s()\n", __func__); | 190 | debugf3("%s()\n", __func__); |
183 | 191 | ||
184 | if ((page < pvt->tolm) || | 192 | if ((page < pvt->tolm) || |
185 | ((page >= 0x100000) && (page < pvt->remapbase))) | 193 | ((page >= 0x100000) && (page < pvt->remapbase))) |
@@ -187,7 +195,7 @@ ctl_page_to_phys(struct mem_ctl_info *mci, unsigned long page) | |||
187 | remap = (page - pvt->tolm) + pvt->remapbase; | 195 | remap = (page - pvt->tolm) + pvt->remapbase; |
188 | if (remap < pvt->remaplimit) | 196 | if (remap < pvt->remaplimit) |
189 | return remap; | 197 | return remap; |
190 | printk(KERN_ERR "Invalid page %lx - out of range\n", page); | 198 | e7xxx_printk(KERN_ERR, "Invalid page %lx - out of range\n", page); |
191 | return pvt->tolm - 1; | 199 | return pvt->tolm - 1; |
192 | } | 200 | } |
193 | 201 | ||
@@ -199,7 +207,7 @@ static void process_ce(struct mem_ctl_info *mci, struct e7xxx_error_info *info) | |||
199 | int row; | 207 | int row; |
200 | int channel; | 208 | int channel; |
201 | 209 | ||
202 | debugf3("MC: " __FILE__ ": %s()\n", __func__); | 210 | debugf3("%s()\n", __func__); |
203 | 211 | ||
204 | /* read the error address */ | 212 | /* read the error address */ |
205 | error_1b = info->dram_celog_add; | 213 | error_1b = info->dram_celog_add; |
@@ -218,7 +226,7 @@ static void process_ce(struct mem_ctl_info *mci, struct e7xxx_error_info *info) | |||
218 | 226 | ||
219 | static void process_ce_no_info(struct mem_ctl_info *mci) | 227 | static void process_ce_no_info(struct mem_ctl_info *mci) |
220 | { | 228 | { |
221 | debugf3("MC: " __FILE__ ": %s()\n", __func__); | 229 | debugf3("%s()\n", __func__); |
222 | edac_mc_handle_ce_no_info(mci, "e7xxx CE log register overflow"); | 230 | edac_mc_handle_ce_no_info(mci, "e7xxx CE log register overflow"); |
223 | } | 231 | } |
224 | 232 | ||
@@ -228,7 +236,7 @@ static void process_ue(struct mem_ctl_info *mci, struct e7xxx_error_info *info) | |||
228 | u32 error_2b, block_page; | 236 | u32 error_2b, block_page; |
229 | int row; | 237 | int row; |
230 | 238 | ||
231 | debugf3("MC: " __FILE__ ": %s()\n", __func__); | 239 | debugf3("%s()\n", __func__); |
232 | 240 | ||
233 | /* read the error address */ | 241 | /* read the error address */ |
234 | error_2b = info->dram_uelog_add; | 242 | error_2b = info->dram_uelog_add; |
@@ -241,7 +249,7 @@ static void process_ue(struct mem_ctl_info *mci, struct e7xxx_error_info *info) | |||
241 | 249 | ||
242 | static void process_ue_no_info(struct mem_ctl_info *mci) | 250 | static void process_ue_no_info(struct mem_ctl_info *mci) |
243 | { | 251 | { |
244 | debugf3("MC: " __FILE__ ": %s()\n", __func__); | 252 | debugf3("%s()\n", __func__); |
245 | edac_mc_handle_ue_no_info(mci, "e7xxx UE log register overflow"); | 253 | edac_mc_handle_ue_no_info(mci, "e7xxx UE log register overflow"); |
246 | } | 254 | } |
247 | 255 | ||
@@ -330,7 +338,7 @@ static void e7xxx_check(struct mem_ctl_info *mci) | |||
330 | { | 338 | { |
331 | struct e7xxx_error_info info; | 339 | struct e7xxx_error_info info; |
332 | 340 | ||
333 | debugf3("MC: " __FILE__ ": %s()\n", __func__); | 341 | debugf3("%s()\n", __func__); |
334 | e7xxx_get_error_info(mci, &info); | 342 | e7xxx_get_error_info(mci, &info); |
335 | e7xxx_process_error_info(mci, &info, 1); | 343 | e7xxx_process_error_info(mci, &info, 1); |
336 | } | 344 | } |
@@ -351,7 +359,7 @@ static int e7xxx_probe1(struct pci_dev *pdev, int dev_idx) | |||
351 | unsigned long last_cumul_size; | 359 | unsigned long last_cumul_size; |
352 | 360 | ||
353 | 361 | ||
354 | debugf0("MC: " __FILE__ ": %s(): mci\n", __func__); | 362 | debugf0("%s(): mci\n", __func__); |
355 | 363 | ||
356 | /* need to find out the number of channels */ | 364 | /* need to find out the number of channels */ |
357 | pci_read_config_dword(pdev, E7XXX_DRC, &drc); | 365 | pci_read_config_dword(pdev, E7XXX_DRC, &drc); |
@@ -369,7 +377,7 @@ static int e7xxx_probe1(struct pci_dev *pdev, int dev_idx) | |||
369 | goto fail; | 377 | goto fail; |
370 | } | 378 | } |
371 | 379 | ||
372 | debugf3("MC: " __FILE__ ": %s(): init mci\n", __func__); | 380 | debugf3("%s(): init mci\n", __func__); |
373 | 381 | ||
374 | mci->mtype_cap = MEM_FLAG_RDDR; | 382 | mci->mtype_cap = MEM_FLAG_RDDR; |
375 | mci->edac_ctl_cap = | 383 | mci->edac_ctl_cap = |
@@ -379,21 +387,21 @@ static int e7xxx_probe1(struct pci_dev *pdev, int dev_idx) | |||
379 | mci->mod_ver = "$Revision: 1.5.2.9 $"; | 387 | mci->mod_ver = "$Revision: 1.5.2.9 $"; |
380 | mci->pdev = pdev; | 388 | mci->pdev = pdev; |
381 | 389 | ||
382 | debugf3("MC: " __FILE__ ": %s(): init pvt\n", __func__); | 390 | debugf3("%s(): init pvt\n", __func__); |
383 | pvt = (struct e7xxx_pvt *) mci->pvt_info; | 391 | pvt = (struct e7xxx_pvt *) mci->pvt_info; |
384 | pvt->dev_info = &e7xxx_devs[dev_idx]; | 392 | pvt->dev_info = &e7xxx_devs[dev_idx]; |
385 | pvt->bridge_ck = pci_get_device(PCI_VENDOR_ID_INTEL, | 393 | pvt->bridge_ck = pci_get_device(PCI_VENDOR_ID_INTEL, |
386 | pvt->dev_info->err_dev, | 394 | pvt->dev_info->err_dev, |
387 | pvt->bridge_ck); | 395 | pvt->bridge_ck); |
388 | if (!pvt->bridge_ck) { | 396 | if (!pvt->bridge_ck) { |
389 | printk(KERN_ERR | 397 | e7xxx_printk(KERN_ERR, "error reporting device not found:" |
390 | "MC: error reporting device not found:" | 398 | "vendor %x device 0x%x (broken BIOS?)\n", |
391 | "vendor %x device 0x%x (broken BIOS?)\n", | 399 | PCI_VENDOR_ID_INTEL, |
392 | PCI_VENDOR_ID_INTEL, e7xxx_devs[dev_idx].err_dev); | 400 | e7xxx_devs[dev_idx].err_dev); |
393 | goto fail; | 401 | goto fail; |
394 | } | 402 | } |
395 | 403 | ||
396 | debugf3("MC: " __FILE__ ": %s(): more mci init\n", __func__); | 404 | debugf3("%s(): more mci init\n", __func__); |
397 | mci->ctl_name = pvt->dev_info->ctl_name; | 405 | mci->ctl_name = pvt->dev_info->ctl_name; |
398 | 406 | ||
399 | mci->edac_check = e7xxx_check; | 407 | mci->edac_check = e7xxx_check; |
@@ -418,8 +426,8 @@ static int e7xxx_probe1(struct pci_dev *pdev, int dev_idx) | |||
418 | pci_read_config_byte(mci->pdev, E7XXX_DRB + index, &value); | 426 | pci_read_config_byte(mci->pdev, E7XXX_DRB + index, &value); |
419 | /* convert a 64 or 32 MiB DRB to a page size. */ | 427 | /* convert a 64 or 32 MiB DRB to a page size. */ |
420 | cumul_size = value << (25 + drc_drbg - PAGE_SHIFT); | 428 | cumul_size = value << (25 + drc_drbg - PAGE_SHIFT); |
421 | debugf3("MC: " __FILE__ ": %s(): (%d) cumul_size 0x%x\n", | 429 | debugf3("%s(): (%d) cumul_size 0x%x\n", __func__, index, |
422 | __func__, index, cumul_size); | 430 | cumul_size); |
423 | if (cumul_size == last_cumul_size) | 431 | if (cumul_size == last_cumul_size) |
424 | continue; /* not populated */ | 432 | continue; /* not populated */ |
425 | 433 | ||
@@ -449,8 +457,7 @@ static int e7xxx_probe1(struct pci_dev *pdev, int dev_idx) | |||
449 | 457 | ||
450 | mci->edac_cap |= EDAC_FLAG_NONE; | 458 | mci->edac_cap |= EDAC_FLAG_NONE; |
451 | 459 | ||
452 | debugf3("MC: " __FILE__ ": %s(): tolm, remapbase, remaplimit\n", | 460 | debugf3("%s(): tolm, remapbase, remaplimit\n", __func__); |
453 | __func__); | ||
454 | /* load the top of low memory, remap base, and remap limit vars */ | 461 | /* load the top of low memory, remap base, and remap limit vars */ |
455 | pci_read_config_word(mci->pdev, E7XXX_TOLM, &pci_data); | 462 | pci_read_config_word(mci->pdev, E7XXX_TOLM, &pci_data); |
456 | pvt->tolm = ((u32) pci_data) << 4; | 463 | pvt->tolm = ((u32) pci_data) << 4; |
@@ -458,22 +465,21 @@ static int e7xxx_probe1(struct pci_dev *pdev, int dev_idx) | |||
458 | pvt->remapbase = ((u32) pci_data) << 14; | 465 | pvt->remapbase = ((u32) pci_data) << 14; |
459 | pci_read_config_word(mci->pdev, E7XXX_REMAPLIMIT, &pci_data); | 466 | pci_read_config_word(mci->pdev, E7XXX_REMAPLIMIT, &pci_data); |
460 | pvt->remaplimit = ((u32) pci_data) << 14; | 467 | pvt->remaplimit = ((u32) pci_data) << 14; |
461 | printk("tolm = %x, remapbase = %x, remaplimit = %x\n", pvt->tolm, | 468 | e7xxx_printk(KERN_INFO, |
462 | pvt->remapbase, pvt->remaplimit); | 469 | "tolm = %x, remapbase = %x, remaplimit = %x\n", |
470 | pvt->tolm, pvt->remapbase, pvt->remaplimit); | ||
463 | 471 | ||
464 | /* clear any pending errors, or initial state bits */ | 472 | /* clear any pending errors, or initial state bits */ |
465 | pci_write_bits8(pvt->bridge_ck, E7XXX_DRAM_FERR, 0x03, 0x03); | 473 | pci_write_bits8(pvt->bridge_ck, E7XXX_DRAM_FERR, 0x03, 0x03); |
466 | pci_write_bits8(pvt->bridge_ck, E7XXX_DRAM_NERR, 0x03, 0x03); | 474 | pci_write_bits8(pvt->bridge_ck, E7XXX_DRAM_NERR, 0x03, 0x03); |
467 | 475 | ||
468 | if (edac_mc_add_mc(mci) != 0) { | 476 | if (edac_mc_add_mc(mci) != 0) { |
469 | debugf3("MC: " __FILE__ | 477 | debugf3("%s(): failed edac_mc_add_mc()\n", __func__); |
470 | ": %s(): failed edac_mc_add_mc()\n", | ||
471 | __func__); | ||
472 | goto fail; | 478 | goto fail; |
473 | } | 479 | } |
474 | 480 | ||
475 | /* get this far and it's successful */ | 481 | /* get this far and it's successful */ |
476 | debugf3("MC: " __FILE__ ": %s(): success\n", __func__); | 482 | debugf3("%s(): success\n", __func__); |
477 | return 0; | 483 | return 0; |
478 | 484 | ||
479 | fail: | 485 | fail: |
@@ -490,7 +496,7 @@ fail: | |||
490 | static int __devinit | 496 | static int __devinit |
491 | e7xxx_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | 497 | e7xxx_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
492 | { | 498 | { |
493 | debugf0("MC: " __FILE__ ": %s()\n", __func__); | 499 | debugf0("%s()\n", __func__); |
494 | 500 | ||
495 | /* wake up and enable device */ | 501 | /* wake up and enable device */ |
496 | return pci_enable_device(pdev) ? | 502 | return pci_enable_device(pdev) ? |
@@ -503,7 +509,7 @@ static void __devexit e7xxx_remove_one(struct pci_dev *pdev) | |||
503 | struct mem_ctl_info *mci; | 509 | struct mem_ctl_info *mci; |
504 | struct e7xxx_pvt *pvt; | 510 | struct e7xxx_pvt *pvt; |
505 | 511 | ||
506 | debugf0(__FILE__ ": %s()\n", __func__); | 512 | debugf0("%s()\n", __func__); |
507 | 513 | ||
508 | if (((mci = edac_mc_find_mci_by_pdev(pdev)) != 0) && | 514 | if (((mci = edac_mc_find_mci_by_pdev(pdev)) != 0) && |
509 | edac_mc_del_mc(mci)) { | 515 | edac_mc_del_mc(mci)) { |