igb(4) enable WOL features for this class of devices.

PR:	208343
Submitted by:	Kaho Tashikazu <kaho@elam.kais.kyoto-u.ac.jp>
This commit is contained in:
Sean Bruno 2017-01-22 18:04:57 +00:00
parent 8b273fc833
commit db569544d1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=312641

View File

@ -1738,7 +1738,7 @@ em_if_stop(if_ctx_t ctx)
e1000_reset_hw(&adapter->hw); e1000_reset_hw(&adapter->hw);
if (adapter->hw.mac.type >= e1000_82544) if (adapter->hw.mac.type >= e1000_82544)
E1000_WRITE_REG(&adapter->hw, E1000_WUC, 0); E1000_WRITE_REG(&adapter->hw, E1000_WUFC, 0);
e1000_led_off(&adapter->hw); e1000_led_off(&adapter->hw);
e1000_cleanup_led(&adapter->hw); e1000_cleanup_led(&adapter->hw);
@ -2313,7 +2313,7 @@ em_reset(if_ctx_t ctx)
/* Issue a global reset */ /* Issue a global reset */
e1000_reset_hw(hw); e1000_reset_hw(hw);
E1000_WRITE_REG(hw, E1000_WUC, 0); E1000_WRITE_REG(hw, E1000_WUFC, 0);
em_disable_aspm(adapter); em_disable_aspm(adapter);
/* and a re-init */ /* and a re-init */
if (e1000_init_hw(hw) < 0) { if (e1000_init_hw(hw) < 0) {
@ -2514,9 +2514,12 @@ em_setup_interface(if_ctx_t ctx)
/* Enable only WOL MAGIC by default */ /* Enable only WOL MAGIC by default */
if (adapter->wol) { if (adapter->wol) {
if_setcapabilitiesbit(ifp, IFCAP_WOL, 0); if_setcapenablebit(ifp, IFCAP_WOL_MAGIC,
if_setcapenablebit(ifp, IFCAP_WOL_MAGIC, 0); IFCAP_WOL_MCAST| IFCAP_WOL_UCAST);
} } else {
if_setcapenablebit(ifp, 0, IFCAP_WOL_MAGIC |
IFCAP_WOL_MCAST| IFCAP_WOL_UCAST);
}
/* /*
* Specify the media types supported by this adapter and register * Specify the media types supported by this adapter and register
@ -3314,6 +3317,15 @@ em_get_wakeup(if_ctx_t ctx)
case e1000_pch2lan: case e1000_pch2lan:
case e1000_pch_lpt: case e1000_pch_lpt:
case e1000_pch_spt: case e1000_pch_spt:
case e1000_82575: /* listing all igb devices */
case e1000_82576:
case e1000_82580:
case e1000_i350:
case e1000_i354:
case e1000_i210:
case e1000_i211:
case e1000_vfadapt:
case e1000_vfadapt_i350:
apme_mask = E1000_WUC_APME; apme_mask = E1000_WUC_APME;
adapter->has_amt = TRUE; adapter->has_amt = TRUE;
eeprom_data = E1000_READ_REG(&adapter->hw, E1000_WUC); eeprom_data = E1000_READ_REG(&adapter->hw, E1000_WUC);
@ -3393,7 +3405,7 @@ em_enable_wakeup(if_ctx_t ctx)
ctrl |= (E1000_CTRL_SWDPIN2 | E1000_CTRL_SWDPIN3); ctrl |= (E1000_CTRL_SWDPIN2 | E1000_CTRL_SWDPIN3);
E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl);
wuc = E1000_READ_REG(&adapter->hw, E1000_WUC); wuc = E1000_READ_REG(&adapter->hw, E1000_WUC);
wuc |= E1000_WUC_PME_EN ; wuc |= (E1000_WUC_PME_EN | E1000_WUC_APME);
E1000_WRITE_REG(&adapter->hw, E1000_WUC, wuc); E1000_WRITE_REG(&adapter->hw, E1000_WUC, wuc);
if ((adapter->hw.mac.type == e1000_ich8lan) || if ((adapter->hw.mac.type == e1000_ich8lan) ||
@ -3417,6 +3429,9 @@ em_enable_wakeup(if_ctx_t ctx)
if ((if_getcapenable(ifp) & IFCAP_WOL_MAGIC) == 0) if ((if_getcapenable(ifp) & IFCAP_WOL_MAGIC) == 0)
adapter->wol &= ~E1000_WUFC_MAG; adapter->wol &= ~E1000_WUFC_MAG;
if ((if_getcapenable(ifp) & IFCAP_WOL_UCAST) == 0)
adapter->wol &= ~E1000_WUFC_EX;
if ((if_getcapenable(ifp) & IFCAP_WOL_MCAST) == 0) if ((if_getcapenable(ifp) & IFCAP_WOL_MCAST) == 0)
adapter->wol &= ~E1000_WUFC_MC; adapter->wol &= ~E1000_WUFC_MC;
else { else {
@ -3425,10 +3440,7 @@ em_enable_wakeup(if_ctx_t ctx)
E1000_WRITE_REG(&adapter->hw, E1000_RCTL, rctl); E1000_WRITE_REG(&adapter->hw, E1000_RCTL, rctl);
} }
if ((adapter->hw.mac.type == e1000_pchlan) || if ( adapter->hw.mac.type >= e1000_pchlan) {
(adapter->hw.mac.type == e1000_pch2lan) ||
(adapter->hw.mac.type == e1000_pch_lpt) ||
(adapter->hw.mac.type == e1000_pch_spt)) {
if (em_enable_phy_wakeup(adapter)) if (em_enable_phy_wakeup(adapter))
return; return;
} else { } else {
@ -3493,7 +3505,7 @@ em_enable_phy_wakeup(struct adapter *adapter)
/* enable PHY wakeup in MAC register */ /* enable PHY wakeup in MAC register */
E1000_WRITE_REG(hw, E1000_WUC, E1000_WRITE_REG(hw, E1000_WUC,
E1000_WUC_PHY_WAKE | E1000_WUC_PME_EN); E1000_WUC_PHY_WAKE | E1000_WUC_PME_EN | E1000_WUC_APME);
E1000_WRITE_REG(hw, E1000_WUFC, adapter->wol); E1000_WRITE_REG(hw, E1000_WUFC, adapter->wol);
/* configure and enable PHY wakeup in PHY registers */ /* configure and enable PHY wakeup in PHY registers */