i82875p_edac: convert driver to use the new edac ABI

The legacy edac ABI is going to be removed. Port the driver to use
and benefit from the new API functionality.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Mauro Carvalho Chehab 2012-04-16 15:10:43 -03:00
parent 84c3a68408
commit 0a8a9ac9ca

View File

@ -38,7 +38,8 @@
#endif /* PCI_DEVICE_ID_INTEL_82875_6 */ #endif /* PCI_DEVICE_ID_INTEL_82875_6 */
/* four csrows in dual channel, eight in single channel */ /* four csrows in dual channel, eight in single channel */
#define I82875P_NR_CSROWS(nr_chans) (8/(nr_chans)) #define I82875P_NR_DIMMS 8
#define I82875P_NR_CSROWS(nr_chans) (I82875P_NR_DIMMS / (nr_chans))
/* Intel 82875p register addresses - device 0 function 0 - DRAM Controller */ /* Intel 82875p register addresses - device 0 function 0 - DRAM Controller */
#define I82875P_EAP 0x58 /* Error Address Pointer (32b) #define I82875P_EAP 0x58 /* Error Address Pointer (32b)
@ -235,7 +236,9 @@ static int i82875p_process_error_info(struct mem_ctl_info *mci,
return 1; return 1;
if ((info->errsts ^ info->errsts2) & 0x0081) { if ((info->errsts ^ info->errsts2) & 0x0081) {
edac_mc_handle_ce_no_info(mci, "UE overwrote CE"); edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, 0, 0, 0,
-1, -1, -1,
"UE overwrote CE", "", NULL);
info->errsts = info->errsts2; info->errsts = info->errsts2;
} }
@ -243,11 +246,15 @@ static int i82875p_process_error_info(struct mem_ctl_info *mci,
row = edac_mc_find_csrow_by_page(mci, info->eap); row = edac_mc_find_csrow_by_page(mci, info->eap);
if (info->errsts & 0x0080) if (info->errsts & 0x0080)
edac_mc_handle_ue(mci, info->eap, 0, row, "i82875p UE"); edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci,
info->eap, 0, 0,
row, -1, -1,
"i82875p UE", "", NULL);
else else
edac_mc_handle_ce(mci, info->eap, 0, info->derrsyn, row, edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci,
multi_chan ? (info->des & 0x1) : 0, info->eap, 0, info->derrsyn,
"i82875p CE"); row, multi_chan ? (info->des & 0x1) : 0,
-1, "i82875p CE", "", NULL);
return 1; return 1;
} }
@ -390,6 +397,7 @@ static int i82875p_probe1(struct pci_dev *pdev, int dev_idx)
{ {
int rc = -ENODEV; int rc = -ENODEV;
struct mem_ctl_info *mci; struct mem_ctl_info *mci;
struct edac_mc_layer layers[2];
struct i82875p_pvt *pvt; struct i82875p_pvt *pvt;
struct pci_dev *ovrfl_pdev; struct pci_dev *ovrfl_pdev;
void __iomem *ovrfl_window; void __iomem *ovrfl_window;
@ -405,9 +413,14 @@ static int i82875p_probe1(struct pci_dev *pdev, int dev_idx)
return -ENODEV; return -ENODEV;
drc = readl(ovrfl_window + I82875P_DRC); drc = readl(ovrfl_window + I82875P_DRC);
nr_chans = dual_channel_active(drc) + 1; nr_chans = dual_channel_active(drc) + 1;
mci = edac_mc_alloc(sizeof(*pvt), I82875P_NR_CSROWS(nr_chans),
nr_chans, 0);
layers[0].type = EDAC_MC_LAYER_CHIP_SELECT;
layers[0].size = I82875P_NR_CSROWS(nr_chans);
layers[0].is_virt_csrow = true;
layers[1].type = EDAC_MC_LAYER_CHANNEL;
layers[1].size = nr_chans;
layers[1].is_virt_csrow = false;
mci = new_edac_mc_alloc(0, ARRAY_SIZE(layers), layers, sizeof(*pvt));
if (!mci) { if (!mci) {
rc = -ENOMEM; rc = -ENOMEM;
goto fail0; goto fail0;