xref: /freebsd/sys/dev/qat/qat_common/adf_freebsd_dbgfs.c (revision c38bafee7e182fbcdc3c346b2785ed258230cb06)
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* Copyright(c) 2007-2025 Intel Corporation */
3 
4 #include "adf_accel_devices.h"
5 #include "adf_cfg_dev_dbg.h"
6 #include "adf_cnvnr_freq_counters.h"
7 #include "adf_common_drv.h"
8 #include "adf_dbgfs.h"
9 #include "adf_fw_counters.h"
10 #include "adf_freebsd_pfvf_ctrs_dbg.h"
11 #include "adf_heartbeat_dbg.h"
12 #include "adf_ver_dbg.h"
13 
14 /**
15  * adf_dbgfs_init() - add persistent debugfs entries
16  * @accel_dev:  Pointer to acceleration device.
17  *
18  * This function creates debugfs entries that are persistent through a device
19  * state change (from up to down or vice versa).
20  */
21 void
adf_dbgfs_init(struct adf_accel_dev * accel_dev)22 adf_dbgfs_init(struct adf_accel_dev *accel_dev)
23 {
24 	adf_cfg_dev_dbg_add(accel_dev);
25 }
26 
27 /**
28  * adf_dbgfs_exit() - remove persistent debugfs entries
29  * @accel_dev:  Pointer to acceleration device.
30  */
31 void
adf_dbgfs_exit(struct adf_accel_dev * accel_dev)32 adf_dbgfs_exit(struct adf_accel_dev *accel_dev)
33 {
34 	adf_cfg_dev_dbg_remove(accel_dev);
35 }
36 
37 /**
38  * adf_dbgfs_add() - add non-persistent debugfs entries
39  * @accel_dev:  Pointer to acceleration device.
40  *
41  * This function creates debugfs entries that are not persistent through
42  * a device state change (from up to down or vice versa).
43  */
44 void
adf_dbgfs_add(struct adf_accel_dev * accel_dev)45 adf_dbgfs_add(struct adf_accel_dev *accel_dev)
46 {
47 	if (!accel_dev->is_vf) {
48 		adf_heartbeat_dbg_add(accel_dev);
49 		adf_ver_dbg_add(accel_dev);
50 		adf_fw_counters_add(accel_dev);
51 		adf_cnvnr_freq_counters_add(accel_dev);
52 	}
53 }
54 
55 /**
56  * adf_dbgfs_rm() - remove non-persistent debugfs entries
57  * @accel_dev:  Pointer to acceleration device.
58  */
59 void
adf_dbgfs_rm(struct adf_accel_dev * accel_dev)60 adf_dbgfs_rm(struct adf_accel_dev *accel_dev)
61 {
62 	if (!accel_dev->is_vf) {
63 		adf_cnvnr_freq_counters_remove(accel_dev);
64 		adf_fw_counters_remove(accel_dev);
65 		adf_ver_dbg_del(accel_dev);
66 		adf_heartbeat_dbg_del(accel_dev);
67 	}
68 }
69