OSDN Git Service

iwlwifi: dump both TCM error tables if present
authorJohannes Berg <johannes.berg@intel.com>
Fri, 10 Dec 2021 09:12:38 +0000 (11:12 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Tue, 21 Dec 2021 10:35:05 +0000 (12:35 +0200)
There can be two TCMs in a given device, dump both of the
error tables if present.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211210110539.887cba319301.Ifdc3f617f7e0e3e39c90e8c208e60f11b3bb9404@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/dump.c
drivers/net/wireless/intel/iwlwifi/iwl-drv.c
drivers/net/wireless/intel/iwlwifi/iwl-trans.h

index b0f9a2c..6c794f8 100644 (file)
@@ -259,21 +259,21 @@ struct iwl_tcm_error_event_table {
        u32 reserved[4];
 } __packed; /* TCM_LOG_ERROR_TABLE_API_S_VER_1 */
 
-static void iwl_fwrt_dump_tcm_error_log(struct iwl_fw_runtime *fwrt)
+static void iwl_fwrt_dump_tcm_error_log(struct iwl_fw_runtime *fwrt, int idx)
 {
        struct iwl_trans *trans = fwrt->trans;
        struct iwl_tcm_error_event_table table = {};
-       u32 base = fwrt->trans->dbg.tcm_error_event_table;
+       u32 base = fwrt->trans->dbg.tcm_error_event_table[idx];
        int i;
+       u32 flag = idx ? IWL_ERROR_EVENT_TABLE_TCM2 :
+                        IWL_ERROR_EVENT_TABLE_TCM1;
 
-       if (!base ||
-           !(fwrt->trans->dbg.error_event_table_tlv_status &
-             IWL_ERROR_EVENT_TABLE_TCM))
+       if (!base || !(fwrt->trans->dbg.error_event_table_tlv_status & flag))
                return;
 
        iwl_trans_read_mem_bytes(trans, base, &table, sizeof(table));
 
-       IWL_ERR(fwrt, "TCM status:\n");
+       IWL_ERR(fwrt, "TCM%d status:\n", idx + 1);
        IWL_ERR(fwrt, "0x%08X | error ID\n", table.error_id);
        IWL_ERR(fwrt, "0x%08X | tcm branchlink2\n", table.blink2);
        IWL_ERR(fwrt, "0x%08X | tcm interruptlink1\n", table.ilink1);
@@ -375,7 +375,8 @@ void iwl_fwrt_dump_error_logs(struct iwl_fw_runtime *fwrt)
        if (fwrt->trans->dbg.lmac_error_event_table[1])
                iwl_fwrt_dump_lmac_error_log(fwrt, 1);
        iwl_fwrt_dump_umac_error_log(fwrt);
-       iwl_fwrt_dump_tcm_error_log(fwrt);
+       iwl_fwrt_dump_tcm_error_log(fwrt, 0);
+       iwl_fwrt_dump_tcm_error_log(fwrt, 1);
        iwl_fwrt_dump_iml_error_log(fwrt);
        iwl_fwrt_dump_fseq_regs(fwrt);
 
index e8550fe..7d5c7de 100644 (file)
@@ -622,9 +622,14 @@ static void iwl_parse_dbg_tlv_assert_tables(struct iwl_drv *drv,
                        IWL_ERROR_EVENT_TABLE_LMAC2;
                break;
        case IWL_FW_INI_REGION_DEVICE_MEMORY_SUBTYPE_TCM_1_ERROR_TABLE:
-               drv->trans->dbg.tcm_error_event_table = addr;
+               drv->trans->dbg.tcm_error_event_table[0] = addr;
                drv->trans->dbg.error_event_table_tlv_status |=
-                       IWL_ERROR_EVENT_TABLE_TCM;
+                       IWL_ERROR_EVENT_TABLE_TCM1;
+               break;
+       case IWL_FW_INI_REGION_DEVICE_MEMORY_SUBTYPE_TCM_2_ERROR_TABLE:
+               drv->trans->dbg.tcm_error_event_table[1] = addr;
+               drv->trans->dbg.error_event_table_tlv_status |=
+                       IWL_ERROR_EVENT_TABLE_TCM2;
                break;
        default:
                break;
index e7c6e7b..3720801 100644 (file)
@@ -193,7 +193,8 @@ enum iwl_error_event_table_status {
        IWL_ERROR_EVENT_TABLE_LMAC1 = BIT(0),
        IWL_ERROR_EVENT_TABLE_LMAC2 = BIT(1),
        IWL_ERROR_EVENT_TABLE_UMAC = BIT(2),
-       IWL_ERROR_EVENT_TABLE_TCM = BIT(3),
+       IWL_ERROR_EVENT_TABLE_TCM1 = BIT(3),
+       IWL_ERROR_EVENT_TABLE_TCM2 = BIT(4),
 };
 
 /**
@@ -728,7 +729,7 @@ struct iwl_self_init_dram {
  * @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
- * @tcm_error_event_table: address of TCM error table
+ * @tcm_error_event_table: address(es) of TCM error table(s)
  * @error_event_table_tlv_status: bitmap that indicates what error table
  *     pointers was recevied via TLV. uses enum &iwl_error_event_table_status
  * @internal_ini_cfg: internal debug cfg state. Uses &enum iwl_ini_cfg_state
@@ -755,7 +756,7 @@ struct iwl_trans_debug {
 
        u32 lmac_error_event_table[2];
        u32 umac_error_event_table;
-       u32 tcm_error_event_table;
+       u32 tcm_error_event_table[2];
        unsigned int error_event_table_tlv_status;
 
        enum iwl_ini_cfg_state internal_ini_cfg;