qed: Send pf-flr as part of initialization
authorMintz, Yuval <Yuval.Mintz@cavium.com>
Tue, 28 Mar 2017 12:12:53 +0000 (15:12 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 29 Mar 2017 01:05:23 +0000 (18:05 -0700)
During HW initialization, driver would set various registers to their
needed values - but it assumes all registers start at their reset-value,
so there's no need to re-configure a register's default value.

This assumption might be incorrect, e.g., in case of preboot driver
running and initializing the driver prior to our driver.

To overcome this, we now ask management firmware to initiate a PF-flr
early during the initialization sequence. That would return everything
in the PF's scope back to default and prevent previous configurations
from still being applied.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qed/qed_dev.c
drivers/net/ethernet/qlogic/qed/qed_hsi.h
drivers/net/ethernet/qlogic/qed/qed_mcp.c
drivers/net/ethernet/qlogic/qed/qed_mcp.h

index 759b819935e4b01e562aa6d861fb319ecbafcd3c..e4b1450ace0cbd5a19c1dfc8fe7dc7c197eca6ec 100644 (file)
@@ -2280,6 +2280,15 @@ static int qed_hw_prepare_single(struct qed_hwfn *p_hwfn,
                goto err2;
        }
 
+       /* Sending a mailbox to the MFW should be done after qed_get_hw_info()
+        * is called as it sets the ports number in an engine.
+        */
+       if (IS_LEAD_HWFN(p_hwfn)) {
+               rc = qed_mcp_initiate_pf_flr(p_hwfn, p_hwfn->p_main_ptt);
+               if (rc)
+                       DP_NOTICE(p_hwfn, "Failed to initiate PF FLR\n");
+       }
+
        /* Allocate the init RT array and initialize the init-ops engine */
        rc = qed_init_alloc(p_hwfn);
        if (rc)
index bf2b20167aca474b3977c06d4938a04997bd5680..2de7aa17f46e3fdbda505510afcadf8aec111e5f 100644 (file)
@@ -10093,6 +10093,7 @@ struct public_drv_mb {
 #define DRV_MSG_CODE_BW_UPDATE_ACK             0x32000000
 #define DRV_MSG_CODE_NIG_DRAIN                 0x30000000
 #define DRV_MSG_GET_RESOURCE_ALLOC_MSG          0x34000000
+#define DRV_MSG_CODE_INITIATE_PF_FLR            0x02010000
 #define DRV_MSG_CODE_VF_DISABLED_DONE          0xc0000000
 #define DRV_MSG_CODE_CFG_VF_MSIX               0xc0010000
 #define DRV_MSG_CODE_NVM_GET_FILE_ATT          0x00030000
index 1a820b4b1b8c1cafd4f175aaadc2e5be350edef3..490619f7e550beaee555740d4c16b691b3b082e0 100644 (file)
@@ -2263,3 +2263,11 @@ int qed_mcp_get_resc_info(struct qed_hwfn *p_hwfn,
 
        return 0;
 }
+
+int qed_mcp_initiate_pf_flr(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
+{
+       u32 mcp_resp, mcp_param;
+
+       return qed_mcp_cmd(p_hwfn, p_ptt, DRV_MSG_CODE_INITIATE_PF_FLR, 0,
+                          &mcp_resp, &mcp_param);
+}
index f76afec957da1da1b141e2aae17ee14fd3387b97..0056cfe69b6a17690ce076a923f099182ef049f5 100644 (file)
@@ -770,4 +770,14 @@ int qed_mcp_get_resc_info(struct qed_hwfn *p_hwfn,
                          struct qed_ptt *p_ptt,
                          struct resource_info *p_resc_info,
                          u32 *p_mcp_resp, u32 *p_mcp_param);
+
+/**
+ * @brief - Initiates PF FLR
+ *
+ *  @param p_hwfn
+ *  @param p_ptt
+ *
+ * @return int - 0 - operation was successful.
+ */
+int qed_mcp_initiate_pf_flr(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
 #endif