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