iwlwifi: mvm: change SMEM dump to general purpose memory dump
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Tue, 9 Dec 2014 12:36:41 +0000 (14:36 +0200)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Sun, 28 Dec 2014 18:00:17 +0000 (20:00 +0200)
Instead of adding a dump type for each type of memory, change
the SMEM type to be a general purpose memory dump. Add the
type of the memory and its offset in the device in the dump
itself. This will allow an external parser to know where
this memory came from.

Note that since this type isn't really in use yet, this is
not a real problem.

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

index c6a81a760cf6806c17ebcb2a578bce1d682c3cc9..c0fe82c130070d5ec6376e531c3b10f78180e625 100644 (file)
@@ -82,7 +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:
+ * @IWL_FW_ERROR_DUMP_MEM: chunk of memory
  */
 enum iwl_fw_error_dump_type {
        IWL_FW_ERROR_DUMP_SRAM = 0,
@@ -94,7 +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_MEM = 9,
 
        IWL_FW_ERROR_DUMP_MAX,
 };
@@ -182,6 +182,23 @@ struct iwl_fw_error_dump_prph {
        __le32 data[];
 };
 
+enum iwl_fw_error_dump_mem_type {
+       IWL_FW_ERROR_DUMP_MEM_SRAM,
+       IWL_FW_ERROR_DUMP_MEM_SMEM,
+};
+
+/**
+ * struct iwl_fw_error_dump_mem - chunk of memory
+ * @type: %enum iwl_fw_error_dump_mem_type
+ * @offset: the offset from which the memory was read
+ * @data: the content of the memory
+ */
+struct iwl_fw_error_dump_mem {
+       __le32 type;
+       __le32 offset;
+       u8 data[];
+};
+
 /**
  * iwl_fw_error_next_data - advance fw error dump data pointer
  * @data: previous data block
index d5d1cdaa03109df3498107e02d1a788c5bf4626a..e24de9712476c086bdf1d732f669f23f6f4e8907 100644 (file)
@@ -815,7 +815,8 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
 
        /* Make room for the SMEM, if it exists */
        if (smem_len)
-               file_len += sizeof(*dump_data) + smem_len;
+               file_len += sizeof(*dump_data) +
+                       sizeof(struct iwl_fw_error_dump_mem) + smem_len;
 
        dump_file = vzalloc(file_len);
        if (!dump_file) {
@@ -868,11 +869,16 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
                                 sram_len);
 
        if (smem_len) {
+               struct iwl_fw_error_dump_mem *dump_mem;
+
                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);
+               dump_data->type = cpu_to_le32(IWL_FW_ERROR_DUMP_MEM);
+               dump_data->len = cpu_to_le32(smem_len + sizeof(*dump_mem));
+               dump_mem = (void *)dump_data->data;
+               dump_mem->type = cpu_to_le32(IWL_FW_ERROR_DUMP_MEM_SMEM);
+               dump_mem->offset = cpu_to_le32(mvm->cfg->smem_offset);
                iwl_trans_read_mem_bytes(mvm->trans, mvm->cfg->smem_offset,
-                                        dump_data->data, smem_len);
+                                        dump_mem->data, smem_len);
        }
 
        fw_error_dump->trans_ptr = iwl_trans_dump_data(mvm->trans);