Skip to content

Commit 4cd177b

Browse files
jmberg-intellucacoelho
authored andcommitted
iwlwifi: dump RCM error tables
There's another set of error tables on newer (Bz) hardware, support finding and dumping those error tables if present. Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Luca Coelho <[email protected]> Link: https://lore.kernel.org/r/iwlwifi.20211210110539.c727a975b434.Ie5ad3fd974b700f1b90867b2b52ef7607799e8fe@changeid Signed-off-by: Luca Coelho <[email protected]>
1 parent 57417e1 commit 4cd177b

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed

drivers/net/wireless/intel/iwlwifi/fw/dump.c

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,72 @@ static void iwl_fwrt_dump_tcm_error_log(struct iwl_fw_runtime *fwrt, int idx)
294294
table.sw_status[i], i);
295295
}
296296

297+
/*
298+
* RCM error struct.
299+
* Note: This structure is read from the device with IO accesses,
300+
* and the reading already does the endian conversion. As it is
301+
* read with u32-sized accesses, any members with a different size
302+
* need to be ordered correctly though!
303+
*/
304+
struct iwl_rcm_error_event_table {
305+
u32 valid;
306+
u32 error_id;
307+
u32 blink2;
308+
u32 ilink1;
309+
u32 ilink2;
310+
u32 data1, data2, data3;
311+
u32 logpc;
312+
u32 frame_pointer;
313+
u32 stack_pointer;
314+
u32 msgid;
315+
u32 isr;
316+
u32 frame_hw_status;
317+
u32 mbx_lmac_to_rcm_req;
318+
u32 mbx_rcm_to_lmac_req;
319+
u32 mh_ctl;
320+
u32 mh_addr1_lo;
321+
u32 mh_info;
322+
u32 mh_err;
323+
u32 reserved[3];
324+
} __packed; /* RCM_LOG_ERROR_TABLE_API_S_VER_1 */
325+
326+
static void iwl_fwrt_dump_rcm_error_log(struct iwl_fw_runtime *fwrt, int idx)
327+
{
328+
struct iwl_trans *trans = fwrt->trans;
329+
struct iwl_rcm_error_event_table table = {};
330+
u32 base = fwrt->trans->dbg.rcm_error_event_table[idx];
331+
u32 flag = idx ? IWL_ERROR_EVENT_TABLE_RCM2 :
332+
IWL_ERROR_EVENT_TABLE_RCM1;
333+
334+
if (!base || !(fwrt->trans->dbg.error_event_table_tlv_status & flag))
335+
return;
336+
337+
iwl_trans_read_mem_bytes(trans, base, &table, sizeof(table));
338+
339+
IWL_ERR(fwrt, "RCM%d status:\n", idx + 1);
340+
IWL_ERR(fwrt, "0x%08X | error ID\n", table.error_id);
341+
IWL_ERR(fwrt, "0x%08X | rcm branchlink2\n", table.blink2);
342+
IWL_ERR(fwrt, "0x%08X | rcm interruptlink1\n", table.ilink1);
343+
IWL_ERR(fwrt, "0x%08X | rcm interruptlink2\n", table.ilink2);
344+
IWL_ERR(fwrt, "0x%08X | rcm data1\n", table.data1);
345+
IWL_ERR(fwrt, "0x%08X | rcm data2\n", table.data2);
346+
IWL_ERR(fwrt, "0x%08X | rcm data3\n", table.data3);
347+
IWL_ERR(fwrt, "0x%08X | rcm log PC\n", table.logpc);
348+
IWL_ERR(fwrt, "0x%08X | rcm frame pointer\n", table.frame_pointer);
349+
IWL_ERR(fwrt, "0x%08X | rcm stack pointer\n", table.stack_pointer);
350+
IWL_ERR(fwrt, "0x%08X | rcm msg ID\n", table.msgid);
351+
IWL_ERR(fwrt, "0x%08X | rcm ISR status\n", table.isr);
352+
IWL_ERR(fwrt, "0x%08X | frame HW status\n", table.frame_hw_status);
353+
IWL_ERR(fwrt, "0x%08X | LMAC-to-RCM request mbox\n",
354+
table.mbx_lmac_to_rcm_req);
355+
IWL_ERR(fwrt, "0x%08X | RCM-to-LMAC request mbox\n",
356+
table.mbx_rcm_to_lmac_req);
357+
IWL_ERR(fwrt, "0x%08X | MAC header control\n", table.mh_ctl);
358+
IWL_ERR(fwrt, "0x%08X | MAC header addr1 low\n", table.mh_addr1_lo);
359+
IWL_ERR(fwrt, "0x%08X | MAC header info\n", table.mh_info);
360+
IWL_ERR(fwrt, "0x%08X | MAC header error\n", table.mh_err);
361+
}
362+
297363
static void iwl_fwrt_dump_iml_error_log(struct iwl_fw_runtime *fwrt)
298364
{
299365
struct iwl_trans *trans = fwrt->trans;
@@ -376,7 +442,9 @@ void iwl_fwrt_dump_error_logs(struct iwl_fw_runtime *fwrt)
376442
iwl_fwrt_dump_lmac_error_log(fwrt, 1);
377443
iwl_fwrt_dump_umac_error_log(fwrt);
378444
iwl_fwrt_dump_tcm_error_log(fwrt, 0);
445+
iwl_fwrt_dump_rcm_error_log(fwrt, 0);
379446
iwl_fwrt_dump_tcm_error_log(fwrt, 1);
447+
iwl_fwrt_dump_rcm_error_log(fwrt, 1);
380448
iwl_fwrt_dump_iml_error_log(fwrt);
381449
iwl_fwrt_dump_fseq_regs(fwrt);
382450

drivers/net/wireless/intel/iwlwifi/iwl-drv.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,16 @@ static void iwl_parse_dbg_tlv_assert_tables(struct iwl_drv *drv,
631631
drv->trans->dbg.error_event_table_tlv_status |=
632632
IWL_ERROR_EVENT_TABLE_TCM2;
633633
break;
634+
case IWL_FW_INI_REGION_DEVICE_MEMORY_SUBTYPE_RCM_1_ERROR_TABLE:
635+
drv->trans->dbg.rcm_error_event_table[0] = addr;
636+
drv->trans->dbg.error_event_table_tlv_status |=
637+
IWL_ERROR_EVENT_TABLE_RCM1;
638+
break;
639+
case IWL_FW_INI_REGION_DEVICE_MEMORY_SUBTYPE_RCM_2_ERROR_TABLE:
640+
drv->trans->dbg.rcm_error_event_table[1] = addr;
641+
drv->trans->dbg.error_event_table_tlv_status |=
642+
IWL_ERROR_EVENT_TABLE_RCM2;
643+
break;
634644
default:
635645
break;
636646
}

drivers/net/wireless/intel/iwlwifi/iwl-trans.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ enum iwl_error_event_table_status {
195195
IWL_ERROR_EVENT_TABLE_UMAC = BIT(2),
196196
IWL_ERROR_EVENT_TABLE_TCM1 = BIT(3),
197197
IWL_ERROR_EVENT_TABLE_TCM2 = BIT(4),
198+
IWL_ERROR_EVENT_TABLE_RCM1 = BIT(5),
199+
IWL_ERROR_EVENT_TABLE_RCM2 = BIT(6),
198200
};
199201

200202
/**
@@ -730,6 +732,7 @@ struct iwl_self_init_dram {
730732
* @lmac_error_event_table: addrs of lmacs error tables
731733
* @umac_error_event_table: addr of umac error table
732734
* @tcm_error_event_table: address(es) of TCM error table(s)
735+
* @rcm_error_event_table: address(es) of RCM error table(s)
733736
* @error_event_table_tlv_status: bitmap that indicates what error table
734737
* pointers was recevied via TLV. uses enum &iwl_error_event_table_status
735738
* @internal_ini_cfg: internal debug cfg state. Uses &enum iwl_ini_cfg_state
@@ -757,6 +760,7 @@ struct iwl_trans_debug {
757760
u32 lmac_error_event_table[2];
758761
u32 umac_error_event_table;
759762
u32 tcm_error_event_table[2];
763+
u32 rcm_error_event_table[2];
760764
unsigned int error_event_table_tlv_status;
761765

762766
enum iwl_ini_cfg_state internal_ini_cfg;

0 commit comments

Comments
 (0)