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 Pull up revision 1.8 (approved by thorpej):



details:   https://anonhg.NetBSD.org/src/rev/0e970bc5b029
branches:  netbsd-1-5
changeset: 488525:0e970bc5b029
user:      tron <tron%NetBSD.org@localhost>
date:      Fri Jul 14 22:05:34 2000 +0000

description:
Pull up revision 1.8 (approved by thorpej):
Check if card was put into sleep mode using PCI/ACPI power management
and try to restart it. This patch based on hints by Jason Thorpe.

diffstat:

 sys/dev/pci/if_epic_pci.c |  23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r a021e2cdebfc -r 0e970bc5b029 sys/dev/pci/if_epic_pci.c
--- a/sys/dev/pci/if_epic_pci.c Fri Jul 14 18:27:33 2000 +0000
+++ b/sys/dev/pci/if_epic_pci.c Fri Jul 14 22:05:34 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_epic_pci.c,v 1.7 1999/07/27 00:37:34 thorpej Exp $  */
+/*     $NetBSD: if_epic_pci.c,v 1.7.12.1 2000/07/14 22:05:34 tron Exp $        */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -163,7 +163,26 @@
        const struct epic_pci_product *epp;
        bus_space_tag_t iot, memt;
        bus_space_handle_t ioh, memh;
-       int ioh_valid, memh_valid;
+       pcireg_t reg;
+       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("%s: unable to wake up from power state D3\n",
+                           sc->sc_dev.dv_xname);
+                       return;
+               }
+               if (reg != 0) {
+                       printf("%s: waking up from power state D%d\n",
+                           sc->sc_dev.dv_xname, reg);
+                       pci_conf_write(pc, pa->pa_tag, pmreg + 4, 0);
+               }
+       }
 
        /*
         * Map the device.



Home | Main Index | Thread Index | Old Index