Skip to content

Commit aece892

Browse files
jmberg-intellucacoelho
authored andcommitted
iwlwifi: parse error tables from debug TLVs
With more things being added, we're no longer going to duplicate the error tables from the debug TLVs nor send them at runtime. Use the debug TLVs to find the locations of the error tables. As we've never released firmware using IWL_UCODE_TLV_TCM_DEBUG_ADDRS just remove that entirely. Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Luca Coelho <[email protected]> Link: https://lore.kernel.org/r/iwlwifi.20211210110539.779d68490f68.I472c7d9cbaca46000a10ec18808ef54836b33a8a@changeid Signed-off-by: Luca Coelho <[email protected]>
1 parent ced50f1 commit aece892

File tree

3 files changed

+58
-14
lines changed

3 files changed

+58
-14
lines changed

drivers/net/wireless/intel/iwlwifi/fw/api/dbg-tlv.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,16 @@ enum iwl_fw_ini_region_type {
386386
IWL_FW_INI_REGION_NUM
387387
}; /* FW_TLV_DEBUG_REGION_TYPE_API_E */
388388

389-
#define IWL_FW_INI_REGION_DEVICE_MEMORY_SUBTYPE_HW_SMEM 1
389+
enum iwl_fw_ini_region_device_memory_subtype {
390+
IWL_FW_INI_REGION_DEVICE_MEMORY_SUBTYPE_HW_SMEM = 1,
391+
IWL_FW_INI_REGION_DEVICE_MEMORY_SUBTYPE_UMAC_ERROR_TABLE = 5,
392+
IWL_FW_INI_REGION_DEVICE_MEMORY_SUBTYPE_LMAC_1_ERROR_TABLE = 7,
393+
IWL_FW_INI_REGION_DEVICE_MEMORY_SUBTYPE_LMAC_2_ERROR_TABLE = 10,
394+
IWL_FW_INI_REGION_DEVICE_MEMORY_SUBTYPE_TCM_1_ERROR_TABLE = 14,
395+
IWL_FW_INI_REGION_DEVICE_MEMORY_SUBTYPE_TCM_2_ERROR_TABLE = 16,
396+
IWL_FW_INI_REGION_DEVICE_MEMORY_SUBTYPE_RCM_1_ERROR_TABLE = 18,
397+
IWL_FW_INI_REGION_DEVICE_MEMORY_SUBTYPE_RCM_2_ERROR_TABLE = 20,
398+
}; /* FW_TLV_DEBUG_REGION_DEVICE_MEMORY_SUBTYPE_API_E */
390399

391400
/**
392401
* enum iwl_fw_ini_time_point

drivers/net/wireless/intel/iwlwifi/fw/file.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ enum iwl_ucode_tlv_type {
9898

9999
IWL_UCODE_TLV_PNVM_VERSION = 62,
100100
IWL_UCODE_TLV_PNVM_SKU = 64,
101-
IWL_UCODE_TLV_TCM_DEBUG_ADDRS = 65,
102101

103102
IWL_UCODE_TLV_SEC_TABLE_ADDR = 66,
104103
IWL_UCODE_TLV_D3_KEK_KCK_ADDR = 67,

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

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,51 @@ static void iwl_drv_set_dump_exclude(struct iwl_drv *drv,
586586
excl->size = le32_to_cpu(fw->size);
587587
}
588588

589+
static void iwl_parse_dbg_tlv_assert_tables(struct iwl_drv *drv,
590+
const struct iwl_ucode_tlv *tlv)
591+
{
592+
const struct iwl_fw_ini_region_tlv *region;
593+
u32 length = le32_to_cpu(tlv->length);
594+
u32 addr;
595+
596+
if (length < offsetof(typeof(*region), special_mem) +
597+
sizeof(region->special_mem))
598+
return;
599+
600+
region = (void *)tlv->data;
601+
addr = le32_to_cpu(region->special_mem.base_addr);
602+
addr += le32_to_cpu(region->special_mem.offset);
603+
addr &= ~FW_ADDR_CACHE_CONTROL;
604+
605+
if (region->type != IWL_FW_INI_REGION_SPECIAL_DEVICE_MEMORY)
606+
return;
607+
608+
switch (region->sub_type) {
609+
case IWL_FW_INI_REGION_DEVICE_MEMORY_SUBTYPE_UMAC_ERROR_TABLE:
610+
drv->trans->dbg.umac_error_event_table = addr;
611+
drv->trans->dbg.error_event_table_tlv_status |=
612+
IWL_ERROR_EVENT_TABLE_UMAC;
613+
break;
614+
case IWL_FW_INI_REGION_DEVICE_MEMORY_SUBTYPE_LMAC_1_ERROR_TABLE:
615+
drv->trans->dbg.lmac_error_event_table[0] = addr;
616+
drv->trans->dbg.error_event_table_tlv_status |=
617+
IWL_ERROR_EVENT_TABLE_LMAC1;
618+
break;
619+
case IWL_FW_INI_REGION_DEVICE_MEMORY_SUBTYPE_LMAC_2_ERROR_TABLE:
620+
drv->trans->dbg.lmac_error_event_table[1] = addr;
621+
drv->trans->dbg.error_event_table_tlv_status |=
622+
IWL_ERROR_EVENT_TABLE_LMAC2;
623+
break;
624+
case IWL_FW_INI_REGION_DEVICE_MEMORY_SUBTYPE_TCM_1_ERROR_TABLE:
625+
drv->trans->dbg.tcm_error_event_table = addr;
626+
drv->trans->dbg.error_event_table_tlv_status |=
627+
IWL_ERROR_EVENT_TABLE_TCM;
628+
break;
629+
default:
630+
break;
631+
}
632+
}
633+
589634
static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
590635
const struct firmware *ucode_raw,
591636
struct iwl_firmware_pieces *pieces,
@@ -1153,21 +1198,12 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
11531198
IWL_ERROR_EVENT_TABLE_LMAC1;
11541199
break;
11551200
}
1156-
case IWL_UCODE_TLV_TCM_DEBUG_ADDRS: {
1157-
struct iwl_fw_tcm_error_addr *ptr = (void *)tlv_data;
1158-
1159-
if (tlv_len != sizeof(*ptr))
1160-
goto invalid_tlv_len;
1161-
drv->trans->dbg.tcm_error_event_table =
1162-
le32_to_cpu(ptr->addr) & ~FW_ADDR_CACHE_CONTROL;
1163-
drv->trans->dbg.error_event_table_tlv_status |=
1164-
IWL_ERROR_EVENT_TABLE_TCM;
1165-
break;
1166-
}
1201+
case IWL_UCODE_TLV_TYPE_REGIONS:
1202+
iwl_parse_dbg_tlv_assert_tables(drv, tlv);
1203+
fallthrough;
11671204
case IWL_UCODE_TLV_TYPE_DEBUG_INFO:
11681205
case IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION:
11691206
case IWL_UCODE_TLV_TYPE_HCMD:
1170-
case IWL_UCODE_TLV_TYPE_REGIONS:
11711207
case IWL_UCODE_TLV_TYPE_TRIGGERS:
11721208
case IWL_UCODE_TLV_TYPE_CONF_SET:
11731209
if (iwlwifi_mod_params.enable_ini)

0 commit comments

Comments
 (0)