162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 2018-2023 Intel Corporation
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci#ifndef __iwl_dbg_tlv_h__
662306a36Sopenharmony_ci#define __iwl_dbg_tlv_h__
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#include <linux/device.h>
962306a36Sopenharmony_ci#include <linux/types.h>
1062306a36Sopenharmony_ci#include <fw/file.h>
1162306a36Sopenharmony_ci#include <fw/api/dbg-tlv.h>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#define IWL_DBG_TLV_MAX_PRESET	15
1462306a36Sopenharmony_ci#define ENABLE_INI		(IWL_DBG_TLV_MAX_PRESET + 1)
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci/**
1762306a36Sopenharmony_ci * struct iwl_dbg_tlv_node - debug TLV node
1862306a36Sopenharmony_ci * @list: list of &struct iwl_dbg_tlv_node
1962306a36Sopenharmony_ci * @tlv: debug TLV
2062306a36Sopenharmony_ci */
2162306a36Sopenharmony_cistruct iwl_dbg_tlv_node {
2262306a36Sopenharmony_ci	struct list_head list;
2362306a36Sopenharmony_ci	struct iwl_ucode_tlv tlv;
2462306a36Sopenharmony_ci};
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci/**
2762306a36Sopenharmony_ci * union iwl_dbg_tlv_tp_data - data that is given in a time point
2862306a36Sopenharmony_ci * @fw_pkt: a packet received from the FW
2962306a36Sopenharmony_ci */
3062306a36Sopenharmony_ciunion iwl_dbg_tlv_tp_data {
3162306a36Sopenharmony_ci	struct iwl_rx_packet *fw_pkt;
3262306a36Sopenharmony_ci};
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci/**
3562306a36Sopenharmony_ci * struct iwl_dbg_tlv_time_point_data
3662306a36Sopenharmony_ci * @trig_list: list of triggers
3762306a36Sopenharmony_ci * @active_trig_list: list of active triggers
3862306a36Sopenharmony_ci * @hcmd_list: list of host commands
3962306a36Sopenharmony_ci * @config_list: list of configuration
4062306a36Sopenharmony_ci */
4162306a36Sopenharmony_cistruct iwl_dbg_tlv_time_point_data {
4262306a36Sopenharmony_ci	struct list_head trig_list;
4362306a36Sopenharmony_ci	struct list_head active_trig_list;
4462306a36Sopenharmony_ci	struct list_head hcmd_list;
4562306a36Sopenharmony_ci	struct list_head config_list;
4662306a36Sopenharmony_ci};
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_cistruct iwl_trans;
4962306a36Sopenharmony_cistruct iwl_fw_runtime;
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_civoid iwl_dbg_tlv_load_bin(struct device *dev, struct iwl_trans *trans);
5262306a36Sopenharmony_civoid iwl_dbg_tlv_free(struct iwl_trans *trans);
5362306a36Sopenharmony_civoid iwl_dbg_tlv_alloc(struct iwl_trans *trans, const struct iwl_ucode_tlv *tlv,
5462306a36Sopenharmony_ci		       bool ext);
5562306a36Sopenharmony_civoid iwl_dbg_tlv_init(struct iwl_trans *trans);
5662306a36Sopenharmony_civoid _iwl_dbg_tlv_time_point(struct iwl_fw_runtime *fwrt,
5762306a36Sopenharmony_ci			     enum iwl_fw_ini_time_point tp_id,
5862306a36Sopenharmony_ci			     union iwl_dbg_tlv_tp_data *tp_data,
5962306a36Sopenharmony_ci			     bool sync);
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_cistatic inline void iwl_dbg_tlv_time_point(struct iwl_fw_runtime *fwrt,
6262306a36Sopenharmony_ci					  enum iwl_fw_ini_time_point tp_id,
6362306a36Sopenharmony_ci					  union iwl_dbg_tlv_tp_data *tp_data)
6462306a36Sopenharmony_ci{
6562306a36Sopenharmony_ci	_iwl_dbg_tlv_time_point(fwrt, tp_id, tp_data, false);
6662306a36Sopenharmony_ci}
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_cistatic inline void iwl_dbg_tlv_time_point_sync(struct iwl_fw_runtime *fwrt,
6962306a36Sopenharmony_ci					       enum iwl_fw_ini_time_point tp_id,
7062306a36Sopenharmony_ci					       union iwl_dbg_tlv_tp_data *tp_data)
7162306a36Sopenharmony_ci{
7262306a36Sopenharmony_ci	_iwl_dbg_tlv_time_point(fwrt, tp_id, tp_data, true);
7362306a36Sopenharmony_ci}
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_civoid iwl_dbg_tlv_del_timers(struct iwl_trans *trans);
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci#endif /* __iwl_dbg_tlv_h__*/
78