xref: /openbmc/linux/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.h (revision b97d6790d03b763eca08847a9a5869a4291b9f9a)
18e99ea8dSJohannes Berg /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
28e99ea8dSJohannes Berg /*
3*bc425179SEmmanuel Grumbach  * Copyright (C) 2018-2023 Intel Corporation
48e99ea8dSJohannes Berg  */
5f14cda6fSSara Sharon #ifndef __iwl_dbg_tlv_h__
6f14cda6fSSara Sharon #define __iwl_dbg_tlv_h__
7f14cda6fSSara Sharon 
8f14cda6fSSara Sharon #include <linux/device.h>
9f14cda6fSSara Sharon #include <linux/types.h>
10d0129315SMordechay Goodstein #include <fw/file.h>
11d0129315SMordechay Goodstein #include <fw/api/dbg-tlv.h>
12f14cda6fSSara Sharon 
13b49c2b25SAyala Barazani #define IWL_DBG_TLV_MAX_PRESET	15
14*bc425179SEmmanuel Grumbach #define ENABLE_INI		(IWL_DBG_TLV_MAX_PRESET + 1)
15b49c2b25SAyala Barazani 
16f14cda6fSSara Sharon /**
17677d25b2SShahar S Matityahu  * struct iwl_dbg_tlv_node - debug TLV node
18677d25b2SShahar S Matityahu  * @list: list of &struct iwl_dbg_tlv_node
19677d25b2SShahar S Matityahu  * @tlv: debug TLV
20f14cda6fSSara Sharon  */
21677d25b2SShahar S Matityahu struct iwl_dbg_tlv_node {
2240b7d22dSShahar S Matityahu 	struct list_head list;
2340b7d22dSShahar S Matityahu 	struct iwl_ucode_tlv tlv;
24f14cda6fSSara Sharon };
25f14cda6fSSara Sharon 
26b108d8c7SShahar S Matityahu /**
27b108d8c7SShahar S Matityahu  * union iwl_dbg_tlv_tp_data - data that is given in a time point
28b108d8c7SShahar S Matityahu  * @fw_pkt: a packet received from the FW
29b108d8c7SShahar S Matityahu  */
30b108d8c7SShahar S Matityahu union iwl_dbg_tlv_tp_data {
31b108d8c7SShahar S Matityahu 	struct iwl_rx_packet *fw_pkt;
32b108d8c7SShahar S Matityahu };
33b108d8c7SShahar S Matityahu 
34a9248de4SShahar S Matityahu /**
35a9248de4SShahar S Matityahu  * struct iwl_dbg_tlv_time_point_data
36a9248de4SShahar S Matityahu  * @trig_list: list of triggers
37cf29c5b6SShahar S Matityahu  * @active_trig_list: list of active triggers
38a9248de4SShahar S Matityahu  * @hcmd_list: list of host commands
39f21baf24SMukesh Sisodiya  * @config_list: list of configuration
40a9248de4SShahar S Matityahu  */
41a9248de4SShahar S Matityahu struct iwl_dbg_tlv_time_point_data {
42a9248de4SShahar S Matityahu 	struct list_head trig_list;
43cf29c5b6SShahar S Matityahu 	struct list_head active_trig_list;
44a9248de4SShahar S Matityahu 	struct list_head hcmd_list;
45f21baf24SMukesh Sisodiya 	struct list_head config_list;
46a9248de4SShahar S Matityahu };
47a9248de4SShahar S Matityahu 
48f14cda6fSSara Sharon struct iwl_trans;
4900eacde4SShahar S Matityahu struct iwl_fw_runtime;
5000eacde4SShahar S Matityahu 
5141874d3aSShahar S Matityahu void iwl_dbg_tlv_load_bin(struct device *dev, struct iwl_trans *trans);
5241874d3aSShahar S Matityahu void iwl_dbg_tlv_free(struct iwl_trans *trans);
53403ea939STakashi Iwai void iwl_dbg_tlv_alloc(struct iwl_trans *trans, const struct iwl_ucode_tlv *tlv,
5468f6f492SSara Sharon 		       bool ext);
55a9248de4SShahar S Matityahu void iwl_dbg_tlv_init(struct iwl_trans *trans);
56b8221b0fSJohannes Berg void _iwl_dbg_tlv_time_point(struct iwl_fw_runtime *fwrt,
57b108d8c7SShahar S Matityahu 			     enum iwl_fw_ini_time_point tp_id,
58b8221b0fSJohannes Berg 			     union iwl_dbg_tlv_tp_data *tp_data,
59b8221b0fSJohannes Berg 			     bool sync);
60b8221b0fSJohannes Berg 
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)61b8221b0fSJohannes Berg static inline void iwl_dbg_tlv_time_point(struct iwl_fw_runtime *fwrt,
62b8221b0fSJohannes Berg 					  enum iwl_fw_ini_time_point tp_id,
63b8221b0fSJohannes Berg 					  union iwl_dbg_tlv_tp_data *tp_data)
64b8221b0fSJohannes Berg {
65b8221b0fSJohannes Berg 	_iwl_dbg_tlv_time_point(fwrt, tp_id, tp_data, false);
66b8221b0fSJohannes Berg }
67b8221b0fSJohannes Berg 
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)68b8221b0fSJohannes Berg static inline void iwl_dbg_tlv_time_point_sync(struct iwl_fw_runtime *fwrt,
69b8221b0fSJohannes Berg 					       enum iwl_fw_ini_time_point tp_id,
70b8221b0fSJohannes Berg 					       union iwl_dbg_tlv_tp_data *tp_data)
71b8221b0fSJohannes Berg {
72b8221b0fSJohannes Berg 	_iwl_dbg_tlv_time_point(fwrt, tp_id, tp_data, true);
73b8221b0fSJohannes Berg }
74b8221b0fSJohannes Berg 
759b1bcfccSShahar S Matityahu void iwl_dbg_tlv_del_timers(struct iwl_trans *trans);
76f14cda6fSSara Sharon 
77f14cda6fSSara Sharon #endif /* __iwl_dbg_tlv_h__*/
78