1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright(c) 2023 Intel Corporation */
3 
4 #ifndef ADF_RAS_H
5 #define ADF_RAS_H
6 
7 #include <linux/bitops.h>
8 #include <linux/atomic.h>
9 
10 struct adf_accel_dev;
11 
12 void adf_sysfs_start_ras(struct adf_accel_dev *accel_dev);
13 void adf_sysfs_stop_ras(struct adf_accel_dev *accel_dev);
14 
15 #define ADF_RAS_ERR_CTR_READ(ras_errors, ERR) \
16 	atomic_read(&(ras_errors).counter[ERR])
17 
18 #define ADF_RAS_ERR_CTR_CLEAR(ras_errors) \
19 	do { \
20 		for (int err = 0; err < ADF_RAS_ERRORS; ++err) \
21 			atomic_set(&(ras_errors).counter[err], 0); \
22 	} while (0)
23 
24 #define ADF_RAS_ERR_CTR_INC(ras_errors, ERR) \
25 	atomic_inc(&(ras_errors).counter[ERR])
26 
27 #endif /* ADF_RAS_H */
28