Commit 1a1ca861 authored by Tobias Diedrich's avatar Tobias Diedrich Committed by Jeff Garzik

[netdrvr] forcedeth: save/restore device configuration space

The memory mapped device configuration space is lost during hibernate.
Save and restore it (fixes 'swapped mac' problem).
Signed-off-by: default avatarTTobias Diedrich <ranma+kernel@tdiedrich.de>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent f735a2a1
...@@ -426,6 +426,7 @@ union ring_type { ...@@ -426,6 +426,7 @@ union ring_type {
#define NV_PCI_REGSZ_VER1 0x270 #define NV_PCI_REGSZ_VER1 0x270
#define NV_PCI_REGSZ_VER2 0x2d4 #define NV_PCI_REGSZ_VER2 0x2d4
#define NV_PCI_REGSZ_VER3 0x604 #define NV_PCI_REGSZ_VER3 0x604
#define NV_PCI_REGSZ_MAX 0x604
/* various timeout delays: all in usec */ /* various timeout delays: all in usec */
#define NV_TXRX_RESET_DELAY 4 #define NV_TXRX_RESET_DELAY 4
...@@ -784,6 +785,9 @@ struct fe_priv { ...@@ -784,6 +785,9 @@ struct fe_priv {
/* flow control */ /* flow control */
u32 pause_flags; u32 pause_flags;
/* power saved state */
u32 saved_config_space[NV_PCI_REGSZ_MAX/4];
}; };
/* /*
...@@ -5785,6 +5789,8 @@ static int nv_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -5785,6 +5789,8 @@ static int nv_suspend(struct pci_dev *pdev, pm_message_t state)
{ {
struct net_device *dev = pci_get_drvdata(pdev); struct net_device *dev = pci_get_drvdata(pdev);
struct fe_priv *np = netdev_priv(dev); struct fe_priv *np = netdev_priv(dev);
u8 __iomem *base = get_hwbase(dev);
int i;
if (!netif_running(dev)) if (!netif_running(dev))
goto out; goto out;
...@@ -5794,6 +5800,10 @@ static int nv_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -5794,6 +5800,10 @@ static int nv_suspend(struct pci_dev *pdev, pm_message_t state)
// Gross. // Gross.
nv_close(dev); nv_close(dev);
/* save non-pci configuration space */
for (i = 0;i <= np->register_size/sizeof(u32); i++)
np->saved_config_space[i] = readl(base + i*sizeof(u32));
pci_save_state(pdev); pci_save_state(pdev);
pci_enable_wake(pdev, pci_choose_state(pdev, state), np->wolenabled); pci_enable_wake(pdev, pci_choose_state(pdev, state), np->wolenabled);
pci_set_power_state(pdev, pci_choose_state(pdev, state)); pci_set_power_state(pdev, pci_choose_state(pdev, state));
...@@ -5804,9 +5814,9 @@ static int nv_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -5804,9 +5814,9 @@ static int nv_suspend(struct pci_dev *pdev, pm_message_t state)
static int nv_resume(struct pci_dev *pdev) static int nv_resume(struct pci_dev *pdev)
{ {
struct net_device *dev = pci_get_drvdata(pdev); struct net_device *dev = pci_get_drvdata(pdev);
struct fe_priv *np = netdev_priv(dev);
u8 __iomem *base = get_hwbase(dev); u8 __iomem *base = get_hwbase(dev);
int rc = 0; int i, rc = 0;
u32 txreg;
if (!netif_running(dev)) if (!netif_running(dev))
goto out; goto out;
...@@ -5817,10 +5827,9 @@ static int nv_resume(struct pci_dev *pdev) ...@@ -5817,10 +5827,9 @@ static int nv_resume(struct pci_dev *pdev)
pci_restore_state(pdev); pci_restore_state(pdev);
pci_enable_wake(pdev, PCI_D0, 0); pci_enable_wake(pdev, PCI_D0, 0);
/* restore mac address reverse flag */ /* restore non-pci configuration space */
txreg = readl(base + NvRegTransmitPoll); for (i = 0;i <= np->register_size/sizeof(u32); i++)
txreg |= NVREG_TRANSMITPOLL_MAC_ADDR_REV; writel(np->saved_config_space[i], base+i*sizeof(u32));
writel(txreg, base + NvRegTransmitPoll);
rc = nv_open(dev); rc = nv_open(dev);
nv_set_multicast(dev); nv_set_multicast(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment