FreeBSD Bugzilla – Attachment 177062 Details for
Bug 208343
[em] wake on lan not working with Intel I219 V2
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
a very initial patch to enable WOL for igb
if_igb.c.diff (text/plain), 3.92 KB, created by
Kaho Toshikazu
on 2016-11-16 10:58:00 UTC
(
hide
)
Description:
a very initial patch to enable WOL for igb
Filename:
MIME Type:
Creator:
Kaho Toshikazu
Created:
2016-11-16 10:58:00 UTC
Size:
3.92 KB
patch
obsolete
>Index: sys/dev/e1000/if_igb.c >=================================================================== >--- sys/dev/e1000/if_igb.c (revision 308663) >+++ sys/dev/e1000/if_igb.c (working copy) >@@ -410,8 +410,10 @@ > { > struct adapter *adapter; > int error = 0; >+#if 0 > u16 eeprom_data; >- >+#endif >+ > INIT_DEBUGOUT("igb_attach: begin"); > > if (resource_disabled("igb", device_get_unit(dev))) { >@@ -631,9 +633,11 @@ > * Setup Wake-on-Lan > */ > /* APME bit in EEPROM is mapped to WUC.APME */ >+#if 0 > eeprom_data = E1000_READ_REG(&adapter->hw, E1000_WUC) & E1000_WUC_APME; > if (eeprom_data) > adapter->wol = E1000_WUFC_MAG; >+#endif > > /* Register for VLAN events */ > adapter->vlan_attach = EVENTHANDLER_REGISTER(vlan_config, >@@ -728,11 +732,7 @@ > igb_release_manageability(adapter); > igb_release_hw_control(adapter); > >- if (adapter->wol) { >- E1000_WRITE_REG(&adapter->hw, E1000_WUC, E1000_WUC_PME_EN); >- E1000_WRITE_REG(&adapter->hw, E1000_WUFC, adapter->wol); >- igb_enable_wakeup(dev); >- } >+ igb_enable_wakeup(dev); > > /* Unregister VLAN events */ > if (adapter->vlan_attach != NULL) >@@ -786,11 +786,7 @@ > igb_release_manageability(adapter); > igb_release_hw_control(adapter); > >- if (adapter->wol) { >- E1000_WRITE_REG(&adapter->hw, E1000_WUC, E1000_WUC_PME_EN); >- E1000_WRITE_REG(&adapter->hw, E1000_WUFC, adapter->wol); >- igb_enable_wakeup(dev); >- } >+ igb_enable_wakeup(dev); > > IGB_CORE_UNLOCK(adapter); > >@@ -1240,6 +1236,14 @@ > ifp->if_capenable ^= IFCAP_LRO; > reinit = 1; > } >+ if (mask & IFCAP_WOL) { >+ if (mask & IFCAP_WOL_MCAST) >+ ifp->if_capenable ^= IFCAP_WOL_MCAST; >+ if (mask & IFCAP_WOL_UCAST) >+ ifp->if_capenable ^= IFCAP_WOL_UCAST; >+ if (mask & IFCAP_WOL_MAGIC) >+ ifp->if_capenable ^= IFCAP_WOL_MAGIC; >+ } > if (reinit && (ifp->if_drv_flags & IFF_DRV_RUNNING)) > igb_init(adapter); > VLAN_CAPABILITIES(ifp); >@@ -2299,7 +2303,7 @@ > } > > e1000_reset_hw(&adapter->hw); >- 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); >@@ -3135,7 +3139,7 @@ > > /* Issue a global reset */ > e1000_reset_hw(hw); >- E1000_WRITE_REG(hw, E1000_WUC, 0); >+ E1000_WRITE_REG(hw, E1000_WUFC, 0); > > /* Reset for AutoMediaDetect */ > if (adapter->flags & IGB_MEDIA_RESET) { >@@ -3227,6 +3231,13 @@ > | IFCAP_VLAN_MTU; > > /* >+ * Force to enable WOL capabilities. >+ * Enable only WOL MAGIC by default. >+ */ >+ ifp->if_capabilities |= IFCAP_WOL; >+ ifp->if_capenable |= IFCAP_WOL_MAGIC; >+ >+ /* > ** Don't turn this on by default, if vlans are > ** created on another pseudo device (eg. lagg) > ** then vlan events are not passed thru, breaking >@@ -5507,9 +5518,35 @@ > static void > igb_enable_wakeup(device_t dev) > { >+ struct adapter *adapter = device_get_softc(dev); >+ struct ifnet *ifp = adapter->ifp; >+ u32 wuc; > u16 cap, status; > u8 id; > >+ adapter->wol = E1000_READ_REG(&adapter->hw, E1000_WUFC); >+ if (ifp->if_capenable & IFCAP_WOL_MAGIC) { >+ adapter->wol |= E1000_WUFC_MAG; >+ } else { >+ adapter->wol &= ~E1000_WUFC_MAG; >+ } >+ if (ifp->if_capenable & IFCAP_WOL_MCAST) { >+ adapter->wol |= E1000_WUFC_MC; >+ } else { >+ adapter->wol &= ~E1000_WUFC_MC; >+ } >+ if (ifp->if_capenable & IFCAP_WOL_UCAST) { >+ adapter->wol |= E1000_WUFC_EX; >+ } else { >+ adapter->wol &= ~E1000_WUFC_EX; >+ } >+ if(adapter->wol & >+ ( E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_MAG) ) { >+ wuc = E1000_READ_REG(&adapter->hw, E1000_WUC); >+ wuc |= (E1000_WUC_PME_EN | E1000_WUC_APME) ; >+ E1000_WRITE_REG(&adapter->hw, E1000_WUC, wuc); >+ E1000_WRITE_REG(&adapter->hw, E1000_WUFC, adapter->wol); >+ > /* First find the capabilities pointer*/ > cap = pci_read_config(dev, PCIR_CAP_PTR, 2); > /* Read the PM Capabilities */ >@@ -5522,6 +5559,7 @@ > status = pci_read_config(dev, cap, 2); > status |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; > pci_write_config(dev, cap, status, 2); >+ } > return; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 208343
:
168707
|
177062
|
177103
|
178797
|
178851
|
181517
|
185903