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  */
37 struct iwl_dbg_tlv_time_point_data {
38 	struct list_head trig_list;
39 	struct list_head active_trig_list;
40 	struct list_head hcmd_list;
41 };
42 
43 struct iwl_trans;
44 struct iwl_fw_runtime;
45 
46 void iwl_dbg_tlv_load_bin(struct device *dev, struct iwl_trans *trans);
47 void iwl_dbg_tlv_free(struct iwl_trans *trans);
48 void iwl_dbg_tlv_alloc(struct iwl_trans *trans, const struct iwl_ucode_tlv *tlv,
49 		       bool ext);
50 void iwl_dbg_tlv_init(struct iwl_trans *trans);
51 void _iwl_dbg_tlv_time_point(struct iwl_fw_runtime *fwrt,
52 			     enum iwl_fw_ini_time_point tp_id,
53 			     union iwl_dbg_tlv_tp_data *tp_data,
54 			     bool sync);
55 
56 static inline void iwl_dbg_tlv_time_point(struct iwl_fw_runtime *fwrt,
57 					  enum iwl_fw_ini_time_point tp_id,
58 					  union iwl_dbg_tlv_tp_data *tp_data)
59 {
60 	_iwl_dbg_tlv_time_point(fwrt, tp_id, tp_data, false);
61 }
62 
63 static inline void iwl_dbg_tlv_time_point_sync(struct iwl_fw_runtime *fwrt,
64 					       enum iwl_fw_ini_time_point tp_id,
65 					       union iwl_dbg_tlv_tp_data *tp_data)
66 {
67 	_iwl_dbg_tlv_time_point(fwrt, tp_id, tp_data, true);
68 }
69 
70 void iwl_dbg_tlv_del_timers(struct iwl_trans *trans);
71 
72 #endif /* __iwl_dbg_tlv_h__*/
73