From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 1A770A05D3 for ; Mon, 25 Mar 2019 06:47:24 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C7DD77CEB; Mon, 25 Mar 2019 06:44:27 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 38122568A for ; Mon, 25 Mar 2019 06:43:47 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Mar 2019 22:43:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,256,1549958400"; d="scan'208";a="128368800" Received: from dpdk51.sh.intel.com ([10.67.110.245]) by orsmga008.jf.intel.com with ESMTP; 24 Mar 2019 22:43:45 -0700 From: Qi Zhang To: wenzhuo.lu@intel.com, qiming.yang@intel.com Cc: dev@dpdk.org, paul.m.stillwell.jr@intel.com, ferruh.yigit@intel.com, Qi Zhang , Victor Raj Date: Mon, 25 Mar 2019 13:44:43 +0800 Message-Id: <20190325054452.2616-30-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20190325054452.2616-1-qi.z.zhang@intel.com> References: <20190228055650.25237-1-qi.z.zhang@intel.com> <20190325054452.2616-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH v4 29/38] net/ice/base: add function to check FW recovery 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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190325054443.Ztnwq144Sck-hdis4uW0cgkJyE8XGB3D6icH0aC7hYA@z> Code added to check the FW recovery mode. This function will be used by the drivers during init to check whether the FW is in recovery mode or not. If FW is in recovery mode then the drivers need to run in a recovery mode where it can allow only limited operations. Link should be down, allow only certain AQ commands etc. Signed-off-by: Victor Raj Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang Reviewed-by: Qiming Yang Reviewed-by: Wenzhuo Lu --- drivers/net/ice/base/ice_common.c | 15 +++++++++++++++ drivers/net/ice/base/ice_common.h | 8 ++++++++ 2 files changed, 23 insertions(+) diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c index c35a2f91d..2ebf95eed 100644 --- a/drivers/net/ice/base/ice_common.c +++ b/drivers/net/ice/base/ice_common.c @@ -3915,3 +3915,18 @@ ice_sched_query_elem(struct ice_hw *hw, u32 node_teid, ice_debug(hw, ICE_DBG_SCHED, "query element failed\n"); return status; } + +/** + * ice_is_fw_in_rec_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) +{ + u32 reg; + + /* check the current FW mode */ + reg = rd32(hw, GL_MNG_FWSM); + return (reg & GL_MNG_FWSM_FW_MODES_M) > ICE_FW_MODE_DBG; +} diff --git a/drivers/net/ice/base/ice_common.h b/drivers/net/ice/base/ice_common.h index cc7a77747..9665f3204 100644 --- a/drivers/net/ice/base/ice_common.h +++ b/drivers/net/ice/base/ice_common.h @@ -10,6 +10,13 @@ #include "ice_flex_pipe.h" #include "ice_switch.h" +enum ice_fw_modes { + ICE_FW_MODE_NORMAL, + ICE_FW_MODE_DBG, + ICE_FW_MODE_REC, + ICE_FW_MODE_DBG_REC +}; + enum ice_status ice_nvm_validate_checksum(struct ice_hw *hw); void @@ -188,4 +195,5 @@ ice_stat_update32(struct ice_hw *hw, u32 reg, bool prev_stat_loaded, 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