ixgbe/base: add sw-firmware sync for resource sharing on X550em_a
[dpdk.git] / drivers / net / ixgbe / base / ixgbe_api.c
index 1ba7b9a..18f7cbd 100644 (file)
@@ -34,6 +34,28 @@ POSSIBILITY OF SUCH DAMAGE.
 #include "ixgbe_api.h"
 #include "ixgbe_common.h"
 
+#define IXGBE_EMPTY_PARAM
+
+static const u32 ixgbe_mvals_base[IXGBE_MVALS_IDX_LIMIT] = {
+       IXGBE_MVALS_INIT(IXGBE_EMPTY_PARAM)
+};
+
+static const u32 ixgbe_mvals_X540[IXGBE_MVALS_IDX_LIMIT] = {
+       IXGBE_MVALS_INIT(_X540)
+};
+
+static const u32 ixgbe_mvals_X550[IXGBE_MVALS_IDX_LIMIT] = {
+       IXGBE_MVALS_INIT(_X550)
+};
+
+static const u32 ixgbe_mvals_X550EM_x[IXGBE_MVALS_IDX_LIMIT] = {
+       IXGBE_MVALS_INIT(_X550EM_x)
+};
+
+static const u32 ixgbe_mvals_X550EM_a[IXGBE_MVALS_IDX_LIMIT] = {
+       IXGBE_MVALS_INIT(_X550EM_a)
+};
+
 /**
  * ixgbe_dcb_get_rtrup2tc - read rtrup2tc reg
  * @hw: pointer to hardware structure
@@ -84,18 +106,21 @@ s32 ixgbe_init_shared_code(struct ixgbe_hw *hw)
                status = ixgbe_init_ops_X550(hw);
                break;
        case ixgbe_mac_X550EM_x:
+       case ixgbe_mac_X550EM_a:
                status = ixgbe_init_ops_X550EM(hw);
                break;
        case ixgbe_mac_82599_vf:
        case ixgbe_mac_X540_vf:
        case ixgbe_mac_X550_vf:
        case ixgbe_mac_X550EM_x_vf:
+       case ixgbe_mac_X550EM_a_vf:
                status = ixgbe_init_ops_vf(hw);
                break;
        default:
                status = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
                break;
        }
+       hw->mac.max_link_up_time = IXGBE_LINK_UP_TIME;
 
        return status;
 }
@@ -119,6 +144,8 @@ s32 ixgbe_set_mac_type(struct ixgbe_hw *hw)
                return IXGBE_ERR_DEVICE_NOT_SUPPORTED;
        }
 
+       hw->mvals = ixgbe_mvals_base;
+
        switch (hw->device_id) {
        case IXGBE_DEV_ID_82598:
        case IXGBE_DEV_ID_82598_BX:
@@ -159,13 +186,17 @@ s32 ixgbe_set_mac_type(struct ixgbe_hw *hw)
        case IXGBE_DEV_ID_X540_VF:
        case IXGBE_DEV_ID_X540_VF_HV:
                hw->mac.type = ixgbe_mac_X540_vf;
+               hw->mvals = ixgbe_mvals_X540;
                break;
        case IXGBE_DEV_ID_X540T:
        case IXGBE_DEV_ID_X540T1:
                hw->mac.type = ixgbe_mac_X540;
+               hw->mvals = ixgbe_mvals_X540;
                break;
        case IXGBE_DEV_ID_X550T:
+       case IXGBE_DEV_ID_X550T1:
                hw->mac.type = ixgbe_mac_X550;
+               hw->mvals = ixgbe_mvals_X550;
                break;
        case IXGBE_DEV_ID_X550EM_X_KX4:
        case IXGBE_DEV_ID_X550EM_X_KR:
@@ -173,14 +204,34 @@ s32 ixgbe_set_mac_type(struct ixgbe_hw *hw)
        case IXGBE_DEV_ID_X550EM_X_1G_T:
        case IXGBE_DEV_ID_X550EM_X_SFP:
                hw->mac.type = ixgbe_mac_X550EM_x;
+               hw->mvals = ixgbe_mvals_X550EM_x;
+               break;
+       case IXGBE_DEV_ID_X550EM_A_KR:
+       case IXGBE_DEV_ID_X550EM_A_KR_L:
+       case IXGBE_DEV_ID_X550EM_A_SFP_N:
+       case IXGBE_DEV_ID_X550EM_A_1G_T:
+       case IXGBE_DEV_ID_X550EM_A_1G_T_L:
+       case IXGBE_DEV_ID_X550EM_A_10G_T:
+       case IXGBE_DEV_ID_X550EM_A_QSFP:
+       case IXGBE_DEV_ID_X550EM_A_QSFP_N:
+       case IXGBE_DEV_ID_X550EM_A_SFP:
+               hw->mac.type = ixgbe_mac_X550EM_a;
+               hw->mvals = ixgbe_mvals_X550EM_a;
                break;
        case IXGBE_DEV_ID_X550_VF:
        case IXGBE_DEV_ID_X550_VF_HV:
                hw->mac.type = ixgbe_mac_X550_vf;
+               hw->mvals = ixgbe_mvals_X550;
                break;
        case IXGBE_DEV_ID_X550EM_X_VF:
        case IXGBE_DEV_ID_X550EM_X_VF_HV:
                hw->mac.type = ixgbe_mac_X550EM_x_vf;
+               hw->mvals = ixgbe_mvals_X550EM_x;
+               break;
+       case IXGBE_DEV_ID_X550EM_A_VF:
+       case IXGBE_DEV_ID_X550EM_A_VF_HV:
+               hw->mac.type = ixgbe_mac_X550EM_a_vf;
+               hw->mvals = ixgbe_mvals_X550EM_a;
                break;
        default:
                ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
@@ -659,6 +710,22 @@ s32 ixgbe_setup_link(struct ixgbe_hw *hw, ixgbe_link_speed speed,
                               IXGBE_NOT_IMPLEMENTED);
 }
 
+/**
+ *  ixgbe_setup_mac_link - Set link speed
+ *  @hw: pointer to hardware structure
+ *  @speed: new link speed
+ *
+ *  Configures link settings.  Restarts the link.
+ *  Performs autonegotiation if needed.
+ **/
+s32 ixgbe_setup_mac_link(struct ixgbe_hw *hw, ixgbe_link_speed speed,
+                        bool autoneg_wait_to_complete)
+{
+       return ixgbe_call_func(hw, hw->mac.ops.setup_mac_link, (hw, speed,
+                              autoneg_wait_to_complete),
+                              IXGBE_NOT_IMPLEMENTED);
+}
+
 /**
  *  ixgbe_get_link_capabilities - Returns link capabilities
  *  @hw: pointer to hardware structure
@@ -1052,6 +1119,18 @@ s32 ixgbe_fc_enable(struct ixgbe_hw *hw)
                               IXGBE_NOT_IMPLEMENTED);
 }
 
+/**
+ *  ixgbe_setup_fc - Set up flow control
+ *  @hw: pointer to hardware structure
+ *
+ *  Called at init time to set up flow control.
+ **/
+s32 ixgbe_setup_fc(struct ixgbe_hw *hw)
+{
+       return ixgbe_call_func(hw, hw->mac.ops.setup_fc, (hw),
+               IXGBE_NOT_IMPLEMENTED);
+}
+
 /**
  * ixgbe_set_fw_drv_ver - Try to send the driver version number FW
  * @hw: pointer to hardware structure
@@ -1251,6 +1330,36 @@ void ixgbe_restore_mdd_vf(struct ixgbe_hw *hw, u32 vf)
                hw->mac.ops.restore_mdd_vf(hw, vf);
 }
 
+/**
+ *  ixgbe_enter_lplu - Transition to low power states
+ *  @hw: pointer to hardware structure
+ *
+ * Configures Low Power Link Up on transition to low power states
+ * (from D0 to non-D0).
+ **/
+s32 ixgbe_enter_lplu(struct ixgbe_hw *hw)
+{
+       return ixgbe_call_func(hw, hw->phy.ops.enter_lplu, (hw),
+                               IXGBE_NOT_IMPLEMENTED);
+}
+
+/**
+ * ixgbe_handle_lasi - Handle external Base T PHY interrupt
+ * @hw: pointer to hardware structure
+ *
+ * Handle external Base T PHY interrupt. If high temperature
+ * failure alarm then return error, else if link status change
+ * then setup internal/external PHY link
+ *
+ * Return IXGBE_ERR_OVERTEMP if interrupt is high temperature
+ * failure alarm, else return PHY access status.
+ */
+s32 ixgbe_handle_lasi(struct ixgbe_hw *hw)
+{
+       return ixgbe_call_func(hw, hw->phy.ops.handle_lasi, (hw),
+                               IXGBE_NOT_IMPLEMENTED);
+}
+
 /**
  *  ixgbe_read_analog_reg8 - Reads 8 bit analog register
  *  @hw: pointer to hardware structure
@@ -1543,3 +1652,16 @@ void ixgbe_enable_rx(struct ixgbe_hw *hw)
        if (hw->mac.ops.enable_rx)
                hw->mac.ops.enable_rx(hw);
 }
+
+/**
+ *  ixgbe_set_rate_select_speed - Set module link speed
+ *  @hw: pointer to hardware structure
+ *  @speed: link speed to set
+ *
+ *  Set module link speed via the rate select.
+ */
+void ixgbe_set_rate_select_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed)
+{
+       if (hw->mac.ops.set_rate_select_speed)
+               hw->mac.ops.set_rate_select_speed(hw, speed);
+}