Print this page
MFV: illumos-gate@5bb0bdfe588c5df0f63ff8ac292cd608a5f4492a
9950 Need support for Intel I219 v6-v9
Reviewed by: Jason King <jason.king@joyent.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Garrett D'Amore <garrett@damore.org>
Author: Robert Mustacchi <rm@joyent.com>
4547 e1000g common code doesn't account for LockMAC
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Jason King <jason.brian.king@gmail.com>
Approved by: Garrett D'Amore <garrett@damore.org>
re #12675 rb4109 some e1000g devices don't support 15 unicast addresses

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/e1000g/e1000g_main.c
          +++ new/usr/src/uts/common/io/e1000g/e1000g_main.c
↓ open down ↓ 17 lines elided ↑ open up ↑
  18   18   * and limitations under the License.
  19   19   */
  20   20  
  21   21  /*
  22   22   * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   */
  24   24  
  25   25  /*
  26   26   * Copyright 2012 DEY Storage Systems, Inc.  All rights reserved.
  27   27   * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  28      - * Copyright (c) 2017, Joyent, Inc.
       28 + * Copyright (c) 2018, Joyent, Inc.
  29   29   */
  30   30  
  31   31  /*
  32   32   * **********************************************************************
  33   33   *                                                                      *
  34   34   * Module Name:                                                         *
  35   35   *   e1000g_main.c                                                      *
  36   36   *                                                                      *
  37   37   * Abstract:                                                            *
  38   38   *   This file contains the interface routines for the solaris OS.      *
↓ open down ↓ 665 lines elided ↑ open up ↑
 704  704                  if (ddi_regs_map_setup(devinfo, rnumber,
 705  705                      (caddr_t *)&hw->flash_address, 0,
 706  706                      mem_size, &e1000g_regs_acc_attr,
 707  707                      &osdep->ich_flash_handle) != DDI_SUCCESS) {
 708  708                          E1000G_DEBUGLOG_0(Adapter, CE_WARN,
 709  709                              "ddi_regs_map_setup for ICH flash failed");
 710  710                          goto regs_map_fail;
 711  711                  }
 712  712                  break;
 713  713          case e1000_pch_spt:
      714 +        case e1000_pch_cnp:
 714  715                  /*
 715  716                   * On the SPT, the device flash is actually in BAR0, not a
 716  717                   * separate BAR. Therefore we end up setting the
 717  718                   * ich_flash_handle to be the same as the register handle.
 718  719                   * We mark the same to reduce the confusion in the other
 719  720                   * functions and macros. Though this does make the set up and
 720  721                   * tear-down path slightly more complicated.
 721  722                   */
 722  723                  osdep->ich_flash_handle = osdep->reg_handle;
 723  724                  hw->flash_address = hw->hw_addr;
↓ open down ↓ 49 lines elided ↑ open up ↑
 773  774          default:
 774  775                  hw->io_base = 0;
 775  776                  break;
 776  777          }
 777  778  
 778  779          return (DDI_SUCCESS);
 779  780  
 780  781  regs_map_fail:
 781  782          if (osdep->reg_handle != NULL)
 782  783                  ddi_regs_map_free(&osdep->reg_handle);
 783      -        if (osdep->ich_flash_handle != NULL && hw->mac.type != e1000_pch_spt)
      784 +        if (osdep->ich_flash_handle != NULL && hw->mac.type < e1000_pch_spt)
 784  785                  ddi_regs_map_free(&osdep->ich_flash_handle);
 785  786          return (DDI_FAILURE);
 786  787  }
 787  788  
 788  789  static int
 789  790  e1000g_set_driver_params(struct e1000g *Adapter)
 790  791  {
 791  792          struct e1000_hw *hw;
 792  793  
 793  794          hw = &Adapter->shared;
↓ open down ↓ 108 lines elided ↑ open up ↑
 902  903                          Adapter->max_mtu = MAXIMUM_MTU_9K;
 903  904                  break;
 904  905          /* pch can do jumbo frames up to 4K */
 905  906          case e1000_pchlan:
 906  907                  Adapter->max_mtu = MAXIMUM_MTU_4K;
 907  908                  break;
 908  909          /* pch2 can do jumbo frames up to 9K */
 909  910          case e1000_pch2lan:
 910  911          case e1000_pch_lpt:
 911  912          case e1000_pch_spt:
      913 +        case e1000_pch_cnp:
 912  914                  Adapter->max_mtu = MAXIMUM_MTU_9K;
 913  915                  break;
 914  916          /* types with a special limit */
 915  917          case e1000_82571:
 916  918          case e1000_82572:
 917  919          case e1000_82574:
 918  920          case e1000_80003es2lan:
 919  921          case e1000_ich10lan:
 920  922                  if (e1000g_jumbo_mtu >= ETHERMTU &&
 921  923                      e1000g_jumbo_mtu <= MAXIMUM_MTU_9K) {
↓ open down ↓ 218 lines elided ↑ open up ↑
1140 1142                          ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_LOST);
1141 1143                  }
1142 1144          }
1143 1145  
1144 1146          e1000g_release_multicast(Adapter);
1145 1147  
1146 1148          if (Adapter->attach_progress & ATTACH_PROGRESS_REGS_MAP) {
1147 1149                  if (Adapter->osdep.reg_handle != NULL)
1148 1150                          ddi_regs_map_free(&Adapter->osdep.reg_handle);
1149 1151                  if (Adapter->osdep.ich_flash_handle != NULL &&
1150      -                    Adapter->shared.mac.type != e1000_pch_spt)
     1152 +                    Adapter->shared.mac.type < e1000_pch_spt)
1151 1153                          ddi_regs_map_free(&Adapter->osdep.ich_flash_handle);
1152 1154                  if (Adapter->osdep.io_reg_handle != NULL)
1153 1155                          ddi_regs_map_free(&Adapter->osdep.io_reg_handle);
1154 1156          }
1155 1157  
1156 1158          if (Adapter->attach_progress & ATTACH_PROGRESS_PCI_CONFIG) {
1157 1159                  if (Adapter->osdep.cfg_handle != NULL)
1158 1160                          pci_config_teardown(&Adapter->osdep.cfg_handle);
1159 1161          }
1160 1162  
↓ open down ↓ 318 lines elided ↑ open up ↑
1479 1481          } else if (hw->mac.type == e1000_ich10lan) {
1480 1482                  pba = E1000_PBA_10K;
1481 1483          } else if (hw->mac.type == e1000_pchlan) {
1482 1484                  pba = E1000_PBA_26K;
1483 1485          } else if (hw->mac.type == e1000_pch2lan) {
1484 1486                  pba = E1000_PBA_26K;
1485 1487          } else if (hw->mac.type == e1000_pch_lpt) {
1486 1488                  pba = E1000_PBA_26K;
1487 1489          } else if (hw->mac.type == e1000_pch_spt) {
1488 1490                  pba = E1000_PBA_26K;
     1491 +        } else if (hw->mac.type == e1000_pch_cnp) {
     1492 +                pba = E1000_PBA_26K;
1489 1493          } else {
1490 1494                  /*
1491 1495                   * Total FIFO is 40K
1492 1496                   */
1493 1497                  if (Adapter->max_frame_size > FRAME_SIZE_UPTO_8K)
1494 1498                          pba = E1000_PBA_22K;    /* 22K for Rx, 18K for Tx */
1495 1499                  else
1496 1500                          pba = E1000_PBA_30K;    /* 30K for Rx, 10K for Tx */
1497 1501          }
1498 1502          E1000_WRITE_REG(hw, E1000_PBA, pba);
↓ open down ↓ 206 lines elided ↑ open up ↑
1705 1709          /*
1706 1710           * get_link_status is set in the interrupt handler on link-status-change
1707 1711           * or rx sequence error interrupt.  get_link_status will stay
1708 1712           * false until the e1000_check_for_link establishes link only
1709 1713           * for copper adapters.
1710 1714           */
1711 1715          switch (hw->phy.media_type) {
1712 1716          case e1000_media_type_copper:
1713 1717                  if (hw->mac.get_link_status) {
1714 1718                          /*
1715      -                         * SPT devices need a bit of extra time before we ask
1716      -                         * them.
     1719 +                         * SPT and newer devices need a bit of extra time before
     1720 +                         * we ask them.
1717 1721                           */
1718      -                        if (hw->mac.type == e1000_pch_spt)
     1722 +                        if (hw->mac.type >= e1000_pch_spt)
1719 1723                                  msec_delay(50);
1720 1724                          (void) e1000_check_for_link(hw);
1721 1725                          if ((E1000_READ_REG(hw, E1000_STATUS) &
1722 1726                              E1000_STATUS_LU)) {
1723 1727                                  link_up = B_TRUE;
1724 1728                          } else {
1725 1729                                  link_up = !hw->mac.get_link_status;
1726 1730                          }
1727 1731                  } else {
1728 1732                          link_up = B_TRUE;
↓ open down ↓ 340 lines elided ↑ open up ↑
2069 2073                  ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_LOST);
2070 2074  
2071 2075          /* Clean the pending rx jumbo packet fragment */
2072 2076          e1000g_rx_clean(Adapter);
2073 2077  
2074 2078          /*
2075 2079           * The I219, eg. the pch_spt, has bugs such that we must ensure that
2076 2080           * rings are flushed before we do anything else. This must be done
2077 2081           * before we release DMA resources.
2078 2082           */
2079      -        if (Adapter->shared.mac.type == e1000_pch_spt)
     2083 +        if (Adapter->shared.mac.type >= e1000_pch_spt)
2080 2084                  e1000g_flush_desc_rings(Adapter);
2081 2085  
2082 2086          if (global) {
2083 2087                  e1000g_release_dma_resources(Adapter);
2084 2088  
2085 2089                  mutex_enter(&e1000g_rx_detach_lock);
2086 2090                  rx_data = Adapter->rx_ring->rx_data;
2087 2091                  rx_data->flag |= E1000G_RX_STOPPED;
2088 2092  
2089 2093                  if (rx_data->pending_count == 0) {
↓ open down ↓ 439 lines elided ↑ open up ↑
2529 2533                   * The common code does not correctly calculate the number of
2530 2534                   * rar's that could be reserved by firmware for the pch_lpt and
2531 2535                   * pch_spt macs. The interface has one primary rar, and 11
2532 2536                   * additional ones. Those 11 additional ones are not always
2533 2537                   * available.  According to the datasheet, we need to check a
2534 2538                   * few of the bits set in the FWSM register. If the value is
2535 2539                   * zero, everything is available. If the value is 1, none of the
2536 2540                   * additional registers are available. If the value is 2-7, only
2537 2541                   * that number are available.
2538 2542                   */
2539      -                if (hw->mac.type == e1000_pch_lpt ||
2540      -                    hw->mac.type == e1000_pch_spt) {
     2543 +                if (hw->mac.type >= e1000_pch_lpt) {
2541 2544                          uint32_t locked, rar;
2542 2545  
2543 2546                          locked = E1000_READ_REG(hw, E1000_FWSM) &
2544 2547                              E1000_FWSM_WLOCK_MAC_MASK;
2545 2548                          locked >>= E1000_FWSM_WLOCK_MAC_SHIFT;
2546 2549                          rar = 1;
2547 2550                          if (locked == 0)
2548 2551                                  rar += 11;
2549 2552                          else if (locked == 1)
2550 2553                                  rar += 0;
↓ open down ↓ 4184 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX