Author: sbruno
Date: Thu Dec 28 21:26:40 2017
New Revision: 327312
URL: https://svnweb.freebsd.org/changeset/base/327312

Log:
  e1000: Add support for Ice Lake and Cannon Lake
  
  Ths add initial support for Ice Lake and Cannon Lake ethernet devices.
  
  This also addressed errata 1.5.4.4 for Sky Lake and Kabby Lake devices:
  
https://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/i218-i219-ethernet-connection-spec-update.pdf?asset=9561
  
  Submitted by: Kevin Bowling <kevin.bowl...@kev009.com>
  Relnotes:     Yes
  Sponsored by: Limelight Networks
  Differential Revision:        https://reviews.freebsd.org/D13660

Modified:
  head/sys/dev/e1000/e1000_api.c
  head/sys/dev/e1000/e1000_hw.h
  head/sys/dev/e1000/e1000_ich8lan.c
  head/sys/dev/e1000/e1000_ich8lan.h
  head/sys/dev/e1000/if_em.c

Modified: head/sys/dev/e1000/e1000_api.c
==============================================================================
--- head/sys/dev/e1000/e1000_api.c      Thu Dec 28 21:23:39 2017        
(r327311)
+++ head/sys/dev/e1000/e1000_api.c      Thu Dec 28 21:26:40 2017        
(r327312)
@@ -311,6 +311,16 @@ s32 e1000_set_mac_type(struct e1000_hw *hw)
        case E1000_DEV_ID_PCH_SPT_I219_V5:
                mac->type = e1000_pch_spt;
                break;
+       case E1000_DEV_ID_PCH_CNP_I219_LM6:
+       case E1000_DEV_ID_PCH_CNP_I219_V6:
+       case E1000_DEV_ID_PCH_CNP_I219_LM7:
+       case E1000_DEV_ID_PCH_CNP_I219_V7:
+       case E1000_DEV_ID_PCH_ICP_I219_LM8:
+       case E1000_DEV_ID_PCH_ICP_I219_V8:
+       case E1000_DEV_ID_PCH_ICP_I219_LM9:
+       case E1000_DEV_ID_PCH_ICP_I219_V9:
+               mac->type = e1000_pch_cnp;
+               break;
        case E1000_DEV_ID_82575EB_COPPER:
        case E1000_DEV_ID_82575EB_FIBER_SERDES:
        case E1000_DEV_ID_82575GB_QUAD_COPPER:
@@ -462,6 +472,7 @@ s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool i
        case e1000_pch2lan:
        case e1000_pch_lpt:
        case e1000_pch_spt:
+       case e1000_pch_cnp:
                e1000_init_function_pointers_ich8lan(hw);
                break;
        case e1000_82575:

Modified: head/sys/dev/e1000/e1000_hw.h
==============================================================================
--- head/sys/dev/e1000/e1000_hw.h       Thu Dec 28 21:23:39 2017        
(r327311)
+++ head/sys/dev/e1000/e1000_hw.h       Thu Dec 28 21:26:40 2017        
(r327312)
@@ -147,6 +147,14 @@ struct e1000_hw;
 #define E1000_DEV_ID_PCH_SPT_I219_V4           0x15D8
 #define E1000_DEV_ID_PCH_SPT_I219_LM5          0x15E3
 #define E1000_DEV_ID_PCH_SPT_I219_V5           0x15D6
+#define E1000_DEV_ID_PCH_CNP_I219_LM6          0x15BD
+#define E1000_DEV_ID_PCH_CNP_I219_V6           0x15BE
+#define E1000_DEV_ID_PCH_CNP_I219_LM7          0x15BB
+#define E1000_DEV_ID_PCH_CNP_I219_V7           0x15BC
+#define E1000_DEV_ID_PCH_ICP_I219_LM8          0x15DF
+#define E1000_DEV_ID_PCH_ICP_I219_V8           0x15E0
+#define E1000_DEV_ID_PCH_ICP_I219_LM9          0x15E1
+#define E1000_DEV_ID_PCH_ICP_I219_V9           0x15E2
 #define E1000_DEV_ID_82576                     0x10C9
 #define E1000_DEV_ID_82576_FIBER               0x10E6
 #define E1000_DEV_ID_82576_SERDES              0x10E7
@@ -233,6 +241,7 @@ enum e1000_mac_type {
        e1000_pch2lan,
        e1000_pch_lpt,
        e1000_pch_spt,
+       e1000_pch_cnp,
        e1000_82575,
        e1000_82576,
        e1000_82580,

Modified: head/sys/dev/e1000/e1000_ich8lan.c
==============================================================================
--- head/sys/dev/e1000/e1000_ich8lan.c  Thu Dec 28 21:23:39 2017        
(r327311)
+++ head/sys/dev/e1000/e1000_ich8lan.c  Thu Dec 28 21:26:40 2017        
(r327312)
@@ -345,6 +345,7 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1
        switch (hw->mac.type) {
        case e1000_pch_lpt:
        case e1000_pch_spt:
+       case e1000_pch_cnp:
                if (e1000_phy_is_accessible_pchlan(hw))
                        break;
 
@@ -493,6 +494,7 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_h
                case e1000_pch2lan:
                case e1000_pch_lpt:
                case e1000_pch_spt:
+               case e1000_pch_cnp:
                        /* In case the PHY needs to be in mdio slow mode,
                         * set slow mode and try to get the PHY id again.
                         */
@@ -794,6 +796,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_
                /* fall-through */
        case e1000_pch_lpt:
        case e1000_pch_spt:
+       case e1000_pch_cnp:
                /* multicast address update for pch2 */
                mac->ops.update_mc_addr_list =
                        e1000_update_mc_addr_list_pch2lan;
@@ -1831,6 +1834,7 @@ void e1000_init_function_pointers_ich8lan(struct e1000
        case e1000_pch2lan:
        case e1000_pch_lpt:
        case e1000_pch_spt:
+       case e1000_pch_cnp:
                hw->phy.ops.init_params = e1000_init_phy_params_pchlan;
                break;
        default:
@@ -2295,6 +2299,7 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw
        case e1000_pch2lan:
        case e1000_pch_lpt:
        case e1000_pch_spt:
+       case e1000_pch_cnp:
                sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M;
                break;
        default:
@@ -2655,6 +2660,8 @@ static s32 e1000_hv_phy_workarounds_ich8lan(struct e10
                        e1000_phy_sw_reset_generic(hw);
                        ret_val = hw->phy.ops.write_reg(hw, PHY_CONTROL,
                                                        0x3140);
+                       if (ret_val)
+                               return ret_val;
                }
        }
 
@@ -3412,6 +3419,7 @@ static s32 e1000_valid_nvm_bank_detect_ich8lan(struct 
 
        switch (hw->mac.type) {
        case e1000_pch_spt:
+       case e1000_pch_cnp:
                bank1_offset = nvm->flash_bank_size;
                act_offset = E1000_ICH_NVM_SIG_WORD;
 
@@ -4387,6 +4395,7 @@ static s32 e1000_validate_nvm_checksum_ich8lan(struct 
        switch (hw->mac.type) {
        case e1000_pch_lpt:
        case e1000_pch_spt:
+       case e1000_pch_cnp:
                word = NVM_COMPAT;
                valid_csum_mask = NVM_COMPAT_VALID_CSUM;
                break;

Modified: head/sys/dev/e1000/e1000_ich8lan.h
==============================================================================
--- head/sys/dev/e1000/e1000_ich8lan.h  Thu Dec 28 21:23:39 2017        
(r327311)
+++ head/sys/dev/e1000/e1000_ich8lan.h  Thu Dec 28 21:26:40 2017        
(r327312)
@@ -124,7 +124,8 @@
 #define NVM_SIZE_MULTIPLIER 4096  /*multiplier for NVMS field*/
 #define E1000_FLASH_BASE_ADDR 0xE000 /*offset of NVM access regs*/
 #define E1000_CTRL_EXT_NVMVS 0x3 /*NVM valid sector */
-#define E1000_TARC0_CB_MULTIQ_3_REQ    (1 << 28 | 1 << 29)
+#define E1000_TARC0_CB_MULTIQ_3_REQ    0x30000000
+#define E1000_TARC0_CB_MULTIQ_2_REQ    0x20000000
 #define PCIE_ICH8_SNOOP_ALL    PCIE_NO_SNOOP_ALL
 
 #define E1000_ICH_RAR_ENTRIES  7

Modified: head/sys/dev/e1000/if_em.c
==============================================================================
--- head/sys/dev/e1000/if_em.c  Thu Dec 28 21:23:39 2017        (r327311)
+++ head/sys/dev/e1000/if_em.c  Thu Dec 28 21:26:40 2017        (r327312)
@@ -166,6 +166,14 @@ static pci_vendor_info_t em_vendor_info_array[] =
        PVID(0x8086, E1000_DEV_ID_PCH_SPT_I219_V4, "Intel(R) PRO/1000 Network 
Connection"),
        PVID(0x8086, E1000_DEV_ID_PCH_SPT_I219_LM5, "Intel(R) PRO/1000 Network 
Connection"),
        PVID(0x8086, E1000_DEV_ID_PCH_SPT_I219_V5, "Intel(R) PRO/1000 Network 
Connection"),
+       PVID(0x8086, E1000_DEV_ID_PCH_CNP_I219_LM6, "Intel(R) PRO/1000 Network 
Connection"),
+       PVID(0x8086, E1000_DEV_ID_PCH_CNP_I219_V6, "Intel(R) PRO/1000 Network 
Connection"),
+       PVID(0x8086, E1000_DEV_ID_PCH_CNP_I219_LM7, "Intel(R) PRO/1000 Network 
Connection"),
+       PVID(0x8086, E1000_DEV_ID_PCH_CNP_I219_V7, "Intel(R) PRO/1000 Network 
Connection"),
+       PVID(0x8086, E1000_DEV_ID_PCH_ICP_I219_LM8, "Intel(R) PRO/1000 Network 
Connection"),
+       PVID(0x8086, E1000_DEV_ID_PCH_ICP_I219_V8, "Intel(R) PRO/1000 Network 
Connection"),
+       PVID(0x8086, E1000_DEV_ID_PCH_ICP_I219_LM9, "Intel(R) PRO/1000 Network 
Connection"),
+       PVID(0x8086, E1000_DEV_ID_PCH_ICP_I219_V9, "Intel(R) PRO/1000 Network 
Connection"),
        /* required last entry */
        PVID_END
 };
@@ -862,7 +870,7 @@ em_if_attach_pre(if_ctx_t ctx)
        ** so use the same tag and an offset handle for the
        ** FLASH read/write macros in the shared code.
        */
-       else if (hw->mac.type == e1000_pch_spt) {
+       else if (hw->mac.type >= e1000_pch_spt) {
                adapter->osdep.flash_bus_space_tag =
                    adapter->osdep.mem_bus_space_tag;
                adapter->osdep.flash_bus_space_handle =
@@ -1132,6 +1140,7 @@ em_if_mtu_set(if_ctx_t ctx, uint32_t mtu)
        case e1000_pch2lan:
        case e1000_pch_lpt:
        case e1000_pch_spt:
+       case e1000_pch_cnp:
        case e1000_82574:
        case e1000_82583:
        case e1000_80003es2lan:
@@ -2416,6 +2425,7 @@ em_reset(if_ctx_t ctx)
        case e1000_pch2lan:
        case e1000_pch_lpt:
        case e1000_pch_spt:
+       case e1000_pch_cnp:
                pba = E1000_PBA_26K;
                break;
        case e1000_82575:
@@ -2524,6 +2534,7 @@ em_reset(if_ctx_t ctx)
        case e1000_pch2lan:
        case e1000_pch_lpt:
        case e1000_pch_spt:
+       case e1000_pch_cnp:
                hw->fc.high_water = 0x5C20;
                hw->fc.low_water = 0x5048;
                hw->fc.pause_time = 0x0650;
@@ -3054,13 +3065,16 @@ em_initialize_transmit_unit(if_ctx_t ctx)
        /* This write will effectively turn on the transmit unit. */
        E1000_WRITE_REG(&adapter->hw, E1000_TCTL, tctl);
 
+       /* SPT and KBL errata workarounds */
        if (hw->mac.type == e1000_pch_spt) {
                u32 reg;
                reg = E1000_READ_REG(hw, E1000_IOSFPC);
                reg |= E1000_RCTL_RDMTS_HEX;
                E1000_WRITE_REG(hw, E1000_IOSFPC, reg);
+               /* i218-i219 Specification Update 1.5.4.4 */
                reg = E1000_READ_REG(hw, E1000_TARC(0));
-               reg |= E1000_TARC0_CB_MULTIQ_3_REQ;
+               reg &= E1000_TARC0_CB_MULTIQ_3_REQ;
+               reg |= E1000_TARC0_CB_MULTIQ_2_REQ;
                E1000_WRITE_REG(hw, E1000_TARC(0), reg);
        }
 }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to