Commit 79f033f6 authored by Sara Sharon's avatar Sara Sharon Committed by Luca Coelho

iwlwifi: dbg: don't limit dump decisions to all or monitor

Currently opmode is limited to asking transport to either
dump all the dumps configured at startup, or monitor only.
Instead, pass to transport a bitmask, to allow flexibility.
Signed-off-by: default avatarSara Sharon <sara.sharon@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent 12d56175
...@@ -908,6 +908,7 @@ void iwl_fw_error_dump(struct iwl_fw_runtime *fwrt) ...@@ -908,6 +908,7 @@ void iwl_fw_error_dump(struct iwl_fw_runtime *fwrt)
struct iwl_fw_error_dump_file *dump_file; struct iwl_fw_error_dump_file *dump_file;
struct scatterlist *sg_dump_data; struct scatterlist *sg_dump_data;
u32 file_len; u32 file_len;
u32 dump_mask = fwrt->fw->dbg.dump_mask;
IWL_DEBUG_INFO(fwrt, "WRT dump start\n"); IWL_DEBUG_INFO(fwrt, "WRT dump start\n");
...@@ -927,8 +928,10 @@ void iwl_fw_error_dump(struct iwl_fw_runtime *fwrt) ...@@ -927,8 +928,10 @@ void iwl_fw_error_dump(struct iwl_fw_runtime *fwrt)
goto out; goto out;
} }
fw_error_dump->trans_ptr = iwl_trans_dump_data(fwrt->trans, if (fwrt->dump.monitor_only)
fwrt->dump.monitor_only); dump_mask &= IWL_FW_ERROR_DUMP_FW_MONITOR;
fw_error_dump->trans_ptr = iwl_trans_dump_data(fwrt->trans, dump_mask);
file_len = le32_to_cpu(dump_file->file_len); file_len = le32_to_cpu(dump_file->file_len);
fw_error_dump->fwrt_len = file_len; fw_error_dump->fwrt_len = file_len;
if (fw_error_dump->trans_ptr) { if (fw_error_dump->trans_ptr) {
......
...@@ -602,7 +602,7 @@ struct iwl_trans_ops { ...@@ -602,7 +602,7 @@ struct iwl_trans_ops {
void (*resume)(struct iwl_trans *trans); void (*resume)(struct iwl_trans *trans);
struct iwl_trans_dump_data *(*dump_data)(struct iwl_trans *trans, struct iwl_trans_dump_data *(*dump_data)(struct iwl_trans *trans,
bool monitor_only); u32 dump_mask);
}; };
/** /**
...@@ -776,7 +776,6 @@ struct iwl_trans { ...@@ -776,7 +776,6 @@ struct iwl_trans {
const struct iwl_fw_dbg_dest_tlv_v1 *dbg_dest_tlv; const struct iwl_fw_dbg_dest_tlv_v1 *dbg_dest_tlv;
const struct iwl_fw_dbg_conf_tlv *dbg_conf_tlv[FW_DBG_CONF_MAX]; const struct iwl_fw_dbg_conf_tlv *dbg_conf_tlv[FW_DBG_CONF_MAX];
struct iwl_fw_dbg_trigger_tlv * const *dbg_trigger_tlv; struct iwl_fw_dbg_trigger_tlv * const *dbg_trigger_tlv;
u32 dbg_dump_mask;
u8 dbg_n_dest_reg; u8 dbg_n_dest_reg;
int num_blocks; int num_blocks;
struct iwl_dram_data fw_mon[IWL_MAX_DEBUG_ALLOCATIONS]; struct iwl_dram_data fw_mon[IWL_MAX_DEBUG_ALLOCATIONS];
...@@ -896,11 +895,11 @@ static inline void iwl_trans_resume(struct iwl_trans *trans) ...@@ -896,11 +895,11 @@ static inline void iwl_trans_resume(struct iwl_trans *trans)
} }
static inline struct iwl_trans_dump_data * static inline struct iwl_trans_dump_data *
iwl_trans_dump_data(struct iwl_trans *trans, bool monitor_only) iwl_trans_dump_data(struct iwl_trans *trans, u32 dump_mask)
{ {
if (!trans->ops->dump_data) if (!trans->ops->dump_data)
return NULL; return NULL;
return trans->ops->dump_data(trans, monitor_only); return trans->ops->dump_data(trans, dump_mask);
} }
static inline struct iwl_device_cmd * static inline struct iwl_device_cmd *
......
...@@ -769,7 +769,6 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, ...@@ -769,7 +769,6 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
memcpy(trans->dbg_conf_tlv, mvm->fw->dbg.conf_tlv, memcpy(trans->dbg_conf_tlv, mvm->fw->dbg.conf_tlv,
sizeof(trans->dbg_conf_tlv)); sizeof(trans->dbg_conf_tlv));
trans->dbg_trigger_tlv = mvm->fw->dbg.trigger_tlv; trans->dbg_trigger_tlv = mvm->fw->dbg.trigger_tlv;
trans->dbg_dump_mask = mvm->fw->dbg.dump_mask;
trans->iml = mvm->fw->iml; trans->iml = mvm->fw->iml;
trans->iml_len = mvm->fw->iml_len; trans->iml_len = mvm->fw->iml_len;
......
...@@ -2990,7 +2990,7 @@ static int iwl_trans_get_fw_monitor_len(struct iwl_trans *trans, int *len) ...@@ -2990,7 +2990,7 @@ static int iwl_trans_get_fw_monitor_len(struct iwl_trans *trans, int *len)
static struct iwl_trans_dump_data static struct iwl_trans_dump_data
*iwl_trans_pcie_dump_data(struct iwl_trans *trans, *iwl_trans_pcie_dump_data(struct iwl_trans *trans,
bool monitor_only) u32 dump_mask)
{ {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
struct iwl_fw_error_dump_data *data; struct iwl_fw_error_dump_data *data;
...@@ -3002,7 +3002,10 @@ static struct iwl_trans_dump_data ...@@ -3002,7 +3002,10 @@ static struct iwl_trans_dump_data
int i, ptr; int i, ptr;
bool dump_rbs = test_bit(STATUS_FW_ERROR, &trans->status) && bool dump_rbs = test_bit(STATUS_FW_ERROR, &trans->status) &&
!trans->cfg->mq_rx_supported && !trans->cfg->mq_rx_supported &&
trans->dbg_dump_mask & BIT(IWL_FW_ERROR_DUMP_RB); dump_mask & BIT(IWL_FW_ERROR_DUMP_RB);
if (!dump_mask)
return NULL;
/* transport dump header */ /* transport dump header */
len = sizeof(*dump_data); len = sizeof(*dump_data);
...@@ -3014,11 +3017,7 @@ static struct iwl_trans_dump_data ...@@ -3014,11 +3017,7 @@ static struct iwl_trans_dump_data
/* FW monitor */ /* FW monitor */
monitor_len = iwl_trans_get_fw_monitor_len(trans, &len); monitor_len = iwl_trans_get_fw_monitor_len(trans, &len);
if (monitor_only) { if (dump_mask == BIT(IWL_FW_ERROR_DUMP_FW_MONITOR)) {
if (!(trans->dbg_dump_mask &
BIT(IWL_FW_ERROR_DUMP_FW_MONITOR)))
return NULL;
dump_data = vzalloc(len); dump_data = vzalloc(len);
if (!dump_data) if (!dump_data)
return NULL; return NULL;
...@@ -3031,11 +3030,11 @@ static struct iwl_trans_dump_data ...@@ -3031,11 +3030,11 @@ static struct iwl_trans_dump_data
} }
/* CSR registers */ /* CSR registers */
if (trans->dbg_dump_mask & BIT(IWL_FW_ERROR_DUMP_CSR)) if (dump_mask & BIT(IWL_FW_ERROR_DUMP_CSR))
len += sizeof(*data) + IWL_CSR_TO_DUMP; len += sizeof(*data) + IWL_CSR_TO_DUMP;
/* FH registers */ /* FH registers */
if (trans->dbg_dump_mask & BIT(IWL_FW_ERROR_DUMP_FH_REGS)) { if (dump_mask & BIT(IWL_FW_ERROR_DUMP_FH_REGS)) {
if (trans->cfg->gen2) if (trans->cfg->gen2)
len += sizeof(*data) + len += sizeof(*data) +
(FH_MEM_UPPER_BOUND_GEN2 - (FH_MEM_UPPER_BOUND_GEN2 -
...@@ -3060,8 +3059,7 @@ static struct iwl_trans_dump_data ...@@ -3060,8 +3059,7 @@ static struct iwl_trans_dump_data
} }
/* Paged memory for gen2 HW */ /* Paged memory for gen2 HW */
if (trans->cfg->gen2 && if (trans->cfg->gen2 && dump_mask & BIT(IWL_FW_ERROR_DUMP_PAGING))
trans->dbg_dump_mask & BIT(IWL_FW_ERROR_DUMP_PAGING))
for (i = 0; i < trans_pcie->init_dram.paging_cnt; i++) for (i = 0; i < trans_pcie->init_dram.paging_cnt; i++)
len += sizeof(*data) + len += sizeof(*data) +
sizeof(struct iwl_fw_error_dump_paging) + sizeof(struct iwl_fw_error_dump_paging) +
...@@ -3074,7 +3072,7 @@ static struct iwl_trans_dump_data ...@@ -3074,7 +3072,7 @@ static struct iwl_trans_dump_data
len = 0; len = 0;
data = (void *)dump_data->data; data = (void *)dump_data->data;
if (trans->dbg_dump_mask & BIT(IWL_FW_ERROR_DUMP_TXCMD)) { if (dump_mask & BIT(IWL_FW_ERROR_DUMP_TXCMD)) {
u16 tfd_size = trans_pcie->tfd_size; u16 tfd_size = trans_pcie->tfd_size;
data->type = cpu_to_le32(IWL_FW_ERROR_DUMP_TXCMD); data->type = cpu_to_le32(IWL_FW_ERROR_DUMP_TXCMD);
...@@ -3108,16 +3106,15 @@ static struct iwl_trans_dump_data ...@@ -3108,16 +3106,15 @@ static struct iwl_trans_dump_data
data = iwl_fw_error_next_data(data); data = iwl_fw_error_next_data(data);
} }
if (trans->dbg_dump_mask & BIT(IWL_FW_ERROR_DUMP_CSR)) if (dump_mask & BIT(IWL_FW_ERROR_DUMP_CSR))
len += iwl_trans_pcie_dump_csr(trans, &data); len += iwl_trans_pcie_dump_csr(trans, &data);
if (trans->dbg_dump_mask & BIT(IWL_FW_ERROR_DUMP_FH_REGS)) if (dump_mask & BIT(IWL_FW_ERROR_DUMP_FH_REGS))
len += iwl_trans_pcie_fh_regs_dump(trans, &data); len += iwl_trans_pcie_fh_regs_dump(trans, &data);
if (dump_rbs) if (dump_rbs)
len += iwl_trans_pcie_dump_rbs(trans, &data, num_rbs); len += iwl_trans_pcie_dump_rbs(trans, &data, num_rbs);
/* Paged memory for gen2 HW */ /* Paged memory for gen2 HW */
if (trans->cfg->gen2 && if (trans->cfg->gen2 && dump_mask & BIT(IWL_FW_ERROR_DUMP_PAGING)) {
trans->dbg_dump_mask & BIT(IWL_FW_ERROR_DUMP_PAGING)) {
for (i = 0; i < trans_pcie->init_dram.paging_cnt; i++) { for (i = 0; i < trans_pcie->init_dram.paging_cnt; i++) {
struct iwl_fw_error_dump_paging *paging; struct iwl_fw_error_dump_paging *paging;
dma_addr_t addr = dma_addr_t addr =
...@@ -3137,7 +3134,7 @@ static struct iwl_trans_dump_data ...@@ -3137,7 +3134,7 @@ static struct iwl_trans_dump_data
len += sizeof(*data) + sizeof(*paging) + page_len; len += sizeof(*data) + sizeof(*paging) + page_len;
} }
} }
if (trans->dbg_dump_mask & BIT(IWL_FW_ERROR_DUMP_FW_MONITOR)) if (dump_mask & BIT(IWL_FW_ERROR_DUMP_FW_MONITOR))
len += iwl_trans_pcie_dump_monitor(trans, &data, monitor_len); len += iwl_trans_pcie_dump_monitor(trans, &data, monitor_len);
dump_data->len = len; dump_data->len = len;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment