iwlwifi: mvm: add smem content to dump data
authorLiad Kaufman <liad.kaufman@intel.com>
Tue, 2 Dec 2014 09:16:04 +0000 (11:16 +0200)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Sun, 28 Dec 2014 18:00:16 +0000 (20:00 +0200)
In NICs that have SMEM - add its content to the dump data
for later debug.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
drivers/net/wireless/iwlwifi/iwl-8000.c
drivers/net/wireless/iwlwifi/iwl-config.h
drivers/net/wireless/iwlwifi/iwl-fw-error-dump.h
drivers/net/wireless/iwlwifi/mvm/mac80211.c

index 8f64928aeb421260e19d527dba15fbdf1240a15b..46e9c9ac6ba205235b150754318eddf067f00ba9 100644 (file)
 #define IWL8000_NVM_VERSION            0x0a1d
 #define IWL8000_TX_POWER_VERSION       0xffff /* meaningless */
 
-/* DCCM offsets and lengths */
+/* Memory offsets and lengths */
 #define IWL8260_DCCM_OFFSET            0x800000
 #define IWL8260_DCCM_LEN               0x18000
+#define IWL8260_SMEM_OFFSET            0x400000
+#define IWL8260_SMEM_LEN               0x68000
 
 #define IWL8000_FW_PRE "iwlwifi-8000"
 #define IWL8000_MODULE_FIRMWARE(api) \
@@ -131,7 +133,9 @@ static const struct iwl_ht_params iwl8000_ht_params = {
        .d0i3 = true,                                           \
        .non_shared_ant = ANT_A,                                \
        .dccm_offset = IWL8260_DCCM_OFFSET,                     \
-       .dccm_len = IWL8260_DCCM_LEN
+       .dccm_len = IWL8260_DCCM_LEN,                           \
+       .smem_offset = IWL8260_SMEM_OFFSET,                     \
+       .smem_len = IWL8260_SMEM_LEN
 
 const struct iwl_cfg iwl8260_2n_cfg = {
        .name = "Intel(R) Dual Band Wireless N 8260",
index 2daabab7ec3f6f172e9179136d562556f9096198..398505121b5900a23b26698a12d6f7138faae04d 100644 (file)
@@ -263,6 +263,8 @@ struct iwl_pwr_tx_backoff {
  *     station can receive in VHT
  * @dccm_offset: offset from which DCCM begins
  * @dccm_len: length of DCCM (including runtime stack CCM)
+ * @smem_offset: offset from which the SMEM begins
+ * @smem_len: the length of SMEM
  *
  * We enable the driver to be backward compatible wrt. hardware features.
  * API differences in uCode shouldn't be handled here but through TLVs
@@ -308,6 +310,8 @@ struct iwl_cfg {
        unsigned int max_vht_ampdu_exponent;
        const u32 dccm_offset;
        const u32 dccm_len;
+       const u32 smem_offset;
+       const u32 smem_len;
 };
 
 /*
index 20a8a64c9fe31dd5e1b9b2244b6ca86b19868fd4..c6a81a760cf6806c17ebcb2a578bce1d682c3cc9 100644 (file)
@@ -82,6 +82,7 @@
  * @IWL_FW_ERROR_DUMP_PRPH: range of periphery registers - there can be several
  *     sections like this in a single file.
  * @IWL_FW_ERROR_DUMP_FH_REGS: range of FH registers
+ * @IWL_FW_ERROR_DUMP_SMEM:
  */
 enum iwl_fw_error_dump_type {
        IWL_FW_ERROR_DUMP_SRAM = 0,
@@ -93,6 +94,7 @@ enum iwl_fw_error_dump_type {
        IWL_FW_ERROR_DUMP_PRPH = 6,
        IWL_FW_ERROR_DUMP_TXF = 7,
        IWL_FW_ERROR_DUMP_FH_REGS = 8,
+       IWL_FW_ERROR_DUMP_SMEM = 9,
 
        IWL_FW_ERROR_DUMP_MAX,
 };
index f53bfd6e8df818c6baf1777d960c6e61a0247bd7..d5d1cdaa03109df3498107e02d1a788c5bf4626a 100644 (file)
@@ -774,9 +774,16 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
        u32 file_len, rxf_len;
        unsigned long flags;
        int reg_val;
+       u32 smem_len = mvm->cfg->smem_len;
 
        lockdep_assert_held(&mvm->mutex);
 
+       /* W/A for 8000 HW family A-step */
+       if (mvm->cfg->smem_len &&
+           mvm->cfg->device_family == IWL_DEVICE_FAMILY_8000 &&
+           CSR_HW_REV_STEP(mvm->trans->hw_rev) == SILICON_A_STEP)
+               smem_len = 0x38000;
+
        fw_error_dump = kzalloc(sizeof(*fw_error_dump), GFP_KERNEL);
        if (!fw_error_dump)
                return;
@@ -806,6 +813,10 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
                   rxf_len +
                   sizeof(*dump_info);
 
+       /* Make room for the SMEM, if it exists */
+       if (smem_len)
+               file_len += sizeof(*dump_data) + smem_len;
+
        dump_file = vzalloc(file_len);
        if (!dump_file) {
                kfree(fw_error_dump);
@@ -856,6 +867,14 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
        iwl_trans_read_mem_bytes(mvm->trans, sram_ofs, dump_data->data,
                                 sram_len);
 
+       if (smem_len) {
+               dump_data = iwl_fw_error_next_data(dump_data);
+               dump_data->type = cpu_to_le32(IWL_FW_ERROR_DUMP_SMEM);
+               dump_data->len = cpu_to_le32(smem_len);
+               iwl_trans_read_mem_bytes(mvm->trans, mvm->cfg->smem_offset,
+                                        dump_data->data, smem_len);
+       }
+
        fw_error_dump->trans_ptr = iwl_trans_dump_data(mvm->trans);
        fw_error_dump->op_mode_len = file_len;
        if (fw_error_dump->trans_ptr)