dimm: Allow increasing internal ECC error counter, instead of setting
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Thu, 14 May 2015 15:42:12 +0000 (23:42 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Thu, 14 May 2015 15:42:12 +0000 (23:42 +0800)
sys/dev/misc/dimm/dimm.c
sys/dev/misc/dimm/dimm.h

index a661c72..874249e 100644 (file)
@@ -73,6 +73,8 @@ TAILQ_HEAD(dimm_softc_list, dimm_softc);
 #define DIMM_SENS_TF_ECC_CRIT          0x2
 
 static void    dimm_mod_unload(void);
+static void    dimm_sensor_ecc(struct dimm_softc *, struct ksensor *,
+                   boolean_t);
 
 /* In the ascending order of dimm_softc.dimm_id */
 static struct dimm_softc_list  dimm_softc_list;
@@ -257,9 +259,22 @@ void
 dimm_sensor_ecc_set(struct dimm_softc *sc, struct ksensor *sens,
     int ecc_cnt, boolean_t crit)
 {
-       enum sensor_status status;
-
        sc->dimm_ecc_cnt = ecc_cnt;
+       dimm_sensor_ecc(sc, sens, crit);
+}
+
+void
+dimm_sensor_ecc_add(struct dimm_softc *sc, struct ksensor *sens,
+    int ecc_cnt, boolean_t crit)
+{
+       sc->dimm_ecc_cnt += ecc_cnt;
+       dimm_sensor_ecc(sc, sens, crit);
+}
+
+static void
+dimm_sensor_ecc(struct dimm_softc *sc, struct ksensor *sens, boolean_t crit)
+{
+       enum sensor_status status;
 
        if (!crit && sc->dimm_ecc_cnt >= sc->dimm_ecc_thresh)
                crit = TRUE;
index 69166f2..aaa3834 100644 (file)
@@ -55,5 +55,8 @@ void                  dimm_sensor_temp(struct dimm_softc *_sc,
 void                   dimm_sensor_ecc_set(struct dimm_softc *_sc,
                            struct ksensor *_sens, int _ecc_cnt,
                            boolean_t _crit);
+void                   dimm_sensor_ecc_add(struct dimm_softc *_sc,
+                           struct ksensor *_sens, int _ecc_cnt,
+                           boolean_t _crit);
 
 #endif /* !_DEV_DIMM_H_ */