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