aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2009-04-15 13:43:24 -0400
committerDavid S. Miller <davem@davemloft.net>2009-04-16 05:15:22 -0400
commitb43fcd7dc7bf0471b3bdda8fee3418e93ac25863 (patch)
treec0348b09954d41823e80e8818cf8404b5fee8b07 /drivers/net
parent719bfeaae8104fca4ca5d47c02592b08682f14fa (diff)
NET/e1000: Fix powering off during shutdown
Prevent e1000 from putting the adapter into D3 during shutdown except when we're going to power off the system, since doing that may generally cause problems with kexec to happen (such problems were observed for igb and forcedeth). For this purpose seperate e1000_shutdown() from e1000_suspend() and use the appropriate PCI PM callbacks in both of them. Signed-off-by: "Rafael J. Wysocki" <rjw@sisk.pl> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/e1000/e1000_main.c46
1 files changed, 33 insertions, 13 deletions
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 4cd8b25c7ed7..ef12931d302a 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -156,8 +156,8 @@ static void e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid);
156static void e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid); 156static void e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid);
157static void e1000_restore_vlan(struct e1000_adapter *adapter); 157static void e1000_restore_vlan(struct e1000_adapter *adapter);
158 158
159static int e1000_suspend(struct pci_dev *pdev, pm_message_t state);
160#ifdef CONFIG_PM 159#ifdef CONFIG_PM
160static int e1000_suspend(struct pci_dev *pdev, pm_message_t state);
161static int e1000_resume(struct pci_dev *pdev); 161static int e1000_resume(struct pci_dev *pdev);
162#endif 162#endif
163static void e1000_shutdown(struct pci_dev *pdev); 163static void e1000_shutdown(struct pci_dev *pdev);
@@ -4601,7 +4601,7 @@ int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)
4601 return 0; 4601 return 0;
4602} 4602}
4603 4603
4604static int e1000_suspend(struct pci_dev *pdev, pm_message_t state) 4604static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake)
4605{ 4605{
4606 struct net_device *netdev = pci_get_drvdata(pdev); 4606 struct net_device *netdev = pci_get_drvdata(pdev);
4607 struct e1000_adapter *adapter = netdev_priv(netdev); 4607 struct e1000_adapter *adapter = netdev_priv(netdev);
@@ -4664,22 +4664,18 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
4664 4664
4665 ew32(WUC, E1000_WUC_PME_EN); 4665 ew32(WUC, E1000_WUC_PME_EN);
4666 ew32(WUFC, wufc); 4666 ew32(WUFC, wufc);
4667 pci_enable_wake(pdev, PCI_D3hot, 1);
4668 pci_enable_wake(pdev, PCI_D3cold, 1);
4669 } else { 4667 } else {
4670 ew32(WUC, 0); 4668 ew32(WUC, 0);
4671 ew32(WUFC, 0); 4669 ew32(WUFC, 0);
4672 pci_enable_wake(pdev, PCI_D3hot, 0);
4673 pci_enable_wake(pdev, PCI_D3cold, 0);
4674 } 4670 }
4675 4671
4676 e1000_release_manageability(adapter); 4672 e1000_release_manageability(adapter);
4677 4673
4674 *enable_wake = !!wufc;
4675
4678 /* make sure adapter isn't asleep if manageability is enabled */ 4676 /* make sure adapter isn't asleep if manageability is enabled */
4679 if (adapter->en_mng_pt) { 4677 if (adapter->en_mng_pt)
4680 pci_enable_wake(pdev, PCI_D3hot, 1); 4678 *enable_wake = true;
4681 pci_enable_wake(pdev, PCI_D3cold, 1);
4682 }
4683 4679
4684 if (hw->phy_type == e1000_phy_igp_3) 4680 if (hw->phy_type == e1000_phy_igp_3)
4685 e1000_phy_powerdown_workaround(hw); 4681 e1000_phy_powerdown_workaround(hw);
@@ -4693,12 +4689,29 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
4693 4689
4694 pci_disable_device(pdev); 4690 pci_disable_device(pdev);
4695 4691
4696 pci_set_power_state(pdev, pci_choose_state(pdev, state));
4697
4698 return 0; 4692 return 0;
4699} 4693}
4700 4694
4701#ifdef CONFIG_PM 4695#ifdef CONFIG_PM
4696static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
4697{
4698 int retval;
4699 bool wake;
4700
4701 retval = __e1000_shutdown(pdev, &wake);
4702 if (retval)
4703 return retval;
4704
4705 if (wake) {
4706 pci_prepare_to_sleep(pdev);
4707 } else {
4708 pci_wake_from_d3(pdev, false);
4709 pci_set_power_state(pdev, PCI_D3hot);
4710 }
4711
4712 return 0;
4713}
4714
4702static int e1000_resume(struct pci_dev *pdev) 4715static int e1000_resume(struct pci_dev *pdev)
4703{ 4716{
4704 struct net_device *netdev = pci_get_drvdata(pdev); 4717 struct net_device *netdev = pci_get_drvdata(pdev);
@@ -4753,7 +4766,14 @@ static int e1000_resume(struct pci_dev *pdev)
4753 4766
4754static void e1000_shutdown(struct pci_dev *pdev) 4767static void e1000_shutdown(struct pci_dev *pdev)
4755{ 4768{
4756 e1000_suspend(pdev, PMSG_SUSPEND); 4769 bool wake;
4770
4771 __e1000_shutdown(pdev, &wake);
4772
4773 if (system_state == SYSTEM_POWER_OFF) {
4774 pci_wake_from_d3(pdev, wake);
4775 pci_set_power_state(pdev, PCI_D3hot);
4776 }
4757} 4777}
4758 4778
4759#ifdef CONFIG_NET_POLL_CONTROLLER 4779#ifdef CONFIG_NET_POLL_CONTROLLER