Skip to content

Commit d3ae691

Browse files
committed
wifi: iwlwifi: fw: fix DBGI dump
The DBGI dump is (unsurprisingly) of type DBGI, not SRAM. This leads to bad register accesses because the union is built differently, there's no allocation ID, and thus the allocation ID ends up being 0x8000. Note that this was already wrong for DRAM vs. SMEM since they use different parts of the union, but the allocation ID is at the same place, so it worked. Fix all of this but set the allocation ID in a way that the offset calculation ends up without any offset. Fixes: 34bc277 ("iwlwifi: yoyo: fix DBGI_SRAM ini dump header.") Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230514120631.19a302ae4c65.I12272599f7c1930666157b9d5e7f81fe9ec4c421@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 204bfec commit d3ae691

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

  • drivers/net/wireless/intel/iwlwifi/fw

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

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,14 +1664,10 @@ static __le32 iwl_get_mon_reg(struct iwl_fw_runtime *fwrt, u32 alloc_id,
16641664
}
16651665

16661666
static void *
1667-
iwl_dump_ini_mon_fill_header(struct iwl_fw_runtime *fwrt,
1668-
struct iwl_dump_ini_region_data *reg_data,
1667+
iwl_dump_ini_mon_fill_header(struct iwl_fw_runtime *fwrt, u32 alloc_id,
16691668
struct iwl_fw_ini_monitor_dump *data,
16701669
const struct iwl_fw_mon_regs *addrs)
16711670
{
1672-
struct iwl_fw_ini_region_tlv *reg = (void *)reg_data->reg_tlv->data;
1673-
u32 alloc_id = le32_to_cpu(reg->dram_alloc_id);
1674-
16751671
if (!iwl_trans_grab_nic_access(fwrt->trans)) {
16761672
IWL_ERR(fwrt, "Failed to get monitor header\n");
16771673
return NULL;
@@ -1702,8 +1698,10 @@ iwl_dump_ini_mon_dram_fill_header(struct iwl_fw_runtime *fwrt,
17021698
void *data, u32 data_len)
17031699
{
17041700
struct iwl_fw_ini_monitor_dump *mon_dump = (void *)data;
1701+
struct iwl_fw_ini_region_tlv *reg = (void *)reg_data->reg_tlv->data;
1702+
u32 alloc_id = le32_to_cpu(reg->dram_alloc_id);
17051703

1706-
return iwl_dump_ini_mon_fill_header(fwrt, reg_data, mon_dump,
1704+
return iwl_dump_ini_mon_fill_header(fwrt, alloc_id, mon_dump,
17071705
&fwrt->trans->cfg->mon_dram_regs);
17081706
}
17091707

@@ -1713,8 +1711,10 @@ iwl_dump_ini_mon_smem_fill_header(struct iwl_fw_runtime *fwrt,
17131711
void *data, u32 data_len)
17141712
{
17151713
struct iwl_fw_ini_monitor_dump *mon_dump = (void *)data;
1714+
struct iwl_fw_ini_region_tlv *reg = (void *)reg_data->reg_tlv->data;
1715+
u32 alloc_id = le32_to_cpu(reg->internal_buffer.alloc_id);
17161716

1717-
return iwl_dump_ini_mon_fill_header(fwrt, reg_data, mon_dump,
1717+
return iwl_dump_ini_mon_fill_header(fwrt, alloc_id, mon_dump,
17181718
&fwrt->trans->cfg->mon_smem_regs);
17191719
}
17201720

@@ -1725,7 +1725,10 @@ iwl_dump_ini_mon_dbgi_fill_header(struct iwl_fw_runtime *fwrt,
17251725
{
17261726
struct iwl_fw_ini_monitor_dump *mon_dump = (void *)data;
17271727

1728-
return iwl_dump_ini_mon_fill_header(fwrt, reg_data, mon_dump,
1728+
return iwl_dump_ini_mon_fill_header(fwrt,
1729+
/* no offset calculation later */
1730+
IWL_FW_INI_ALLOCATION_ID_DBGC1,
1731+
mon_dump,
17291732
&fwrt->trans->cfg->mon_dbgi_regs);
17301733
}
17311734

0 commit comments

Comments
 (0)