Blame SOURCES/_RHEL8_PATCH_20-45_iwlwifi_print_fseq_info_upon_fw_assert.patch

deb259
Date: Fri, 19 Jul 2019 11:39:47 -0400
deb259
From: Jarod Wilson <jarod@redhat.com>
deb259
To: rhkernel-list@redhat.com
deb259
Cc: Jarod Wilson <jarod@redhat.com>
deb259
Subject: [RHEL8 PATCH 20/45] iwlwifi: print fseq info upon fw assert
deb259
deb259
Bugzilla: http://bugzilla.redhat.com/1728992
deb259
deb259
commit cc5470df4495049170d49466415680ee3c2a9a42
deb259
Author: Shahar S Matityahu <shahar.s.matityahu@intel.com>
deb259
Date:   Wed May 29 16:39:52 2019 +0300
deb259
deb259
    iwlwifi: print fseq info upon fw assert
deb259
deb259
    Read fseq info from FW registers and print it upon fw assert.
deb259
    The print is needed since the fseq version coming from the TLV might
deb259
    not be the actual version that is used.
deb259
deb259
    Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
deb259
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
deb259
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
deb259
deb259
Signed-off-by: Jarod Wilson <jarod@redhat.com>
deb259
---
deb259
 drivers/net/wireless/intel/iwlwifi/fw/dbg.c   | 39 +++++++++++++++++++
deb259
 drivers/net/wireless/intel/iwlwifi/fw/dbg.h   |  2 +
deb259
 drivers/net/wireless/intel/iwlwifi/iwl-prph.h | 15 ++++++-
deb259
 .../net/wireless/intel/iwlwifi/mvm/utils.c    |  2 +
deb259
 .../net/wireless/intel/iwlwifi/pcie/trans.c   |  3 +-
deb259
 5 files changed, 59 insertions(+), 2 deletions(-)
deb259
deb259
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
deb259
index 5f52e40a2903..33d7bc5500db 100644
deb259
--- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
deb259
+++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
deb259
@@ -2747,3 +2747,42 @@ void iwl_fw_dbg_periodic_trig_handler(struct timer_list *t)
deb259
 			  jiffies + msecs_to_jiffies(collect_interval));
deb259
 	}
deb259
 }
deb259
+
deb259
+#define FSEQ_REG(x) { .addr = (x), .str = #x, }
deb259
+
deb259
+void iwl_fw_error_print_fseq_regs(struct iwl_fw_runtime *fwrt)
deb259
+{
deb259
+	struct iwl_trans *trans = fwrt->trans;
deb259
+	unsigned long flags;
deb259
+	int i;
deb259
+	struct {
deb259
+		u32 addr;
deb259
+		const char *str;
deb259
+	} fseq_regs[] = {
deb259
+		FSEQ_REG(FSEQ_ERROR_CODE),
deb259
+		FSEQ_REG(FSEQ_TOP_INIT_VERSION),
deb259
+		FSEQ_REG(FSEQ_CNVIO_INIT_VERSION),
deb259
+		FSEQ_REG(FSEQ_OTP_VERSION),
deb259
+		FSEQ_REG(FSEQ_TOP_CONTENT_VERSION),
deb259
+		FSEQ_REG(FSEQ_ALIVE_TOKEN),
deb259
+		FSEQ_REG(FSEQ_CNVI_ID),
deb259
+		FSEQ_REG(FSEQ_CNVR_ID),
deb259
+		FSEQ_REG(CNVI_AUX_MISC_CHIP),
deb259
+		FSEQ_REG(CNVR_AUX_MISC_CHIP),
deb259
+		FSEQ_REG(CNVR_SCU_SD_REGS_SD_REG_DIG_DCDC_VTRIM),
deb259
+		FSEQ_REG(CNVR_SCU_SD_REGS_SD_REG_ACTIVE_VDIG_MIRROR),
deb259
+	};
deb259
+
deb259
+	if (!iwl_trans_grab_nic_access(trans, &flags))
deb259
+		return;
deb259
+
deb259
+	IWL_ERR(fwrt, "Fseq Registers:\n");
deb259
+
deb259
+	for (i = 0; i < ARRAY_SIZE(fseq_regs); i++)
deb259
+		IWL_ERR(fwrt, "0x%08X | %s\n",
deb259
+			iwl_read_prph_no_grab(trans, fseq_regs[i].addr),
deb259
+			fseq_regs[i].str);
deb259
+
deb259
+	iwl_trans_release_nic_access(trans, &flags);
deb259
+}
deb259
+IWL_EXPORT_SYMBOL(iwl_fw_error_print_fseq_regs);
deb259
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.h b/drivers/net/wireless/intel/iwlwifi/fw/dbg.h
deb259
index 2a9e560a906b..fd0ad220e961 100644
deb259
--- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.h
deb259
+++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.h
deb259
@@ -471,4 +471,6 @@ static inline void iwl_fw_error_collect(struct iwl_fw_runtime *fwrt)
deb259
 }
deb259
 
deb259
 void iwl_fw_dbg_periodic_trig_handler(struct timer_list *t);
deb259
+
deb259
+void iwl_fw_error_print_fseq_regs(struct iwl_fw_runtime *fwrt);
deb259
 #endif  /* __iwl_fw_dbg_h__ */
deb259
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-prph.h b/drivers/net/wireless/intel/iwlwifi/iwl-prph.h
deb259
index 925f308764bf..8d930bfe0727 100644
deb259
--- a/drivers/net/wireless/intel/iwlwifi/iwl-prph.h
deb259
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-prph.h
deb259
@@ -395,7 +395,11 @@ enum {
deb259
 	WFPM_AUX_CTL_AUX_IF_MAC_OWNER_MSK	= 0x80000000,
deb259
 };
deb259
 
deb259
-#define AUX_MISC_REG			0xA200B0
deb259
+#define CNVI_AUX_MISC_CHIP				0xA200B0
deb259
+#define CNVR_AUX_MISC_CHIP				0xA2B800
deb259
+#define CNVR_SCU_SD_REGS_SD_REG_DIG_DCDC_VTRIM		0xA29890
deb259
+#define CNVR_SCU_SD_REGS_SD_REG_ACTIVE_VDIG_MIRROR	0xA29938
deb259
+
deb259
 enum {
deb259
 	HW_STEP_LOCATION_BITS = 24,
deb259
 };
deb259
@@ -447,4 +451,13 @@ enum {
deb259
 
deb259
 #define UREG_DOORBELL_TO_ISR6		0xA05C04
deb259
 #define UREG_DOORBELL_TO_ISR6_NMI_BIT	BIT(0)
deb259
+
deb259
+#define FSEQ_ERROR_CODE			0xA340C8
deb259
+#define FSEQ_TOP_INIT_VERSION		0xA34038
deb259
+#define FSEQ_CNVIO_INIT_VERSION		0xA3403C
deb259
+#define FSEQ_OTP_VERSION		0xA340FC
deb259
+#define FSEQ_TOP_CONTENT_VERSION	0xA340F4
deb259
+#define FSEQ_ALIVE_TOKEN		0xA340F0
deb259
+#define FSEQ_CNVI_ID			0xA3408C
deb259
+#define FSEQ_CNVR_ID			0xA34090
deb259
 #endif				/* __iwl_prph_h__ */
deb259
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
deb259
index b9914efc55c4..cc56ab88fb43 100644
deb259
--- a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
deb259
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
deb259
@@ -596,6 +596,8 @@ void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm)
deb259
 		iwl_mvm_dump_lmac_error_log(mvm, 1);
deb259
 
deb259
 	iwl_mvm_dump_umac_error_log(mvm);
deb259
+
deb259
+	iwl_fw_error_print_fseq_regs(&mvm->fwrt);
deb259
 }
deb259
 
deb259
 int iwl_mvm_reconfig_scd(struct iwl_mvm *mvm, int queue, int fifo, int sta_id,
deb259
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
deb259
index e9d1075d91db..21da18af0155 100644
deb259
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
deb259
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
deb259
@@ -3546,7 +3546,8 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
deb259
 			hw_step |= ENABLE_WFPM;
deb259
 			iwl_write_umac_prph_no_grab(trans, WFPM_CTRL_REG,
deb259
 						    hw_step);
deb259
-			hw_step = iwl_read_prph_no_grab(trans, AUX_MISC_REG);
deb259
+			hw_step = iwl_read_prph_no_grab(trans,
deb259
+							CNVI_AUX_MISC_CHIP);
deb259
 			hw_step = (hw_step >> HW_STEP_LOCATION_BITS) & 0xF;
deb259
 			if (hw_step == 0x3)
deb259
 				trans->hw_rev = (trans->hw_rev & 0xFFFFFFF3) |
deb259
-- 
deb259
2.20.1
deb259
deb259