xref: /freebsd/sys/dev/qat/include/adf_fw_counters.h (revision ebacd8013fe5f7fdf9f6a5b286f6680dd2891036)
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* Copyright(c) 2007-2022 Intel Corporation */
3 /* $FreeBSD$ */
4 #ifndef ADF_FW_COUNTERS_H_
5 #define ADF_FW_COUNTERS_H_
6 
7 #include <linux/rwsem.h>
8 #include "adf_accel_devices.h"
9 
10 #define FW_COUNTERS_MAX_STR_LEN 64
11 #define FW_COUNTERS_MAX_KEY_LEN_IN_BYTES FW_COUNTERS_MAX_STR_LEN
12 #define FW_COUNTERS_MAX_VAL_LEN_IN_BYTES FW_COUNTERS_MAX_STR_LEN
13 #define FW_COUNTERS_MAX_SECTION_LEN_IN_BYTES FW_COUNTERS_MAX_STR_LEN
14 #define ADF_FW_COUNTERS_NO_RESPONSE -1
15 
16 struct adf_fw_counters_val {
17 	char key[FW_COUNTERS_MAX_KEY_LEN_IN_BYTES];
18 	char val[FW_COUNTERS_MAX_VAL_LEN_IN_BYTES];
19 	struct list_head list;
20 };
21 
22 struct adf_fw_counters_section {
23 	char name[FW_COUNTERS_MAX_SECTION_LEN_IN_BYTES];
24 	struct list_head list;
25 	struct list_head param_head;
26 };
27 
28 struct adf_fw_counters_data {
29 	struct list_head ae_sec_list;
30 	struct sysctl_oid *debug;
31 	struct rw_semaphore lock;
32 };
33 
34 int adf_fw_counters_add(struct adf_accel_dev *accel_dev);
35 void adf_fw_counters_remove(struct adf_accel_dev *accel_dev);
36 int adf_fw_count_ras_event(struct adf_accel_dev *accel_dev,
37 			   u32 *ras_event,
38 			   char *aeidstr);
39 
40 #endif /* ADF_FW_COUNTERS_H_ */
41