History

misc: xilinx_sdfec: Add stats & status ioctls

SD-FEC statistic data are: - count of data interface errors (isr_err_count) - count of Correctable ECC errors (cecc_count) - count of Uncorrectable ECC errors (uecc_count) Add support: 1. clear stats ioctl callback which clears collected statistic data, 2. get stats ioctl callback which reads a collected statistic data, 3. set default configuration ioctl callback, 4. start ioctl callback enables SD-FEC HW, 5. stop ioctl callback disables SD-FEC HW. In a failed state driver enables the following ioctls: - get status - get statistics - clear stats - set default SD-FEC device configuration

Dragan Cvetic committed 7 years ago

Commit 6bd6a691 parent cc538f62 files · +200 −0Browse files

Showing the changes to include/uapi (1 of 2 files). Show all

Unified · Split

include/uapi/misc/xilinx_sdfec.h+75−0
@@ -233,6 +233,21 @@ struct xsdfec_config { · 232 unmodified lines
233233 __s8 code_wr_protect;
234234 };
235235
236+/**
237+ * struct xsdfec_stats - Stats retrived by ioctl XSDFEC_GET_STATS. Used
238+ * to buffer atomic_t variables from struct
239+ * xsdfec_dev. Counts are accumulated until
240+ * the user clears them.
241+ * @isr_err_count: Count of ISR errors
242+ * @cecc_count: Count of Correctable ECC errors (SBE)
243+ * @uecc_count: Count of Uncorrectable ECC errors (MBE)
244+ */
245+struct xsdfec_stats {
246+ __u32 isr_err_count;
247+ __u32 cecc_count;
248+ __u32 uecc_count;
249+};
250+
236251 /**
237252 * struct xsdfec_ldpc_param_table_sizes - Used to store sizes of SD-FEC table
238253 * entries for an individual LPDC code
@@ -251,6 +266,32 @@ struct xsdfec_ldpc_param_table_sizes { · 12 unmodified lines
251266 * XSDFEC IOCTL List
252267 */
253268 #define XSDFEC_MAGIC 'f'
269+/**
270+ * DOC: XSDFEC_START_DEV
271+ *
272+ * @Description
273+ *
274+ * ioctl to start SD-FEC core
275+ *
276+ * This fails if the XSDFEC_SET_ORDER ioctl has not been previously called
277+ */
278+#define XSDFEC_START_DEV _IO(XSDFEC_MAGIC, 0)
279+/**
280+ * DOC: XSDFEC_STOP_DEV
281+ *
282+ * @Description
283+ *
284+ * ioctl to stop the SD-FEC core
285+ */
286+#define XSDFEC_STOP_DEV _IO(XSDFEC_MAGIC, 1)
287+/**
288+ * DOC: XSDFEC_GET_STATUS
289+ *
290+ * @Description
291+ *
292+ * ioctl that returns status of SD-FEC core
293+ */
294+#define XSDFEC_GET_STATUS _IOR(XSDFEC_MAGIC, 2, struct xsdfec_status)
254295 /**
255296 * DOC: XSDFEC_SET_IRQ
256297 * @Parameters
@@ -370,4 +411,38 @@ struct xsdfec_ldpc_param_table_sizes { · 113 unmodified lines
370411 * ioctl that determines if SD-FEC is processing data
371412 */
372413 #define XSDFEC_IS_ACTIVE _IOR(XSDFEC_MAGIC, 10, bool)
414+/**
415+ * DOC: XSDFEC_CLEAR_STATS
416+ *
417+ * @Description
418+ *
419+ * ioctl that clears error stats collected during interrupts
420+ */
421+#define XSDFEC_CLEAR_STATS _IO(XSDFEC_MAGIC, 11)
422+/**
423+ * DOC: XSDFEC_GET_STATS
424+ * @Parameters
425+ *
426+ * @struct xsdfec_stats *
427+ * Pointer to the &struct xsdfec_stats that will contain the updated stats
428+ * values
429+ *
430+ * @Description
431+ *
432+ * ioctl that returns SD-FEC core stats
433+ *
434+ * This can only be used when the driver is in the XSDFEC_STOPPED state
435+ */
436+#define XSDFEC_GET_STATS _IOR(XSDFEC_MAGIC, 12, struct xsdfec_stats)
437+/**
438+ * DOC: XSDFEC_SET_DEFAULT_CONFIG
439+ *
440+ * @Description
441+ *
442+ * ioctl that returns SD-FEC core to default config, use after a reset
443+ *
444+ * This can only be used when the driver is in the XSDFEC_STOPPED state
445+ */
446+#define XSDFEC_SET_DEFAULT_CONFIG _IO(XSDFEC_MAGIC, 13)
447+
373448 #endif /* __XILINX_SDFEC_H__ */