summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>2000-12-18 22:06:12 +0000
committerwpaul <wpaul@FreeBSD.org>2000-12-18 22:06:12 +0000
commitddd50f5780dccc6bb9d965f807b6808570ebb405 (patch)
tree83abf3f22c76b0e15428d64f4f5b02dbb5d90d37 /sys
parent29d9ced63d2cf6eded71df28817fa9e8ae59ee1b (diff)
downloadFreeBSD-src-ddd50f5780dccc6bb9d965f807b6808570ebb405.zip
FreeBSD-src-ddd50f5780dccc6bb9d965f807b6808570ebb405.tar.gz
Add power state manipulation to the fxp driver. Some people have
claimed that their Intel NIC is comatose after a warm boot from Windoze. This is most likely due to the card getting put in the D3 state. This should bring it back to life.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/fxp/if_fxp.c20
-rw-r--r--sys/pci/if_fxp.c20
2 files changed, 40 insertions, 0 deletions
diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c
index 13cd0fd..b6f66d1 100644
--- a/sys/dev/fxp/if_fxp.c
+++ b/sys/dev/fxp/if_fxp.c
@@ -328,6 +328,26 @@ fxp_attach(device_t dev)
val |= (PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN);
pci_write_config(dev, PCIR_COMMAND, val, 2);
+ if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) {
+ u_int32_t iobase, membase, irq;
+
+ /* Save important PCI config data. */
+ iobase = pci_read_config(dev, FXP_PCI_IOBA, 4);
+ membase = pci_read_config(dev, FXP_PCI_MMBA, 4);
+ irq = pci_read_config(dev, PCIR_INTLINE, 4);
+
+ /* Reset the power state. */
+ device_printf(dev, "chip is in D%d power mode "
+ "-- setting to D0\n", pci_get_powerstate(dev));
+
+ pci_set_powerstate(dev, PCI_POWERSTATE_D0);
+
+ /* Restore PCI config data. */
+ pci_write_config(dev, FXP_PCI_IOBA, iobase, 4);
+ pci_write_config(dev, FXP_PCI_MMBA, membase, 4);
+ pci_write_config(dev, PCIR_INTLINE, irq, 4);
+ }
+
/*
* Map control/status registers.
*/
diff --git a/sys/pci/if_fxp.c b/sys/pci/if_fxp.c
index 13cd0fd..b6f66d1 100644
--- a/sys/pci/if_fxp.c
+++ b/sys/pci/if_fxp.c
@@ -328,6 +328,26 @@ fxp_attach(device_t dev)
val |= (PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN);
pci_write_config(dev, PCIR_COMMAND, val, 2);
+ if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) {
+ u_int32_t iobase, membase, irq;
+
+ /* Save important PCI config data. */
+ iobase = pci_read_config(dev, FXP_PCI_IOBA, 4);
+ membase = pci_read_config(dev, FXP_PCI_MMBA, 4);
+ irq = pci_read_config(dev, PCIR_INTLINE, 4);
+
+ /* Reset the power state. */
+ device_printf(dev, "chip is in D%d power mode "
+ "-- setting to D0\n", pci_get_powerstate(dev));
+
+ pci_set_powerstate(dev, PCI_POWERSTATE_D0);
+
+ /* Restore PCI config data. */
+ pci_write_config(dev, FXP_PCI_IOBA, iobase, 4);
+ pci_write_config(dev, FXP_PCI_MMBA, membase, 4);
+ pci_write_config(dev, PCIR_INTLINE, irq, 4);
+ }
+
/*
* Map control/status registers.
*/
OpenPOWER on IntegriCloud