Skip to content

Commit

Permalink
iwlwifi: dbg_ini: add monitor dumping support
Browse files Browse the repository at this point in the history
Allow collecting monitor data in ini debug mode.
Implement both SMEM and DRAM monitor regions dumping.
For DRAM monitor, support DBGC1, DBGC2 and DBGC3 and support several
DRAM fragments per DBGC.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
  • Loading branch information
Shahar S Matityahu authored and Luca Coelho committed Oct 25, 2019
1 parent 69f0e50 commit 593fae3
Show file tree
Hide file tree
Showing 10 changed files with 440 additions and 54 deletions.
55 changes: 48 additions & 7 deletions drivers/net/wireless/intel/iwlwifi/cfg/22000.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#include <linux/module.h>
#include <linux/stringify.h>
#include "iwl-config.h"
#include "iwl-prph.h"

/* Highest firmware API version supported */
#define IWL_22000_UCODE_API_MAX 50
Expand Down Expand Up @@ -183,23 +184,49 @@ static const struct iwl_ht_params iwl_22000_ht_params = {
.min_umac_error_event_table = 0x400000, \
.d3_debug_data_base_addr = 0x401000, \
.d3_debug_data_length = 60 * 1024, \
.fw_mon_smem_write_ptr_addr = 0xa0c16c, \
.fw_mon_smem_write_ptr_msk = 0xfffff, \
.fw_mon_smem_cycle_cnt_ptr_addr = 0xa0c174, \
.fw_mon_smem_cycle_cnt_ptr_msk = 0xfffff
.mon_smem_regs = { \
.write_ptr = { \
.addr = LDBG_M2S_BUF_WPTR, \
.mask = LDBG_M2S_BUF_WPTR_VAL_MSK, \
}, \
.cycle_cnt = { \
.addr = LDBG_M2S_BUF_WRAP_CNT, \
.mask = LDBG_M2S_BUF_WRAP_CNT_VAL_MSK, \
}, \
}

#define IWL_DEVICE_22500 \
IWL_DEVICE_22000_COMMON, \
.trans.device_family = IWL_DEVICE_FAMILY_22000, \
.trans.base_params = &iwl_22000_base_params, \
.trans.csr = &iwl_csr_v1, \
.gp2_reg_addr = 0xa02c68
.gp2_reg_addr = 0xa02c68, \
.mon_dram_regs = { \
.write_ptr = { \
.addr = MON_BUFF_WRPTR_VER2, \
.mask = 0xffffffff, \
}, \
.cycle_cnt = { \
.addr = MON_BUFF_CYCLE_CNT_VER2, \
.mask = 0xffffffff, \
}, \
}

#define IWL_DEVICE_22560 \
IWL_DEVICE_22000_COMMON, \
.trans.device_family = IWL_DEVICE_FAMILY_22560, \
.trans.base_params = &iwl_22560_base_params, \
.trans.csr = &iwl_csr_v2
.trans.csr = &iwl_csr_v2, \
.mon_dram_regs = { \
.write_ptr = { \
.addr = MON_BUFF_WRPTR_VER2, \
.mask = 0xffffffff, \
}, \
.cycle_cnt = { \
.addr = MON_BUFF_CYCLE_CNT_VER2, \
.mask = 0xffffffff, \
}, \
}

#define IWL_DEVICE_AX210 \
IWL_DEVICE_22000_COMMON, \
Expand All @@ -209,7 +236,21 @@ static const struct iwl_ht_params iwl_22000_ht_params = {
.trans.csr = &iwl_csr_v1, \
.min_txq_size = 128, \
.gp2_reg_addr = 0xd02c68, \
.min_256_ba_txq_size = 512
.min_256_ba_txq_size = 512, \
.mon_dram_regs = { \
.write_ptr = { \
.addr = DBGC_CUR_DBGBUF_STATUS, \
.mask = DBGC_CUR_DBGBUF_STATUS_OFFSET_MSK, \
}, \
.cycle_cnt = { \
.addr = DBGC_DBGBUF_WRAP_AROUND, \
.mask = 0xffffffff, \
}, \
.cur_frag = { \
.addr = DBGC_CUR_DBGBUF_STATUS, \
.mask = DBGC_CUR_DBGBUF_STATUS_IDX_MSK, \
}, \
}

const struct iwl_cfg iwl22000_2ac_cfg_hr = {
.name = "Intel(R) Dual Band Wireless AC 22000",
Expand Down
25 changes: 21 additions & 4 deletions drivers/net/wireless/intel/iwlwifi/cfg/9000.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#include <linux/stringify.h>
#include "iwl-config.h"
#include "fw/file.h"
#include "iwl-prph.h"

/* Highest firmware API version supported */
#define IWL9000_UCODE_API_MAX 46
Expand Down Expand Up @@ -149,10 +150,26 @@ static const struct iwl_tt_params iwl9000_tt_params = {
.ht_params = &iwl9000_ht_params, \
.nvm_ver = IWL9000_NVM_VERSION, \
.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, \
.fw_mon_smem_write_ptr_addr = 0xa0476c, \
.fw_mon_smem_write_ptr_msk = 0xfffff, \
.fw_mon_smem_cycle_cnt_ptr_addr = 0xa04774, \
.fw_mon_smem_cycle_cnt_ptr_msk = 0xfffff
.mon_smem_regs = { \
.write_ptr = { \
.addr = LDBG_M2S_BUF_WPTR, \
.mask = LDBG_M2S_BUF_WPTR_VAL_MSK, \
}, \
.cycle_cnt = { \
.addr = LDBG_M2S_BUF_WRAP_CNT, \
.mask = LDBG_M2S_BUF_WRAP_CNT_VAL_MSK, \
}, \
}, \
.mon_dram_regs = { \
.write_ptr = { \
.addr = MON_BUFF_WRPTR_VER2, \
.mask = 0xffffffff, \
}, \
.cycle_cnt = { \
.addr = MON_BUFF_CYCLE_CNT_VER2, \
.mask = 0xffffffff, \
}, \
}


const struct iwl_cfg iwl9160_2ac_cfg = {
Expand Down
41 changes: 19 additions & 22 deletions drivers/net/wireless/intel/iwlwifi/fw/api/dbg-tlv.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,28 +73,6 @@ struct iwl_fw_ini_header {
u8 data[];
} __packed; /* FW_DEBUG_TLV_HEADER_S */

/**
* struct iwl_fw_ini_allocation_tlv - (IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION)
* buffer allocation TLV - for debug
*
* @iwl_fw_ini_header: header
* @allocation_id: &enum iwl_fw_ini_allocation_id - to bind allocation and hcmd
* if needed (DBGC1/DBGC2/SDFX/...)
* @buffer_location: type of iwl_fw_ini_buffer_location
* @size: size in bytes
* @max_fragments: the maximum allowed fragmentation in the desired memory
* allocation above
* @min_frag_size: the minimum allowed fragmentation size in bytes
*/
struct iwl_fw_ini_allocation_tlv {
struct iwl_fw_ini_header header;
__le32 allocation_id;
__le32 buffer_location;
__le32 size;
__le32 max_fragments;
__le32 min_frag_size;
} __packed; /* FW_DEBUG_TLV_BUFFER_ALLOCATION_TLV_S_VER_1 */

/**
* enum iwl_fw_ini_dbg_domain - debug domains
* allows to send host cmd or collect memory region if a given domain is enabled
Expand Down Expand Up @@ -350,6 +328,25 @@ struct iwl_fw_ini_trigger {
__le32 data[];
} __packed; /* FW_TLV_DEBUG_TRIGGER_CONFIG_API_S_VER_1 */

/**
* struct iwl_fw_ini_allocation_tlv - Allocates DRAM buffers
*
* @hdr: debug header
* @alloc_id: allocation id. One of &enum iwl_fw_ini_allocation_id
* @buf_location: buffer location. One of &enum iwl_fw_ini_buffer_location
* @req_size: requested buffer size
* @max_frags_num: maximum number of fragments
* @min_size: minimum buffer size
*/
struct iwl_fw_ini_allocation_tlv {
struct iwl_fw_ini_header hdr;
__le32 alloc_id;
__le32 buf_location;
__le32 req_size;
__le32 max_frags_num;
__le32 min_size;
} __packed; /* FW_TLV_DEBUG_BUFFER_ALLOCATION_API_S_VER_1 */

/**
* struct iwl_fw_ini_trigger_tlv - trigger TLV
*
Expand Down
Loading

0 comments on commit 593fae3

Please sign in to comment.