Hi, This patch adds PCI suspend/resume support to the 8139cp ethernet driver. Consider pulling it from: http://cscience.org/~coqueiro/linux/patches-fwd/2.5/8139cp-suspend_resume.patch Please apply. Felipe --- ./drivers/net/8139cp.c.orig Fri Aug 2 09:34:42 2002 +++ ./drivers/net/8139cp.c Fri Aug 2 10:16:39 2002 @@ -21,13 +21,13 @@ Contributors: Wake-on-LAN support - Felipe Damasio <felipewd@terra.com.br> + PCI suspend/resume - Felipe Damasio <felipewd@terra.com.br> TODO, in rough priority order: * dev->tx_timeout * LinkChg interrupt * Support forcing media type with a module parameter, like dl2k.c/sundance.c - * Implement PCI suspend/resume * Constants (module parms?) for Rx work limit * support 64-bit PCI DMA * Complete reset on PciErr @@ -82,7 +82,7 @@ /* These identify the driver base version and may not be removed. */ static char version[] __devinitdata = -KERN_INFO DRV_NAME ": 10/100 PCI Ethernet driver v" DRV_VERSION " (" DRV_RELDATE ")\n"; +DRV_NAME ": 10/100 PCI Ethernet driver v" DRV_VERSION " (" DRV_RELDATE ")\n"; MODULE_AUTHOR("Jeff Garzik <jgarzik@mandrakesoft.com>"); MODULE_DESCRIPTION("RealTek RTL-8139C+ series 10/100 PCI Ethernet driver"); @@ -360,6 +360,7 @@ unsigned int board_type; unsigned int wol_enabled : 1; /* Is Wake-on-LAN enabled? */ + u32 power_state[16]; struct mii_if_info mii_if; }; @@ -1896,17 +1897,74 @@ kfree(dev); } +#ifdef CONFIG_PM +static int cp_suspend (struct pci_dev *pdev, u32 state) +{ + struct net_device *dev; + struct cp_private *cp; + unsigned long flags; + + dev = pci_get_drvdata (pdev); + cp = dev->priv; + + if (!dev || !netif_running (dev)) return 0; + + netif_device_detach (dev); + netif_stop_queue (dev); + + spin_lock_irqsave (&cp->lock, flags); + + /* Disable Rx and Tx */ + cpw16 (IntrMask, 0); + cpw8 (Cmd, cpr8 (Cmd) & (~RxOn | ~TxOn)); + + spin_unlock_irqrestore (&cp->lock, flags); + + if (cp->pdev && cp->wol_enabled) { + pci_save_state (cp->pdev, cp->power_state); + cp_set_d3_state (cp); + } + + return 0; +} + +static int cp_resume (struct pci_dev *pdev) +{ + struct net_device *dev; + struct cp_private *cp; + + dev = pci_get_drvdata (pdev); + cp = dev->priv; + + netif_device_attach (dev); + + if (cp->pdev && cp->wol_enabled) { + pci_set_power_state (cp->pdev, 0); + pci_restore_state (cp->pdev, cp->power_state); + } + + cp_init_hw (cp); + netif_start_queue (dev); + + return 0; +} +#endif /* CONFIG_PM */ + static struct pci_driver cp_driver = { .name = DRV_NAME, .id_table = cp_pci_tbl, .probe = cp_init_one, .remove = __devexit_p(cp_remove_one), +#ifdef CONFIG_PM + .resume = cp_resume, + .suspend = cp_suspend, +#endif }; static int __init cp_init (void) { #ifdef MODULE - printk("%s", version); + printk(KERN_INFO "%s", version); #endif return pci_module_init (&cp_driver); } - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html