1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /*
3  * Copyright (C) 2018-2022 Intel Corporation
4  */
5 #ifndef __iwl_dbg_tlv_h__
6 #define __iwl_dbg_tlv_h__
7 
8 #include <linux/device.h>
9 #include <linux/types.h>
10 #include <fw/file.h>
11 #include <fw/api/dbg-tlv.h>
12 
13 #define IWL_DBG_TLV_MAX_PRESET 15
14 
15 /**
16  * struct iwl_dbg_tlv_node - debug TLV node
17  * @list: list of &struct iwl_dbg_tlv_node
18  * @tlv: debug TLV
19  */
20 struct iwl_dbg_tlv_node {
21 	struct list_head list;
22 	struct iwl_ucode_tlv tlv;
23 };
24 
25 /**
26  * union iwl_dbg_tlv_tp_data - data that is given in a time point
27  * @fw_pkt: a packet received from the FW
28  */
29 union iwl_dbg_tlv_tp_data {
30 	struct iwl_rx_packet *fw_pkt;
31 };
32 
33 /**
34  * struct iwl_dbg_tlv_time_point_data
35  * @trig_list: list of triggers
36  * @active_trig_list: list of active triggers
37  * @hcmd_list: list of host commands
38  * @config_list: list of configuration
39  */
40 struct iwl_dbg_tlv_time_point_data {
41 	struct list_head trig_list;
42 	struct list_head active_trig_list;
43 	struct list_head hcmd_list;
44 	struct list_head config_list;
45 };
46 
47 struct iwl_trans;
48 struct iwl_fw_runtime;
49 
50 void iwl_dbg_tlv_load_bin(struct device *dev, struct iwl_trans *trans);
51 void iwl_dbg_tlv_free(struct iwl_trans *trans);
52 void iwl_dbg_tlv_alloc(struct iwl_trans *trans, const struct iwl_ucode_tlv *tlv,
53 		       bool ext);
54 void iwl_dbg_tlv_init(struct iwl_trans *trans);
55 void _iwl_dbg_tlv_time_point(struct iwl_fw_runtime *fwrt,
56 			     enum iwl_fw_ini_time_point tp_id,
57 			     union iwl_dbg_tlv_tp_data *tp_data,
58 			     bool sync);
59 
iwl_dbg_tlv_time_point(struct iwl_fw_runtime * fwrt,enum iwl_fw_ini_time_point tp_id,union iwl_dbg_tlv_tp_data * tp_data)60 static inline void iwl_dbg_tlv_time_point(struct iwl_fw_runtime *fwrt,
61 					  enum iwl_fw_ini_time_point tp_id,
62 					  union iwl_dbg_tlv_tp_data *tp_data)
63 {
64 	_iwl_dbg_tlv_time_point(fwrt, tp_id, tp_data, false);
65 }
66 
iwl_dbg_tlv_time_point_sync(struct iwl_fw_runtime * fwrt,enum iwl_fw_ini_time_point tp_id,union iwl_dbg_tlv_tp_data * tp_data)67 static inline void iwl_dbg_tlv_time_point_sync(struct iwl_fw_runtime *fwrt,
68 					       enum iwl_fw_ini_time_point tp_id,
69 					       union iwl_dbg_tlv_tp_data *tp_data)
70 {
71 	_iwl_dbg_tlv_time_point(fwrt, tp_id, tp_data, true);
72 }
73 
74 void iwl_dbg_tlv_del_timers(struct iwl_trans *trans);
75 
76 #endif /* __iwl_dbg_tlv_h__*/
77