- patches.arch/x86_mce_intel_decode_physical_address.patch:
[linux-flexiantxendom0-3.2.10.git] / drivers / net / ixgbe / ixgbe_phy.c
index 1c1efd3..09e1911 100644 (file)
@@ -135,6 +135,11 @@ static enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id)
  **/
 s32 ixgbe_reset_phy_generic(struct ixgbe_hw *hw)
 {
+       /* Don't reset PHY if it's shut down due to overtemp. */
+       if (!hw->phy.reset_if_overtemp &&
+           (IXGBE_ERR_OVERTEMP == hw->phy.ops.check_overtemp(hw)))
+               return 0;
+
        /*
         * Perform soft PHY reset to the PHY_XS.
         * This will cause a soft reset to the PHY
@@ -475,7 +480,7 @@ s32 ixgbe_reset_phy_nl(struct ixgbe_hw *hw)
                        msleep(edata);
                        break;
                case IXGBE_DATA_NL:
-                       hw_dbg(hw, "DATA:  \n");
+                       hw_dbg(hw, "DATA:\n");
                        data_offset++;
                        hw->eeprom.ops.read(hw, data_offset++,
                                            &phy_offset);
@@ -491,7 +496,7 @@ s32 ixgbe_reset_phy_nl(struct ixgbe_hw *hw)
                        break;
                case IXGBE_CONTROL_NL:
                        data_offset++;
-                       hw_dbg(hw, "CONTROL: \n");
+                       hw_dbg(hw, "CONTROL:\n");
                        if (edata == IXGBE_CONTROL_EOL_NL) {
                                hw_dbg(hw, "EOL\n");
                                end_data = true;
@@ -531,6 +536,7 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
        u8 comp_codes_10g = 0;
        u8 oui_bytes[3] = {0, 0, 0};
        u8 cable_tech = 0;
+       u8 cable_spec = 0;
        u16 enforce_sfp = 0;
 
        if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_fiber) {
@@ -580,14 +586,30 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
                        else
                                hw->phy.sfp_type = ixgbe_sfp_type_unknown;
                } else if (hw->mac.type == ixgbe_mac_82599EB) {
-                       if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE)
+                       if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE) {
                                if (hw->bus.lan_id == 0)
                                        hw->phy.sfp_type =
                                                     ixgbe_sfp_type_da_cu_core0;
                                else
                                        hw->phy.sfp_type =
                                                     ixgbe_sfp_type_da_cu_core1;
-                       else if (comp_codes_10g & IXGBE_SFF_10GBASESR_CAPABLE)
+                       } else if (cable_tech & IXGBE_SFF_DA_ACTIVE_CABLE) {
+                               hw->phy.ops.read_i2c_eeprom(
+                                               hw, IXGBE_SFF_CABLE_SPEC_COMP,
+                                               &cable_spec);
+                               if (cable_spec &
+                                   IXGBE_SFF_DA_SPEC_ACTIVE_LIMITING) {
+                                       if (hw->bus.lan_id == 0)
+                                               hw->phy.sfp_type =
+                                               ixgbe_sfp_type_da_act_lmt_core0;
+                                       else
+                                               hw->phy.sfp_type =
+                                               ixgbe_sfp_type_da_act_lmt_core1;
+                               } else {
+                                       hw->phy.sfp_type =
+                                               ixgbe_sfp_type_unknown;
+                               }
+                       } else if (comp_codes_10g & IXGBE_SFF_10GBASESR_CAPABLE)
                                if (hw->bus.lan_id == 0)
                                        hw->phy.sfp_type =
                                                      ixgbe_sfp_type_srlr_core0;
@@ -637,10 +659,14 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
                        switch (vendor_oui) {
                        case IXGBE_SFF_VENDOR_OUI_TYCO:
                                if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE)
-                                       hw->phy.type = ixgbe_phy_tw_tyco;
+                                       hw->phy.type =
+                                               ixgbe_phy_sfp_passive_tyco;
                                break;
                        case IXGBE_SFF_VENDOR_OUI_FTL:
-                               hw->phy.type = ixgbe_phy_sfp_ftl;
+                               if (cable_tech & IXGBE_SFF_DA_ACTIVE_CABLE)
+                                       hw->phy.type = ixgbe_phy_sfp_ftl_active;
+                               else
+                                       hw->phy.type = ixgbe_phy_sfp_ftl;
                                break;
                        case IXGBE_SFF_VENDOR_OUI_AVAGO:
                                hw->phy.type = ixgbe_phy_sfp_avago;
@@ -650,7 +676,11 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
                                break;
                        default:
                                if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE)
-                                       hw->phy.type = ixgbe_phy_tw_unknown;
+                                       hw->phy.type =
+                                               ixgbe_phy_sfp_passive_unknown;
+                               else if (cable_tech & IXGBE_SFF_DA_ACTIVE_CABLE)
+                                       hw->phy.type =
+                                               ixgbe_phy_sfp_active_unknown;
                                else
                                        hw->phy.type = ixgbe_phy_sfp_unknown;
                                break;
@@ -658,7 +688,8 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
                }
 
                /* All passive DA cables are supported */
-               if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE) {
+               if (cable_tech & (IXGBE_SFF_DA_PASSIVE_CABLE |
+                   IXGBE_SFF_DA_ACTIVE_CABLE)) {
                        status = 0;
                        goto out;
                }
@@ -1319,3 +1350,28 @@ s32 ixgbe_get_phy_firmware_version_tnx(struct ixgbe_hw *hw,
        return status;
 }
 
+/**
+ *  ixgbe_tn_check_overtemp - Checks if an overtemp occured.
+ *  @hw: pointer to hardware structure
+ *
+ *  Checks if the LASI temp alarm status was triggered due to overtemp
+ **/
+s32 ixgbe_tn_check_overtemp(struct ixgbe_hw *hw)
+{
+       s32 status = 0;
+       u16 phy_data = 0;
+
+       if (hw->device_id != IXGBE_DEV_ID_82599_T3_LOM)
+               goto out;
+
+       /* Check that the LASI temp alarm status was triggered */
+       hw->phy.ops.read_reg(hw, IXGBE_TN_LASI_STATUS_REG,
+                            MDIO_MMD_PMAPMD, &phy_data);
+
+       if (!(phy_data & IXGBE_TN_LASI_STATUS_TEMP_ALARM))
+               goto out;
+
+       status = IXGBE_ERR_OVERTEMP;
+out:
+       return status;
+}