Print this page
3014 Intel X540 Support (fix lint)

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/ixgbe/ixgbe_phy.c
          +++ new/usr/src/uts/common/io/ixgbe/ixgbe_phy.c
↓ open down ↓ 90 lines elided ↑ open up ↑
  91   91          s32 status = IXGBE_ERR_PHY_ADDR_INVALID;
  92   92          u32 phy_addr;
  93   93          u16 ext_ability = 0;
  94   94  
  95   95          DEBUGFUNC("ixgbe_identify_phy_generic");
  96   96  
  97   97          if (hw->phy.type == ixgbe_phy_unknown) {
  98   98                  for (phy_addr = 0; phy_addr < IXGBE_MAX_PHY_ADDR; phy_addr++) {
  99   99                          if (ixgbe_validate_phy_addr(hw, phy_addr)) {
 100  100                                  hw->phy.addr = phy_addr;
 101      -                                ixgbe_get_phy_id(hw);
      101 +                                (void) ixgbe_get_phy_id(hw);
 102  102                                  hw->phy.type =
 103  103                                          ixgbe_get_phy_type_from_id(hw->phy.id);
 104  104  
 105  105                                  if (hw->phy.type == ixgbe_phy_unknown) {
 106  106                                          hw->phy.ops.read_reg(hw,
 107  107                                                    IXGBE_MDIO_PHY_EXT_ABILITY,
 108  108                                                    IXGBE_MDIO_PMA_PMD_DEV_TYPE,
 109  109                                                    &ext_ability);
 110  110                                          if (ext_ability &
 111  111                                              (IXGBE_MDIO_PHY_10GBASET_ABILITY |
↓ open down ↓ 351 lines elided ↑ open up ↑
 463  463  }
 464  464  
 465  465  /**
 466  466   *  ixgbe_setup_phy_link_generic - Set and restart autoneg
 467  467   *  @hw: pointer to hardware structure
 468  468   *
 469  469   *  Restart autonegotiation and PHY and waits for completion.
 470  470   **/
 471  471  s32 ixgbe_setup_phy_link_generic(struct ixgbe_hw *hw)
 472  472  {
 473      -        s32 status = IXGBE_SUCCESS;
      473 +        s32 status;
 474  474          u32 time_out;
 475  475          u32 max_time_out = 10;
 476  476          u16 autoneg_reg = IXGBE_MII_AUTONEG_REG;
 477  477          bool autoneg = FALSE;
 478  478          ixgbe_link_speed speed;
 479  479  
 480  480          DEBUGFUNC("ixgbe_setup_phy_link_generic");
 481  481  
 482      -        ixgbe_get_copper_link_capabilities_generic(hw, &speed, &autoneg);
      482 +        status =
      483 +            ixgbe_get_copper_link_capabilities_generic(hw, &speed, &autoneg);
      484 +        if (status != IXGBE_SUCCESS)
      485 +                return status;
 483  486  
 484  487          if (speed & IXGBE_LINK_SPEED_10GB_FULL) {
 485  488                  /* Set or unset auto-negotiation 10G advertisement */
 486  489                  hw->phy.ops.read_reg(hw, IXGBE_MII_10GBASE_T_AUTONEG_CTRL_REG,
 487  490                                       IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
 488  491                                       &autoneg_reg);
 489  492  
 490  493                  autoneg_reg &= ~IXGBE_MII_10GBASE_T_ADVERTISE;
 491  494                  if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10GB_FULL)
 492  495                          autoneg_reg |= IXGBE_MII_10GBASE_T_ADVERTISE;
↓ open down ↓ 188 lines elided ↑ open up ↑
 681  684  }
 682  685  
 683  686  /**
 684  687   *      ixgbe_setup_phy_link_tnx - Set and restart autoneg
 685  688   *      @hw: pointer to hardware structure
 686  689   *
 687  690   *      Restart autonegotiation and PHY and waits for completion.
 688  691   **/
 689  692  s32 ixgbe_setup_phy_link_tnx(struct ixgbe_hw *hw)
 690  693  {
 691      -        s32 status = IXGBE_SUCCESS;
      694 +        s32 status;
 692  695          u32 time_out;
 693  696          u32 max_time_out = 10;
 694  697          u16 autoneg_reg = IXGBE_MII_AUTONEG_REG;
 695  698          bool autoneg = FALSE;
 696  699          ixgbe_link_speed speed;
 697  700  
 698  701          DEBUGFUNC("ixgbe_setup_phy_link_tnx");
 699  702  
 700      -        ixgbe_get_copper_link_capabilities_generic(hw, &speed, &autoneg);
      703 +        status =
      704 +            ixgbe_get_copper_link_capabilities_generic(hw, &speed, &autoneg);
      705 +        if (status != IXGBE_SUCCESS)
      706 +                return status;
 701  707  
 702  708          if (speed & IXGBE_LINK_SPEED_10GB_FULL) {
 703  709                  /* Set or unset auto-negotiation 10G advertisement */
 704  710                  hw->phy.ops.read_reg(hw, IXGBE_MII_10GBASE_T_AUTONEG_CTRL_REG,
 705  711                                       IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
 706  712                                       &autoneg_reg);
 707  713  
 708  714                  autoneg_reg &= ~IXGBE_MII_10GBASE_T_ADVERTISE;
 709  715                  if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10GB_FULL)
 710  716                          autoneg_reg |= IXGBE_MII_10GBASE_T_ADVERTISE;
↓ open down ↓ 467 lines elided ↑ open up ↑
1178 1184                          status = IXGBE_ERR_SFP_NOT_SUPPORTED;
1179 1185                          goto out;
1180 1186                  }
1181 1187  
1182 1188                  /* Anything else 82598-based is supported */
1183 1189                  if (hw->mac.type == ixgbe_mac_82598EB) {
1184 1190                          status = IXGBE_SUCCESS;
1185 1191                          goto out;
1186 1192                  }
1187 1193  
1188      -                ixgbe_get_device_caps(hw, &enforce_sfp);
     1194 +                (void) ixgbe_get_device_caps(hw, &enforce_sfp);
1189 1195                  if (!(enforce_sfp & IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP) &&
1190 1196                      !((hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0) ||
1191 1197                        (hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1) ||
1192 1198                        (hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0)  ||
1193 1199                        (hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1))) {
1194 1200                          /* Make sure we're a supported PHY type */
1195 1201                          if (hw->phy.type == ixgbe_phy_sfp_intel) {
1196 1202                                  status = IXGBE_SUCCESS;
1197 1203                          } else {
1198 1204                                  if (hw->allow_unsupported_sfp == TRUE) {
↓ open down ↓ 323 lines elided ↑ open up ↑
1522 1528   *
1523 1529   *  Sets I2C start condition (High -> Low on SDA while SCL is High)
1524 1530   **/
1525 1531  static void ixgbe_i2c_start(struct ixgbe_hw *hw)
1526 1532  {
1527 1533          u32 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL);
1528 1534  
1529 1535          DEBUGFUNC("ixgbe_i2c_start");
1530 1536  
1531 1537          /* Start condition must begin with data and clock high */
1532      -        ixgbe_set_i2c_data(hw, &i2cctl, 1);
     1538 +        (void) ixgbe_set_i2c_data(hw, &i2cctl, 1);
1533 1539          ixgbe_raise_i2c_clk(hw, &i2cctl);
1534 1540  
1535 1541          /* Setup time for start condition (4.7us) */
1536 1542          usec_delay(IXGBE_I2C_T_SU_STA);
1537 1543  
1538      -        ixgbe_set_i2c_data(hw, &i2cctl, 0);
     1544 +        (void) ixgbe_set_i2c_data(hw, &i2cctl, 0);
1539 1545  
1540 1546          /* Hold time for start condition (4us) */
1541 1547          usec_delay(IXGBE_I2C_T_HD_STA);
1542 1548  
1543 1549          ixgbe_lower_i2c_clk(hw, &i2cctl);
1544 1550  
1545 1551          /* Minimum low period of clock is 4.7 us */
1546 1552          usec_delay(IXGBE_I2C_T_LOW);
1547 1553  
1548 1554  }
↓ open down ↓ 4 lines elided ↑ open up ↑
1553 1559   *
1554 1560   *  Sets I2C stop condition (Low -> High on SDA while SCL is High)
1555 1561   **/
1556 1562  static void ixgbe_i2c_stop(struct ixgbe_hw *hw)
1557 1563  {
1558 1564          u32 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL);
1559 1565  
1560 1566          DEBUGFUNC("ixgbe_i2c_stop");
1561 1567  
1562 1568          /* Stop condition must begin with data low and clock high */
1563      -        ixgbe_set_i2c_data(hw, &i2cctl, 0);
     1569 +        (void) ixgbe_set_i2c_data(hw, &i2cctl, 0);
1564 1570          ixgbe_raise_i2c_clk(hw, &i2cctl);
1565 1571  
1566 1572          /* Setup time for stop condition (4us) */
1567 1573          usec_delay(IXGBE_I2C_T_SU_STO);
1568 1574  
1569      -        ixgbe_set_i2c_data(hw, &i2cctl, 1);
     1575 +        (void) ixgbe_set_i2c_data(hw, &i2cctl, 1);
1570 1576  
1571 1577          /* bus free time between stop and start (4.7us)*/
1572 1578          usec_delay(IXGBE_I2C_T_BUF);
1573 1579  }
1574 1580  
1575 1581  /**
1576 1582   *  ixgbe_clock_in_i2c_byte - Clocks in one byte via I2C
1577 1583   *  @hw: pointer to hardware structure
1578 1584   *  @data: data byte to clock in
1579 1585   *
1580 1586   *  Clocks in one byte data via I2C data/clock
1581 1587   **/
1582 1588  static s32 ixgbe_clock_in_i2c_byte(struct ixgbe_hw *hw, u8 *data)
1583 1589  {
1584      -        s32 i;
     1590 +        s32 i, status = IXGBE_SUCCESS;
1585 1591          bool bit = 0;
1586 1592  
1587 1593          DEBUGFUNC("ixgbe_clock_in_i2c_byte");
1588 1594  
1589 1595          for (i = 7; i >= 0; i--) {
1590      -                ixgbe_clock_in_i2c_bit(hw, &bit);
     1596 +                status = ixgbe_clock_in_i2c_bit(hw, &bit);
     1597 +                if (status != IXGBE_SUCCESS)
     1598 +                        break;
1591 1599                  *data |= bit << i;
1592 1600          }
1593 1601  
1594      -        return IXGBE_SUCCESS;
     1602 +        return status;
1595 1603  }
1596 1604  
1597 1605  /**
1598 1606   *  ixgbe_clock_out_i2c_byte - Clocks out one byte via I2C
1599 1607   *  @hw: pointer to hardware structure
1600 1608   *  @data: data byte clocked out
1601 1609   *
1602 1610   *  Clocks out one byte data via I2C data/clock
1603 1611   **/
1604 1612  static s32 ixgbe_clock_out_i2c_byte(struct ixgbe_hw *hw, u8 data)
↓ open down ↓ 246 lines elided ↑ open up ↑
1851 1859   **/
1852 1860  void ixgbe_i2c_bus_clear(struct ixgbe_hw *hw)
1853 1861  {
1854 1862          u32 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL);
1855 1863          u32 i;
1856 1864  
1857 1865          DEBUGFUNC("ixgbe_i2c_bus_clear");
1858 1866  
1859 1867          ixgbe_i2c_start(hw);
1860 1868  
1861      -        ixgbe_set_i2c_data(hw, &i2cctl, 1);
     1869 +        (void) ixgbe_set_i2c_data(hw, &i2cctl, 1);
1862 1870  
1863 1871          for (i = 0; i < 9; i++) {
1864 1872                  ixgbe_raise_i2c_clk(hw, &i2cctl);
1865 1873  
1866 1874                  /* Min high period of clock is 4us */
1867 1875                  usec_delay(IXGBE_I2C_T_HIGH);
1868 1876  
1869 1877                  ixgbe_lower_i2c_clk(hw, &i2cctl);
1870 1878  
1871 1879                  /* Min low period of clock is 4.7us*/
↓ open down ↓ 36 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX