Skip to content

Commit

Permalink
Cycle hardware enable/disable routines to support WOL from S5 if cont…
Browse files Browse the repository at this point in the history
…roller already disabled.
  • Loading branch information
jpz4085 committed Sep 27, 2020
1 parent c8d8e9a commit 45c5398
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
17 changes: 8 additions & 9 deletions IntelMausiEthernet/IntelMausiEthernet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ bool IntelMausi::start(IOService *provider)
goto error3;
}

if (provider->getProperty("disable-wol-from-shutdown"))
if (pciDevice->getProperty("disable-wol-from-shutdown"))
wolPwrOff = false;

pciDevice->close(this);
Expand Down Expand Up @@ -420,13 +420,7 @@ void IntelMausi::systemWillShutdown(IOOptionBits specifier)

if ((kIOMessageSystemWillPowerOff | kIOMessageSystemWillRestart) & specifier) {
setWakeOnLanFromShutdown();

/* Call intelDisable to set WOL from S5 if contoller already
disabled otherwise call disable at shutdown if required. */
if (!isEnabled && wolActive)
intelDisable();
else
disable(netif);
disable(netif);

/* Restore the original MAC address. */
adapterData.hw.mac.ops.rar_set(&adapterData.hw, adapterData.hw.mac.perm_addr, 0);
Expand Down Expand Up @@ -1027,7 +1021,12 @@ void IntelMausi::setWakeOnLanFromShutdown()

if (kIOEthernetWakeOnMagicPacket & wakeSetting) {
wolActive = true;
DebugLog("Ethernet [IntelMausi]: Wake On LAN from shutdown enabled.\n");
DebugLog("Ethernet [IntelMausi]: Wake on magic packet enabled.\n");
}
if (!isEnabled && wolActive) {
intelEnable();
intelDisable();
DebugLog("Ethernet [IntelMausi]: Wake On LAN from shutdown active.\n");
}
}

Expand Down
5 changes: 3 additions & 2 deletions IntelMausiEthernet/IntelMausiEthernet.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,9 @@ class IntelMausi : public super
/* timer action */
void timerAction(IOTimerEventSource *timer);

/* Set wolActive prior to shutdown or restart to support WOL
from S5 if "Wake for network access" or "WOMP" is enabled. */
/* Set wolActive prior to shutdown or restart to support WOL from S5
if "Wake for network access" or "WOMP" is enabled and run the hardware
enable/disable routines if the controller is already disabled. */
void setWakeOnLanFromShutdown();

private:
Expand Down

0 comments on commit 45c5398

Please sign in to comment.