On 2/27/2017 7:56 AM, Rasesh Mody wrote:
> Add support to send FW version and driver state to Management FW.
>
> Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
<...>
> - return ECORE_SUCCESS;
> + if (IS_PF(p_dev)) {
> + p_hwfn = ECORE_LEADING_HWFN(p_dev);
> + drv_mb_param = (FW_MAJOR_VERSION << 24) |
> + (FW_MINOR_VERSION << 16) |
> + (FW_REVISION_VERSION << 8) |
> + (FW_ENGINEERING_VERSION);
> + rc = ecore_mcp_cmd(p_hwfn, p_hwfn->p_main_ptt,
> + DRV_MSG_CODE_OV_UPDATE_STORM_FW_VER,
> + drv_mb_param, &load_code, ¶m);
> + if (rc != ECORE_SUCCESS) {
> + DP_ERR(p_hwfn, "Failed to send firmware version\n");
> + return rc;
> + }
> +
> + rc = ecore_mcp_ov_update_driver_state(p_hwfn,
> + p_hwfn->p_main_ptt,
> + ECORE_OV_DRIVER_STATE_DISABLED);
Is this something that effects end user, the application that uses this PMD?
> + }
> +
> + return rc;
> }
>
<...>
@@ -1617,8 +1617,9 @@ static void ecore_reset_mb_shadow(struct ecore_hwfn *p_hwfn,
enum _ecore_status_t ecore_hw_init(struct ecore_dev *p_dev,
struct ecore_hw_init_params *p_params)
{
- enum _ecore_status_t rc, mfw_rc;
- u32 load_code, param;
+ enum _ecore_status_t rc = ECORE_SUCCESS, mfw_rc;
+ u32 load_code, param, drv_mb_param;
+ struct ecore_hwfn *p_hwfn;
int i;
if ((p_params->int_mode == ECORE_INT_MODE_MSI) &&
@@ -1751,7 +1752,26 @@ enum _ecore_status_t ecore_hw_init(struct ecore_dev *p_dev,
p_hwfn->hw_init_done = true;
}
- return ECORE_SUCCESS;
+ if (IS_PF(p_dev)) {
+ p_hwfn = ECORE_LEADING_HWFN(p_dev);
+ drv_mb_param = (FW_MAJOR_VERSION << 24) |
+ (FW_MINOR_VERSION << 16) |
+ (FW_REVISION_VERSION << 8) |
+ (FW_ENGINEERING_VERSION);
+ rc = ecore_mcp_cmd(p_hwfn, p_hwfn->p_main_ptt,
+ DRV_MSG_CODE_OV_UPDATE_STORM_FW_VER,
+ drv_mb_param, &load_code, ¶m);
+ if (rc != ECORE_SUCCESS) {
+ DP_ERR(p_hwfn, "Failed to send firmware version\n");
+ return rc;
+ }
+
+ rc = ecore_mcp_ov_update_driver_state(p_hwfn,
+ p_hwfn->p_main_ptt,
+ ECORE_OV_DRIVER_STATE_DISABLED);
+ }
+
+ return rc;
}
#define ECORE_HW_STOP_RETRY_LIMIT (10)
@@ -3138,8 +3158,13 @@ enum _ecore_status_t ecore_hw_prepare(struct ecore_dev *p_dev,
void ecore_hw_remove(struct ecore_dev *p_dev)
{
+ struct ecore_hwfn *p_hwfn = ECORE_LEADING_HWFN(p_dev);
int i;
+ if (IS_PF(p_dev))
+ ecore_mcp_ov_update_driver_state(p_hwfn, p_hwfn->p_main_ptt,
+ ECORE_OV_DRIVER_STATE_NOT_LOADED);
+
for_each_hwfn(p_dev, i) {
struct ecore_hwfn *p_hwfn = &p_dev->hwfns[i];
@@ -1724,6 +1724,9 @@ enum _ecore_status_t
case ECORE_OV_CLIENT_USER:
drv_mb_param = DRV_MB_PARAM_OV_CURR_CFG_OTHER;
break;
+ case ECORE_OV_CLIENT_VENDOR_SPEC:
+ drv_mb_param = DRV_MB_PARAM_OV_CURR_CFG_VENDOR_SPEC;
+ break;
default:
DP_NOTICE(p_hwfn, true, "Invalid client type %d\n", config);
return ECORE_INVAL;
@@ -1762,9 +1765,9 @@ enum _ecore_status_t
}
rc = ecore_mcp_cmd(p_hwfn, p_ptt, DRV_MSG_CODE_OV_UPDATE_DRIVER_STATE,
- drv_state, &resp, ¶m);
+ drv_mb_param, &resp, ¶m);
if (rc != ECORE_SUCCESS)
- DP_ERR(p_hwfn, "MCP response failure, aborting\n");
+ DP_ERR(p_hwfn, "Failed to send driver state\n");
return rc;
}
@@ -181,7 +181,8 @@ enum ecore_ov_config_method {
enum ecore_ov_client {
ECORE_OV_CLIENT_DRV,
- ECORE_OV_CLIENT_USER
+ ECORE_OV_CLIENT_USER,
+ ECORE_OV_CLIENT_VENDOR_SPEC
};
enum ecore_ov_driver_state {
@@ -150,8 +150,11 @@ struct qed_common_ops {
uint16_t sb_id, enum qed_sb_type type);
bool (*can_link_change)(struct ecore_dev *edev);
+
void (*update_msglvl)(struct ecore_dev *edev,
uint32_t dp_module, uint8_t dp_level);
+
+ int (*send_drv_state)(struct ecore_dev *edev, bool active);
};
#endif /* _QEDE_IF_H */
@@ -668,6 +668,25 @@ static void qed_remove(struct ecore_dev *edev)
ecore_hw_remove(edev);
}
+static int qed_send_drv_state(struct ecore_dev *edev, bool active)
+{
+ struct ecore_hwfn *hwfn = ECORE_LEADING_HWFN(edev);
+ struct ecore_ptt *ptt;
+ int status = 0;
+
+ ptt = ecore_ptt_acquire(hwfn);
+ if (!ptt)
+ return -EAGAIN;
+
+ status = ecore_mcp_ov_update_driver_state(hwfn, ptt, active ?
+ ECORE_OV_DRIVER_STATE_ACTIVE :
+ ECORE_OV_DRIVER_STATE_DISABLED);
+
+ ecore_ptt_release(hwfn, ptt);
+
+ return status;
+}
+
const struct qed_common_ops qed_common_ops_pass = {
INIT_STRUCT_FIELD(probe, &qed_probe),
INIT_STRUCT_FIELD(update_pf_params, &qed_update_pf_params),
@@ -681,4 +700,5 @@ static void qed_remove(struct ecore_dev *edev)
INIT_STRUCT_FIELD(drain, &qed_drain),
INIT_STRUCT_FIELD(slowpath_stop, &qed_slowpath_stop),
INIT_STRUCT_FIELD(remove, &qed_remove),
+ INIT_STRUCT_FIELD(send_drv_state, &qed_send_drv_state),
};