Commit 53032e6e authored by Shahar S Matityahu's avatar Shahar S Matityahu Committed by Luca Coelho

iwlwifi: dbg_ini: add debug prints to the ini flows

Add debug prints to the ini flow and rewrite existing prints to provide
more information
Signed-off-by: default avatarShahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent 2953c393
...@@ -1685,6 +1685,9 @@ iwl_dump_ini_mem(struct iwl_fw_runtime *fwrt, ...@@ -1685,6 +1685,9 @@ iwl_dump_ini_mem(struct iwl_fw_runtime *fwrt,
!ops->fill_mem_hdr || !ops->fill_range)) !ops->fill_mem_hdr || !ops->fill_range))
return; return;
IWL_DEBUG_FW(fwrt, "WRT: collecting region: id=%d, type=%d\n",
le32_to_cpu(reg->region_id), type);
num_of_ranges = ops->get_num_of_ranges(fwrt, reg); num_of_ranges = ops->get_num_of_ranges(fwrt, reg);
(*data)->type = cpu_to_le32(type | INI_DUMP_BIT); (*data)->type = cpu_to_le32(type | INI_DUMP_BIT);
...@@ -1698,7 +1701,8 @@ iwl_dump_ini_mem(struct iwl_fw_runtime *fwrt, ...@@ -1698,7 +1701,8 @@ iwl_dump_ini_mem(struct iwl_fw_runtime *fwrt,
range = ops->fill_mem_hdr(fwrt, reg, header); range = ops->fill_mem_hdr(fwrt, reg, header);
if (!range) { if (!range) {
IWL_ERR(fwrt, "Failed to fill region header: id=%d, type=%d\n", IWL_ERR(fwrt,
"WRT: failed to fill region header: id=%d, type=%d\n",
le32_to_cpu(reg->region_id), type); le32_to_cpu(reg->region_id), type);
memset(*data, 0, le32_to_cpu((*data)->len)); memset(*data, 0, le32_to_cpu((*data)->len));
return; return;
...@@ -1708,7 +1712,8 @@ iwl_dump_ini_mem(struct iwl_fw_runtime *fwrt, ...@@ -1708,7 +1712,8 @@ iwl_dump_ini_mem(struct iwl_fw_runtime *fwrt,
int range_size = ops->fill_range(fwrt, reg, range, i); int range_size = ops->fill_range(fwrt, reg, range, i);
if (range_size < 0) { if (range_size < 0) {
IWL_ERR(fwrt, "Failed to dump region: id=%d, type=%d\n", IWL_ERR(fwrt,
"WRT: failed to dump region: id=%d, type=%d\n",
le32_to_cpu(reg->region_id), type); le32_to_cpu(reg->region_id), type);
memset(*data, 0, le32_to_cpu((*data)->len)); memset(*data, 0, le32_to_cpu((*data)->len));
return; return;
...@@ -1734,8 +1739,12 @@ static int iwl_fw_ini_get_trigger_len(struct iwl_fw_runtime *fwrt, ...@@ -1734,8 +1739,12 @@ static int iwl_fw_ini_get_trigger_len(struct iwl_fw_runtime *fwrt,
continue; continue;
reg = fwrt->dump.active_regs[reg_id]; reg = fwrt->dump.active_regs[reg_id];
if (WARN(!reg, "Unassigned region %d\n", reg_id)) if (!reg) {
IWL_WARN(fwrt,
"WRT: unassigned region id %d, skipping\n",
reg_id);
continue; continue;
}
switch (le32_to_cpu(reg->region_type)) { switch (le32_to_cpu(reg->region_type)) {
case IWL_FW_INI_REGION_DEVICE_MEMORY: case IWL_FW_INI_REGION_DEVICE_MEMORY:
...@@ -2108,6 +2117,12 @@ int _iwl_fw_dbg_ini_collect(struct iwl_fw_runtime *fwrt, ...@@ -2108,6 +2117,12 @@ int _iwl_fw_dbg_ini_collect(struct iwl_fw_runtime *fwrt,
if (test_and_set_bit(IWL_FWRT_STATUS_DUMPING, &fwrt->status)) if (test_and_set_bit(IWL_FWRT_STATUS_DUMPING, &fwrt->status))
return -EBUSY; return -EBUSY;
if (!iwl_fw_ini_trigger_on(fwrt, id)) {
IWL_WARN(fwrt, "WRT: Trigger %d is not active, aborting dump\n",
id);
return -EINVAL;
}
active = &fwrt->dump.active_trigs[id]; active = &fwrt->dump.active_trigs[id];
delay = le32_to_cpu(active->trig->dump_delay); delay = le32_to_cpu(active->trig->dump_delay);
occur = le32_to_cpu(active->trig->occurrences); occur = le32_to_cpu(active->trig->occurrences);
...@@ -2117,14 +2132,14 @@ int _iwl_fw_dbg_ini_collect(struct iwl_fw_runtime *fwrt, ...@@ -2117,14 +2132,14 @@ int _iwl_fw_dbg_ini_collect(struct iwl_fw_runtime *fwrt,
active->trig->occurrences = cpu_to_le32(--occur); active->trig->occurrences = cpu_to_le32(--occur);
if (le32_to_cpu(active->trig->force_restart)) { if (le32_to_cpu(active->trig->force_restart)) {
IWL_WARN(fwrt, "Force restart: trigger %d fired.\n", id); IWL_WARN(fwrt, "WRT: force restart: trigger %d fired.\n", id);
iwl_force_nmi(fwrt->trans); iwl_force_nmi(fwrt->trans);
return 0; return 0;
} }
fwrt->dump.ini_trig_id = id; fwrt->dump.ini_trig_id = id;
IWL_WARN(fwrt, "Collecting data: ini trigger %d fired.\n", id); IWL_WARN(fwrt, "WRT: collecting data: ini trigger %d fired.\n", id);
schedule_delayed_work(&fwrt->dump.wk, usecs_to_jiffies(delay)); schedule_delayed_work(&fwrt->dump.wk, usecs_to_jiffies(delay));
...@@ -2262,12 +2277,12 @@ void iwl_fw_dbg_collect_sync(struct iwl_fw_runtime *fwrt) ...@@ -2262,12 +2277,12 @@ void iwl_fw_dbg_collect_sync(struct iwl_fw_runtime *fwrt)
iwl_fw_dbg_stop_recording(fwrt, &params); iwl_fw_dbg_stop_recording(fwrt, &params);
IWL_DEBUG_INFO(fwrt, "WRT dump start\n"); IWL_DEBUG_FW_INFO(fwrt, "WRT: data collection start\n");
if (fwrt->trans->ini_valid) if (fwrt->trans->ini_valid)
iwl_fw_error_ini_dump(fwrt); iwl_fw_error_ini_dump(fwrt);
else else
iwl_fw_error_dump(fwrt); iwl_fw_error_dump(fwrt);
IWL_DEBUG_INFO(fwrt, "WRT dump done\n"); IWL_DEBUG_FW_INFO(fwrt, "WRT: data collection done\n");
/* start recording again if the firmware is not crashed */ /* start recording again if the firmware is not crashed */
if (!test_bit(STATUS_FW_ERROR, &fwrt->trans->status) && if (!test_bit(STATUS_FW_ERROR, &fwrt->trans->status) &&
...@@ -2337,12 +2352,14 @@ iwl_fw_dbg_buffer_allocation(struct iwl_fw_runtime *fwrt, u32 size) ...@@ -2337,12 +2352,14 @@ iwl_fw_dbg_buffer_allocation(struct iwl_fw_runtime *fwrt, u32 size)
if (!virtual_addr) if (!virtual_addr)
IWL_ERR(fwrt, "Failed to allocate debug memory\n"); IWL_ERR(fwrt, "Failed to allocate debug memory\n");
IWL_DEBUG_FW(trans,
"Allocated DRAM buffer[%d], size=0x%x\n",
trans->num_blocks, size);
trans->fw_mon[trans->num_blocks].block = virtual_addr; trans->fw_mon[trans->num_blocks].block = virtual_addr;
trans->fw_mon[trans->num_blocks].physical = phys_addr; trans->fw_mon[trans->num_blocks].physical = phys_addr;
trans->fw_mon[trans->num_blocks].size = size; trans->fw_mon[trans->num_blocks].size = size;
trans->num_blocks++; trans->num_blocks++;
IWL_DEBUG_FW(trans, "Allocated debug block of size %d\n", size);
} }
static void iwl_fw_dbg_buffer_apply(struct iwl_fw_runtime *fwrt, static void iwl_fw_dbg_buffer_apply(struct iwl_fw_runtime *fwrt,
...@@ -2365,11 +2382,15 @@ static void iwl_fw_dbg_buffer_apply(struct iwl_fw_runtime *fwrt, ...@@ -2365,11 +2382,15 @@ static void iwl_fw_dbg_buffer_apply(struct iwl_fw_runtime *fwrt,
if (buf_location == IWL_FW_INI_LOCATION_SRAM_PATH) { if (buf_location == IWL_FW_INI_LOCATION_SRAM_PATH) {
if (!WARN(pnt != IWL_FW_INI_APPLY_EARLY, if (!WARN(pnt != IWL_FW_INI_APPLY_EARLY,
"Invalid apply point %d for SMEM buffer allocation", "WRT: Invalid apply point %d for SMEM buffer allocation, aborting\n",
pnt)) pnt)) {
IWL_DEBUG_FW(trans,
"WRT: applying SMEM buffer destination\n");
/* set sram monitor by enabling bit 7 */ /* set sram monitor by enabling bit 7 */
iwl_set_bit(fwrt->trans, CSR_HW_IF_CONFIG_REG, iwl_set_bit(fwrt->trans, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BIT_MONITOR_SRAM); CSR_HW_IF_CONFIG_REG_BIT_MONITOR_SRAM);
}
return; return;
} }
...@@ -2388,6 +2409,9 @@ static void iwl_fw_dbg_buffer_apply(struct iwl_fw_runtime *fwrt, ...@@ -2388,6 +2409,9 @@ static void iwl_fw_dbg_buffer_apply(struct iwl_fw_runtime *fwrt,
if (trans->num_blocks == 1) if (trans->num_blocks == 1)
return; return;
IWL_DEBUG_FW(trans,
"WRT: applying DRAM buffer[%d] destination\n", block_idx);
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->fw_mon[block_idx].physical);
...@@ -2399,7 +2423,8 @@ static void iwl_fw_dbg_buffer_apply(struct iwl_fw_runtime *fwrt, ...@@ -2399,7 +2423,8 @@ static void iwl_fw_dbg_buffer_apply(struct iwl_fw_runtime *fwrt,
} }
static void iwl_fw_dbg_send_hcmd(struct iwl_fw_runtime *fwrt, static void iwl_fw_dbg_send_hcmd(struct iwl_fw_runtime *fwrt,
struct iwl_ucode_tlv *tlv) struct iwl_ucode_tlv *tlv,
bool ext)
{ {
struct iwl_fw_ini_hcmd_tlv *hcmd_tlv = (void *)&tlv->data[0]; struct iwl_fw_ini_hcmd_tlv *hcmd_tlv = (void *)&tlv->data[0];
struct iwl_fw_ini_hcmd *data = &hcmd_tlv->hcmd; struct iwl_fw_ini_hcmd *data = &hcmd_tlv->hcmd;
...@@ -2415,6 +2440,10 @@ static void iwl_fw_dbg_send_hcmd(struct iwl_fw_runtime *fwrt, ...@@ -2415,6 +2440,10 @@ static void iwl_fw_dbg_send_hcmd(struct iwl_fw_runtime *fwrt,
if (le32_to_cpu(hcmd_tlv->domain) != IWL_FW_INI_DBG_DOMAIN_ALWAYS_ON) if (le32_to_cpu(hcmd_tlv->domain) != IWL_FW_INI_DBG_DOMAIN_ALWAYS_ON)
return; return;
IWL_DEBUG_FW(fwrt,
"WRT: ext=%d. Sending host command id=0x%x, group=0x%x\n",
ext, data->id, data->group);
iwl_trans_send_cmd(fwrt->trans, &hcmd); iwl_trans_send_cmd(fwrt->trans, &hcmd);
} }
...@@ -2431,17 +2460,20 @@ static void iwl_fw_dbg_update_regions(struct iwl_fw_runtime *fwrt, ...@@ -2431,17 +2460,20 @@ static void iwl_fw_dbg_update_regions(struct iwl_fw_runtime *fwrt,
u32 type = le32_to_cpu(reg->region_type); u32 type = le32_to_cpu(reg->region_type);
if (WARN(id >= ARRAY_SIZE(fwrt->dump.active_regs), if (WARN(id >= ARRAY_SIZE(fwrt->dump.active_regs),
"Invalid region id %d for apply point %d\n", id, pnt)) "WRT: ext=%d. Invalid region id %d for apply point %d\n",
ext, id, pnt))
break; break;
active = &fwrt->dump.active_regs[id]; active = &fwrt->dump.active_regs[id];
if (*active) if (*active)
IWL_WARN(fwrt->trans, "region TLV %d override\n", id); IWL_WARN(fwrt->trans,
"WRT: ext=%d. Region id %d override\n",
ext, id);
IWL_DEBUG_FW(fwrt, IWL_DEBUG_FW(fwrt,
"%s: apply point %d, activating region ID %d\n", "WRT: ext=%d. Activating region id %d\n",
__func__, pnt, id); ext, id);
*active = reg; *active = reg;
...@@ -2474,7 +2506,8 @@ static int iwl_fw_dbg_trig_realloc(struct iwl_fw_runtime *fwrt, ...@@ -2474,7 +2506,8 @@ static int iwl_fw_dbg_trig_realloc(struct iwl_fw_runtime *fwrt,
ptr = krealloc(active->trig, size, GFP_KERNEL); ptr = krealloc(active->trig, size, GFP_KERNEL);
if (!ptr) { if (!ptr) {
IWL_ERR(fwrt, "Failed to allocate memory for trigger %d\n", id); IWL_ERR(fwrt, "WRT: Failed to allocate memory for trigger %d\n",
id);
return -ENOMEM; return -ENOMEM;
} }
active->trig = ptr; active->trig = ptr;
...@@ -2498,7 +2531,9 @@ static void iwl_fw_dbg_update_triggers(struct iwl_fw_runtime *fwrt, ...@@ -2498,7 +2531,9 @@ static void iwl_fw_dbg_update_triggers(struct iwl_fw_runtime *fwrt,
u32 trig_regs_size = le32_to_cpu(trig->num_regions) * u32 trig_regs_size = le32_to_cpu(trig->num_regions) *
sizeof(__le32); sizeof(__le32);
if (WARN_ON(id >= ARRAY_SIZE(fwrt->dump.active_trigs))) if (WARN(id >= ARRAY_SIZE(fwrt->dump.active_trigs),
"WRT: ext=%d. Invalid trigger id %d for apply point %d\n",
ext, id, apply_point))
break; break;
active = &fwrt->dump.active_trigs[id]; active = &fwrt->dump.active_trigs[id];
...@@ -2506,6 +2541,10 @@ static void iwl_fw_dbg_update_triggers(struct iwl_fw_runtime *fwrt, ...@@ -2506,6 +2541,10 @@ static void iwl_fw_dbg_update_triggers(struct iwl_fw_runtime *fwrt,
if (!active->active) { if (!active->active) {
size_t trig_size = sizeof(*trig) + trig_regs_size; size_t trig_size = sizeof(*trig) + trig_regs_size;
IWL_DEBUG_FW(fwrt,
"WRT: ext=%d. Activating trigger %d\n",
ext, id);
if (iwl_fw_dbg_trig_realloc(fwrt, active, id, if (iwl_fw_dbg_trig_realloc(fwrt, active, id,
trig_size)) trig_size))
goto next; goto next;
...@@ -2524,8 +2563,16 @@ static void iwl_fw_dbg_update_triggers(struct iwl_fw_runtime *fwrt, ...@@ -2524,8 +2563,16 @@ static void iwl_fw_dbg_update_triggers(struct iwl_fw_runtime *fwrt,
int mem_to_add = trig_regs_size; int mem_to_add = trig_regs_size;
if (region_override) { if (region_override) {
IWL_DEBUG_FW(fwrt,
"WRT: ext=%d. Trigger %d regions override\n",
ext, id);
mem_to_add -= active_regs * sizeof(__le32); mem_to_add -= active_regs * sizeof(__le32);
} else { } else {
IWL_DEBUG_FW(fwrt,
"WRT: ext=%d. Trigger %d regions appending\n",
ext, id);
offset += active_regs; offset += active_regs;
new_regs += active_regs; new_regs += active_regs;
} }
...@@ -2534,8 +2581,13 @@ static void iwl_fw_dbg_update_triggers(struct iwl_fw_runtime *fwrt, ...@@ -2534,8 +2581,13 @@ static void iwl_fw_dbg_update_triggers(struct iwl_fw_runtime *fwrt,
active->size + mem_to_add)) active->size + mem_to_add))
goto next; goto next;
if (conf_override) if (conf_override) {
IWL_DEBUG_FW(fwrt,
"WRT: ext=%d. Trigger %d configuration override\n",
ext, id);
memcpy(active->trig, trig, sizeof(*trig)); memcpy(active->trig, trig, sizeof(*trig));
}
memcpy(active->trig->data + offset, trig->data, memcpy(active->trig->data + offset, trig->data,
trig_regs_size); trig_regs_size);
...@@ -2576,11 +2628,11 @@ static void _iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt, ...@@ -2576,11 +2628,11 @@ static void _iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt,
case IWL_UCODE_TLV_TYPE_HCMD: case IWL_UCODE_TLV_TYPE_HCMD:
if (pnt < IWL_FW_INI_APPLY_AFTER_ALIVE) { if (pnt < IWL_FW_INI_APPLY_AFTER_ALIVE) {
IWL_ERR(fwrt, IWL_ERR(fwrt,
"Invalid apply point %x for host command\n", "WRT: ext=%d. Invalid apply point %d for host command\n",
pnt); ext, pnt);
goto next; goto next;
} }
iwl_fw_dbg_send_hcmd(fwrt, tlv); iwl_fw_dbg_send_hcmd(fwrt, tlv, ext);
break; break;
case IWL_UCODE_TLV_TYPE_REGIONS: case IWL_UCODE_TLV_TYPE_REGIONS:
iwl_fw_dbg_update_regions(fwrt, ini_tlv, ext, pnt); iwl_fw_dbg_update_regions(fwrt, ini_tlv, ext, pnt);
...@@ -2591,7 +2643,9 @@ static void _iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt, ...@@ -2591,7 +2643,9 @@ static void _iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt,
case IWL_UCODE_TLV_TYPE_DEBUG_FLOW: case IWL_UCODE_TLV_TYPE_DEBUG_FLOW:
break; break;
default: default:
WARN_ONCE(1, "Invalid TLV %x for apply point\n", type); WARN_ONCE(1,
"WRT: ext=%d. Invalid TLV 0x%x for apply point\n",
ext, type);
break; break;
} }
next: next:
...@@ -2605,6 +2659,8 @@ void iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt, ...@@ -2605,6 +2659,8 @@ void iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt,
void *data = &fwrt->trans->apply_points[apply_point]; void *data = &fwrt->trans->apply_points[apply_point];
int i; int i;
IWL_DEBUG_FW(fwrt, "WRT: enabling apply point %d\n", apply_point);
if (apply_point == IWL_FW_INI_APPLY_EARLY) { if (apply_point == IWL_FW_INI_APPLY_EARLY) {
for (i = 0; i < IWL_FW_INI_MAX_REGION_ID; i++) for (i = 0; i < IWL_FW_INI_MAX_REGION_ID; i++)
fwrt->dump.active_regs[i] = NULL; fwrt->dump.active_regs[i] = NULL;
......
...@@ -138,7 +138,7 @@ void iwl_alloc_dbg_tlv(struct iwl_trans *trans, size_t len, const u8 *data, ...@@ -138,7 +138,7 @@ void iwl_alloc_dbg_tlv(struct iwl_trans *trans, size_t len, const u8 *data,
if (le32_to_cpu(hdr->tlv_version) != 1) if (le32_to_cpu(hdr->tlv_version) != 1)
continue; continue;
IWL_DEBUG_FW(trans, "Read TLV %x, apply point %d\n", IWL_DEBUG_FW(trans, "WRT: read TLV 0x%x, apply point %d\n",
le32_to_cpu(tlv->type), apply); le32_to_cpu(tlv->type), apply);
if (WARN_ON(apply >= IWL_FW_INI_APPLY_NUM)) if (WARN_ON(apply >= IWL_FW_INI_APPLY_NUM))
......
...@@ -896,6 +896,8 @@ void iwl_pcie_apply_destination(struct iwl_trans *trans) ...@@ -896,6 +896,8 @@ void iwl_pcie_apply_destination(struct iwl_trans *trans)
if (!trans->num_blocks) if (!trans->num_blocks)
return; return;
IWL_DEBUG_FW(trans,
"WRT: applying DRAM buffer[0] destination\n");
iwl_write_umac_prph(trans, MON_BUFF_BASE_ADDR_VER2, iwl_write_umac_prph(trans, MON_BUFF_BASE_ADDR_VER2,
trans->fw_mon[0].physical >> trans->fw_mon[0].physical >>
MON_BUFF_SHIFT_VER2); MON_BUFF_SHIFT_VER2);
......
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