Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f0afea54 authored by Matti Gottlieb's avatar Matti Gottlieb Committed by Emmanuel Grumbach
Browse files

iwlwifi: mvm: Dump FW's virtual image in the case of a NIC error



When paging is enabled the driver stores part of the FW's
image in the DRAM.

Dump FW's virtual image in the case of a NIC error.

Signed-off-by: default avatarGolan Ben-Ami <golan.ben.ami@intel.com>
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
parent e621c228
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
@@ -86,6 +86,8 @@
 *	Structured as &struct iwl_fw_error_dump_trigger_desc.
 *	Structured as &struct iwl_fw_error_dump_trigger_desc.
 * @IWL_FW_ERROR_DUMP_RB: the content of an RB structured as
 * @IWL_FW_ERROR_DUMP_RB: the content of an RB structured as
 *	&struct iwl_fw_error_dump_rb
 *	&struct iwl_fw_error_dump_rb
 * @IWL_FW_ERROR_PAGING: UMAC's image memory segments which were
 *	paged to the DRAM.
 */
 */
enum iwl_fw_error_dump_type {
enum iwl_fw_error_dump_type {
	/* 0 is deprecated */
	/* 0 is deprecated */
@@ -100,6 +102,7 @@ enum iwl_fw_error_dump_type {
	IWL_FW_ERROR_DUMP_MEM = 9,
	IWL_FW_ERROR_DUMP_MEM = 9,
	IWL_FW_ERROR_DUMP_ERROR_INFO = 10,
	IWL_FW_ERROR_DUMP_ERROR_INFO = 10,
	IWL_FW_ERROR_DUMP_RB = 11,
	IWL_FW_ERROR_DUMP_RB = 11,
	IWL_FW_ERROR_DUMP_PAGING = 12,


	IWL_FW_ERROR_DUMP_MAX,
	IWL_FW_ERROR_DUMP_MAX,
};
};
@@ -239,6 +242,19 @@ struct iwl_fw_error_dump_rb {
	u8 data[];
	u8 data[];
};
};


/**
 * struct iwl_fw_error_dump_paging - content of the UMAC's image page
 *	block on DRAM
 * @index: the index of the page block
 * @reserved:
 * @data: the content of the page block
 */
struct iwl_fw_error_dump_paging {
	__le32 index;
	__le32 reserved;
	u8 data[];
};

/**
/**
 * iwl_fw_error_next_data - advance fw error dump data pointer
 * iwl_fw_error_next_data - advance fw error dump data pointer
 * @data: previous data block
 * @data: previous data block
+27 −0
Original line number Original line Diff line number Diff line
@@ -1192,6 +1192,13 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
	if (sram2_len)
	if (sram2_len)
		file_len += sizeof(*dump_data) + sizeof(*dump_mem) + sram2_len;
		file_len += sizeof(*dump_data) + sizeof(*dump_mem) + sram2_len;


	/* Make room for fw's virtual image pages, if it exists */
	if (mvm->fw->img[mvm->cur_ucode].paging_mem_size)
		file_len += mvm->num_of_paging_blk *
			(sizeof(*dump_data) +
			 sizeof(struct iwl_fw_error_dump_paging) +
			 PAGING_BLOCK_SIZE);

	/* If we only want a monitor dump, reset the file length */
	/* If we only want a monitor dump, reset the file length */
	if (monitor_dump_only) {
	if (monitor_dump_only) {
		file_len = sizeof(*dump_file) + sizeof(*dump_data) +
		file_len = sizeof(*dump_file) + sizeof(*dump_data) +
@@ -1302,6 +1309,26 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
					 dump_mem->data, IWL8260_ICCM_LEN);
					 dump_mem->data, IWL8260_ICCM_LEN);
	}
	}


	/* Dump fw's virtual image */
	if (mvm->fw->img[mvm->cur_ucode].paging_mem_size) {
		u32 i;

		for (i = 1; i < mvm->num_of_paging_blk + 1; i++) {
			struct iwl_fw_error_dump_paging *paging;
			struct page *pages =
				mvm->fw_paging_db[i].fw_paging_block;

			dump_data = iwl_fw_error_next_data(dump_data);
			dump_data->type = cpu_to_le32(IWL_FW_ERROR_DUMP_PAGING);
			dump_data->len = cpu_to_le32(sizeof(*paging) +
						     PAGING_BLOCK_SIZE);
			paging = (void *)dump_data->data;
			paging->index = cpu_to_le32(i);
			memcpy(paging->data, page_address(pages),
			       PAGING_BLOCK_SIZE);
		}
	}

dump_trans_data:
dump_trans_data:
	fw_error_dump->trans_ptr = iwl_trans_dump_data(mvm->trans,
	fw_error_dump->trans_ptr = iwl_trans_dump_data(mvm->trans,
						       mvm->fw_dump_trig);
						       mvm->fw_dump_trig);