aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/edac/amd64_edac.c135
-rw-r--r--drivers/edac/amd76x_edac.c2
-rw-r--r--drivers/edac/e752x_edac.c6
-rw-r--r--drivers/edac/e7xxx_edac.c2
-rw-r--r--drivers/edac/edac_device.c3
-rw-r--r--drivers/edac/edac_mc_sysfs.c2
-rw-r--r--drivers/edac/i3000_edac.c2
-rw-r--r--drivers/edac/i3200_edac.c2
-rw-r--r--drivers/edac/i5000_edac.c2
-rw-r--r--drivers/edac/i5100_edac.c2
-rw-r--r--drivers/edac/i5400_edac.c2
-rw-r--r--drivers/edac/i7300_edac.c2
-rw-r--r--drivers/edac/i7core_edac.c2
-rw-r--r--drivers/edac/i82443bxgx_edac.c2
-rw-r--r--drivers/edac/i82860_edac.c2
-rw-r--r--drivers/edac/i82875p_edac.c2
-rw-r--r--drivers/edac/i82975x_edac.c2
-rw-r--r--drivers/edac/mpc85xx_edac.c98
-rw-r--r--drivers/edac/mpc85xx_edac.h7
-rw-r--r--drivers/edac/r82600_edac.c2
-rw-r--r--drivers/edac/sb_edac.c4
-rw-r--r--drivers/edac/x38_edac.c2
22 files changed, 181 insertions, 104 deletions
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index b53d0de17e15..98e14ee4833c 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -1,7 +1,7 @@
1#include "amd64_edac.h" 1#include "amd64_edac.h"
2#include <asm/amd_nb.h> 2#include <asm/amd_nb.h>
3 3
4static struct edac_pci_ctl_info *amd64_ctl_pci; 4static struct edac_pci_ctl_info *pci_ctl;
5 5
6static int report_gart_errors; 6static int report_gart_errors;
7module_param(report_gart_errors, int, 0644); 7module_param(report_gart_errors, int, 0644);
@@ -162,7 +162,7 @@ static int f15_read_dct_pci_cfg(struct amd64_pvt *pvt, int addr, u32 *val,
162 * scan the scrub rate mapping table for a close or matching bandwidth value to 162 * scan the scrub rate mapping table for a close or matching bandwidth value to
163 * issue. If requested is too big, then use last maximum value found. 163 * issue. If requested is too big, then use last maximum value found.
164 */ 164 */
165static int __amd64_set_scrub_rate(struct pci_dev *ctl, u32 new_bw, u32 min_rate) 165static int __set_scrub_rate(struct pci_dev *ctl, u32 new_bw, u32 min_rate)
166{ 166{
167 u32 scrubval; 167 u32 scrubval;
168 int i; 168 int i;
@@ -198,7 +198,7 @@ static int __amd64_set_scrub_rate(struct pci_dev *ctl, u32 new_bw, u32 min_rate)
198 return 0; 198 return 0;
199} 199}
200 200
201static int amd64_set_scrub_rate(struct mem_ctl_info *mci, u32 bw) 201static int set_scrub_rate(struct mem_ctl_info *mci, u32 bw)
202{ 202{
203 struct amd64_pvt *pvt = mci->pvt_info; 203 struct amd64_pvt *pvt = mci->pvt_info;
204 u32 min_scrubrate = 0x5; 204 u32 min_scrubrate = 0x5;
@@ -210,10 +210,10 @@ static int amd64_set_scrub_rate(struct mem_ctl_info *mci, u32 bw)
210 if (pvt->fam == 0x15 && pvt->model < 0x10) 210 if (pvt->fam == 0x15 && pvt->model < 0x10)
211 f15h_select_dct(pvt, 0); 211 f15h_select_dct(pvt, 0);
212 212
213 return __amd64_set_scrub_rate(pvt->F3, bw, min_scrubrate); 213 return __set_scrub_rate(pvt->F3, bw, min_scrubrate);
214} 214}
215 215
216static int amd64_get_scrub_rate(struct mem_ctl_info *mci) 216static int get_scrub_rate(struct mem_ctl_info *mci)
217{ 217{
218 struct amd64_pvt *pvt = mci->pvt_info; 218 struct amd64_pvt *pvt = mci->pvt_info;
219 u32 scrubval = 0; 219 u32 scrubval = 0;
@@ -240,8 +240,7 @@ static int amd64_get_scrub_rate(struct mem_ctl_info *mci)
240 * returns true if the SysAddr given by sys_addr matches the 240 * returns true if the SysAddr given by sys_addr matches the
241 * DRAM base/limit associated with node_id 241 * DRAM base/limit associated with node_id
242 */ 242 */
243static bool amd64_base_limit_match(struct amd64_pvt *pvt, u64 sys_addr, 243static bool base_limit_match(struct amd64_pvt *pvt, u64 sys_addr, u8 nid)
244 u8 nid)
245{ 244{
246 u64 addr; 245 u64 addr;
247 246
@@ -285,7 +284,7 @@ static struct mem_ctl_info *find_mc_by_sys_addr(struct mem_ctl_info *mci,
285 284
286 if (intlv_en == 0) { 285 if (intlv_en == 0) {
287 for (node_id = 0; node_id < DRAM_RANGES; node_id++) { 286 for (node_id = 0; node_id < DRAM_RANGES; node_id++) {
288 if (amd64_base_limit_match(pvt, sys_addr, node_id)) 287 if (base_limit_match(pvt, sys_addr, node_id))
289 goto found; 288 goto found;
290 } 289 }
291 goto err_no_match; 290 goto err_no_match;
@@ -309,7 +308,7 @@ static struct mem_ctl_info *find_mc_by_sys_addr(struct mem_ctl_info *mci,
309 } 308 }
310 309
311 /* sanity test for sys_addr */ 310 /* sanity test for sys_addr */
312 if (unlikely(!amd64_base_limit_match(pvt, sys_addr, node_id))) { 311 if (unlikely(!base_limit_match(pvt, sys_addr, node_id))) {
313 amd64_warn("%s: sys_addr 0x%llx falls outside base/limit address" 312 amd64_warn("%s: sys_addr 0x%llx falls outside base/limit address"
314 "range for node %d with node interleaving enabled.\n", 313 "range for node %d with node interleaving enabled.\n",
315 __func__, sys_addr, node_id); 314 __func__, sys_addr, node_id);
@@ -660,7 +659,7 @@ static int get_channel_from_ecc_syndrome(struct mem_ctl_info *, u16);
660 * Determine if the DIMMs have ECC enabled. ECC is enabled ONLY if all the DIMMs 659 * Determine if the DIMMs have ECC enabled. ECC is enabled ONLY if all the DIMMs
661 * are ECC capable. 660 * are ECC capable.
662 */ 661 */
663static unsigned long amd64_determine_edac_cap(struct amd64_pvt *pvt) 662static unsigned long determine_edac_cap(struct amd64_pvt *pvt)
664{ 663{
665 u8 bit; 664 u8 bit;
666 unsigned long edac_cap = EDAC_FLAG_NONE; 665 unsigned long edac_cap = EDAC_FLAG_NONE;
@@ -675,9 +674,9 @@ static unsigned long amd64_determine_edac_cap(struct amd64_pvt *pvt)
675 return edac_cap; 674 return edac_cap;
676} 675}
677 676
678static void amd64_debug_display_dimm_sizes(struct amd64_pvt *, u8); 677static void debug_display_dimm_sizes(struct amd64_pvt *, u8);
679 678
680static void amd64_dump_dramcfg_low(struct amd64_pvt *pvt, u32 dclr, int chan) 679static void debug_dump_dramcfg_low(struct amd64_pvt *pvt, u32 dclr, int chan)
681{ 680{
682 edac_dbg(1, "F2x%d90 (DRAM Cfg Low): 0x%08x\n", chan, dclr); 681 edac_dbg(1, "F2x%d90 (DRAM Cfg Low): 0x%08x\n", chan, dclr);
683 682
@@ -711,7 +710,7 @@ static void dump_misc_regs(struct amd64_pvt *pvt)
711 (pvt->nbcap & NBCAP_SECDED) ? "yes" : "no", 710 (pvt->nbcap & NBCAP_SECDED) ? "yes" : "no",
712 (pvt->nbcap & NBCAP_CHIPKILL) ? "yes" : "no"); 711 (pvt->nbcap & NBCAP_CHIPKILL) ? "yes" : "no");
713 712
714 amd64_dump_dramcfg_low(pvt, pvt->dclr0, 0); 713 debug_dump_dramcfg_low(pvt, pvt->dclr0, 0);
715 714
716 edac_dbg(1, "F3xB0 (Online Spare): 0x%08x\n", pvt->online_spare); 715 edac_dbg(1, "F3xB0 (Online Spare): 0x%08x\n", pvt->online_spare);
717 716
@@ -722,19 +721,19 @@ static void dump_misc_regs(struct amd64_pvt *pvt)
722 721
723 edac_dbg(1, " DramHoleValid: %s\n", dhar_valid(pvt) ? "yes" : "no"); 722 edac_dbg(1, " DramHoleValid: %s\n", dhar_valid(pvt) ? "yes" : "no");
724 723
725 amd64_debug_display_dimm_sizes(pvt, 0); 724 debug_display_dimm_sizes(pvt, 0);
726 725
727 /* everything below this point is Fam10h and above */ 726 /* everything below this point is Fam10h and above */
728 if (pvt->fam == 0xf) 727 if (pvt->fam == 0xf)
729 return; 728 return;
730 729
731 amd64_debug_display_dimm_sizes(pvt, 1); 730 debug_display_dimm_sizes(pvt, 1);
732 731
733 amd64_info("using %s syndromes.\n", ((pvt->ecc_sym_sz == 8) ? "x8" : "x4")); 732 amd64_info("using %s syndromes.\n", ((pvt->ecc_sym_sz == 8) ? "x8" : "x4"));
734 733
735 /* Only if NOT ganged does dclr1 have valid info */ 734 /* Only if NOT ganged does dclr1 have valid info */
736 if (!dct_ganging_enabled(pvt)) 735 if (!dct_ganging_enabled(pvt))
737 amd64_dump_dramcfg_low(pvt, pvt->dclr1, 1); 736 debug_dump_dramcfg_low(pvt, pvt->dclr1, 1);
738} 737}
739 738
740/* 739/*
@@ -800,7 +799,7 @@ static void read_dct_base_mask(struct amd64_pvt *pvt)
800 } 799 }
801} 800}
802 801
803static enum mem_type amd64_determine_memory_type(struct amd64_pvt *pvt, int cs) 802static enum mem_type determine_memory_type(struct amd64_pvt *pvt, int cs)
804{ 803{
805 enum mem_type type; 804 enum mem_type type;
806 805
@@ -1578,7 +1577,7 @@ static int f15_m30h_match_to_this_node(struct amd64_pvt *pvt, unsigned range,
1578 num_dcts_intlv, dct_sel); 1577 num_dcts_intlv, dct_sel);
1579 1578
1580 /* Verify we stay within the MAX number of channels allowed */ 1579 /* Verify we stay within the MAX number of channels allowed */
1581 if (channel > 4 || channel < 0) 1580 if (channel > 3)
1582 return -EINVAL; 1581 return -EINVAL;
1583 1582
1584 leg_mmio_hole = (u8) (dct_cont_base_reg >> 1 & BIT(0)); 1583 leg_mmio_hole = (u8) (dct_cont_base_reg >> 1 & BIT(0));
@@ -1702,7 +1701,7 @@ static void f1x_map_sysaddr_to_csrow(struct mem_ctl_info *mci, u64 sys_addr,
1702 * debug routine to display the memory sizes of all logical DIMMs and its 1701 * debug routine to display the memory sizes of all logical DIMMs and its
1703 * CSROWs 1702 * CSROWs
1704 */ 1703 */
1705static void amd64_debug_display_dimm_sizes(struct amd64_pvt *pvt, u8 ctrl) 1704static void debug_display_dimm_sizes(struct amd64_pvt *pvt, u8 ctrl)
1706{ 1705{
1707 int dimm, size0, size1; 1706 int dimm, size0, size1;
1708 u32 *dcsb = ctrl ? pvt->csels[1].csbases : pvt->csels[0].csbases; 1707 u32 *dcsb = ctrl ? pvt->csels[1].csbases : pvt->csels[0].csbases;
@@ -1744,7 +1743,7 @@ static void amd64_debug_display_dimm_sizes(struct amd64_pvt *pvt, u8 ctrl)
1744 } 1743 }
1745} 1744}
1746 1745
1747static struct amd64_family_type amd64_family_types[] = { 1746static struct amd64_family_type family_types[] = {
1748 [K8_CPUS] = { 1747 [K8_CPUS] = {
1749 .ctl_name = "K8", 1748 .ctl_name = "K8",
1750 .f1_id = PCI_DEVICE_ID_AMD_K8_NB_ADDRMAP, 1749 .f1_id = PCI_DEVICE_ID_AMD_K8_NB_ADDRMAP,
@@ -2005,9 +2004,9 @@ static void __log_bus_error(struct mem_ctl_info *mci, struct err_info *err,
2005 string, ""); 2004 string, "");
2006} 2005}
2007 2006
2008static inline void __amd64_decode_bus_error(struct mem_ctl_info *mci, 2007static inline void decode_bus_error(int node_id, struct mce *m)
2009 struct mce *m)
2010{ 2008{
2009 struct mem_ctl_info *mci = mcis[node_id];
2011 struct amd64_pvt *pvt = mci->pvt_info; 2010 struct amd64_pvt *pvt = mci->pvt_info;
2012 u8 ecc_type = (m->status >> 45) & 0x3; 2011 u8 ecc_type = (m->status >> 45) & 0x3;
2013 u8 xec = XEC(m->status, 0x1f); 2012 u8 xec = XEC(m->status, 0x1f);
@@ -2035,11 +2034,6 @@ static inline void __amd64_decode_bus_error(struct mem_ctl_info *mci,
2035 __log_bus_error(mci, &err, ecc_type); 2034 __log_bus_error(mci, &err, ecc_type);
2036} 2035}
2037 2036
2038void amd64_decode_bus_error(int node_id, struct mce *m)
2039{
2040 __amd64_decode_bus_error(mcis[node_id], m);
2041}
2042
2043/* 2037/*
2044 * Use pvt->F2 which contains the F2 CPU PCI device to get the related 2038 * Use pvt->F2 which contains the F2 CPU PCI device to get the related
2045 * F1 (AddrMap) and F3 (Misc) devices. Return negative value on error. 2039 * F1 (AddrMap) and F3 (Misc) devices. Return negative value on error.
@@ -2196,7 +2190,7 @@ static void read_mc_regs(struct amd64_pvt *pvt)
2196 * encompasses 2190 * encompasses
2197 * 2191 *
2198 */ 2192 */
2199static u32 amd64_csrow_nr_pages(struct amd64_pvt *pvt, u8 dct, int csrow_nr) 2193static u32 get_csrow_nr_pages(struct amd64_pvt *pvt, u8 dct, int csrow_nr)
2200{ 2194{
2201 u32 cs_mode, nr_pages; 2195 u32 cs_mode, nr_pages;
2202 u32 dbam = dct ? pvt->dbam1 : pvt->dbam0; 2196 u32 dbam = dct ? pvt->dbam1 : pvt->dbam0;
@@ -2263,19 +2257,19 @@ static int init_csrows(struct mem_ctl_info *mci)
2263 pvt->mc_node_id, i); 2257 pvt->mc_node_id, i);
2264 2258
2265 if (row_dct0) { 2259 if (row_dct0) {
2266 nr_pages = amd64_csrow_nr_pages(pvt, 0, i); 2260 nr_pages = get_csrow_nr_pages(pvt, 0, i);
2267 csrow->channels[0]->dimm->nr_pages = nr_pages; 2261 csrow->channels[0]->dimm->nr_pages = nr_pages;
2268 } 2262 }
2269 2263
2270 /* K8 has only one DCT */ 2264 /* K8 has only one DCT */
2271 if (pvt->fam != 0xf && row_dct1) { 2265 if (pvt->fam != 0xf && row_dct1) {
2272 int row_dct1_pages = amd64_csrow_nr_pages(pvt, 1, i); 2266 int row_dct1_pages = get_csrow_nr_pages(pvt, 1, i);
2273 2267
2274 csrow->channels[1]->dimm->nr_pages = row_dct1_pages; 2268 csrow->channels[1]->dimm->nr_pages = row_dct1_pages;
2275 nr_pages += row_dct1_pages; 2269 nr_pages += row_dct1_pages;
2276 } 2270 }
2277 2271
2278 mtype = amd64_determine_memory_type(pvt, i); 2272 mtype = determine_memory_type(pvt, i);
2279 2273
2280 edac_dbg(1, "Total csrow%d pages: %u\n", i, nr_pages); 2274 edac_dbg(1, "Total csrow%d pages: %u\n", i, nr_pages);
2281 2275
@@ -2309,7 +2303,7 @@ static void get_cpus_on_this_dct_cpumask(struct cpumask *mask, u16 nid)
2309} 2303}
2310 2304
2311/* check MCG_CTL on all the cpus on this node */ 2305/* check MCG_CTL on all the cpus on this node */
2312static bool amd64_nb_mce_bank_enabled_on_node(u16 nid) 2306static bool nb_mce_bank_enabled_on_node(u16 nid)
2313{ 2307{
2314 cpumask_var_t mask; 2308 cpumask_var_t mask;
2315 int cpu, nbe; 2309 int cpu, nbe;
@@ -2482,7 +2476,7 @@ static bool ecc_enabled(struct pci_dev *F3, u16 nid)
2482 ecc_en = !!(value & NBCFG_ECC_ENABLE); 2476 ecc_en = !!(value & NBCFG_ECC_ENABLE);
2483 amd64_info("DRAM ECC %s.\n", (ecc_en ? "enabled" : "disabled")); 2477 amd64_info("DRAM ECC %s.\n", (ecc_en ? "enabled" : "disabled"));
2484 2478
2485 nb_mce_en = amd64_nb_mce_bank_enabled_on_node(nid); 2479 nb_mce_en = nb_mce_bank_enabled_on_node(nid);
2486 if (!nb_mce_en) 2480 if (!nb_mce_en)
2487 amd64_notice("NB MCE bank disabled, set MSR " 2481 amd64_notice("NB MCE bank disabled, set MSR "
2488 "0x%08x[4] on node %d to enable.\n", 2482 "0x%08x[4] on node %d to enable.\n",
@@ -2537,7 +2531,7 @@ static void setup_mci_misc_attrs(struct mem_ctl_info *mci,
2537 if (pvt->nbcap & NBCAP_CHIPKILL) 2531 if (pvt->nbcap & NBCAP_CHIPKILL)
2538 mci->edac_ctl_cap |= EDAC_FLAG_S4ECD4ED; 2532 mci->edac_ctl_cap |= EDAC_FLAG_S4ECD4ED;
2539 2533
2540 mci->edac_cap = amd64_determine_edac_cap(pvt); 2534 mci->edac_cap = determine_edac_cap(pvt);
2541 mci->mod_name = EDAC_MOD_STR; 2535 mci->mod_name = EDAC_MOD_STR;
2542 mci->mod_ver = EDAC_AMD64_VERSION; 2536 mci->mod_ver = EDAC_AMD64_VERSION;
2543 mci->ctl_name = fam->ctl_name; 2537 mci->ctl_name = fam->ctl_name;
@@ -2545,14 +2539,14 @@ static void setup_mci_misc_attrs(struct mem_ctl_info *mci,
2545 mci->ctl_page_to_phys = NULL; 2539 mci->ctl_page_to_phys = NULL;
2546 2540
2547 /* memory scrubber interface */ 2541 /* memory scrubber interface */
2548 mci->set_sdram_scrub_rate = amd64_set_scrub_rate; 2542 mci->set_sdram_scrub_rate = set_scrub_rate;
2549 mci->get_sdram_scrub_rate = amd64_get_scrub_rate; 2543 mci->get_sdram_scrub_rate = get_scrub_rate;
2550} 2544}
2551 2545
2552/* 2546/*
2553 * returns a pointer to the family descriptor on success, NULL otherwise. 2547 * returns a pointer to the family descriptor on success, NULL otherwise.
2554 */ 2548 */
2555static struct amd64_family_type *amd64_per_family_init(struct amd64_pvt *pvt) 2549static struct amd64_family_type *per_family_init(struct amd64_pvt *pvt)
2556{ 2550{
2557 struct amd64_family_type *fam_type = NULL; 2551 struct amd64_family_type *fam_type = NULL;
2558 2552
@@ -2563,29 +2557,29 @@ static struct amd64_family_type *amd64_per_family_init(struct amd64_pvt *pvt)
2563 2557
2564 switch (pvt->fam) { 2558 switch (pvt->fam) {
2565 case 0xf: 2559 case 0xf:
2566 fam_type = &amd64_family_types[K8_CPUS]; 2560 fam_type = &family_types[K8_CPUS];
2567 pvt->ops = &amd64_family_types[K8_CPUS].ops; 2561 pvt->ops = &family_types[K8_CPUS].ops;
2568 break; 2562 break;
2569 2563
2570 case 0x10: 2564 case 0x10:
2571 fam_type = &amd64_family_types[F10_CPUS]; 2565 fam_type = &family_types[F10_CPUS];
2572 pvt->ops = &amd64_family_types[F10_CPUS].ops; 2566 pvt->ops = &family_types[F10_CPUS].ops;
2573 break; 2567 break;
2574 2568
2575 case 0x15: 2569 case 0x15:
2576 if (pvt->model == 0x30) { 2570 if (pvt->model == 0x30) {
2577 fam_type = &amd64_family_types[F15_M30H_CPUS]; 2571 fam_type = &family_types[F15_M30H_CPUS];
2578 pvt->ops = &amd64_family_types[F15_M30H_CPUS].ops; 2572 pvt->ops = &family_types[F15_M30H_CPUS].ops;
2579 break; 2573 break;
2580 } 2574 }
2581 2575
2582 fam_type = &amd64_family_types[F15_CPUS]; 2576 fam_type = &family_types[F15_CPUS];
2583 pvt->ops = &amd64_family_types[F15_CPUS].ops; 2577 pvt->ops = &family_types[F15_CPUS].ops;
2584 break; 2578 break;
2585 2579
2586 case 0x16: 2580 case 0x16:
2587 fam_type = &amd64_family_types[F16_CPUS]; 2581 fam_type = &family_types[F16_CPUS];
2588 pvt->ops = &amd64_family_types[F16_CPUS].ops; 2582 pvt->ops = &family_types[F16_CPUS].ops;
2589 break; 2583 break;
2590 2584
2591 default: 2585 default:
@@ -2601,7 +2595,7 @@ static struct amd64_family_type *amd64_per_family_init(struct amd64_pvt *pvt)
2601 return fam_type; 2595 return fam_type;
2602} 2596}
2603 2597
2604static int amd64_init_one_instance(struct pci_dev *F2) 2598static int init_one_instance(struct pci_dev *F2)
2605{ 2599{
2606 struct amd64_pvt *pvt = NULL; 2600 struct amd64_pvt *pvt = NULL;
2607 struct amd64_family_type *fam_type = NULL; 2601 struct amd64_family_type *fam_type = NULL;
@@ -2619,7 +2613,7 @@ static int amd64_init_one_instance(struct pci_dev *F2)
2619 pvt->F2 = F2; 2613 pvt->F2 = F2;
2620 2614
2621 ret = -EINVAL; 2615 ret = -EINVAL;
2622 fam_type = amd64_per_family_init(pvt); 2616 fam_type = per_family_init(pvt);
2623 if (!fam_type) 2617 if (!fam_type)
2624 goto err_free; 2618 goto err_free;
2625 2619
@@ -2680,7 +2674,7 @@ static int amd64_init_one_instance(struct pci_dev *F2)
2680 if (report_gart_errors) 2674 if (report_gart_errors)
2681 amd_report_gart_errors(true); 2675 amd_report_gart_errors(true);
2682 2676
2683 amd_register_ecc_decoder(amd64_decode_bus_error); 2677 amd_register_ecc_decoder(decode_bus_error);
2684 2678
2685 mcis[nid] = mci; 2679 mcis[nid] = mci;
2686 2680
@@ -2703,8 +2697,8 @@ err_ret:
2703 return ret; 2697 return ret;
2704} 2698}
2705 2699
2706static int amd64_probe_one_instance(struct pci_dev *pdev, 2700static int probe_one_instance(struct pci_dev *pdev,
2707 const struct pci_device_id *mc_type) 2701 const struct pci_device_id *mc_type)
2708{ 2702{
2709 u16 nid = amd_get_node_id(pdev); 2703 u16 nid = amd_get_node_id(pdev);
2710 struct pci_dev *F3 = node_to_amd_nb(nid)->misc; 2704 struct pci_dev *F3 = node_to_amd_nb(nid)->misc;
@@ -2736,7 +2730,7 @@ static int amd64_probe_one_instance(struct pci_dev *pdev,
2736 goto err_enable; 2730 goto err_enable;
2737 } 2731 }
2738 2732
2739 ret = amd64_init_one_instance(pdev); 2733 ret = init_one_instance(pdev);
2740 if (ret < 0) { 2734 if (ret < 0) {
2741 amd64_err("Error probing instance: %d\n", nid); 2735 amd64_err("Error probing instance: %d\n", nid);
2742 restore_ecc_error_reporting(s, nid, F3); 2736 restore_ecc_error_reporting(s, nid, F3);
@@ -2752,7 +2746,7 @@ err_out:
2752 return ret; 2746 return ret;
2753} 2747}
2754 2748
2755static void amd64_remove_one_instance(struct pci_dev *pdev) 2749static void remove_one_instance(struct pci_dev *pdev)
2756{ 2750{
2757 struct mem_ctl_info *mci; 2751 struct mem_ctl_info *mci;
2758 struct amd64_pvt *pvt; 2752 struct amd64_pvt *pvt;
@@ -2777,7 +2771,7 @@ static void amd64_remove_one_instance(struct pci_dev *pdev)
2777 2771
2778 /* unregister from EDAC MCE */ 2772 /* unregister from EDAC MCE */
2779 amd_report_gart_errors(false); 2773 amd_report_gart_errors(false);
2780 amd_unregister_ecc_decoder(amd64_decode_bus_error); 2774 amd_unregister_ecc_decoder(decode_bus_error);
2781 2775
2782 kfree(ecc_stngs[nid]); 2776 kfree(ecc_stngs[nid]);
2783 ecc_stngs[nid] = NULL; 2777 ecc_stngs[nid] = NULL;
@@ -2795,7 +2789,7 @@ static void amd64_remove_one_instance(struct pci_dev *pdev)
2795 * PCI core identifies what devices are on a system during boot, and then 2789 * PCI core identifies what devices are on a system during boot, and then
2796 * inquiry this table to see if this driver is for a given device found. 2790 * inquiry this table to see if this driver is for a given device found.
2797 */ 2791 */
2798static DEFINE_PCI_DEVICE_TABLE(amd64_pci_table) = { 2792static const struct pci_device_id amd64_pci_table[] = {
2799 { 2793 {
2800 .vendor = PCI_VENDOR_ID_AMD, 2794 .vendor = PCI_VENDOR_ID_AMD,
2801 .device = PCI_DEVICE_ID_AMD_K8_NB_MEMCTL, 2795 .device = PCI_DEVICE_ID_AMD_K8_NB_MEMCTL,
@@ -2843,8 +2837,8 @@ MODULE_DEVICE_TABLE(pci, amd64_pci_table);
2843 2837
2844static struct pci_driver amd64_pci_driver = { 2838static struct pci_driver amd64_pci_driver = {
2845 .name = EDAC_MOD_STR, 2839 .name = EDAC_MOD_STR,
2846 .probe = amd64_probe_one_instance, 2840 .probe = probe_one_instance,
2847 .remove = amd64_remove_one_instance, 2841 .remove = remove_one_instance,
2848 .id_table = amd64_pci_table, 2842 .id_table = amd64_pci_table,
2849}; 2843};
2850 2844
@@ -2853,23 +2847,18 @@ static void setup_pci_device(void)
2853 struct mem_ctl_info *mci; 2847 struct mem_ctl_info *mci;
2854 struct amd64_pvt *pvt; 2848 struct amd64_pvt *pvt;
2855 2849
2856 if (amd64_ctl_pci) 2850 if (pci_ctl)
2857 return; 2851 return;
2858 2852
2859 mci = mcis[0]; 2853 mci = mcis[0];
2860 if (mci) { 2854 if (!mci)
2861 2855 return;
2862 pvt = mci->pvt_info;
2863 amd64_ctl_pci =
2864 edac_pci_create_generic_ctl(&pvt->F2->dev, EDAC_MOD_STR);
2865
2866 if (!amd64_ctl_pci) {
2867 pr_warning("%s(): Unable to create PCI control\n",
2868 __func__);
2869 2856
2870 pr_warning("%s(): PCI error report via EDAC not set\n", 2857 pvt = mci->pvt_info;
2871 __func__); 2858 pci_ctl = edac_pci_create_generic_ctl(&pvt->F2->dev, EDAC_MOD_STR);
2872 } 2859 if (!pci_ctl) {
2860 pr_warn("%s(): Unable to create PCI control\n", __func__);
2861 pr_warn("%s(): PCI error report via EDAC not set\n", __func__);
2873 } 2862 }
2874} 2863}
2875 2864
@@ -2925,8 +2914,8 @@ err_ret:
2925 2914
2926static void __exit amd64_edac_exit(void) 2915static void __exit amd64_edac_exit(void)
2927{ 2916{
2928 if (amd64_ctl_pci) 2917 if (pci_ctl)
2929 edac_pci_release_generic_ctl(amd64_ctl_pci); 2918 edac_pci_release_generic_ctl(pci_ctl);
2930 2919
2931 pci_unregister_driver(&amd64_pci_driver); 2920 pci_unregister_driver(&amd64_pci_driver);
2932 2921
diff --git a/drivers/edac/amd76x_edac.c b/drivers/edac/amd76x_edac.c
index 96e3ee3460a5..3a501b530e11 100644
--- a/drivers/edac/amd76x_edac.c
+++ b/drivers/edac/amd76x_edac.c
@@ -333,7 +333,7 @@ static void amd76x_remove_one(struct pci_dev *pdev)
333 edac_mc_free(mci); 333 edac_mc_free(mci);
334} 334}
335 335
336static DEFINE_PCI_DEVICE_TABLE(amd76x_pci_tbl) = { 336static const struct pci_device_id amd76x_pci_tbl[] = {
337 { 337 {
338 PCI_VEND_DEV(AMD, FE_GATE_700C), PCI_ANY_ID, PCI_ANY_ID, 0, 0, 338 PCI_VEND_DEV(AMD, FE_GATE_700C), PCI_ANY_ID, PCI_ANY_ID, 0, 0,
339 AMD762}, 339 AMD762},
diff --git a/drivers/edac/e752x_edac.c b/drivers/edac/e752x_edac.c
index 644fec54681f..92d54fa65f93 100644
--- a/drivers/edac/e752x_edac.c
+++ b/drivers/edac/e752x_edac.c
@@ -1182,9 +1182,11 @@ static int e752x_get_devs(struct pci_dev *pdev, int dev_idx,
1182 pvt->bridge_ck = pci_get_device(PCI_VENDOR_ID_INTEL, 1182 pvt->bridge_ck = pci_get_device(PCI_VENDOR_ID_INTEL,
1183 pvt->dev_info->err_dev, pvt->bridge_ck); 1183 pvt->dev_info->err_dev, pvt->bridge_ck);
1184 1184
1185 if (pvt->bridge_ck == NULL) 1185 if (pvt->bridge_ck == NULL) {
1186 pvt->bridge_ck = pci_scan_single_device(pdev->bus, 1186 pvt->bridge_ck = pci_scan_single_device(pdev->bus,
1187 PCI_DEVFN(0, 1)); 1187 PCI_DEVFN(0, 1));
1188 pci_dev_get(pvt->bridge_ck);
1189 }
1188 1190
1189 if (pvt->bridge_ck == NULL) { 1191 if (pvt->bridge_ck == NULL) {
1190 e752x_printk(KERN_ERR, "error reporting device not found:" 1192 e752x_printk(KERN_ERR, "error reporting device not found:"
@@ -1421,7 +1423,7 @@ static void e752x_remove_one(struct pci_dev *pdev)
1421 edac_mc_free(mci); 1423 edac_mc_free(mci);
1422} 1424}
1423 1425
1424static DEFINE_PCI_DEVICE_TABLE(e752x_pci_tbl) = { 1426static const struct pci_device_id e752x_pci_tbl[] = {
1425 { 1427 {
1426 PCI_VEND_DEV(INTEL, 7520_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1428 PCI_VEND_DEV(INTEL, 7520_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0,
1427 E7520}, 1429 E7520},
diff --git a/drivers/edac/e7xxx_edac.c b/drivers/edac/e7xxx_edac.c
index 1c4056a50383..3cda79bc8b00 100644
--- a/drivers/edac/e7xxx_edac.c
+++ b/drivers/edac/e7xxx_edac.c
@@ -555,7 +555,7 @@ static void e7xxx_remove_one(struct pci_dev *pdev)
555 edac_mc_free(mci); 555 edac_mc_free(mci);
556} 556}
557 557
558static DEFINE_PCI_DEVICE_TABLE(e7xxx_pci_tbl) = { 558static const struct pci_device_id e7xxx_pci_tbl[] = {
559 { 559 {
560 PCI_VEND_DEV(INTEL, 7205_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0, 560 PCI_VEND_DEV(INTEL, 7205_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0,
561 E7205}, 561 E7205},
diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c
index 102674346035..592af5f0cf39 100644
--- a/drivers/edac/edac_device.c
+++ b/drivers/edac/edac_device.c
@@ -437,6 +437,9 @@ void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev)
437{ 437{
438 int status; 438 int status;
439 439
440 if (!edac_dev->edac_check)
441 return;
442
440 status = cancel_delayed_work(&edac_dev->work); 443 status = cancel_delayed_work(&edac_dev->work);
441 if (status == 0) { 444 if (status == 0) {
442 /* workq instance might be running, wait for it */ 445 /* workq instance might be running, wait for it */
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
index 9f7e0e609516..51c0362acf5c 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -914,7 +914,7 @@ void __exit edac_debugfs_exit(void)
914 debugfs_remove(edac_debugfs); 914 debugfs_remove(edac_debugfs);
915} 915}
916 916
917int edac_create_debug_nodes(struct mem_ctl_info *mci) 917static int edac_create_debug_nodes(struct mem_ctl_info *mci)
918{ 918{
919 struct dentry *d, *parent; 919 struct dentry *d, *parent;
920 char name[80]; 920 char name[80];
diff --git a/drivers/edac/i3000_edac.c b/drivers/edac/i3000_edac.c
index 694efcbf19c0..cd28b968e5c7 100644
--- a/drivers/edac/i3000_edac.c
+++ b/drivers/edac/i3000_edac.c
@@ -487,7 +487,7 @@ static void i3000_remove_one(struct pci_dev *pdev)
487 edac_mc_free(mci); 487 edac_mc_free(mci);
488} 488}
489 489
490static DEFINE_PCI_DEVICE_TABLE(i3000_pci_tbl) = { 490static const struct pci_device_id i3000_pci_tbl[] = {
491 { 491 {
492 PCI_VEND_DEV(INTEL, 3000_HB), PCI_ANY_ID, PCI_ANY_ID, 0, 0, 492 PCI_VEND_DEV(INTEL, 3000_HB), PCI_ANY_ID, PCI_ANY_ID, 0, 0,
493 I3000}, 493 I3000},
diff --git a/drivers/edac/i3200_edac.c b/drivers/edac/i3200_edac.c
index be10a74b16ea..fa1326e5a4b0 100644
--- a/drivers/edac/i3200_edac.c
+++ b/drivers/edac/i3200_edac.c
@@ -466,7 +466,7 @@ static void i3200_remove_one(struct pci_dev *pdev)
466 edac_mc_free(mci); 466 edac_mc_free(mci);
467} 467}
468 468
469static DEFINE_PCI_DEVICE_TABLE(i3200_pci_tbl) = { 469static const struct pci_device_id i3200_pci_tbl[] = {
470 { 470 {
471 PCI_VEND_DEV(INTEL, 3200_HB), PCI_ANY_ID, PCI_ANY_ID, 0, 0, 471 PCI_VEND_DEV(INTEL, 3200_HB), PCI_ANY_ID, PCI_ANY_ID, 0, 0,
472 I3200}, 472 I3200},
diff --git a/drivers/edac/i5000_edac.c b/drivers/edac/i5000_edac.c
index 63b2194e8c20..72e07e3cf718 100644
--- a/drivers/edac/i5000_edac.c
+++ b/drivers/edac/i5000_edac.c
@@ -1530,7 +1530,7 @@ static void i5000_remove_one(struct pci_dev *pdev)
1530 * 1530 *
1531 * The "E500P" device is the first device supported. 1531 * The "E500P" device is the first device supported.
1532 */ 1532 */
1533static DEFINE_PCI_DEVICE_TABLE(i5000_pci_tbl) = { 1533static const struct pci_device_id i5000_pci_tbl[] = {
1534 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_I5000_DEV16), 1534 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_I5000_DEV16),
1535 .driver_data = I5000P}, 1535 .driver_data = I5000P},
1536 1536
diff --git a/drivers/edac/i5100_edac.c b/drivers/edac/i5100_edac.c
index 157b934e8ce3..36a38ee94fa8 100644
--- a/drivers/edac/i5100_edac.c
+++ b/drivers/edac/i5100_edac.c
@@ -1213,7 +1213,7 @@ static void i5100_remove_one(struct pci_dev *pdev)
1213 edac_mc_free(mci); 1213 edac_mc_free(mci);
1214} 1214}
1215 1215
1216static DEFINE_PCI_DEVICE_TABLE(i5100_pci_tbl) = { 1216static const struct pci_device_id i5100_pci_tbl[] = {
1217 /* Device 16, Function 0, Channel 0 Memory Map, Error Flag/Mask, ... */ 1217 /* Device 16, Function 0, Channel 0 Memory Map, Error Flag/Mask, ... */
1218 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5100_16) }, 1218 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5100_16) },
1219 { 0, } 1219 { 0, }
diff --git a/drivers/edac/i5400_edac.c b/drivers/edac/i5400_edac.c
index 0a05bbceb08f..e080cbfa8fc9 100644
--- a/drivers/edac/i5400_edac.c
+++ b/drivers/edac/i5400_edac.c
@@ -1416,7 +1416,7 @@ static void i5400_remove_one(struct pci_dev *pdev)
1416 * 1416 *
1417 * The "E500P" device is the first device supported. 1417 * The "E500P" device is the first device supported.
1418 */ 1418 */
1419static DEFINE_PCI_DEVICE_TABLE(i5400_pci_tbl) = { 1419static const struct pci_device_id i5400_pci_tbl[] = {
1420 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5400_ERR)}, 1420 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5400_ERR)},
1421 {0,} /* 0 terminated list. */ 1421 {0,} /* 0 terminated list. */
1422}; 1422};
diff --git a/drivers/edac/i7300_edac.c b/drivers/edac/i7300_edac.c
index 9004c64b169e..d63f4798f7d0 100644
--- a/drivers/edac/i7300_edac.c
+++ b/drivers/edac/i7300_edac.c
@@ -1160,7 +1160,7 @@ static void i7300_remove_one(struct pci_dev *pdev)
1160 * 1160 *
1161 * Has only 8086:360c PCI ID 1161 * Has only 8086:360c PCI ID
1162 */ 1162 */
1163static DEFINE_PCI_DEVICE_TABLE(i7300_pci_tbl) = { 1163static const struct pci_device_id i7300_pci_tbl[] = {
1164 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_I7300_MCH_ERR)}, 1164 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_I7300_MCH_ERR)},
1165 {0,} /* 0 terminated list. */ 1165 {0,} /* 0 terminated list. */
1166}; 1166};
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
index 80a963d64e58..87533ca7752e 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -394,7 +394,7 @@ static const struct pci_id_table pci_dev_table[] = {
394/* 394/*
395 * pci_device_id table for which devices we are looking for 395 * pci_device_id table for which devices we are looking for
396 */ 396 */
397static DEFINE_PCI_DEVICE_TABLE(i7core_pci_tbl) = { 397static const struct pci_device_id i7core_pci_tbl[] = {
398 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_X58_HUB_MGMT)}, 398 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_X58_HUB_MGMT)},
399 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_LYNNFIELD_QPI_LINK0)}, 399 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_LYNNFIELD_QPI_LINK0)},
400 {0,} /* 0 terminated list. */ 400 {0,} /* 0 terminated list. */
diff --git a/drivers/edac/i82443bxgx_edac.c b/drivers/edac/i82443bxgx_edac.c
index 57fdb77903ba..d730e276d1a8 100644
--- a/drivers/edac/i82443bxgx_edac.c
+++ b/drivers/edac/i82443bxgx_edac.c
@@ -386,7 +386,7 @@ static void i82443bxgx_edacmc_remove_one(struct pci_dev *pdev)
386 386
387EXPORT_SYMBOL_GPL(i82443bxgx_edacmc_remove_one); 387EXPORT_SYMBOL_GPL(i82443bxgx_edacmc_remove_one);
388 388
389static DEFINE_PCI_DEVICE_TABLE(i82443bxgx_pci_tbl) = { 389static const struct pci_device_id i82443bxgx_pci_tbl[] = {
390 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443BX_0)}, 390 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443BX_0)},
391 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443BX_2)}, 391 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443BX_2)},
392 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443GX_0)}, 392 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443GX_0)},
diff --git a/drivers/edac/i82860_edac.c b/drivers/edac/i82860_edac.c
index 3e3e431c8301..3382f6344e42 100644
--- a/drivers/edac/i82860_edac.c
+++ b/drivers/edac/i82860_edac.c
@@ -288,7 +288,7 @@ static void i82860_remove_one(struct pci_dev *pdev)
288 edac_mc_free(mci); 288 edac_mc_free(mci);
289} 289}
290 290
291static DEFINE_PCI_DEVICE_TABLE(i82860_pci_tbl) = { 291static const struct pci_device_id i82860_pci_tbl[] = {
292 { 292 {
293 PCI_VEND_DEV(INTEL, 82860_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0, 293 PCI_VEND_DEV(INTEL, 82860_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0,
294 I82860}, 294 I82860},
diff --git a/drivers/edac/i82875p_edac.c b/drivers/edac/i82875p_edac.c
index 2f8535fc451e..80573df0a4d7 100644
--- a/drivers/edac/i82875p_edac.c
+++ b/drivers/edac/i82875p_edac.c
@@ -527,7 +527,7 @@ static void i82875p_remove_one(struct pci_dev *pdev)
527 edac_mc_free(mci); 527 edac_mc_free(mci);
528} 528}
529 529
530static DEFINE_PCI_DEVICE_TABLE(i82875p_pci_tbl) = { 530static const struct pci_device_id i82875p_pci_tbl[] = {
531 { 531 {
532 PCI_VEND_DEV(INTEL, 82875_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0, 532 PCI_VEND_DEV(INTEL, 82875_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0,
533 I82875P}, 533 I82875P},
diff --git a/drivers/edac/i82975x_edac.c b/drivers/edac/i82975x_edac.c
index 0c8d4b0eaa32..10b10521f62e 100644
--- a/drivers/edac/i82975x_edac.c
+++ b/drivers/edac/i82975x_edac.c
@@ -628,7 +628,7 @@ static void i82975x_remove_one(struct pci_dev *pdev)
628 edac_mc_free(mci); 628 edac_mc_free(mci);
629} 629}
630 630
631static DEFINE_PCI_DEVICE_TABLE(i82975x_pci_tbl) = { 631static const struct pci_device_id i82975x_pci_tbl[] = {
632 { 632 {
633 PCI_VEND_DEV(INTEL, 82975_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0, 633 PCI_VEND_DEV(INTEL, 82975_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0,
634 I82975X 634 I82975X
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index fd46b0bd5f2a..8f9182179a7c 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -1,6 +1,8 @@
1/* 1/*
2 * Freescale MPC85xx Memory Controller kenel module 2 * Freescale MPC85xx Memory Controller kenel module
3 * 3 *
4 * Parts Copyrighted (c) 2013 by Freescale Semiconductor, Inc.
5 *
4 * Author: Dave Jiang <djiang@mvista.com> 6 * Author: Dave Jiang <djiang@mvista.com>
5 * 7 *
6 * 2006-2007 (c) MontaVista Software, Inc. This file is licensed under 8 * 2006-2007 (c) MontaVista Software, Inc. This file is licensed under
@@ -196,6 +198,42 @@ static void mpc85xx_pci_check(struct edac_pci_ctl_info *pci)
196 edac_pci_handle_npe(pci, pci->ctl_name); 198 edac_pci_handle_npe(pci, pci->ctl_name);
197} 199}
198 200
201static void mpc85xx_pcie_check(struct edac_pci_ctl_info *pci)
202{
203 struct mpc85xx_pci_pdata *pdata = pci->pvt_info;
204 u32 err_detect;
205
206 err_detect = in_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_DR);
207
208 pr_err("PCIe error(s) detected\n");
209 pr_err("PCIe ERR_DR register: 0x%08x\n", err_detect);
210 pr_err("PCIe ERR_CAP_STAT register: 0x%08x\n",
211 in_be32(pdata->pci_vbase + MPC85XX_PCI_GAS_TIMR));
212 pr_err("PCIe ERR_CAP_R0 register: 0x%08x\n",
213 in_be32(pdata->pci_vbase + MPC85XX_PCIE_ERR_CAP_R0));
214 pr_err("PCIe ERR_CAP_R1 register: 0x%08x\n",
215 in_be32(pdata->pci_vbase + MPC85XX_PCIE_ERR_CAP_R1));
216 pr_err("PCIe ERR_CAP_R2 register: 0x%08x\n",
217 in_be32(pdata->pci_vbase + MPC85XX_PCIE_ERR_CAP_R2));
218 pr_err("PCIe ERR_CAP_R3 register: 0x%08x\n",
219 in_be32(pdata->pci_vbase + MPC85XX_PCIE_ERR_CAP_R3));
220
221 /* clear error bits */
222 out_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_DR, err_detect);
223}
224
225static int mpc85xx_pcie_find_capability(struct device_node *np)
226{
227 struct pci_controller *hose;
228
229 if (!np)
230 return -EINVAL;
231
232 hose = pci_find_hose_for_OF_device(np);
233
234 return early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP);
235}
236
199static irqreturn_t mpc85xx_pci_isr(int irq, void *dev_id) 237static irqreturn_t mpc85xx_pci_isr(int irq, void *dev_id)
200{ 238{
201 struct edac_pci_ctl_info *pci = dev_id; 239 struct edac_pci_ctl_info *pci = dev_id;
@@ -207,7 +245,10 @@ static irqreturn_t mpc85xx_pci_isr(int irq, void *dev_id)
207 if (!err_detect) 245 if (!err_detect)
208 return IRQ_NONE; 246 return IRQ_NONE;
209 247
210 mpc85xx_pci_check(pci); 248 if (pdata->is_pcie)
249 mpc85xx_pcie_check(pci);
250 else
251 mpc85xx_pci_check(pci);
211 252
212 return IRQ_HANDLED; 253 return IRQ_HANDLED;
213} 254}
@@ -239,14 +280,22 @@ int mpc85xx_pci_err_probe(struct platform_device *op)
239 pdata = pci->pvt_info; 280 pdata = pci->pvt_info;
240 pdata->name = "mpc85xx_pci_err"; 281 pdata->name = "mpc85xx_pci_err";
241 pdata->irq = NO_IRQ; 282 pdata->irq = NO_IRQ;
283
284 if (mpc85xx_pcie_find_capability(op->dev.of_node) > 0)
285 pdata->is_pcie = true;
286
242 dev_set_drvdata(&op->dev, pci); 287 dev_set_drvdata(&op->dev, pci);
243 pci->dev = &op->dev; 288 pci->dev = &op->dev;
244 pci->mod_name = EDAC_MOD_STR; 289 pci->mod_name = EDAC_MOD_STR;
245 pci->ctl_name = pdata->name; 290 pci->ctl_name = pdata->name;
246 pci->dev_name = dev_name(&op->dev); 291 pci->dev_name = dev_name(&op->dev);
247 292
248 if (edac_op_state == EDAC_OPSTATE_POLL) 293 if (edac_op_state == EDAC_OPSTATE_POLL) {
249 pci->edac_check = mpc85xx_pci_check; 294 if (pdata->is_pcie)
295 pci->edac_check = mpc85xx_pcie_check;
296 else
297 pci->edac_check = mpc85xx_pci_check;
298 }
250 299
251 pdata->edac_idx = edac_pci_idx++; 300 pdata->edac_idx = edac_pci_idx++;
252 301
@@ -275,16 +324,26 @@ int mpc85xx_pci_err_probe(struct platform_device *op)
275 goto err; 324 goto err;
276 } 325 }
277 326
278 orig_pci_err_cap_dr = 327 if (pdata->is_pcie) {
279 in_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_CAP_DR); 328 orig_pci_err_cap_dr =
329 in_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_ADDR);
330 out_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_ADDR, ~0);
331 orig_pci_err_en =
332 in_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_EN);
333 out_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_EN, 0);
334 } else {
335 orig_pci_err_cap_dr =
336 in_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_CAP_DR);
280 337
281 /* PCI master abort is expected during config cycles */ 338 /* PCI master abort is expected during config cycles */
282 out_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_CAP_DR, 0x40); 339 out_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_CAP_DR, 0x40);
283 340
284 orig_pci_err_en = in_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_EN); 341 orig_pci_err_en =
342 in_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_EN);
285 343
286 /* disable master abort reporting */ 344 /* disable master abort reporting */
287 out_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_EN, ~0x40); 345 out_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_EN, ~0x40);
346 }
288 347
289 /* clear error bits */ 348 /* clear error bits */
290 out_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_DR, ~0); 349 out_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_DR, ~0);
@@ -297,7 +356,8 @@ int mpc85xx_pci_err_probe(struct platform_device *op)
297 if (edac_op_state == EDAC_OPSTATE_INT) { 356 if (edac_op_state == EDAC_OPSTATE_INT) {
298 pdata->irq = irq_of_parse_and_map(op->dev.of_node, 0); 357 pdata->irq = irq_of_parse_and_map(op->dev.of_node, 0);
299 res = devm_request_irq(&op->dev, pdata->irq, 358 res = devm_request_irq(&op->dev, pdata->irq,
300 mpc85xx_pci_isr, IRQF_DISABLED, 359 mpc85xx_pci_isr,
360 IRQF_DISABLED | IRQF_SHARED,
301 "[EDAC] PCI err", pci); 361 "[EDAC] PCI err", pci);
302 if (res < 0) { 362 if (res < 0) {
303 printk(KERN_ERR 363 printk(KERN_ERR
@@ -312,6 +372,22 @@ int mpc85xx_pci_err_probe(struct platform_device *op)
312 pdata->irq); 372 pdata->irq);
313 } 373 }
314 374
375 if (pdata->is_pcie) {
376 /*
377 * Enable all PCIe error interrupt & error detect except invalid
378 * PEX_CONFIG_ADDR/PEX_CONFIG_DATA access interrupt generation
379 * enable bit and invalid PEX_CONFIG_ADDR/PEX_CONFIG_DATA access
380 * detection enable bit. Because PCIe bus code to initialize and
381 * configure these PCIe devices on booting will use some invalid
382 * PEX_CONFIG_ADDR/PEX_CONFIG_DATA, edac driver prints the much
383 * notice information. So disable this detect to fix ugly print.
384 */
385 out_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_EN, ~0
386 & ~PEX_ERR_ICCAIE_EN_BIT);
387 out_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_ADDR, 0
388 | PEX_ERR_ICCAD_DISR_BIT);
389 }
390
315 devres_remove_group(&op->dev, mpc85xx_pci_err_probe); 391 devres_remove_group(&op->dev, mpc85xx_pci_err_probe);
316 edac_dbg(3, "success\n"); 392 edac_dbg(3, "success\n");
317 printk(KERN_INFO EDAC_MOD_STR " PCI err registered\n"); 393 printk(KERN_INFO EDAC_MOD_STR " PCI err registered\n");
diff --git a/drivers/edac/mpc85xx_edac.h b/drivers/edac/mpc85xx_edac.h
index 932016f2cf06..8c6256436227 100644
--- a/drivers/edac/mpc85xx_edac.h
+++ b/drivers/edac/mpc85xx_edac.h
@@ -134,13 +134,19 @@
134#define MPC85XX_PCI_ERR_DR 0x0000 134#define MPC85XX_PCI_ERR_DR 0x0000
135#define MPC85XX_PCI_ERR_CAP_DR 0x0004 135#define MPC85XX_PCI_ERR_CAP_DR 0x0004
136#define MPC85XX_PCI_ERR_EN 0x0008 136#define MPC85XX_PCI_ERR_EN 0x0008
137#define PEX_ERR_ICCAIE_EN_BIT 0x00020000
137#define MPC85XX_PCI_ERR_ATTRIB 0x000c 138#define MPC85XX_PCI_ERR_ATTRIB 0x000c
138#define MPC85XX_PCI_ERR_ADDR 0x0010 139#define MPC85XX_PCI_ERR_ADDR 0x0010
140#define PEX_ERR_ICCAD_DISR_BIT 0x00020000
139#define MPC85XX_PCI_ERR_EXT_ADDR 0x0014 141#define MPC85XX_PCI_ERR_EXT_ADDR 0x0014
140#define MPC85XX_PCI_ERR_DL 0x0018 142#define MPC85XX_PCI_ERR_DL 0x0018
141#define MPC85XX_PCI_ERR_DH 0x001c 143#define MPC85XX_PCI_ERR_DH 0x001c
142#define MPC85XX_PCI_GAS_TIMR 0x0020 144#define MPC85XX_PCI_GAS_TIMR 0x0020
143#define MPC85XX_PCI_PCIX_TIMR 0x0024 145#define MPC85XX_PCI_PCIX_TIMR 0x0024
146#define MPC85XX_PCIE_ERR_CAP_R0 0x0028
147#define MPC85XX_PCIE_ERR_CAP_R1 0x002c
148#define MPC85XX_PCIE_ERR_CAP_R2 0x0030
149#define MPC85XX_PCIE_ERR_CAP_R3 0x0034
144 150
145struct mpc85xx_mc_pdata { 151struct mpc85xx_mc_pdata {
146 char *name; 152 char *name;
@@ -158,6 +164,7 @@ struct mpc85xx_l2_pdata {
158 164
159struct mpc85xx_pci_pdata { 165struct mpc85xx_pci_pdata {
160 char *name; 166 char *name;
167 bool is_pcie;
161 int edac_idx; 168 int edac_idx;
162 void __iomem *pci_vbase; 169 void __iomem *pci_vbase;
163 int irq; 170 int irq;
diff --git a/drivers/edac/r82600_edac.c b/drivers/edac/r82600_edac.c
index 2fd6a5490905..8f936bc7a010 100644
--- a/drivers/edac/r82600_edac.c
+++ b/drivers/edac/r82600_edac.c
@@ -383,7 +383,7 @@ static void r82600_remove_one(struct pci_dev *pdev)
383 edac_mc_free(mci); 383 edac_mc_free(mci);
384} 384}
385 385
386static DEFINE_PCI_DEVICE_TABLE(r82600_pci_tbl) = { 386static const struct pci_device_id r82600_pci_tbl[] = {
387 { 387 {
388 PCI_DEVICE(PCI_VENDOR_ID_RADISYS, R82600_BRIDGE_ID) 388 PCI_DEVICE(PCI_VENDOR_ID_RADISYS, R82600_BRIDGE_ID)
389 }, 389 },
diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
index d7f1b57bd3be..de988c8da1c8 100644
--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -461,7 +461,7 @@ static const struct pci_id_table pci_dev_descr_ibridge_table[] = {
461/* 461/*
462 * pci_device_id table for which devices we are looking for 462 * pci_device_id table for which devices we are looking for
463 */ 463 */
464static DEFINE_PCI_DEVICE_TABLE(sbridge_pci_tbl) = { 464static const struct pci_device_id sbridge_pci_tbl[] = {
465 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TA)}, 465 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TA)},
466 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA0_TA)}, 466 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA0_TA)},
467 {0,} /* 0 terminated list. */ 467 {0,} /* 0 terminated list. */
@@ -915,7 +915,7 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
915 } 915 }
916} 916}
917 917
918struct mem_ctl_info *get_mci_for_node_id(u8 node_id) 918static struct mem_ctl_info *get_mci_for_node_id(u8 node_id)
919{ 919{
920 struct sbridge_dev *sbridge_dev; 920 struct sbridge_dev *sbridge_dev;
921 921
diff --git a/drivers/edac/x38_edac.c b/drivers/edac/x38_edac.c
index 1a4df82376ba..4891b450830b 100644
--- a/drivers/edac/x38_edac.c
+++ b/drivers/edac/x38_edac.c
@@ -448,7 +448,7 @@ static void x38_remove_one(struct pci_dev *pdev)
448 edac_mc_free(mci); 448 edac_mc_free(mci);
449} 449}
450 450
451static DEFINE_PCI_DEVICE_TABLE(x38_pci_tbl) = { 451static const struct pci_device_id x38_pci_tbl[] = {
452 { 452 {
453 PCI_VEND_DEV(INTEL, X38_HB), PCI_ANY_ID, PCI_ANY_ID, 0, 0, 453 PCI_VEND_DEV(INTEL, X38_HB), PCI_ANY_ID, PCI_ANY_ID, 0, 0,
454 X38}, 454 X38},