summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authortron <tron@NetBSD.org>2000-07-16 20:18:48 +0000
committertron <tron@NetBSD.org>2000-07-16 20:18:48 +0000
commit114bb7f9d938d4c32bb33b2f5090710fe32f8081 (patch)
treef147cea3dbb0fe22cc729c768c604b7202605bc3 /sys/dev
parentde40c8191d3189755688ee6f6708aca60c627e00 (diff)
If card is in power state D3 put it into power state D0 so that it will
at least work after the next reboot.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/if_epic_pci.c26
-rw-r--r--sys/dev/pci/if_tlp_pci.c22
2 files changed, 28 insertions, 20 deletions
diff --git a/sys/dev/pci/if_epic_pci.c b/sys/dev/pci/if_epic_pci.c
index 4f018218a86..b5a5d45b7be 100644
--- a/sys/dev/pci/if_epic_pci.c
+++ b/sys/dev/pci/if_epic_pci.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_epic_pci.c,v 1.11 2000/07/15 20:57:24 tron Exp $ */
+/* $NetBSD: if_epic_pci.c,v 1.12 2000/07/16 20:18:48 tron Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -166,19 +166,23 @@ epic_pci_attach(parent, self, aux)
int pmreg, ioh_valid, memh_valid;
if (pci_get_capability(pc, pa->pa_tag, PCI_CAP_PWRMGMT, &pmreg, 0)) {
- reg = pci_conf_read(pc, pa->pa_tag, pmreg + 4) & 0x3;
- if (reg == 3) {
+ reg = pci_conf_read(pc, pa->pa_tag, pmreg + 4);
+ switch (reg & PCI_PMCSR_STATE_MASK) {
+ case PCI_PMCSR_STATE_D1:
+ case PCI_PMCSR_STATE_D2:
+ printf(": waking up from power state D%d\n%s",
+ reg & PCI_PMCSR_STATE_MASK, sc->sc_dev.dv_xname);
+ pci_conf_write(pc, pa->pa_tag, pmreg + 4, 0);
+ break;
+ case PCI_PMCSR_STATE_D3:
/*
- * The card has lost all configuration data in
- * this state, so punt.
+ * IO and MEM are disabled. We can't enable
+ * the card because the BARs might be invalid.
*/
- printf(": unable to wake up from power state D3\n");
- return;
- }
- if (reg != 0) {
- printf(": waking up from power state D%d\n%s",
- reg, sc->sc_dev.dv_xname);
+ printf(": unable to wake up from power state D3, "
+ "reboot required.\n");
pci_conf_write(pc, pa->pa_tag, pmreg + 4, 0);
+ return;
}
}
diff --git a/sys/dev/pci/if_tlp_pci.c b/sys/dev/pci/if_tlp_pci.c
index 587bf17a495..96651f74da9 100644
--- a/sys/dev/pci/if_tlp_pci.c
+++ b/sys/dev/pci/if_tlp_pci.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_tlp_pci.c,v 1.42 2000/07/15 20:57:24 tron Exp $ */
+/* $NetBSD: if_tlp_pci.c,v 1.43 2000/07/16 20:18:48 tron Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -482,19 +482,23 @@ tlp_pci_attach(parent, self, aux)
}
if (pci_get_capability(pc, pa->pa_tag, PCI_CAP_PWRMGMT, &pmreg, 0)) {
- reg = pci_conf_read(pc, pa->pa_tag, pmreg + 4) & 0x3;
- if (reg == 3) {
+ reg = pci_conf_read(pc, pa->pa_tag, pmreg + 4);
+ switch (reg & PCI_PMCSR_STATE_MASK) {
+ case PCI_PMCSR_STATE_D1:
+ case PCI_PMCSR_STATE_D2:
+ printf(": waking up from power state D%d\n%s",
+ reg & PCI_PMCSR_STATE_MASK, sc->sc_dev.dv_xname);
+ pci_conf_write(pc, pa->pa_tag, pmreg + 4, 0);
+ break;
+ case PCI_PMCSR_STATE_D3:
/*
* The card has lost all configuration data in
* this state, so punt.
*/
- printf(": unable to wake up from power state D3\n");
- return;
- }
- if (reg != 0) {
- printf(": waking up from power state D%d\n%s",
- reg, sc->sc_dev.dv_xname);
+ printf(": unable to wake up from power state D3, "
+ "reboot required.\n");
pci_conf_write(pc, pa->pa_tag, pmreg + 4, 0);
+ return;
}
}