diff options
Diffstat (limited to 'drivers/edac')
-rw-r--r-- | drivers/edac/i82875p_edac.c | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/drivers/edac/i82875p_edac.c b/drivers/edac/i82875p_edac.c index 485525e4e8e8..889ccf6ad85c 100644 --- a/drivers/edac/i82875p_edac.c +++ b/drivers/edac/i82875p_edac.c | |||
@@ -174,8 +174,7 @@ struct i82875p_error_info { | |||
174 | 174 | ||
175 | static const struct i82875p_dev_info i82875p_devs[] = { | 175 | static const struct i82875p_dev_info i82875p_devs[] = { |
176 | [I82875P] = { | 176 | [I82875P] = { |
177 | .ctl_name = "i82875p" | 177 | .ctl_name = "i82875p"}, |
178 | }, | ||
179 | }; | 178 | }; |
180 | 179 | ||
181 | static struct pci_dev *mci_pdev = NULL; /* init dev: in case that AGP code has | 180 | static struct pci_dev *mci_pdev = NULL; /* init dev: in case that AGP code has |
@@ -185,7 +184,7 @@ static struct pci_dev *mci_pdev = NULL; /* init dev: in case that AGP code has | |||
185 | static int i82875p_registered = 1; | 184 | static int i82875p_registered = 1; |
186 | 185 | ||
187 | static void i82875p_get_error_info(struct mem_ctl_info *mci, | 186 | static void i82875p_get_error_info(struct mem_ctl_info *mci, |
188 | struct i82875p_error_info *info) | 187 | struct i82875p_error_info *info) |
189 | { | 188 | { |
190 | struct pci_dev *pdev; | 189 | struct pci_dev *pdev; |
191 | 190 | ||
@@ -216,13 +215,13 @@ static void i82875p_get_error_info(struct mem_ctl_info *mci, | |||
216 | if ((info->errsts ^ info->errsts2) & 0x0081) { | 215 | if ((info->errsts ^ info->errsts2) & 0x0081) { |
217 | pci_read_config_dword(pdev, I82875P_EAP, &info->eap); | 216 | pci_read_config_dword(pdev, I82875P_EAP, &info->eap); |
218 | pci_read_config_byte(pdev, I82875P_DES, &info->des); | 217 | pci_read_config_byte(pdev, I82875P_DES, &info->des); |
219 | pci_read_config_byte(pdev, I82875P_DERRSYN, | 218 | pci_read_config_byte(pdev, I82875P_DERRSYN, &info->derrsyn); |
220 | &info->derrsyn); | ||
221 | } | 219 | } |
222 | } | 220 | } |
223 | 221 | ||
224 | static int i82875p_process_error_info(struct mem_ctl_info *mci, | 222 | static int i82875p_process_error_info(struct mem_ctl_info *mci, |
225 | struct i82875p_error_info *info, int handle_errors) | 223 | struct i82875p_error_info *info, |
224 | int handle_errors) | ||
226 | { | 225 | { |
227 | int row, multi_chan; | 226 | int row, multi_chan; |
228 | 227 | ||
@@ -246,8 +245,8 @@ static int i82875p_process_error_info(struct mem_ctl_info *mci, | |||
246 | edac_mc_handle_ue(mci, info->eap, 0, row, "i82875p UE"); | 245 | edac_mc_handle_ue(mci, info->eap, 0, row, "i82875p UE"); |
247 | else | 246 | else |
248 | edac_mc_handle_ce(mci, info->eap, 0, info->derrsyn, row, | 247 | edac_mc_handle_ce(mci, info->eap, 0, info->derrsyn, row, |
249 | multi_chan ? (info->des & 0x1) : 0, | 248 | multi_chan ? (info->des & 0x1) : 0, |
250 | "i82875p CE"); | 249 | "i82875p CE"); |
251 | 250 | ||
252 | return 1; | 251 | return 1; |
253 | } | 252 | } |
@@ -263,7 +262,8 @@ static void i82875p_check(struct mem_ctl_info *mci) | |||
263 | 262 | ||
264 | /* Return 0 on success or 1 on failure. */ | 263 | /* Return 0 on success or 1 on failure. */ |
265 | static int i82875p_setup_overfl_dev(struct pci_dev *pdev, | 264 | static int i82875p_setup_overfl_dev(struct pci_dev *pdev, |
266 | struct pci_dev **ovrfl_pdev, void __iomem **ovrfl_window) | 265 | struct pci_dev **ovrfl_pdev, |
266 | void __iomem ** ovrfl_window) | ||
267 | { | 267 | { |
268 | struct pci_dev *dev; | 268 | struct pci_dev *dev; |
269 | void __iomem *window; | 269 | void __iomem *window; |
@@ -284,7 +284,7 @@ static int i82875p_setup_overfl_dev(struct pci_dev *pdev, | |||
284 | if (dev == NULL) | 284 | if (dev == NULL) |
285 | return 1; | 285 | return 1; |
286 | 286 | ||
287 | pci_bus_add_device(dev); | 287 | pci_bus_add_device(dev); |
288 | } | 288 | } |
289 | 289 | ||
290 | *ovrfl_pdev = dev; | 290 | *ovrfl_pdev = dev; |
@@ -314,32 +314,31 @@ static int i82875p_setup_overfl_dev(struct pci_dev *pdev, | |||
314 | *ovrfl_window = window; | 314 | *ovrfl_window = window; |
315 | return 0; | 315 | return 0; |
316 | 316 | ||
317 | fail1: | 317 | fail1: |
318 | pci_release_regions(dev); | 318 | pci_release_regions(dev); |
319 | 319 | ||
320 | #ifdef CORRECT_BIOS | 320 | #ifdef CORRECT_BIOS |
321 | fail0: | 321 | fail0: |
322 | pci_disable_device(dev); | 322 | pci_disable_device(dev); |
323 | #endif | 323 | #endif |
324 | /* NOTE: the ovrfl proc entry and pci_dev are intentionally left */ | 324 | /* NOTE: the ovrfl proc entry and pci_dev are intentionally left */ |
325 | return 1; | 325 | return 1; |
326 | } | 326 | } |
327 | 327 | ||
328 | |||
329 | /* Return 1 if dual channel mode is active. Else return 0. */ | 328 | /* Return 1 if dual channel mode is active. Else return 0. */ |
330 | static inline int dual_channel_active(u32 drc) | 329 | static inline int dual_channel_active(u32 drc) |
331 | { | 330 | { |
332 | return (drc >> 21) & 0x1; | 331 | return (drc >> 21) & 0x1; |
333 | } | 332 | } |
334 | 333 | ||
335 | |||
336 | static void i82875p_init_csrows(struct mem_ctl_info *mci, | 334 | static void i82875p_init_csrows(struct mem_ctl_info *mci, |
337 | struct pci_dev *pdev, void __iomem *ovrfl_window, u32 drc) | 335 | struct pci_dev *pdev, |
336 | void __iomem * ovrfl_window, u32 drc) | ||
338 | { | 337 | { |
339 | struct csrow_info *csrow; | 338 | struct csrow_info *csrow; |
340 | unsigned long last_cumul_size; | 339 | unsigned long last_cumul_size; |
341 | u8 value; | 340 | u8 value; |
342 | u32 drc_ddim; /* DRAM Data Integrity Mode 0=none,2=edac */ | 341 | u32 drc_ddim; /* DRAM Data Integrity Mode 0=none,2=edac */ |
343 | u32 cumul_size; | 342 | u32 cumul_size; |
344 | int index; | 343 | int index; |
345 | 344 | ||
@@ -392,7 +391,7 @@ static int i82875p_probe1(struct pci_dev *pdev, int dev_idx) | |||
392 | drc = readl(ovrfl_window + I82875P_DRC); | 391 | drc = readl(ovrfl_window + I82875P_DRC); |
393 | nr_chans = dual_channel_active(drc) + 1; | 392 | nr_chans = dual_channel_active(drc) + 1; |
394 | mci = edac_mc_alloc(sizeof(*pvt), I82875P_NR_CSROWS(nr_chans), | 393 | mci = edac_mc_alloc(sizeof(*pvt), I82875P_NR_CSROWS(nr_chans), |
395 | nr_chans); | 394 | nr_chans); |
396 | 395 | ||
397 | if (!mci) { | 396 | if (!mci) { |
398 | rc = -ENOMEM; | 397 | rc = -ENOMEM; |
@@ -411,16 +410,16 @@ static int i82875p_probe1(struct pci_dev *pdev, int dev_idx) | |||
411 | mci->edac_check = i82875p_check; | 410 | mci->edac_check = i82875p_check; |
412 | mci->ctl_page_to_phys = NULL; | 411 | mci->ctl_page_to_phys = NULL; |
413 | debugf3("%s(): init pvt\n", __func__); | 412 | debugf3("%s(): init pvt\n", __func__); |
414 | pvt = (struct i82875p_pvt *) mci->pvt_info; | 413 | pvt = (struct i82875p_pvt *)mci->pvt_info; |
415 | pvt->ovrfl_pdev = ovrfl_pdev; | 414 | pvt->ovrfl_pdev = ovrfl_pdev; |
416 | pvt->ovrfl_window = ovrfl_window; | 415 | pvt->ovrfl_window = ovrfl_window; |
417 | i82875p_init_csrows(mci, pdev, ovrfl_window, drc); | 416 | i82875p_init_csrows(mci, pdev, ovrfl_window, drc); |
418 | i82875p_get_error_info(mci, &discard); /* clear counters */ | 417 | i82875p_get_error_info(mci, &discard); /* clear counters */ |
419 | 418 | ||
420 | /* Here we assume that we will never see multiple instances of this | 419 | /* Here we assume that we will never see multiple instances of this |
421 | * type of memory controller. The ID is therefore hardcoded to 0. | 420 | * type of memory controller. The ID is therefore hardcoded to 0. |
422 | */ | 421 | */ |
423 | if (edac_mc_add_mc(mci,0)) { | 422 | if (edac_mc_add_mc(mci, 0)) { |
424 | debugf3("%s(): failed edac_mc_add_mc()\n", __func__); | 423 | debugf3("%s(): failed edac_mc_add_mc()\n", __func__); |
425 | goto fail1; | 424 | goto fail1; |
426 | } | 425 | } |
@@ -429,10 +428,10 @@ static int i82875p_probe1(struct pci_dev *pdev, int dev_idx) | |||
429 | debugf3("%s(): success\n", __func__); | 428 | debugf3("%s(): success\n", __func__); |
430 | return 0; | 429 | return 0; |
431 | 430 | ||
432 | fail1: | 431 | fail1: |
433 | edac_mc_free(mci); | 432 | edac_mc_free(mci); |
434 | 433 | ||
435 | fail0: | 434 | fail0: |
436 | iounmap(ovrfl_window); | 435 | iounmap(ovrfl_window); |
437 | pci_release_regions(ovrfl_pdev); | 436 | pci_release_regions(ovrfl_pdev); |
438 | 437 | ||
@@ -443,7 +442,7 @@ fail0: | |||
443 | 442 | ||
444 | /* returns count (>= 0), or negative on error */ | 443 | /* returns count (>= 0), or negative on error */ |
445 | static int __devinit i82875p_init_one(struct pci_dev *pdev, | 444 | static int __devinit i82875p_init_one(struct pci_dev *pdev, |
446 | const struct pci_device_id *ent) | 445 | const struct pci_device_id *ent) |
447 | { | 446 | { |
448 | int rc; | 447 | int rc; |
449 | 448 | ||
@@ -471,7 +470,7 @@ static void __devexit i82875p_remove_one(struct pci_dev *pdev) | |||
471 | if ((mci = edac_mc_del_mc(&pdev->dev)) == NULL) | 470 | if ((mci = edac_mc_del_mc(&pdev->dev)) == NULL) |
472 | return; | 471 | return; |
473 | 472 | ||
474 | pvt = (struct i82875p_pvt *) mci->pvt_info; | 473 | pvt = (struct i82875p_pvt *)mci->pvt_info; |
475 | 474 | ||
476 | if (pvt->ovrfl_window) | 475 | if (pvt->ovrfl_window) |
477 | iounmap(pvt->ovrfl_window); | 476 | iounmap(pvt->ovrfl_window); |
@@ -489,12 +488,11 @@ static void __devexit i82875p_remove_one(struct pci_dev *pdev) | |||
489 | 488 | ||
490 | static const struct pci_device_id i82875p_pci_tbl[] __devinitdata = { | 489 | static const struct pci_device_id i82875p_pci_tbl[] __devinitdata = { |
491 | { | 490 | { |
492 | PCI_VEND_DEV(INTEL, 82875_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 491 | PCI_VEND_DEV(INTEL, 82875_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
493 | I82875P | 492 | I82875P}, |
494 | }, | ||
495 | { | 493 | { |
496 | 0, | 494 | 0, |
497 | } /* 0 terminated list. */ | 495 | } /* 0 terminated list. */ |
498 | }; | 496 | }; |
499 | 497 | ||
500 | MODULE_DEVICE_TABLE(pci, i82875p_pci_tbl); | 498 | MODULE_DEVICE_TABLE(pci, i82875p_pci_tbl); |
@@ -518,7 +516,7 @@ static int __init i82875p_init(void) | |||
518 | 516 | ||
519 | if (mci_pdev == NULL) { | 517 | if (mci_pdev == NULL) { |
520 | mci_pdev = pci_get_device(PCI_VENDOR_ID_INTEL, | 518 | mci_pdev = pci_get_device(PCI_VENDOR_ID_INTEL, |
521 | PCI_DEVICE_ID_INTEL_82875_0, NULL); | 519 | PCI_DEVICE_ID_INTEL_82875_0, NULL); |
522 | 520 | ||
523 | if (!mci_pdev) { | 521 | if (!mci_pdev) { |
524 | debugf0("875p pci_get_device fail\n"); | 522 | debugf0("875p pci_get_device fail\n"); |
@@ -537,10 +535,10 @@ static int __init i82875p_init(void) | |||
537 | 535 | ||
538 | return 0; | 536 | return 0; |
539 | 537 | ||
540 | fail1: | 538 | fail1: |
541 | pci_unregister_driver(&i82875p_driver); | 539 | pci_unregister_driver(&i82875p_driver); |
542 | 540 | ||
543 | fail0: | 541 | fail0: |
544 | if (mci_pdev != NULL) | 542 | if (mci_pdev != NULL) |
545 | pci_dev_put(mci_pdev); | 543 | pci_dev_put(mci_pdev); |
546 | 544 | ||