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.15 (requested by tacha):



details:   https://anonhg.NetBSD.org/src/rev/ee21ba9f26c8
branches:  netbsd-1-5
changeset: 490691:ee21ba9f26c8
user:      he <he%NetBSD.org@localhost>
date:      Mon Feb 26 17:53:08 2001 +0000

description:
Pull up revision 1.15 (requested by tacha):
  Fix problem when warm booting from Windows.

diffstat:

 sys/dev/pci/cs4280.c |  24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diffs (50 lines):

diff -r 933d98b972a2 -r ee21ba9f26c8 sys/dev/pci/cs4280.c
--- a/sys/dev/pci/cs4280.c      Mon Feb 26 17:50:52 2001 +0000
+++ b/sys/dev/pci/cs4280.c      Mon Feb 26 17:53:08 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cs4280.c,v 1.4.4.5 2001/02/26 15:51:40 he Exp $        */
+/*     $NetBSD: cs4280.c,v 1.4.4.6 2001/02/26 17:53:08 he Exp $        */
 
 /*
  * Copyright (c) 1999, 2000 Tatoku Ogaito.  All rights reserved.
@@ -561,10 +561,11 @@
        pci_chipset_tag_t pc = pa->pa_pc;
        char const *intrstr;
        pci_intr_handle_t ih;
-       pcireg_t csr;
+       pcireg_t reg;
        char devinfo[256];
        mixer_ctrl_t ctl;
        u_int32_t mem;
+       int pci_pwrmgmt_cap_reg, pci_pwrmgmt_csr_reg;
     
        pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo);
        printf(": %s (rev. 0x%02x)\n", devinfo, PCI_REVISION(pa->pa_class));
@@ -585,10 +586,25 @@
 
        sc->sc_dmatag = pa->pa_dmat;
 
+       /* Check and set Power State */
+       if (pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_PWRMGMT,
+           &pci_pwrmgmt_cap_reg, 0)) {
+               pci_pwrmgmt_csr_reg = pci_pwrmgmt_cap_reg + 4;
+               reg = pci_conf_read(pa->pa_pc, pa->pa_tag,
+                   pci_pwrmgmt_csr_reg);
+               DPRINTF(("%s: Power State is %d\n", 
+                   sc->sc_dev.dv_xname, reg & PCI_PMCSR_STATE_MASK));
+               if ((reg & PCI_PMCSR_STATE_MASK) != PCI_PMCSR_STATE_D0) {
+                       pci_conf_write(pc, pa->pa_tag, pci_pwrmgmt_csr_reg,
+                           (reg & ~PCI_PMCSR_STATE_MASK) |
+                           PCI_PMCSR_STATE_D0);
+               }
+       }
+
        /* Enable the device (set bus master flag) */
-       csr = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
+       reg = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
        pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG,
-                      csr | PCI_COMMAND_MASTER_ENABLE);
+                      reg | PCI_COMMAND_MASTER_ENABLE);
 
        /* LATENCY_TIMER setting */
        mem = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_BHLC_REG);



Home | Main Index | Thread Index | Old Index