aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/intel/e1000e/80003es2lan.c1
-rw-r--r--drivers/net/ethernet/intel/e1000e/82571.c1
-rw-r--r--drivers/net/ethernet/intel/e1000e/hw.h3
-rw-r--r--drivers/net/ethernet/intel/e1000e/ich8lan.c57
-rw-r--r--drivers/net/ethernet/intel/e1000e/mac.c9
-rw-r--r--drivers/net/ethernet/intel/e1000e/mac.h3
-rw-r--r--drivers/net/ethernet/intel/e1000e/netdev.c10
7 files changed, 71 insertions, 13 deletions
diff --git a/drivers/net/ethernet/intel/e1000e/80003es2lan.c b/drivers/net/ethernet/intel/e1000e/80003es2lan.c
index a5f6b11d6992..08f22f348800 100644
--- a/drivers/net/ethernet/intel/e1000e/80003es2lan.c
+++ b/drivers/net/ethernet/intel/e1000e/80003es2lan.c
@@ -1365,6 +1365,7 @@ static const struct e1000_mac_operations es2_mac_ops = {
1365 .setup_led = e1000e_setup_led_generic, 1365 .setup_led = e1000e_setup_led_generic,
1366 .config_collision_dist = e1000e_config_collision_dist_generic, 1366 .config_collision_dist = e1000e_config_collision_dist_generic,
1367 .rar_set = e1000e_rar_set_generic, 1367 .rar_set = e1000e_rar_set_generic,
1368 .rar_get_count = e1000e_rar_get_count_generic,
1368}; 1369};
1369 1370
1370static const struct e1000_phy_operations es2_phy_ops = { 1371static const struct e1000_phy_operations es2_phy_ops = {
diff --git a/drivers/net/ethernet/intel/e1000e/82571.c b/drivers/net/ethernet/intel/e1000e/82571.c
index e0aa7f1efb08..218481e509f9 100644
--- a/drivers/net/ethernet/intel/e1000e/82571.c
+++ b/drivers/net/ethernet/intel/e1000e/82571.c
@@ -1896,6 +1896,7 @@ static const struct e1000_mac_operations e82571_mac_ops = {
1896 .config_collision_dist = e1000e_config_collision_dist_generic, 1896 .config_collision_dist = e1000e_config_collision_dist_generic,
1897 .read_mac_addr = e1000_read_mac_addr_82571, 1897 .read_mac_addr = e1000_read_mac_addr_82571,
1898 .rar_set = e1000e_rar_set_generic, 1898 .rar_set = e1000e_rar_set_generic,
1899 .rar_get_count = e1000e_rar_get_count_generic,
1899}; 1900};
1900 1901
1901static const struct e1000_phy_operations e82_phy_ops_igp = { 1902static const struct e1000_phy_operations e82_phy_ops_igp = {
diff --git a/drivers/net/ethernet/intel/e1000e/hw.h b/drivers/net/ethernet/intel/e1000e/hw.h
index 6b3de5f39a97..72f5475c4b90 100644
--- a/drivers/net/ethernet/intel/e1000e/hw.h
+++ b/drivers/net/ethernet/intel/e1000e/hw.h
@@ -469,8 +469,9 @@ struct e1000_mac_operations {
469 s32 (*setup_led)(struct e1000_hw *); 469 s32 (*setup_led)(struct e1000_hw *);
470 void (*write_vfta)(struct e1000_hw *, u32, u32); 470 void (*write_vfta)(struct e1000_hw *, u32, u32);
471 void (*config_collision_dist)(struct e1000_hw *); 471 void (*config_collision_dist)(struct e1000_hw *);
472 void (*rar_set)(struct e1000_hw *, u8 *, u32); 472 int (*rar_set)(struct e1000_hw *, u8 *, u32);
473 s32 (*read_mac_addr)(struct e1000_hw *); 473 s32 (*read_mac_addr)(struct e1000_hw *);
474 u32 (*rar_get_count)(struct e1000_hw *);
474}; 475};
475 476
476/* When to use various PHY register access functions: 477/* When to use various PHY register access functions:
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
index 5f5539561661..b75862dd7282 100644
--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
@@ -139,8 +139,9 @@ static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link);
139static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw); 139static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw);
140static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw); 140static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw);
141static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw); 141static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw);
142static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index); 142static int e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index);
143static void e1000_rar_set_pch_lpt(struct e1000_hw *hw, u8 *addr, u32 index); 143static int e1000_rar_set_pch_lpt(struct e1000_hw *hw, u8 *addr, u32 index);
144static u32 e1000_rar_get_count_pch_lpt(struct e1000_hw *hw);
144static s32 e1000_k1_workaround_lv(struct e1000_hw *hw); 145static s32 e1000_k1_workaround_lv(struct e1000_hw *hw);
145static void e1000_gate_hw_phy_config_ich8lan(struct e1000_hw *hw, bool gate); 146static void e1000_gate_hw_phy_config_ich8lan(struct e1000_hw *hw, bool gate);
146static s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force); 147static s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force);
@@ -704,6 +705,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw)
704 mac->ops.rar_set = e1000_rar_set_pch_lpt; 705 mac->ops.rar_set = e1000_rar_set_pch_lpt;
705 mac->ops.setup_physical_interface = 706 mac->ops.setup_physical_interface =
706 e1000_setup_copper_link_pch_lpt; 707 e1000_setup_copper_link_pch_lpt;
708 mac->ops.rar_get_count = e1000_rar_get_count_pch_lpt;
707 } 709 }
708 710
709 /* Enable PCS Lock-loss workaround for ICH8 */ 711 /* Enable PCS Lock-loss workaround for ICH8 */
@@ -1668,7 +1670,7 @@ static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw)
1668 * contain the MAC address but RAR[1-6] are reserved for manageability (ME). 1670 * contain the MAC address but RAR[1-6] are reserved for manageability (ME).
1669 * Use SHRA[0-3] in place of those reserved for ME. 1671 * Use SHRA[0-3] in place of those reserved for ME.
1670 **/ 1672 **/
1671static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index) 1673static int e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index)
1672{ 1674{
1673 u32 rar_low, rar_high; 1675 u32 rar_low, rar_high;
1674 1676
@@ -1690,7 +1692,7 @@ static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index)
1690 e1e_flush(); 1692 e1e_flush();
1691 ew32(RAH(index), rar_high); 1693 ew32(RAH(index), rar_high);
1692 e1e_flush(); 1694 e1e_flush();
1693 return; 1695 return 0;
1694 } 1696 }
1695 1697
1696 /* RAR[1-6] are owned by manageability. Skip those and program the 1698 /* RAR[1-6] are owned by manageability. Skip those and program the
@@ -1713,7 +1715,7 @@ static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index)
1713 /* verify the register updates */ 1715 /* verify the register updates */
1714 if ((er32(SHRAL(index - 1)) == rar_low) && 1716 if ((er32(SHRAL(index - 1)) == rar_low) &&
1715 (er32(SHRAH(index - 1)) == rar_high)) 1717 (er32(SHRAH(index - 1)) == rar_high))
1716 return; 1718 return 0;
1717 1719
1718 e_dbg("SHRA[%d] might be locked by ME - FWSM=0x%8.8x\n", 1720 e_dbg("SHRA[%d] might be locked by ME - FWSM=0x%8.8x\n",
1719 (index - 1), er32(FWSM)); 1721 (index - 1), er32(FWSM));
@@ -1721,6 +1723,43 @@ static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index)
1721 1723
1722out: 1724out:
1723 e_dbg("Failed to write receive address at index %d\n", index); 1725 e_dbg("Failed to write receive address at index %d\n", index);
1726 return -E1000_ERR_CONFIG;
1727}
1728
1729/**
1730 * e1000_rar_get_count_pch_lpt - Get the number of available SHRA
1731 * @hw: pointer to the HW structure
1732 *
1733 * Get the number of available receive registers that the Host can
1734 * program. SHRA[0-10] are the shared receive address registers
1735 * that are shared between the Host and manageability engine (ME).
1736 * ME can reserve any number of addresses and the host needs to be
1737 * able to tell how many available registers it has access to.
1738 **/
1739static u32 e1000_rar_get_count_pch_lpt(struct e1000_hw *hw)
1740{
1741 u32 wlock_mac;
1742 u32 num_entries;
1743
1744 wlock_mac = er32(FWSM) & E1000_FWSM_WLOCK_MAC_MASK;
1745 wlock_mac >>= E1000_FWSM_WLOCK_MAC_SHIFT;
1746
1747 switch (wlock_mac) {
1748 case 0:
1749 /* All SHRA[0..10] and RAR[0] available */
1750 num_entries = hw->mac.rar_entry_count;
1751 break;
1752 case 1:
1753 /* Only RAR[0] available */
1754 num_entries = 1;
1755 break;
1756 default:
1757 /* SHRA[0..(wlock_mac - 1)] available + RAR[0] */
1758 num_entries = wlock_mac + 1;
1759 break;
1760 }
1761
1762 return num_entries;
1724} 1763}
1725 1764
1726/** 1765/**
@@ -1734,7 +1773,7 @@ out:
1734 * contain the MAC address. SHRA[0-10] are the shared receive address 1773 * contain the MAC address. SHRA[0-10] are the shared receive address
1735 * registers that are shared between the Host and manageability engine (ME). 1774 * registers that are shared between the Host and manageability engine (ME).
1736 **/ 1775 **/
1737static void e1000_rar_set_pch_lpt(struct e1000_hw *hw, u8 *addr, u32 index) 1776static int e1000_rar_set_pch_lpt(struct e1000_hw *hw, u8 *addr, u32 index)
1738{ 1777{
1739 u32 rar_low, rar_high; 1778 u32 rar_low, rar_high;
1740 u32 wlock_mac; 1779 u32 wlock_mac;
@@ -1756,7 +1795,7 @@ static void e1000_rar_set_pch_lpt(struct e1000_hw *hw, u8 *addr, u32 index)
1756 e1e_flush(); 1795 e1e_flush();
1757 ew32(RAH(index), rar_high); 1796 ew32(RAH(index), rar_high);
1758 e1e_flush(); 1797 e1e_flush();
1759 return; 1798 return 0;
1760 } 1799 }
1761 1800
1762 /* The manageability engine (ME) can lock certain SHRAR registers that 1801 /* The manageability engine (ME) can lock certain SHRAR registers that
@@ -1788,12 +1827,13 @@ static void e1000_rar_set_pch_lpt(struct e1000_hw *hw, u8 *addr, u32 index)
1788 /* verify the register updates */ 1827 /* verify the register updates */
1789 if ((er32(SHRAL_PCH_LPT(index - 1)) == rar_low) && 1828 if ((er32(SHRAL_PCH_LPT(index - 1)) == rar_low) &&
1790 (er32(SHRAH_PCH_LPT(index - 1)) == rar_high)) 1829 (er32(SHRAH_PCH_LPT(index - 1)) == rar_high))
1791 return; 1830 return 0;
1792 } 1831 }
1793 } 1832 }
1794 1833
1795out: 1834out:
1796 e_dbg("Failed to write receive address at index %d\n", index); 1835 e_dbg("Failed to write receive address at index %d\n", index);
1836 return -E1000_ERR_CONFIG;
1797} 1837}
1798 1838
1799/** 1839/**
@@ -4977,6 +5017,7 @@ static const struct e1000_mac_operations ich8_mac_ops = {
4977 /* id_led_init dependent on mac type */ 5017 /* id_led_init dependent on mac type */
4978 .config_collision_dist = e1000e_config_collision_dist_generic, 5018 .config_collision_dist = e1000e_config_collision_dist_generic,
4979 .rar_set = e1000e_rar_set_generic, 5019 .rar_set = e1000e_rar_set_generic,
5020 .rar_get_count = e1000e_rar_get_count_generic,
4980}; 5021};
4981 5022
4982static const struct e1000_phy_operations ich8_phy_ops = { 5023static const struct e1000_phy_operations ich8_phy_ops = {
diff --git a/drivers/net/ethernet/intel/e1000e/mac.c b/drivers/net/ethernet/intel/e1000e/mac.c
index baa0a466d1d0..8c386f3a15eb 100644
--- a/drivers/net/ethernet/intel/e1000e/mac.c
+++ b/drivers/net/ethernet/intel/e1000e/mac.c
@@ -211,6 +211,11 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw)
211 return 0; 211 return 0;
212} 212}
213 213
214u32 e1000e_rar_get_count_generic(struct e1000_hw *hw)
215{
216 return hw->mac.rar_entry_count;
217}
218
214/** 219/**
215 * e1000e_rar_set_generic - Set receive address register 220 * e1000e_rar_set_generic - Set receive address register
216 * @hw: pointer to the HW structure 221 * @hw: pointer to the HW structure
@@ -220,7 +225,7 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw)
220 * Sets the receive address array register at index to the address passed 225 * Sets the receive address array register at index to the address passed
221 * in by addr. 226 * in by addr.
222 **/ 227 **/
223void e1000e_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index) 228int e1000e_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index)
224{ 229{
225 u32 rar_low, rar_high; 230 u32 rar_low, rar_high;
226 231
@@ -244,6 +249,8 @@ void e1000e_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index)
244 e1e_flush(); 249 e1e_flush();
245 ew32(RAH(index), rar_high); 250 ew32(RAH(index), rar_high);
246 e1e_flush(); 251 e1e_flush();
252
253 return 0;
247} 254}
248 255
249/** 256/**
diff --git a/drivers/net/ethernet/intel/e1000e/mac.h b/drivers/net/ethernet/intel/e1000e/mac.h
index 4e81c2825b7a..0513d90cdeea 100644
--- a/drivers/net/ethernet/intel/e1000e/mac.h
+++ b/drivers/net/ethernet/intel/e1000e/mac.h
@@ -61,7 +61,8 @@ void e1000e_update_adaptive(struct e1000_hw *hw);
61void e1000_write_vfta_generic(struct e1000_hw *hw, u32 offset, u32 value); 61void e1000_write_vfta_generic(struct e1000_hw *hw, u32 offset, u32 value);
62 62
63void e1000_set_lan_id_multi_port_pcie(struct e1000_hw *hw); 63void e1000_set_lan_id_multi_port_pcie(struct e1000_hw *hw);
64void e1000e_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index); 64u32 e1000e_rar_get_count_generic(struct e1000_hw *hw);
65int e1000e_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index);
65void e1000e_config_collision_dist_generic(struct e1000_hw *hw); 66void e1000e_config_collision_dist_generic(struct e1000_hw *hw);
66 67
67#endif 68#endif
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index e4207efd13f8..6084e6ba45c2 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -3311,9 +3311,11 @@ static int e1000e_write_uc_addr_list(struct net_device *netdev)
3311{ 3311{
3312 struct e1000_adapter *adapter = netdev_priv(netdev); 3312 struct e1000_adapter *adapter = netdev_priv(netdev);
3313 struct e1000_hw *hw = &adapter->hw; 3313 struct e1000_hw *hw = &adapter->hw;
3314 unsigned int rar_entries = hw->mac.rar_entry_count; 3314 unsigned int rar_entries;
3315 int count = 0; 3315 int count = 0;
3316 3316
3317 rar_entries = hw->mac.ops.rar_get_count(hw);
3318
3317 /* save a rar entry for our hardware address */ 3319 /* save a rar entry for our hardware address */
3318 rar_entries--; 3320 rar_entries--;
3319 3321
@@ -3332,9 +3334,13 @@ static int e1000e_write_uc_addr_list(struct net_device *netdev)
3332 * combining 3334 * combining
3333 */ 3335 */
3334 netdev_for_each_uc_addr(ha, netdev) { 3336 netdev_for_each_uc_addr(ha, netdev) {
3337 int rval;
3338
3335 if (!rar_entries) 3339 if (!rar_entries)
3336 break; 3340 break;
3337 hw->mac.ops.rar_set(hw, ha->addr, rar_entries--); 3341 rval = hw->mac.ops.rar_set(hw, ha->addr, rar_entries--);
3342 if (rval < 0)
3343 return -ENOMEM;
3338 count++; 3344 count++;
3339 } 3345 }
3340 } 3346 }