Author: sbruno
Date: Sun Jan 22 18:04:57 2017
New Revision: 312641
URL: https://svnweb.freebsd.org/changeset/base/312641

Log:
  igb(4) enable WOL features for this class of devices.
  
  PR:   208343
  Submitted by: Kaho Tashikazu <k...@elam.kais.kyoto-u.ac.jp>

Modified:
  head/sys/dev/e1000/if_em.c

Modified: head/sys/dev/e1000/if_em.c
==============================================================================
--- head/sys/dev/e1000/if_em.c  Sun Jan 22 18:04:41 2017        (r312640)
+++ head/sys/dev/e1000/if_em.c  Sun Jan 22 18:04:57 2017        (r312641)
@@ -1738,7 +1738,7 @@ em_if_stop(if_ctx_t ctx)
        
        e1000_reset_hw(&adapter->hw);
        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_cleanup_led(&adapter->hw);
@@ -2313,7 +2313,7 @@ em_reset(if_ctx_t ctx)
 
        /* Issue a global reset */
        e1000_reset_hw(hw);
-       E1000_WRITE_REG(hw, E1000_WUC, 0);
+       E1000_WRITE_REG(hw, E1000_WUFC, 0);
        em_disable_aspm(adapter);
        /* and a re-init */
        if (e1000_init_hw(hw) < 0) {
@@ -2514,9 +2514,12 @@ em_setup_interface(if_ctx_t ctx)
 
        /* Enable only WOL MAGIC by default */
        if (adapter->wol) {
-               if_setcapabilitiesbit(ifp, IFCAP_WOL, 0);
-               if_setcapenablebit(ifp, IFCAP_WOL_MAGIC, 0);
-       }
+               if_setcapenablebit(ifp, IFCAP_WOL_MAGIC,
+                            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
@@ -3314,6 +3317,15 @@ em_get_wakeup(if_ctx_t ctx)
        case e1000_pch2lan:
        case e1000_pch_lpt:
        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;
                adapter->has_amt = TRUE;
                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);
        E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl);
        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);
 
        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)
                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)
                adapter->wol &= ~E1000_WUFC_MC;
        else {
@@ -3425,10 +3440,7 @@ em_enable_wakeup(if_ctx_t ctx)
                E1000_WRITE_REG(&adapter->hw, E1000_RCTL, rctl);
        }
 
-       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 ( adapter->hw.mac.type >= e1000_pchlan) {
                if (em_enable_phy_wakeup(adapter))
                        return;
        } else {
@@ -3493,7 +3505,7 @@ em_enable_phy_wakeup(struct adapter *ada
 
        /* enable PHY wakeup in MAC register */
        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);
 
        /* configure and enable PHY wakeup in PHY registers */
_______________________________________________
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