igb: No longer rely on APME to determine WoL settings
Historically, we've been using the APME bit to determine whether a device supports wake on a given port or not. However, this bit specifies the default wake setting, rather than the wake support. Change the behavior so that we use a flag to keep the capabilities separate from the enablement while meeting customer requirements. Signed-off-by: Matthew Vick <matthew.vick@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
committed by
Jeff Kirsher
parent
3e961a06a0
commit
63d4a8f963
@@ -1837,7 +1837,6 @@ static int __devinit igb_probe(struct pci_dev *pdev,
|
||||
const struct e1000_info *ei = igb_info_tbl[ent->driver_data];
|
||||
unsigned long mmio_start, mmio_len;
|
||||
int err, pci_using_dac;
|
||||
u16 eeprom_apme_mask = IGB_EEPROM_APME;
|
||||
u8 part_str[E1000_PBANUM_LENGTH];
|
||||
|
||||
/* Catch broken hardware that put the wrong VF device ID in
|
||||
@@ -2045,28 +2044,27 @@ static int __devinit igb_probe(struct pci_dev *pdev,
|
||||
|
||||
igb_validate_mdi_setting(hw);
|
||||
|
||||
/* Initial Wake on LAN setting If APM wake is enabled in the EEPROM,
|
||||
* enable the ACPI Magic Packet filter
|
||||
*/
|
||||
|
||||
/* By default, support wake on port A */
|
||||
if (hw->bus.func == 0)
|
||||
hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A, 1, &eeprom_data);
|
||||
else if (hw->mac.type >= e1000_82580)
|
||||
adapter->flags |= IGB_FLAG_WOL_SUPPORTED;
|
||||
|
||||
/* Check the NVM for wake support on non-port A ports */
|
||||
if (hw->mac.type >= e1000_82580)
|
||||
hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A +
|
||||
NVM_82580_LAN_FUNC_OFFSET(hw->bus.func), 1,
|
||||
&eeprom_data);
|
||||
else if (hw->bus.func == 1)
|
||||
hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_B, 1, &eeprom_data);
|
||||
|
||||
if (eeprom_data & eeprom_apme_mask)
|
||||
adapter->eeprom_wol |= E1000_WUFC_MAG;
|
||||
if (eeprom_data & IGB_EEPROM_APME)
|
||||
adapter->flags |= IGB_FLAG_WOL_SUPPORTED;
|
||||
|
||||
/* now that we have the eeprom settings, apply the special cases where
|
||||
* the eeprom may be wrong or the board simply won't support wake on
|
||||
* lan on a particular port */
|
||||
switch (pdev->device) {
|
||||
case E1000_DEV_ID_82575GB_QUAD_COPPER:
|
||||
adapter->eeprom_wol = 0;
|
||||
adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED;
|
||||
break;
|
||||
case E1000_DEV_ID_82575EB_FIBER_SERDES:
|
||||
case E1000_DEV_ID_82576_FIBER:
|
||||
@@ -2074,24 +2072,38 @@ static int __devinit igb_probe(struct pci_dev *pdev,
|
||||
/* Wake events only supported on port A for dual fiber
|
||||
* regardless of eeprom setting */
|
||||
if (rd32(E1000_STATUS) & E1000_STATUS_FUNC_1)
|
||||
adapter->eeprom_wol = 0;
|
||||
adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED;
|
||||
break;
|
||||
case E1000_DEV_ID_82576_QUAD_COPPER:
|
||||
case E1000_DEV_ID_82576_QUAD_COPPER_ET2:
|
||||
/* if quad port adapter, disable WoL on all but port A */
|
||||
if (global_quad_port_a != 0)
|
||||
adapter->eeprom_wol = 0;
|
||||
adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED;
|
||||
else
|
||||
adapter->flags |= IGB_FLAG_QUAD_PORT_A;
|
||||
/* Reset for multiple quad port adapters */
|
||||
if (++global_quad_port_a == 4)
|
||||
global_quad_port_a = 0;
|
||||
break;
|
||||
default:
|
||||
/* If the device can't wake, don't set software support */
|
||||
if (!device_can_wakeup(&adapter->pdev->dev))
|
||||
adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED;
|
||||
}
|
||||
|
||||
/* initialize the wol settings based on the eeprom settings */
|
||||
adapter->wol = adapter->eeprom_wol;
|
||||
device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);
|
||||
if (adapter->flags & IGB_FLAG_WOL_SUPPORTED)
|
||||
adapter->wol |= E1000_WUFC_MAG;
|
||||
|
||||
/* Some vendors want WoL disabled by default, but still supported */
|
||||
if ((hw->mac.type == e1000_i350) &&
|
||||
(pdev->subsystem_vendor == PCI_VENDOR_ID_HP)) {
|
||||
adapter->flags |= IGB_FLAG_WOL_SUPPORTED;
|
||||
adapter->wol = 0;
|
||||
}
|
||||
|
||||
device_set_wakeup_enable(&adapter->pdev->dev,
|
||||
adapter->flags & IGB_FLAG_WOL_SUPPORTED);
|
||||
|
||||
/* reset the hardware with the new settings */
|
||||
igb_reset(adapter);
|
||||
|
||||
Reference in New Issue
Block a user