Commit 91c28b83 authored by Shahar S Matityahu's avatar Shahar S Matityahu Committed by Luca Coelho

iwlwifi: dbg: move trans debug fields to a separate struct

Unite iwl_trans debug related fields under iwl_trans_debug struct to
increase readability and keep iwl_trans clean.
Signed-off-by: default avatarShahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent 1d45a700
...@@ -1155,10 +1155,10 @@ iwl_dump_ini_mon_dram_iter(struct iwl_fw_runtime *fwrt, ...@@ -1155,10 +1155,10 @@ iwl_dump_ini_mon_dram_iter(struct iwl_fw_runtime *fwrt,
return -EBUSY; return -EBUSY;
range->dram_base_addr = cpu_to_le64(start_addr); range->dram_base_addr = cpu_to_le64(start_addr);
range->range_data_size = cpu_to_le32(fwrt->trans->fw_mon[idx].size); range->range_data_size = cpu_to_le32(fwrt->trans->dbg.fw_mon[idx].size);
memcpy(range->data, fwrt->trans->fw_mon[idx].block, memcpy(range->data, fwrt->trans->dbg.fw_mon[idx].block,
fwrt->trans->fw_mon[idx].size); fwrt->trans->dbg.fw_mon[idx].size);
return sizeof(*range) + le32_to_cpu(range->range_data_size); return sizeof(*range) + le32_to_cpu(range->range_data_size);
} }
...@@ -1581,8 +1581,8 @@ static u32 iwl_dump_ini_mon_dram_get_size(struct iwl_fw_runtime *fwrt, ...@@ -1581,8 +1581,8 @@ static u32 iwl_dump_ini_mon_dram_get_size(struct iwl_fw_runtime *fwrt,
u32 size = sizeof(struct iwl_fw_ini_monitor_dump) + u32 size = sizeof(struct iwl_fw_ini_monitor_dump) +
sizeof(struct iwl_fw_ini_error_dump_range); sizeof(struct iwl_fw_ini_error_dump_range);
if (fwrt->trans->num_blocks) if (fwrt->trans->dbg.num_blocks)
size += fwrt->trans->fw_mon[0].size; size += fwrt->trans->dbg.fw_mon[0].size;
return size; return size;
} }
...@@ -1735,7 +1735,8 @@ static void iwl_dump_ini_info(struct iwl_fw_runtime *fwrt, ...@@ -1735,7 +1735,8 @@ static void iwl_dump_ini_info(struct iwl_fw_runtime *fwrt,
dump->version = cpu_to_le32(IWL_INI_DUMP_VER); dump->version = cpu_to_le32(IWL_INI_DUMP_VER);
dump->trigger_id = trigger->trigger_id; dump->trigger_id = trigger->trigger_id;
dump->is_external_cfg = cpu_to_le32(fwrt->trans->external_ini_loaded); dump->is_external_cfg =
cpu_to_le32(fwrt->trans->dbg.external_ini_loaded);
dump->ver_type = cpu_to_le32(fwrt->dump.fw_ver.type); dump->ver_type = cpu_to_le32(fwrt->dump.fw_ver.type);
dump->ver_subtype = cpu_to_le32(fwrt->dump.fw_ver.subtype); dump->ver_subtype = cpu_to_le32(fwrt->dump.fw_ver.subtype);
...@@ -1842,7 +1843,7 @@ static int iwl_fw_ini_get_trigger_len(struct iwl_fw_runtime *fwrt, ...@@ -1842,7 +1843,7 @@ static int iwl_fw_ini_get_trigger_len(struct iwl_fw_runtime *fwrt,
ret_size += hdr_len + size; ret_size += hdr_len + size;
break; break;
case IWL_FW_INI_REGION_DRAM_BUFFER: case IWL_FW_INI_REGION_DRAM_BUFFER:
if (!fwrt->trans->num_blocks) if (!fwrt->trans->dbg.num_blocks)
break; break;
size = iwl_dump_ini_mon_dram_get_size(fwrt, reg); size = iwl_dump_ini_mon_dram_get_size(fwrt, reg);
if (size) if (size)
...@@ -2097,7 +2098,7 @@ int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt, ...@@ -2097,7 +2098,7 @@ int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt,
u32 trig_type = le32_to_cpu(desc->trig_desc.type); u32 trig_type = le32_to_cpu(desc->trig_desc.type);
int ret; int ret;
if (fwrt->trans->ini_valid) { if (fwrt->trans->dbg.ini_valid) {
ret = iwl_fw_dbg_ini_collect(fwrt, trig_type); ret = iwl_fw_dbg_ini_collect(fwrt, trig_type);
if (!ret) if (!ret)
iwl_fw_free_dump_desc(fwrt); iwl_fw_free_dump_desc(fwrt);
...@@ -2374,7 +2375,7 @@ static void iwl_fw_dbg_collect_sync(struct iwl_fw_runtime *fwrt, u8 wk_idx) ...@@ -2374,7 +2375,7 @@ static void iwl_fw_dbg_collect_sync(struct iwl_fw_runtime *fwrt, u8 wk_idx)
iwl_fw_dbg_stop_recording(fwrt, &params); iwl_fw_dbg_stop_recording(fwrt, &params);
IWL_DEBUG_FW_INFO(fwrt, "WRT: data collection start\n"); IWL_DEBUG_FW_INFO(fwrt, "WRT: data collection start\n");
if (fwrt->trans->ini_valid) if (fwrt->trans->dbg.ini_valid)
iwl_fw_error_ini_dump(fwrt, wk_idx); iwl_fw_error_ini_dump(fwrt, wk_idx);
else else
iwl_fw_error_dump(fwrt); iwl_fw_error_dump(fwrt);
...@@ -2474,7 +2475,8 @@ iwl_fw_dbg_buffer_allocation(struct iwl_fw_runtime *fwrt, u32 size) ...@@ -2474,7 +2475,8 @@ iwl_fw_dbg_buffer_allocation(struct iwl_fw_runtime *fwrt, u32 size)
void *virtual_addr = NULL; void *virtual_addr = NULL;
dma_addr_t phys_addr; dma_addr_t phys_addr;
if (WARN_ON_ONCE(trans->num_blocks == ARRAY_SIZE(trans->fw_mon))) if (WARN_ON_ONCE(trans->dbg.num_blocks ==
ARRAY_SIZE(trans->dbg.fw_mon)))
return; return;
virtual_addr = virtual_addr =
...@@ -2488,12 +2490,12 @@ iwl_fw_dbg_buffer_allocation(struct iwl_fw_runtime *fwrt, u32 size) ...@@ -2488,12 +2490,12 @@ iwl_fw_dbg_buffer_allocation(struct iwl_fw_runtime *fwrt, u32 size)
IWL_DEBUG_FW(trans, IWL_DEBUG_FW(trans,
"Allocated DRAM buffer[%d], size=0x%x\n", "Allocated DRAM buffer[%d], size=0x%x\n",
trans->num_blocks, size); trans->dbg.num_blocks, size);
trans->fw_mon[trans->num_blocks].block = virtual_addr; trans->dbg.fw_mon[trans->dbg.num_blocks].block = virtual_addr;
trans->fw_mon[trans->num_blocks].physical = phys_addr; trans->dbg.fw_mon[trans->dbg.num_blocks].physical = phys_addr;
trans->fw_mon[trans->num_blocks].size = size; trans->dbg.fw_mon[trans->dbg.num_blocks].size = size;
trans->num_blocks++; trans->dbg.num_blocks++;
} }
static void iwl_fw_dbg_buffer_apply(struct iwl_fw_runtime *fwrt, static void iwl_fw_dbg_buffer_apply(struct iwl_fw_runtime *fwrt,
...@@ -2511,7 +2513,7 @@ static void iwl_fw_dbg_buffer_apply(struct iwl_fw_runtime *fwrt, ...@@ -2511,7 +2513,7 @@ static void iwl_fw_dbg_buffer_apply(struct iwl_fw_runtime *fwrt,
.data[0] = &ldbg_cmd, .data[0] = &ldbg_cmd,
.len[0] = sizeof(ldbg_cmd), .len[0] = sizeof(ldbg_cmd),
}; };
int block_idx = trans->num_blocks; int block_idx = trans->dbg.num_blocks;
u32 buf_location = le32_to_cpu(alloc->tlv.buffer_location); u32 buf_location = le32_to_cpu(alloc->tlv.buffer_location);
if (buf_location == IWL_FW_INI_LOCATION_SRAM_PATH) { if (buf_location == IWL_FW_INI_LOCATION_SRAM_PATH) {
...@@ -2529,13 +2531,13 @@ static void iwl_fw_dbg_buffer_apply(struct iwl_fw_runtime *fwrt, ...@@ -2529,13 +2531,13 @@ static void iwl_fw_dbg_buffer_apply(struct iwl_fw_runtime *fwrt,
if (!alloc->is_alloc) { if (!alloc->is_alloc) {
iwl_fw_dbg_buffer_allocation(fwrt, iwl_fw_dbg_buffer_allocation(fwrt,
le32_to_cpu(alloc->tlv.size)); le32_to_cpu(alloc->tlv.size));
if (block_idx == trans->num_blocks) if (block_idx == trans->dbg.num_blocks)
return; return;
alloc->is_alloc = 1; alloc->is_alloc = 1;
} }
/* First block is assigned via registers / context info */ /* First block is assigned via registers / context info */
if (trans->num_blocks == 1) if (trans->dbg.num_blocks == 1)
return; return;
IWL_DEBUG_FW(trans, IWL_DEBUG_FW(trans,
...@@ -2543,7 +2545,7 @@ static void iwl_fw_dbg_buffer_apply(struct iwl_fw_runtime *fwrt, ...@@ -2543,7 +2545,7 @@ static void iwl_fw_dbg_buffer_apply(struct iwl_fw_runtime *fwrt,
cmd->num_frags = cpu_to_le32(1); cmd->num_frags = cpu_to_le32(1);
cmd->fragments[0].address = cmd->fragments[0].address =
cpu_to_le64(trans->fw_mon[block_idx].physical); cpu_to_le64(trans->dbg.fw_mon[block_idx].physical);
cmd->fragments[0].size = alloc->tlv.size; cmd->fragments[0].size = alloc->tlv.size;
cmd->allocation_id = alloc->tlv.allocation_id; cmd->allocation_id = alloc->tlv.allocation_id;
cmd->buffer_location = alloc->tlv.buffer_location; cmd->buffer_location = alloc->tlv.buffer_location;
...@@ -2835,7 +2837,7 @@ static void iwl_fw_dbg_ini_reset_cfg(struct iwl_fw_runtime *fwrt) ...@@ -2835,7 +2837,7 @@ static void iwl_fw_dbg_ini_reset_cfg(struct iwl_fw_runtime *fwrt)
void iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt, void iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt,
enum iwl_fw_ini_apply_point apply_point) enum iwl_fw_ini_apply_point apply_point)
{ {
void *data = &fwrt->trans->apply_points[apply_point]; void *data = &fwrt->trans->dbg.apply_points[apply_point];
IWL_DEBUG_FW(fwrt, "WRT: enabling apply point %d\n", apply_point); IWL_DEBUG_FW(fwrt, "WRT: enabling apply point %d\n", apply_point);
...@@ -2844,7 +2846,7 @@ void iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt, ...@@ -2844,7 +2846,7 @@ void iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt,
_iwl_fw_dbg_apply_point(fwrt, data, apply_point, false); _iwl_fw_dbg_apply_point(fwrt, data, apply_point, false);
data = &fwrt->trans->apply_points_ext[apply_point]; data = &fwrt->trans->dbg.apply_points_ext[apply_point];
_iwl_fw_dbg_apply_point(fwrt, data, apply_point, true); _iwl_fw_dbg_apply_point(fwrt, data, apply_point, true);
} }
IWL_EXPORT_SYMBOL(iwl_fw_dbg_apply_point); IWL_EXPORT_SYMBOL(iwl_fw_dbg_apply_point);
......
...@@ -202,7 +202,7 @@ _iwl_fw_dbg_trigger_on(struct iwl_fw_runtime *fwrt, ...@@ -202,7 +202,7 @@ _iwl_fw_dbg_trigger_on(struct iwl_fw_runtime *fwrt,
{ {
struct iwl_fw_dbg_trigger_tlv *trig; struct iwl_fw_dbg_trigger_tlv *trig;
if (fwrt->trans->ini_valid) if (fwrt->trans->dbg.ini_valid)
return NULL; return NULL;
if (!iwl_fw_dbg_trigger_enabled(fwrt->fw, id)) if (!iwl_fw_dbg_trigger_enabled(fwrt->fw, id))
...@@ -229,7 +229,7 @@ iwl_fw_ini_trigger_on(struct iwl_fw_runtime *fwrt, ...@@ -229,7 +229,7 @@ iwl_fw_ini_trigger_on(struct iwl_fw_runtime *fwrt,
struct iwl_fw_ini_trigger *trig; struct iwl_fw_ini_trigger *trig;
u32 usec; u32 usec;
if (!fwrt->trans->ini_valid || id == IWL_FW_TRIGGER_ID_INVALID || if (!fwrt->trans->dbg.ini_valid || id == IWL_FW_TRIGGER_ID_INVALID ||
id >= IWL_FW_TRIGGER_ID_NUM || !fwrt->dump.active_trigs[id].active) id >= IWL_FW_TRIGGER_ID_NUM || !fwrt->dump.active_trigs[id].active)
return false; return false;
...@@ -301,7 +301,7 @@ _iwl_fw_dbg_stop_recording(struct iwl_trans *trans, ...@@ -301,7 +301,7 @@ _iwl_fw_dbg_stop_recording(struct iwl_trans *trans,
usleep_range(700, 1000); usleep_range(700, 1000);
iwl_write_umac_prph(trans, DBGC_OUT_CTRL, 0); iwl_write_umac_prph(trans, DBGC_OUT_CTRL, 0);
#ifdef CONFIG_IWLWIFI_DEBUGFS #ifdef CONFIG_IWLWIFI_DEBUGFS
trans->dbg_rec_on = false; trans->dbg.rec_on = false;
#endif #endif
} }
...@@ -336,7 +336,7 @@ _iwl_fw_dbg_restart_recording(struct iwl_trans *trans, ...@@ -336,7 +336,7 @@ _iwl_fw_dbg_restart_recording(struct iwl_trans *trans,
static inline void iwl_fw_set_dbg_rec_on(struct iwl_fw_runtime *fwrt) static inline void iwl_fw_set_dbg_rec_on(struct iwl_fw_runtime *fwrt)
{ {
if (fwrt->fw->dbg.dest_tlv && fwrt->cur_fw_img == IWL_UCODE_REGULAR) if (fwrt->fw->dbg.dest_tlv && fwrt->cur_fw_img == IWL_UCODE_REGULAR)
fwrt->trans->dbg_rec_on = true; fwrt->trans->dbg.rec_on = true;
} }
#endif #endif
...@@ -452,28 +452,28 @@ void iwl_fwrt_stop_device(struct iwl_fw_runtime *fwrt); ...@@ -452,28 +452,28 @@ void iwl_fwrt_stop_device(struct iwl_fw_runtime *fwrt);
static inline void iwl_fw_lmac1_set_alive_err_table(struct iwl_trans *trans, static inline void iwl_fw_lmac1_set_alive_err_table(struct iwl_trans *trans,
u32 lmac_error_event_table) u32 lmac_error_event_table)
{ {
if (!(trans->error_event_table_tlv_status & if (!(trans->dbg.error_event_table_tlv_status &
IWL_ERROR_EVENT_TABLE_LMAC1) || IWL_ERROR_EVENT_TABLE_LMAC1) ||
WARN_ON(trans->lmac_error_event_table[0] != WARN_ON(trans->dbg.lmac_error_event_table[0] !=
lmac_error_event_table)) lmac_error_event_table))
trans->lmac_error_event_table[0] = lmac_error_event_table; trans->dbg.lmac_error_event_table[0] = lmac_error_event_table;
} }
static inline void iwl_fw_umac_set_alive_err_table(struct iwl_trans *trans, static inline void iwl_fw_umac_set_alive_err_table(struct iwl_trans *trans,
u32 umac_error_event_table) u32 umac_error_event_table)
{ {
if (!(trans->error_event_table_tlv_status & if (!(trans->dbg.error_event_table_tlv_status &
IWL_ERROR_EVENT_TABLE_UMAC) || IWL_ERROR_EVENT_TABLE_UMAC) ||
WARN_ON(trans->umac_error_event_table != WARN_ON(trans->dbg.umac_error_event_table !=
umac_error_event_table)) umac_error_event_table))
trans->umac_error_event_table = umac_error_event_table; trans->dbg.umac_error_event_table = umac_error_event_table;
} }
static inline void iwl_fw_error_collect(struct iwl_fw_runtime *fwrt) static inline void iwl_fw_error_collect(struct iwl_fw_runtime *fwrt)
{ {
if (fwrt->trans->ini_valid && fwrt->trans->hw_error) { if (fwrt->trans->dbg.ini_valid && fwrt->trans->dbg.hw_error) {
_iwl_fw_dbg_ini_collect(fwrt, IWL_FW_TRIGGER_ID_FW_HW_ERROR); _iwl_fw_dbg_ini_collect(fwrt, IWL_FW_TRIGGER_ID_FW_HW_ERROR);
fwrt->trans->hw_error = false; fwrt->trans->dbg.hw_error = false;
} else { } else {
iwl_fw_dbg_collect_desc(fwrt, &iwl_dump_desc_assert, false, 0); iwl_fw_dbg_collect_desc(fwrt, &iwl_dump_desc_assert, false, 0);
} }
......
...@@ -81,9 +81,9 @@ void iwl_fw_dbg_copy_tlv(struct iwl_trans *trans, struct iwl_ucode_tlv *tlv, ...@@ -81,9 +81,9 @@ void iwl_fw_dbg_copy_tlv(struct iwl_trans *trans, struct iwl_ucode_tlv *tlv,
return; return;
if (ext) if (ext)
data = &trans->apply_points_ext[apply_point]; data = &trans->dbg.apply_points_ext[apply_point];
else else
data = &trans->apply_points[apply_point]; data = &trans->dbg.apply_points[apply_point];
/* add room for is_alloc field in &iwl_fw_ini_allocation_data struct */ /* add room for is_alloc field in &iwl_fw_ini_allocation_data struct */
if (le32_to_cpu(tlv->type) == IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION) { if (le32_to_cpu(tlv->type) == IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION) {
...@@ -172,14 +172,14 @@ void iwl_alloc_dbg_tlv(struct iwl_trans *trans, size_t len, const u8 *data, ...@@ -172,14 +172,14 @@ void iwl_alloc_dbg_tlv(struct iwl_trans *trans, size_t len, const u8 *data,
} }
if (ext) { if (ext) {
trans->apply_points_ext[i].data = mem; trans->dbg.apply_points_ext[i].data = mem;
trans->apply_points_ext[i].size = size[i]; trans->dbg.apply_points_ext[i].size = size[i];
} else { } else {
trans->apply_points[i].data = mem; trans->dbg.apply_points[i].data = mem;
trans->apply_points[i].size = size[i]; trans->dbg.apply_points[i].size = size[i];
} }
trans->ini_valid = true; trans->dbg.ini_valid = true;
} }
} }
...@@ -187,14 +187,14 @@ void iwl_fw_dbg_free(struct iwl_trans *trans) ...@@ -187,14 +187,14 @@ void iwl_fw_dbg_free(struct iwl_trans *trans)
{ {
int i; int i;
for (i = 0; i < ARRAY_SIZE(trans->apply_points); i++) { for (i = 0; i < ARRAY_SIZE(trans->dbg.apply_points); i++) {
kfree(trans->apply_points[i].data); kfree(trans->dbg.apply_points[i].data);
trans->apply_points[i].size = 0; trans->dbg.apply_points[i].size = 0;
trans->apply_points[i].offset = 0; trans->dbg.apply_points[i].offset = 0;
kfree(trans->apply_points_ext[i].data); kfree(trans->dbg.apply_points_ext[i].data);
trans->apply_points_ext[i].size = 0; trans->dbg.apply_points_ext[i].size = 0;
trans->apply_points_ext[i].offset = 0; trans->dbg.apply_points_ext[i].offset = 0;
} }
} }
...@@ -243,7 +243,7 @@ void iwl_load_fw_dbg_tlv(struct device *dev, struct iwl_trans *trans) ...@@ -243,7 +243,7 @@ void iwl_load_fw_dbg_tlv(struct device *dev, struct iwl_trans *trans)
const struct firmware *fw; const struct firmware *fw;
int res; int res;
if (trans->external_ini_loaded || !iwlwifi_mod_params.enable_ini) if (trans->dbg.external_ini_loaded || !iwlwifi_mod_params.enable_ini)
return; return;
res = request_firmware(&fw, "iwl-dbg-tlv.ini", dev); res = request_firmware(&fw, "iwl-dbg-tlv.ini", dev);
...@@ -253,6 +253,6 @@ void iwl_load_fw_dbg_tlv(struct device *dev, struct iwl_trans *trans) ...@@ -253,6 +253,6 @@ void iwl_load_fw_dbg_tlv(struct device *dev, struct iwl_trans *trans)
iwl_alloc_dbg_tlv(trans, fw->size, fw->data, true); iwl_alloc_dbg_tlv(trans, fw->size, fw->data, true);
iwl_parse_fw_dbg_tlv(trans, fw->data, fw->size); iwl_parse_fw_dbg_tlv(trans, fw->data, fw->size);
trans->external_ini_loaded = true; trans->dbg.external_ini_loaded = true;
release_firmware(fw); release_firmware(fw);
} }
...@@ -1114,10 +1114,10 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, ...@@ -1114,10 +1114,10 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
if (drv->trans->cfg->device_family < if (drv->trans->cfg->device_family <
IWL_DEVICE_FAMILY_22000) IWL_DEVICE_FAMILY_22000)
break; break;
drv->trans->umac_error_event_table = drv->trans->dbg.umac_error_event_table =
le32_to_cpu(dbg_ptrs->error_info_addr) & le32_to_cpu(dbg_ptrs->error_info_addr) &
~FW_ADDR_CACHE_CONTROL; ~FW_ADDR_CACHE_CONTROL;
drv->trans->error_event_table_tlv_status |= drv->trans->dbg.error_event_table_tlv_status |=
IWL_ERROR_EVENT_TABLE_UMAC; IWL_ERROR_EVENT_TABLE_UMAC;
break; break;
} }
...@@ -1130,10 +1130,10 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, ...@@ -1130,10 +1130,10 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
if (drv->trans->cfg->device_family < if (drv->trans->cfg->device_family <
IWL_DEVICE_FAMILY_22000) IWL_DEVICE_FAMILY_22000)
break; break;
drv->trans->lmac_error_event_table[0] = drv->trans->dbg.lmac_error_event_table[0] =
le32_to_cpu(dbg_ptrs->error_event_table_ptr) & le32_to_cpu(dbg_ptrs->error_event_table_ptr) &
~FW_ADDR_CACHE_CONTROL; ~FW_ADDR_CACHE_CONTROL;
drv->trans->error_event_table_tlv_status |= drv->trans->dbg.error_event_table_tlv_status |=
IWL_ERROR_EVENT_TABLE_LMAC1; IWL_ERROR_EVENT_TABLE_LMAC1;
break; break;
} }
......
...@@ -721,6 +721,48 @@ struct iwl_self_init_dram { ...@@ -721,6 +721,48 @@ struct iwl_self_init_dram {
int paging_cnt; int paging_cnt;
}; };
/**
* struct iwl_trans_debug - transport debug related data
*
* @n_dest_reg: num of reg_ops in %dbg_dest_tlv
* @rec_on: true iff there is a fw debug recording currently active
* @dest_tlv: points to the destination TLV for debug
* @conf_tlv: array of pointers to configuration TLVs for debug
* @trigger_tlv: array of pointers to triggers TLVs for debug
* @lmac_error_event_table: addrs of lmacs error tables
* @umac_error_event_table: addr of umac error table
* @error_event_table_tlv_status: bitmap that indicates what error table
* pointers was recevied via TLV. uses enum &iwl_error_event_table_status
* @external_ini_loaded: indicates if an external ini cfg was given
* @ini_valid: indicates if debug ini mode is on
* @num_blocks: number of blocks in fw_mon
* @fw_mon: address of the buffers for firmware monitor
* @hw_error: equals true if hw error interrupt was received from the FW
*/
struct iwl_trans_debug {
u8 n_dest_reg;
bool rec_on;
const struct iwl_fw_dbg_dest_tlv_v1 *dest_tlv;
const struct iwl_fw_dbg_conf_tlv *conf_tlv[FW_DBG_CONF_MAX];
struct iwl_fw_dbg_trigger_tlv * const *trigger_tlv;
u32 lmac_error_event_table[2];
u32 umac_error_event_table;
unsigned int error_event_table_tlv_status;
bool external_ini_loaded;
bool ini_valid;
struct iwl_apply_point_data apply_points[IWL_FW_INI_APPLY_NUM];
struct iwl_apply_point_data apply_points_ext[IWL_FW_INI_APPLY_NUM];
int num_blocks;
struct iwl_dram_data fw_mon[IWL_FW_INI_APPLY_NUM];
bool hw_error;
};
/** /**
* struct iwl_trans - transport common data * struct iwl_trans - transport common data
* *
...@@ -750,24 +792,12 @@ struct iwl_self_init_dram { ...@@ -750,24 +792,12 @@ struct iwl_self_init_dram {
* @rx_mpdu_cmd_hdr_size: used for tracing, amount of data before the * @rx_mpdu_cmd_hdr_size: used for tracing, amount of data before the
* start of the 802.11 header in the @rx_mpdu_cmd * start of the 802.11 header in the @rx_mpdu_cmd
* @dflt_pwr_limit: default power limit fetched from the platform (ACPI) * @dflt_pwr_limit: default power limit fetched from the platform (ACPI)
* @dbg_dest_tlv: points to the destination TLV for debug
* @dbg_conf_tlv: array of pointers to configuration TLVs for debug
* @dbg_trigger_tlv: array of pointers to triggers TLVs for debug
* @dbg_n_dest_reg: num of reg_ops in %dbg_dest_tlv
* @num_blocks: number of blocks in fw_mon
* @fw_mon: address of the buffers for firmware monitor
* @system_pm_mode: the system-wide power management mode in use. * @system_pm_mode: the system-wide power management mode in use.
* This mode is set dynamically, depending on the WoWLAN values * This mode is set dynamically, depending on the WoWLAN values
* configured from the userspace at runtime. * configured from the userspace at runtime.
* @runtime_pm_mode: the runtime power management mode in use. This * @runtime_pm_mode: the runtime power management mode in use. This
* mode is set during the initialization phase and is not * mode is set during the initialization phase and is not
* supposed to change during runtime. * supposed to change during runtime.
* @dbg_rec_on: true iff there is a fw debug recording currently active
* @lmac_error_event_table: addrs of lmacs error tables
* @umac_error_event_table: addr of umac error table
* @error_event_table_tlv_status: bitmap that indicates what error table
* pointers was recevied via TLV. use enum &iwl_error_event_table_status
* @hw_error: equals true if hw error interrupt was received from the FW
*/ */
struct iwl_trans { struct iwl_trans {
const struct iwl_trans_ops *ops; const struct iwl_trans_ops *ops;
...@@ -808,29 +838,12 @@ struct iwl_trans { ...@@ -808,29 +838,12 @@ struct iwl_trans {
struct lockdep_map sync_cmd_lockdep_map; struct lockdep_map sync_cmd_lockdep_map;
#endif #endif
struct iwl_apply_point_data apply_points[IWL_FW_INI_APPLY_NUM]; struct iwl_trans_debug dbg;
struct iwl_apply_point_data apply_points_ext[IWL_FW_INI_APPLY_NUM];
bool external_ini_loaded;
bool ini_valid;
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];
struct iwl_fw_dbg_trigger_tlv * const *dbg_trigger_tlv;
u8 dbg_n_dest_reg;
int num_blocks;
struct iwl_dram_data fw_mon[IWL_FW_INI_APPLY_NUM];
struct iwl_self_init_dram init_dram; struct iwl_self_init_dram init_dram;
enum iwl_plat_pm_mode system_pm_mode; enum iwl_plat_pm_mode system_pm_mode;
enum iwl_plat_pm_mode runtime_pm_mode; enum iwl_plat_pm_mode runtime_pm_mode;
bool suspending; bool suspending;
bool dbg_rec_on;
u32 lmac_error_event_table[2];
u32 umac_error_event_table;
unsigned int error_event_table_tlv_status;
bool hw_error;
/* pointer to trans specific struct */ /* pointer to trans specific struct */
/*Ensure that this pointer will always be aligned to sizeof pointer */ /*Ensure that this pointer will always be aligned to sizeof pointer */
......
...@@ -1985,7 +1985,7 @@ static void iwl_mvm_d3_disconnect_iter(void *data, u8 *mac, ...@@ -1985,7 +1985,7 @@ static void iwl_mvm_d3_disconnect_iter(void *data, u8 *mac,
static int iwl_mvm_check_rt_status(struct iwl_mvm *mvm, static int iwl_mvm_check_rt_status(struct iwl_mvm *mvm,
struct ieee80211_vif *vif) struct ieee80211_vif *vif)
{ {
u32 base = mvm->trans->lmac_error_event_table[0]; u32 base = mvm->trans->dbg.lmac_error_event_table[0];
struct error_table_start { struct error_table_start {
/* cf. struct iwl_error_event_table */ /* cf. struct iwl_error_event_table */
u32 valid; u32 valid;
......
...@@ -238,7 +238,7 @@ static bool iwl_alive_fn(struct iwl_notif_wait_data *notif_wait, ...@@ -238,7 +238,7 @@ static bool iwl_alive_fn(struct iwl_notif_wait_data *notif_wait,
iwl_fw_lmac1_set_alive_err_table(mvm->trans, lmac_error_event_table); iwl_fw_lmac1_set_alive_err_table(mvm->trans, lmac_error_event_table);
if (lmac2) if (lmac2)
mvm->trans->lmac_error_event_table[1] = mvm->trans->dbg.lmac_error_event_table[1] =
le32_to_cpu(lmac2->dbg_ptrs.error_event_table_ptr); le32_to_cpu(lmac2->dbg_ptrs.error_event_table_ptr);
umac_error_event_table = le32_to_cpu(umac->dbg_ptrs.error_info_addr); umac_error_event_table = le32_to_cpu(umac->dbg_ptrs.error_info_addr);
...@@ -1174,7 +1174,7 @@ int iwl_mvm_up(struct iwl_mvm *mvm) ...@@ -1174,7 +1174,7 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
if (ret) if (ret)
IWL_ERR(mvm, "Failed to initialize Smart Fifo\n"); IWL_ERR(mvm, "Failed to initialize Smart Fifo\n");
if (!mvm->trans->ini_valid) { if (!mvm->trans->dbg.ini_valid) {
mvm->fwrt.dump.conf = FW_DBG_INVALID; mvm->fwrt.dump.conf = FW_DBG_INVALID;
/* if we have a destination, assume EARLY START */ /* if we have a destination, assume EARLY START */
if (mvm->fw->dbg.dest_tlv) if (mvm->fw->dbg.dest_tlv)
......
...@@ -799,11 +799,11 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, ...@@ -799,11 +799,11 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
iwl_trans_configure(mvm->trans, &trans_cfg); iwl_trans_configure(mvm->trans, &trans_cfg);
trans->rx_mpdu_cmd = REPLY_RX_MPDU_CMD; trans->rx_mpdu_cmd = REPLY_RX_MPDU_CMD;
trans->dbg_dest_tlv = mvm->fw->dbg.dest_tlv; trans->dbg.dest_tlv = mvm->fw->dbg.dest_tlv;
trans->dbg_n_dest_reg = mvm->fw->dbg.n_dest_reg; trans->dbg.n_dest_reg = mvm->fw->dbg.n_dest_reg;
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->iml = mvm->fw->iml; trans->iml = mvm->fw->iml;
trans->iml_len = mvm->fw->iml_len; trans->iml_len = mvm->fw->iml_len;
......
...@@ -469,10 +469,10 @@ static void iwl_mvm_dump_umac_error_log(struct iwl_mvm *mvm) ...@@ -469,10 +469,10 @@ static void iwl_mvm_dump_umac_error_log(struct iwl_mvm *mvm)
{ {
struct iwl_trans *trans = mvm->trans; struct iwl_trans *trans = mvm->trans;
struct iwl_umac_error_event_table table; struct iwl_umac_error_event_table table;
u32 base = mvm->trans->umac_error_event_table; u32 base = mvm->trans->dbg.umac_error_event_table;
if (!mvm->support_umac_log && if (!mvm->support_umac_log &&
!(mvm->trans->error_event_table_tlv_status & !(mvm->trans->dbg.error_event_table_tlv_status &
IWL_ERROR_EVENT_TABLE_UMAC)) IWL_ERROR_EVENT_TABLE_UMAC))
return; return;
...@@ -508,7 +508,7 @@ static void iwl_mvm_dump_lmac_error_log(struct iwl_mvm *mvm, u8 lmac_num) ...@@ -508,7 +508,7 @@ static void iwl_mvm_dump_lmac_error_log(struct iwl_mvm *mvm, u8 lmac_num)
{ {
struct iwl_trans *trans = mvm->trans; struct iwl_trans *trans = mvm->trans;
struct iwl_error_event_table table; struct iwl_error_event_table table;
u32 val, base = mvm->trans->lmac_error_event_table[lmac_num]; u32 val, base = mvm->trans->dbg.lmac_error_event_table[lmac_num];
if (mvm->fwrt.cur_fw_img == IWL_UCODE_INIT) { if (mvm->fwrt.cur_fw_img == IWL_UCODE_INIT) {
if (!base) if (!base)
...@@ -604,7 +604,7 @@ void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm) ...@@ -604,7 +604,7 @@ void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm)
iwl_mvm_dump_lmac_error_log(mvm, 0); iwl_mvm_dump_lmac_error_log(mvm, 0);
if (mvm->trans->lmac_error_event_table[1]) if (mvm->trans->dbg.lmac_error_event_table[1])
iwl_mvm_dump_lmac_error_log(mvm, 1); iwl_mvm_dump_lmac_error_log(mvm, 1);
iwl_mvm_dump_umac_error_log(mvm); iwl_mvm_dump_umac_error_log(mvm);
......
...@@ -96,13 +96,13 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans, ...@@ -96,13 +96,13 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans,
cpu_to_le64(trans_pcie->rxq->bd_dma); cpu_to_le64(trans_pcie->rxq->bd_dma);
/* Configure debug, for integration */ /* Configure debug, for integration */
if (!trans->ini_valid) if (!trans->dbg.ini_valid)
iwl_pcie_alloc_fw_monitor(trans, 0); iwl_pcie_alloc_fw_monitor(trans, 0);
if (trans->num_blocks) { if (trans->dbg.num_blocks) {
prph_sc_ctrl->hwm_cfg.hwm_base_addr = prph_sc_ctrl->hwm_cfg.hwm_base_addr =
cpu_to_le64(trans->fw_mon[0].physical); cpu_to_le64(trans->dbg.fw_mon[0].physical);
prph_sc_ctrl->hwm_cfg.hwm_size = prph_sc_ctrl->hwm_cfg.hwm_size =
cpu_to_le32(trans->fw_mon[0].size); cpu_to_le32(trans->dbg.fw_mon[0].size);
} }
/* allocate ucode sections in dram and set addresses */ /* allocate ucode sections in dram and set addresses */
......
...@@ -1018,7 +1018,7 @@ static inline void __iwl_trans_pcie_set_bit(struct iwl_trans *trans, ...@@ -1018,7 +1018,7 @@ static inline void __iwl_trans_pcie_set_bit(struct iwl_trans *trans,
static inline bool iwl_pcie_dbg_on(struct iwl_trans *trans) static inline bool iwl_pcie_dbg_on(struct iwl_trans *trans)
{ {
return (trans->dbg_dest_tlv || trans->ini_valid); return (trans->dbg.dest_tlv || trans->dbg.ini_valid);
} }
void iwl_trans_pcie_rf_kill(struct iwl_trans *trans, bool state); void iwl_trans_pcie_rf_kill(struct iwl_trans *trans, bool state);
......
...@@ -2212,7 +2212,7 @@ irqreturn_t iwl_pcie_irq_msix_handler(int irq, void *dev_id) ...@@ -2212,7 +2212,7 @@ irqreturn_t iwl_pcie_irq_msix_handler(int irq, void *dev_id)
"Hardware error detected. Restarting.\n"); "Hardware error detected. Restarting.\n");
isr_stats->hw++; isr_stats->hw++;
trans->hw_error = true; trans->dbg.hw_error = true;
iwl_pcie_irq_handle_error(trans); iwl_pcie_irq_handle_error(trans);
} }
......
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