Define function ixgbe_mng_present to check if management capability is present or not.
Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Acked-by: Jijiang Liu <jijiang.liu@intel.com>
  **/
 void ixgbe_stop_mac_link_on_d3_82599(struct ixgbe_hw *hw)
 {
-       u32 autoc2_reg, fwsm;
+       u32 autoc2_reg;
        u16 ee_ctrl_2 = 0;
 
        DEBUGFUNC("ixgbe_stop_mac_link_on_d3_82599");
        ixgbe_read_eeprom(hw, IXGBE_EEPROM_CTRL_2, &ee_ctrl_2);
 
-       /* Check to see if MNG FW could be enabled */
-       fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM);
-
-       if (((fwsm & IXGBE_FWSM_MODE_MASK) != IXGBE_FWSM_FW_MODE_PT) &&
-           !hw->wol_enabled &&
+       if (!ixgbe_mng_present(hw) && !hw->wol_enabled &&
            ee_ctrl_2 & IXGBE_EEPROM_CCD_BIT) {
                autoc2_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC2);
                autoc2_reg |= IXGBE_AUTOC2_LINK_DISABLE_ON_D3_MASK;
 
        }
 }
 
+/**
+ * ixgbe_mng_present - returns true when management capability is present
+ * @hw: pointer to hardware structure
+ */
+bool ixgbe_mng_present(struct ixgbe_hw *hw)
+{
+       u32 fwsm;
+
+       if (hw->mac.type < ixgbe_mac_82599EB)
+               return false;
+
+       fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM);
+       fwsm &= IXGBE_FWSM_MODE_MASK;
+       return fwsm == IXGBE_FWSM_FW_MODE_PT;
+}
+
 /**
  * ixgbe_mng_enabled - Is the manageability engine enabled?
  * @hw: pointer to hardware structure
 
 
 extern s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw);
 extern void ixgbe_stop_mac_link_on_d3_82599(struct ixgbe_hw *hw);
+bool ixgbe_mng_present(struct ixgbe_hw *hw);
 bool ixgbe_mng_enabled(struct ixgbe_hw *hw);
 
 #define IXGBE_I2C_THERMAL_SENSOR_ADDR  0xF8