/* Actual values for this controller */
int maxch; /* Max channels */
int maxdimmperch; /* Max DIMMs per channel */
+
+ /* Hardware error reporting status */
+ bool enabled_error_reporting;
};
/* I5400 MCH error information retrieved from Hardware */
}
/*
- * i5400_enable_error_reporting
- * Turn on the memory reporting features of the hardware
+ * i5400_set_error_reporting
+ * Turn on/off the memory reporting features of the hardware
*/
-static void i5400_enable_error_reporting(struct mem_ctl_info *mci)
+static void i5400_set_error_reporting(struct mem_ctl_info *mci, bool enable)
{
struct i5400_pvt *pvt;
u32 fbd_error_mask;
pci_read_config_dword(pvt->branchmap_werrors, EMASK_FBD,
&fbd_error_mask);
- /* Enable with a '0' */
- fbd_error_mask &= ~(ENABLE_EMASK_ALL);
+ /* Enable with 0, disable with 1 */
+ if (enable)
+ fbd_error_mask &= ~(ENABLE_EMASK_ALL);
+ else
+ fbd_error_mask |= ENABLE_EMASK_ALL;
pci_write_config_dword(pvt->branchmap_werrors, EMASK_FBD,
fbd_error_mask);
if (i5400_init_dimms(mci)) {
edac_dbg(0, "MC: Setting mci->edac_cap to EDAC_FLAG_NONE because i5400_init_dimms() returned nonzero value\n");
mci->edac_cap = EDAC_FLAG_NONE; /* no dimms found */
+ pvt->enabled_error_reporting = false;
} else {
edac_dbg(1, "MC: Enable error reporting now\n");
- i5400_enable_error_reporting(mci);
+ i5400_set_error_reporting(mci, true);
+ pvt->enabled_error_reporting = true;
}
/* add this new MC control structure to EDAC's list of MCs */
if (edac_mc_add_mc(mci)) {
edac_dbg(0, "MC: failed edac_mc_add_mc()\n");
- /* FIXME: perhaps some code should go here that disables error
- * reporting if we just enabled it
- */
+ /* Disable error reporting if we just enabled it */
+ if (pvt->enabled_error_reporting)
+ i5400_set_error_reporting(mci, false);
goto fail1;
}
static void i5400_remove_one(struct pci_dev *pdev)
{
struct mem_ctl_info *mci;
+ struct i5400_pvt *pvt;
edac_dbg(0, "\n");
if (!mci)
return;
+ pvt = mci->pvt_info;
+
+ /* Disable error reporting on teardown */
+ if (pvt->enabled_error_reporting)
+ i5400_set_error_reporting(mci, false);
+
/* retrieve references to resources, and free those resources */
i5400_put_devices(mci);