All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiaoyun Li <xiaoyun.li@intel.com>
To: qi.z.zhang@intel.com, wenzhuo.lu@intel.com, ferruh.yigit@intel.com
Cc: dev@dpdk.org, Xiaoyun Li <xiaoyun.li@intel.com>
Subject: [PATCH v2 3/7] net/ixgbe/base: add FW recovery mode check
Date: Mon, 17 Sep 2018 17:28:10 +0800	[thread overview]
Message-ID: <20180917092814.59921-4-xiaoyun.li@intel.com> (raw)
In-Reply-To: <20180917092814.59921-1-xiaoyun.li@intel.com>

Add FM NVM recovery mode check. Allow the software to detect this.

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_api.c  | 12 ++++++++++++
 drivers/net/ixgbe/base/ixgbe_api.h  |  1 +
 drivers/net/ixgbe/base/ixgbe_type.h |  4 ++++
 drivers/net/ixgbe/base/ixgbe_x550.c | 16 ++++++++++++++++
 drivers/net/ixgbe/base/ixgbe_x550.h |  1 +
 5 files changed, 34 insertions(+)

diff --git a/drivers/net/ixgbe/base/ixgbe_api.c b/drivers/net/ixgbe/base/ixgbe_api.c
index 3450d401f..873c07999 100644
--- a/drivers/net/ixgbe/base/ixgbe_api.c
+++ b/drivers/net/ixgbe/base/ixgbe_api.c
@@ -1327,6 +1327,18 @@ void ixgbe_restore_mdd_vf(struct ixgbe_hw *hw, u32 vf)
 		hw->mac.ops.restore_mdd_vf(hw, vf);
 }
 
+/**
+ *  ixgbe_fw_recovery_mode - Check if in FW NVM recovery mode
+ *  @hw: pointer to hardware structure
+ *
+ **/
+bool ixgbe_fw_recovery_mode(struct ixgbe_hw *hw)
+{
+	if (hw->mac.ops.fw_recovery_mode)
+		return hw->mac.ops.fw_recovery_mode(hw);
+	return false;
+}
+
 /**
  *  ixgbe_enter_lplu - Transition to low power states
  *  @hw: pointer to hardware structure
diff --git a/drivers/net/ixgbe/base/ixgbe_api.h b/drivers/net/ixgbe/base/ixgbe_api.h
index 8ec951e60..ff8f7b261 100644
--- a/drivers/net/ixgbe/base/ixgbe_api.h
+++ b/drivers/net/ixgbe/base/ixgbe_api.h
@@ -185,6 +185,7 @@ void ixgbe_disable_mdd(struct ixgbe_hw *hw);
 void ixgbe_enable_mdd(struct ixgbe_hw *hw);
 void ixgbe_mdd_event(struct ixgbe_hw *hw, u32 *vf_bitmap);
 void ixgbe_restore_mdd_vf(struct ixgbe_hw *hw, u32 vf);
+bool ixgbe_fw_recovery_mode(struct ixgbe_hw *hw);
 s32 ixgbe_enter_lplu(struct ixgbe_hw *hw);
 s32 ixgbe_handle_lasi(struct ixgbe_hw *hw);
 void ixgbe_set_rate_select_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed);
diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index ff3546ece..ea34bb979 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -1067,6 +1067,9 @@ struct ixgbe_dmac_config {
 #define IXGBE_FWSM_MODE_MASK	0xE
 #define IXGBE_FWSM_TS_ENABLED	0x1
 #define IXGBE_FWSM_FW_MODE_PT	0x4
+#define IXGBE_FWSM_FW_NVM_RECOVERY_MODE (1 << 5)
+#define IXGBE_FWSM_EXT_ERR_IND_MASK 0x01F80000
+#define IXGBE_FWSM_FW_VAL_BIT	(1 << 15)
 
 /* ARC Subsystem registers */
 #define IXGBE_HICR		0x15F00
@@ -4016,6 +4019,7 @@ struct ixgbe_mac_operations {
 	void (*enable_mdd)(struct ixgbe_hw *hw);
 	void (*mdd_event)(struct ixgbe_hw *hw, u32 *vf_bitmap);
 	void (*restore_mdd_vf)(struct ixgbe_hw *hw, u32 vf);
+	bool (*fw_recovery_mode)(struct ixgbe_hw *hw);
 };
 
 struct ixgbe_phy_operations {
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index a44d95e95..c9f1563a9 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -53,6 +53,7 @@ s32 ixgbe_init_ops_X550(struct ixgbe_hw *hw)
 	mac->ops.enable_mdd = ixgbe_enable_mdd_X550;
 	mac->ops.mdd_event = ixgbe_mdd_event_X550;
 	mac->ops.restore_mdd_vf = ixgbe_restore_mdd_vf_X550;
+	mac->ops.fw_recovery_mode = ixgbe_fw_recovery_mode_X550;
 	mac->ops.disable_rx = ixgbe_disable_rx_x550;
 	/* Manageability interface */
 	mac->ops.set_fw_drv_ver = ixgbe_set_fw_drv_ver_x550;
@@ -4632,3 +4633,18 @@ s32 ixgbe_set_fw_drv_ver_x550(struct ixgbe_hw *hw, u8 maj, u8 min,
 
 	return ret_val;
 }
+
+/**
+ * ixgbe_fw_recovery_mode_X550 - Check FW NVM recovery mode
+ * @hw: pointer t hardware structure
+ *
+ * Returns true if in FW NVM recovery mode.
+ **/
+bool ixgbe_fw_recovery_mode_X550(struct ixgbe_hw *hw)
+{
+	u32 fwsm;
+
+	fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM_BY_MAC(hw));
+
+	return !!(fwsm & IXGBE_FWSM_FW_NVM_RECOVERY_MODE);
+}
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.h b/drivers/net/ixgbe/base/ixgbe_x550.h
index f90007ce8..3bd98f243 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.h
+++ b/drivers/net/ixgbe/base/ixgbe_x550.h
@@ -92,4 +92,5 @@ s32 ixgbe_reset_phy_t_X550em(struct ixgbe_hw *hw);
 s32 ixgbe_identify_sfp_module_X550em(struct ixgbe_hw *hw);
 s32 ixgbe_led_on_t_X550em(struct ixgbe_hw *hw, u32 led_idx);
 s32 ixgbe_led_off_t_X550em(struct ixgbe_hw *hw, u32 led_idx);
+bool ixgbe_fw_recovery_mode_X550(struct ixgbe_hw *hw);
 #endif /* _IXGBE_X550_H_ */
-- 
2.17.1

  parent reply	other threads:[~2018-09-17  9:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-10 16:37 [PATCH 0/8] update ixgbe base code Xiaoyun Li
2018-09-10 16:37 ` [PATCH 1/8] net/ixgbe/base: update the license Xiaoyun Li
2018-09-10 16:37 ` [PATCH 2/8] net/ixgbe/base: cleanup codes Xiaoyun Li
2018-09-13  9:02   ` Ferruh Yigit
2018-09-17  6:46     ` Li, Xiaoyun
2018-09-10 16:37 ` [PATCH 3/8] net/ixgbe/base: add FW recovery mode check Xiaoyun Li
2018-09-10 16:37 ` [PATCH 4/8] net/ixgbe/base: relpace an operation in X550 setup Xiaoyun Li
2018-09-10 16:37 ` [PATCH 5/8] net/ixgbe/base: update X550 SFP identification Xiaoyun Li
2018-09-10 16:37 ` [PATCH 6/8] net/ixgbe/base: add support for DCB registers dump Xiaoyun Li
2018-09-10 16:37 ` [PATCH 7/8] net/ixgbe: remove Light Spring code Xiaoyun Li
2018-09-10 16:37 ` [PATCH 8/8] net/ixgbe/base: update README file Xiaoyun Li
2018-09-13  2:16 ` [PATCH 0/8] update ixgbe base code Zhang, Qi Z
2018-09-17  9:28 ` [PATCH v2 0/7] " Xiaoyun Li
2018-09-17  9:28   ` [PATCH v2 1/7] net/ixgbe/base: update the license Xiaoyun Li
2018-09-17  9:28   ` [PATCH v2 2/7] net/ixgbe/base: cleanup codes Xiaoyun Li
2018-09-17  9:28   ` Xiaoyun Li [this message]
2018-09-17  9:28   ` [PATCH v2 4/7] net/ixgbe/base: relpace an operation in X550 setup Xiaoyun Li
2018-09-17  9:28   ` [PATCH v2 5/7] net/ixgbe/base: update X550 SFP identification Xiaoyun Li
2018-09-17  9:28   ` [PATCH v2 6/7] net/ixgbe/base: add support for DCB registers dump Xiaoyun Li
2018-09-17  9:28   ` [PATCH v2 7/7] net/ixgbe/base: update README file Xiaoyun Li
2018-09-19 14:31   ` [PATCH v2 0/7] update ixgbe base code Zhang, Qi Z

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180917092814.59921-4-xiaoyun.li@intel.com \
    --to=xiaoyun.li@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=wenzhuo.lu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.