diff options
author | Matthew Vick <matthew.vick@intel.com> | 2012-11-09 00:49:54 -0500 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2012-11-22 05:00:58 -0500 |
commit | 63d4a8f963fce8fe5d8ba3d5eba34d7d7ca6f82b (patch) | |
tree | 34d71b51d5abcfa21be055245b6e8292b1aedb83 /drivers/net/ethernet/intel/igb/igb_main.c | |
parent | 3e961a06a0d509d9f7cddc8240431d25f6dcd51f (diff) |
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>
Diffstat (limited to 'drivers/net/ethernet/intel/igb/igb_main.c')
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb_main.c | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 7044aaadeca1..0fe25210629b 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -1837,7 +1837,6 @@ static int __devinit igb_probe(struct pci_dev *pdev, | |||
1837 | const struct e1000_info *ei = igb_info_tbl[ent->driver_data]; | 1837 | const struct e1000_info *ei = igb_info_tbl[ent->driver_data]; |
1838 | unsigned long mmio_start, mmio_len; | 1838 | unsigned long mmio_start, mmio_len; |
1839 | int err, pci_using_dac; | 1839 | int err, pci_using_dac; |
1840 | u16 eeprom_apme_mask = IGB_EEPROM_APME; | ||
1841 | u8 part_str[E1000_PBANUM_LENGTH]; | 1840 | u8 part_str[E1000_PBANUM_LENGTH]; |
1842 | 1841 | ||
1843 | /* Catch broken hardware that put the wrong VF device ID in | 1842 | /* Catch broken hardware that put the wrong VF device ID in |
@@ -2045,28 +2044,27 @@ static int __devinit igb_probe(struct pci_dev *pdev, | |||
2045 | 2044 | ||
2046 | igb_validate_mdi_setting(hw); | 2045 | igb_validate_mdi_setting(hw); |
2047 | 2046 | ||
2048 | /* Initial Wake on LAN setting If APM wake is enabled in the EEPROM, | 2047 | /* By default, support wake on port A */ |
2049 | * enable the ACPI Magic Packet filter | ||
2050 | */ | ||
2051 | |||
2052 | if (hw->bus.func == 0) | 2048 | if (hw->bus.func == 0) |
2053 | hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A, 1, &eeprom_data); | 2049 | adapter->flags |= IGB_FLAG_WOL_SUPPORTED; |
2054 | else if (hw->mac.type >= e1000_82580) | 2050 | |
2051 | /* Check the NVM for wake support on non-port A ports */ | ||
2052 | if (hw->mac.type >= e1000_82580) | ||
2055 | hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A + | 2053 | hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A + |
2056 | NVM_82580_LAN_FUNC_OFFSET(hw->bus.func), 1, | 2054 | NVM_82580_LAN_FUNC_OFFSET(hw->bus.func), 1, |
2057 | &eeprom_data); | 2055 | &eeprom_data); |
2058 | else if (hw->bus.func == 1) | 2056 | else if (hw->bus.func == 1) |
2059 | hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_B, 1, &eeprom_data); | 2057 | hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_B, 1, &eeprom_data); |
2060 | 2058 | ||
2061 | if (eeprom_data & eeprom_apme_mask) | 2059 | if (eeprom_data & IGB_EEPROM_APME) |
2062 | adapter->eeprom_wol |= E1000_WUFC_MAG; | 2060 | adapter->flags |= IGB_FLAG_WOL_SUPPORTED; |
2063 | 2061 | ||
2064 | /* now that we have the eeprom settings, apply the special cases where | 2062 | /* now that we have the eeprom settings, apply the special cases where |
2065 | * the eeprom may be wrong or the board simply won't support wake on | 2063 | * the eeprom may be wrong or the board simply won't support wake on |
2066 | * lan on a particular port */ | 2064 | * lan on a particular port */ |
2067 | switch (pdev->device) { | 2065 | switch (pdev->device) { |
2068 | case E1000_DEV_ID_82575GB_QUAD_COPPER: | 2066 | case E1000_DEV_ID_82575GB_QUAD_COPPER: |
2069 | adapter->eeprom_wol = 0; | 2067 | adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED; |
2070 | break; | 2068 | break; |
2071 | case E1000_DEV_ID_82575EB_FIBER_SERDES: | 2069 | case E1000_DEV_ID_82575EB_FIBER_SERDES: |
2072 | case E1000_DEV_ID_82576_FIBER: | 2070 | case E1000_DEV_ID_82576_FIBER: |
@@ -2074,24 +2072,38 @@ static int __devinit igb_probe(struct pci_dev *pdev, | |||
2074 | /* Wake events only supported on port A for dual fiber | 2072 | /* Wake events only supported on port A for dual fiber |
2075 | * regardless of eeprom setting */ | 2073 | * regardless of eeprom setting */ |
2076 | if (rd32(E1000_STATUS) & E1000_STATUS_FUNC_1) | 2074 | if (rd32(E1000_STATUS) & E1000_STATUS_FUNC_1) |
2077 | adapter->eeprom_wol = 0; | 2075 | adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED; |
2078 | break; | 2076 | break; |
2079 | case E1000_DEV_ID_82576_QUAD_COPPER: | 2077 | case E1000_DEV_ID_82576_QUAD_COPPER: |
2080 | case E1000_DEV_ID_82576_QUAD_COPPER_ET2: | 2078 | case E1000_DEV_ID_82576_QUAD_COPPER_ET2: |
2081 | /* if quad port adapter, disable WoL on all but port A */ | 2079 | /* if quad port adapter, disable WoL on all but port A */ |
2082 | if (global_quad_port_a != 0) | 2080 | if (global_quad_port_a != 0) |
2083 | adapter->eeprom_wol = 0; | 2081 | adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED; |
2084 | else | 2082 | else |
2085 | adapter->flags |= IGB_FLAG_QUAD_PORT_A; | 2083 | adapter->flags |= IGB_FLAG_QUAD_PORT_A; |
2086 | /* Reset for multiple quad port adapters */ | 2084 | /* Reset for multiple quad port adapters */ |
2087 | if (++global_quad_port_a == 4) | 2085 | if (++global_quad_port_a == 4) |
2088 | global_quad_port_a = 0; | 2086 | global_quad_port_a = 0; |
2089 | break; | 2087 | break; |
2088 | default: | ||
2089 | /* If the device can't wake, don't set software support */ | ||
2090 | if (!device_can_wakeup(&adapter->pdev->dev)) | ||
2091 | adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED; | ||
2090 | } | 2092 | } |
2091 | 2093 | ||
2092 | /* initialize the wol settings based on the eeprom settings */ | 2094 | /* initialize the wol settings based on the eeprom settings */ |
2093 | adapter->wol = adapter->eeprom_wol; | 2095 | if (adapter->flags & IGB_FLAG_WOL_SUPPORTED) |
2094 | device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); | 2096 | adapter->wol |= E1000_WUFC_MAG; |
2097 | |||
2098 | /* Some vendors want WoL disabled by default, but still supported */ | ||
2099 | if ((hw->mac.type == e1000_i350) && | ||
2100 | (pdev->subsystem_vendor == PCI_VENDOR_ID_HP)) { | ||
2101 | adapter->flags |= IGB_FLAG_WOL_SUPPORTED; | ||
2102 | adapter->wol = 0; | ||
2103 | } | ||
2104 | |||
2105 | device_set_wakeup_enable(&adapter->pdev->dev, | ||
2106 | adapter->flags & IGB_FLAG_WOL_SUPPORTED); | ||
2095 | 2107 | ||
2096 | /* reset the hardware with the new settings */ | 2108 | /* reset the hardware with the new settings */ |
2097 | igb_reset(adapter); | 2109 | igb_reset(adapter); |