From 45c539876b361c5f0b18d86f01ebfa663190752d Mon Sep 17 00:00:00 2001 From: jpz4085 Date: Sun, 27 Sep 2020 19:52:32 -0400 Subject: [PATCH] Cycle hardware enable/disable routines to support WOL from S5 if controller already disabled. --- IntelMausiEthernet/IntelMausiEthernet.cpp | 17 ++++++++--------- IntelMausiEthernet/IntelMausiEthernet.h | 5 +++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/IntelMausiEthernet/IntelMausiEthernet.cpp b/IntelMausiEthernet/IntelMausiEthernet.cpp index bc61329..0b1f2ea 100644 --- a/IntelMausiEthernet/IntelMausiEthernet.cpp +++ b/IntelMausiEthernet/IntelMausiEthernet.cpp @@ -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); @@ -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); @@ -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"); } } diff --git a/IntelMausiEthernet/IntelMausiEthernet.h b/IntelMausiEthernet/IntelMausiEthernet.h index dfa5062..6250e38 100644 --- a/IntelMausiEthernet/IntelMausiEthernet.h +++ b/IntelMausiEthernet/IntelMausiEthernet.h @@ -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: