aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/amd64_edac.c
diff options
context:
space:
mode:
authorBorislav Petkov <borislav.petkov@amd.com>2010-10-01 13:35:38 -0400
committerBorislav Petkov <borislav.petkov@amd.com>2011-01-07 05:33:53 -0500
commitb8cfa02f833a614e80f851747c4ce14989a4cfd0 (patch)
tree64e9b0dca377952e8671b4a61c47bfffc73e6235 /drivers/edac/amd64_edac.c
parentbbd0c1f675d7d64fc02393d4985a069be5037b54 (diff)
amd64_edac: Concentrate per-family init even more
Move the remaining per-family init code into the proper place and simplify the rest of the initialization. Reorganize error handling in amd64_init_one_instance(). Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Diffstat (limited to 'drivers/edac/amd64_edac.c')
-rw-r--r--drivers/edac/amd64_edac.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 437f5b67ab3c..0caea2b76659 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -2573,11 +2573,13 @@ static struct amd64_family_type *amd64_per_family_init(struct amd64_pvt *pvt)
2573 switch (fam) { 2573 switch (fam) {
2574 case 0xf: 2574 case 0xf:
2575 fam_type = &amd64_family_types[K8_CPUS]; 2575 fam_type = &amd64_family_types[K8_CPUS];
2576 pvt->ops = &amd64_family_types[K8_CPUS].ops;
2576 pvt->ctl_name = fam_type->ctl_name; 2577 pvt->ctl_name = fam_type->ctl_name;
2577 pvt->min_scrubrate = K8_MIN_SCRUB_RATE_BITS; 2578 pvt->min_scrubrate = K8_MIN_SCRUB_RATE_BITS;
2578 break; 2579 break;
2579 case 0x10: 2580 case 0x10:
2580 fam_type = &amd64_family_types[F10_CPUS]; 2581 fam_type = &amd64_family_types[F10_CPUS];
2582 pvt->ops = &amd64_family_types[F10_CPUS].ops;
2581 pvt->ctl_name = fam_type->ctl_name; 2583 pvt->ctl_name = fam_type->ctl_name;
2582 pvt->min_scrubrate = F10_MIN_SCRUB_RATE_BITS; 2584 pvt->min_scrubrate = F10_MIN_SCRUB_RATE_BITS;
2583 break; 2585 break;
@@ -2587,6 +2589,8 @@ static struct amd64_family_type *amd64_per_family_init(struct amd64_pvt *pvt)
2587 return NULL; 2589 return NULL;
2588 } 2590 }
2589 2591
2592 pvt->ext_model = boot_cpu_data.x86_model >> 4;
2593
2590 amd64_printk(KERN_INFO, "%s %s detected.\n", pvt->ctl_name, 2594 amd64_printk(KERN_INFO, "%s %s detected.\n", pvt->ctl_name,
2591 (fam == 0xf ? 2595 (fam == 0xf ?
2592 (pvt->ext_model >= K8_REV_F ? "revF or later" 2596 (pvt->ext_model >= K8_REV_F ? "revF or later"
@@ -2607,8 +2611,7 @@ static struct amd64_family_type *amd64_per_family_init(struct amd64_pvt *pvt)
2607 * later come back in a finish-setup function to perform that final 2611 * later come back in a finish-setup function to perform that final
2608 * initialization. See also amd64_init_2nd_stage() for that. 2612 * initialization. See also amd64_init_2nd_stage() for that.
2609 */ 2613 */
2610static int amd64_probe_one_instance(struct pci_dev *dram_f2_ctl, 2614static int amd64_probe_one_instance(struct pci_dev *dram_f2_ctl)
2611 int mc_type_index)
2612{ 2615{
2613 struct amd64_pvt *pvt = NULL; 2616 struct amd64_pvt *pvt = NULL;
2614 struct amd64_family_type *fam_type = NULL; 2617 struct amd64_family_type *fam_type = NULL;
@@ -2619,12 +2622,8 @@ static int amd64_probe_one_instance(struct pci_dev *dram_f2_ctl,
2619 if (!pvt) 2622 if (!pvt)
2620 goto err_exit; 2623 goto err_exit;
2621 2624
2622 pvt->mc_node_id = get_node_id(dram_f2_ctl); 2625 pvt->mc_node_id = get_node_id(dram_f2_ctl);
2623 2626 pvt->dram_f2_ctl = dram_f2_ctl;
2624 pvt->dram_f2_ctl = dram_f2_ctl;
2625 pvt->ext_model = boot_cpu_data.x86_model >> 4;
2626 pvt->mc_type_index = mc_type_index;
2627 pvt->ops = family_ops(mc_type_index);
2628 2627
2629 ret = -EINVAL; 2628 ret = -EINVAL;
2630 fam_type = amd64_per_family_init(pvt); 2629 fam_type = amd64_per_family_init(pvt);
@@ -2743,20 +2742,22 @@ err_exit:
2743 2742
2744 2743
2745static int __devinit amd64_init_one_instance(struct pci_dev *pdev, 2744static int __devinit amd64_init_one_instance(struct pci_dev *pdev,
2746 const struct pci_device_id *mc_type) 2745 const struct pci_device_id *mc_type)
2747{ 2746{
2748 int ret = 0; 2747 int ret = 0;
2749 2748
2750 debugf0("(MC node=%d)\n", get_node_id(pdev)); 2749 debugf0("(MC node=%d)\n", get_node_id(pdev));
2751 2750
2752 ret = pci_enable_device(pdev); 2751 ret = pci_enable_device(pdev);
2753 if (ret < 0) 2752 if (ret < 0) {
2754 ret = -EIO; 2753 debugf0("ret=%d\n", ret);
2755 else 2754 return -EIO;
2756 ret = amd64_probe_one_instance(pdev, mc_type->driver_data); 2755 }
2757 2756
2757 ret = amd64_probe_one_instance(pdev);
2758 if (ret < 0) 2758 if (ret < 0)
2759 debugf0("ret=%d\n", ret); 2759 amd64_printk(KERN_ERR, "Error probing instance: %d\n",
2760 get_node_id(pdev));
2760 2761
2761 return ret; 2762 return ret;
2762} 2763}
@@ -2805,7 +2806,6 @@ static const struct pci_device_id amd64_pci_table[] __devinitdata = {
2805 .subdevice = PCI_ANY_ID, 2806 .subdevice = PCI_ANY_ID,
2806 .class = 0, 2807 .class = 0,
2807 .class_mask = 0, 2808 .class_mask = 0,
2808 .driver_data = K8_CPUS
2809 }, 2809 },
2810 { 2810 {
2811 .vendor = PCI_VENDOR_ID_AMD, 2811 .vendor = PCI_VENDOR_ID_AMD,
@@ -2814,7 +2814,6 @@ static const struct pci_device_id amd64_pci_table[] __devinitdata = {
2814 .subdevice = PCI_ANY_ID, 2814 .subdevice = PCI_ANY_ID,
2815 .class = 0, 2815 .class = 0,
2816 .class_mask = 0, 2816 .class_mask = 0,
2817 .driver_data = F10_CPUS
2818 }, 2817 },
2819 {0, } 2818 {0, }
2820}; 2819};