Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/sys/dev/pci Sync with NetBSD-current (pull up approved ...



details:   https://anonhg.NetBSD.org/src/rev/a6c741e7427e
branches:  netbsd-1-5
changeset: 488545:a6c741e7427e
user:      tron <tron%NetBSD.org@localhost>
date:      Sun Jul 16 20:29:08 2000 +0000

description:
Sync with NetBSD-current (pull up approved by thorpej):

syssrc/sys/dev/pci/if_epic_pci.c, 1.12
syssrc/sys/dev/pci/if_tlp_pci.c, 1.43

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:

 sys/dev/pci/if_epic_pci.c |  26 +++++++++++++++-----------
 sys/dev/pci/if_tlp_pci.c  |  22 +++++++++++++---------
 2 files changed, 28 insertions(+), 20 deletions(-)

diffs (86 lines):

diff -r 6c3a4227cba7 -r a6c741e7427e sys/dev/pci/if_epic_pci.c
--- a/sys/dev/pci/if_epic_pci.c Sun Jul 16 20:07:06 2000 +0000
+++ b/sys/dev/pci/if_epic_pci.c Sun Jul 16 20:29:08 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_epic_pci.c,v 1.7.12.3 2000/07/15 22:48:01 tron Exp $        */
+/*     $NetBSD: if_epic_pci.c,v 1.7.12.4 2000/07/16 20:29:08 tron Exp $        */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -167,20 +167,24 @@
        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");
+                       printf(": unable to wake up from power state D3, "
+                              "reboot required.\n");
+                       pci_conf_write(pc, pa->pa_tag, pmreg + 4, 0);
                        return;
                }
-               if (reg != 0) {
-                       printf(": waking up from power state D%d\n%s",
-                           reg, sc->sc_dev.dv_xname);
-                       pci_conf_write(pc, pa->pa_tag, pmreg + 4, 0);
-               }
        }
 
        /*
diff -r 6c3a4227cba7 -r a6c741e7427e sys/dev/pci/if_tlp_pci.c
--- a/sys/dev/pci/if_tlp_pci.c  Sun Jul 16 20:07:06 2000 +0000
+++ b/sys/dev/pci/if_tlp_pci.c  Sun Jul 16 20:29:08 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_tlp_pci.c,v 1.39.2.3 2000/07/15 22:48:01 tron Exp $ */
+/*     $NetBSD: if_tlp_pci.c,v 1.39.2.4 2000/07/16 20:29:08 tron Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -482,20 +482,24 @@
        }
 
        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");
+                       printf(": unable to wake up from power state D3, "
+                              "reboot required.\n");
+                       pci_conf_write(pc, pa->pa_tag, pmreg + 4, 0);
                        return;
                }
-               if (reg != 0) {
-                       printf(": waking up from power state D%d\n%s",
-                           reg, sc->sc_dev.dv_xname);
-                       pci_conf_write(pc, pa->pa_tag, pmreg + 4, 0);
-               }
        }
 
        /*



Home | Main Index | Thread Index | Old Index