Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Apr 2004 13:08:16 -0700 (PDT)
From:      Dmitry Remesov <dmitry@remesov.ru>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/65964: Critical typos in setting power state routines
Message-ID:  <200404252008.i3PK8GJg031254@www.freebsd.org>
Resent-Message-ID: <200404252010.i3PKALHN061960@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         65964
>Category:       kern
>Synopsis:       Critical typos in setting power state routines
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 25 13:10:21 PDT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Dmitry Remesov
>Release:        5.2-CURRENT
>Organization:
>Environment:
FreeBSD dmitry.local-uga.dmz 5.2-CURRENT FreeBSD 5.2-CURRENT #4: Sun Apr 25 23:21:41 MSD 2004     root@dmitry.local-uga.dmz:/usr/src/sys/i386/compile/kernconf  i386
>Description:
1. There is an error in sys/dev/acpica/acpi_pci.c that prevents setting power state from high values to low (D3 -> D0).

2. In pci_set_powerstate_method(dev,child,state) in file sys/dev/pci/pci.c a check is made on current powerstate of device not for device child but for device dev

3. It is stated in UPDATING that the default is to do powerstate changes on startup and shutdown (hw.pci.do_powerstate is 1 by default) but it is not

These problems seem to be typos
>How-To-Repeat:
      
>Fix:
Here are pacthes


--- sys/dev/acpica/acpi_pci.c.orig      Wed Apr 14 21:46:21 2004
+++ sys/dev/acpica/acpi_pci.c   Sun Apr 25 23:35:13 2004
@@ -207,7 +207,7 @@
                            acpi_state, device_get_nameunit(child),
                            AcpiFormatException(status));
        }
-       if (state > old_state)
+       if (state < old_state)
                return (pci_set_powerstate_method(dev, child, state));
        else
                return (0);


--- sys/dev/pci/pci.c.orig      Fri Apr 23 19:48:48 2004
+++ sys/dev/pci/pci.c   Sun Apr 25 23:38:39 2004
@@ -176,10 +176,10 @@
 enable these bits correctly.  We'd like to do this all the time, but there\n\
 are some peripherals that this causes problems with.");

-static int pci_do_powerstate = 0;
+static int pci_do_powerstate = 1;
 TUNABLE_INT("hw.pci.do_powerstate", (int *)&pci_do_powerstate);
 SYSCTL_INT(_hw_pci, OID_AUTO, do_powerstate, CTLFLAG_RW,
-    &pci_do_powerstate, 0,
+    &pci_do_powerstate, 1,
     "Enable setting the power states of the PCI devices.  This means that we\n\
 set devices into D0 before probe/attach, and D3 if they fail to attach.  It\n\
 also means we set devices into D3 state before shutdown.");
@@ -495,7 +495,7 @@
        /*
         * Dx -> Dx is a nop always.
         */
-       if (pci_get_powerstate(dev) == state)
+       if (pci_get_powerstate(child) == state)
                return (0);

        if (cfg->pp.pp_cap != 0) {



>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200404252008.i3PK8GJg031254>