From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D8442A0613 for ; Thu, 29 Aug 2019 04:34:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2A75C1C128; Thu, 29 Aug 2019 04:34:25 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id B0B641C0BE for ; Thu, 29 Aug 2019 04:34:20 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Aug 2019 19:34:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,442,1559545200"; d="scan'208";a="332363426" Received: from dpdk51.sh.intel.com ([10.67.110.245]) by orsmga004.jf.intel.com with ESMTP; 28 Aug 2019 19:34:18 -0700 From: Qi Zhang To: wenzhuo.lu@intel.com, qiming.yang@intel.com Cc: dev@dpdk.org, xiaolong.ye@intel.com, Qi Zhang , Anirudh Venkataramanan , Paul M Stillwell Jr Date: Thu, 29 Aug 2019 10:35:55 +0800 Message-Id: <20190829023656.8220-3-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20190829023656.8220-1-qi.z.zhang@intel.com> References: <20190826105105.19121-1-qi.z.zhang@intel.com> <20190829023656.8220-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH v2 02/63] net/ice/base: add function to get FW mode X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add a helper function to get FW mode. The FW mode can be normal, debug, recovery or rollback. This makes ice_is_fw_in_rec_mode redundant, so remove it. Signed-off-by: Anirudh Venkataramanan Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_common.c | 23 ++++++++++++++++------- drivers/net/ice/base/ice_common.h | 4 ++-- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c index 52fd8c897..681740cee 100644 --- a/drivers/net/ice/base/ice_common.c +++ b/drivers/net/ice/base/ice_common.c @@ -4102,16 +4102,25 @@ ice_sched_query_elem(struct ice_hw *hw, u32 node_teid, } /** - * ice_is_fw_in_rec_mode + * ice_get_fw_mode - returns FW mode * @hw: pointer to the HW struct - * - * This function returns true if fw is in recovery mode */ -bool ice_is_fw_in_rec_mode(struct ice_hw *hw) +enum ice_fw_modes ice_get_fw_mode(struct ice_hw *hw) { - u32 reg; +#define ICE_FW_MODE_DBG_M BIT(0) +#define ICE_FW_MODE_REC_M BIT(1) +#define ICE_FW_MODE_ROLLBACK_M BIT(2) + u32 fw_mode; /* check the current FW mode */ - reg = rd32(hw, GL_MNG_FWSM); - return (reg & GL_MNG_FWSM_FW_MODES_M) > ICE_FW_MODE_DBG; + fw_mode = rd32(hw, GL_MNG_FWSM) & GL_MNG_FWSM_FW_MODES_M; + + if (fw_mode & ICE_FW_MODE_DBG_M) + return ICE_FW_MODE_DBG; + else if (fw_mode & ICE_FW_MODE_REC_M) + return ICE_FW_MODE_REC; + else if (fw_mode & ICE_FW_MODE_ROLLBACK_M) + return ICE_FW_MODE_ROLLBACK; + else + return ICE_FW_MODE_NORMAL; } diff --git a/drivers/net/ice/base/ice_common.h b/drivers/net/ice/base/ice_common.h index 2063295ce..1d8701d64 100644 --- a/drivers/net/ice/base/ice_common.h +++ b/drivers/net/ice/base/ice_common.h @@ -14,7 +14,7 @@ enum ice_fw_modes { ICE_FW_MODE_NORMAL, ICE_FW_MODE_DBG, ICE_FW_MODE_REC, - ICE_FW_MODE_DBG_REC + ICE_FW_MODE_ROLLBACK }; enum ice_status ice_nvm_validate_checksum(struct ice_hw *hw); @@ -198,8 +198,8 @@ ice_stat_update40(struct ice_hw *hw, u32 reg, bool prev_stat_loaded, void ice_stat_update32(struct ice_hw *hw, u32 reg, bool prev_stat_loaded, u64 *prev_stat, u64 *cur_stat); +enum ice_fw_modes ice_get_fw_mode(struct ice_hw *hw); enum ice_status ice_sched_query_elem(struct ice_hw *hw, u32 node_teid, struct ice_aqc_get_elem *buf); -bool ice_is_fw_in_rec_mode(struct ice_hw *hw); #endif /* _ICE_COMMON_H_ */ -- 2.13.6