From owner-freebsd-bugs@FreeBSD.ORG Sun Apr 25 13:10:21 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D2E2716A4CE for ; Sun, 25 Apr 2004 13:10:21 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id BE02F43D55 for ; Sun, 25 Apr 2004 13:10:21 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i3PKALbv061961 for ; Sun, 25 Apr 2004 13:10:21 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i3PKALHN061960; Sun, 25 Apr 2004 13:10:21 -0700 (PDT) (envelope-from gnats) Resent-Date: Sun, 25 Apr 2004 13:10:21 -0700 (PDT) Resent-Message-Id: <200404252010.i3PKALHN061960@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Dmitry Remesov Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8FB0F16A4CE for ; Sun, 25 Apr 2004 13:08:17 -0700 (PDT) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 72EAF43D46 for ; Sun, 25 Apr 2004 13:08:17 -0700 (PDT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.12.10/8.12.10) with ESMTP id i3PK8GIn031255 for ; Sun, 25 Apr 2004 13:08:16 -0700 (PDT) (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.10/8.12.10/Submit) id i3PK8GJg031254; Sun, 25 Apr 2004 13:08:16 -0700 (PDT) (envelope-from nobody) Message-Id: <200404252008.i3PK8GJg031254@www.freebsd.org> Date: Sun, 25 Apr 2004 13:08:16 -0700 (PDT) From: Dmitry Remesov To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Subject: kern/65964: Critical typos in setting power state routines X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Apr 2004 20:10:22 -0000 >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: