If card is in power state D3 put it into power state D0 so that it will

at least work after the next reboot.
This commit is contained in:
tron 2000-07-16 20:18:48 +00:00
parent de40c8191d
commit 114bb7f9d9
2 changed files with 29 additions and 21 deletions

View File

@ -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) {
/*
* 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) {
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, sc->sc_dev.dv_xname);
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:
/*
* 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, "
"reboot required.\n");
pci_conf_write(pc, pa->pa_tag, pmreg + 4, 0);
return;
}
}

View File

@ -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;
}
}