From owner-cvs-src@FreeBSD.ORG Fri Apr 9 14:02:11 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1874616A4CE; Fri, 9 Apr 2004 14:02:11 -0700 (PDT) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 53FB043D39; Fri, 9 Apr 2004 14:02:09 -0700 (PDT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.10/8.12.9) with ESMTP id i39L28kj044529; Fri, 9 Apr 2004 15:02:08 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Fri, 09 Apr 2004 15:02:49 -0600 (MDT) Message-Id: <20040409.150249.73652600.imp@bsdimp.com> To: nate@root.org From: "M. Warner Losh" In-Reply-To: <20040409134654.J49998@root.org> References: <20040409204143.57F6816A4D9@hub.freebsd.org> <20040409134654.J49998@root.org> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/pci pci.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2004 21:02:11 -0000 In message: <20040409134654.J49998@root.org> Nate Lawson writes: : On Fri, 9 Apr 2004, Warner Losh wrote: : > Modified files: : > sys/dev/pci pci.c : > Log: : > Only print state change message for real state changes. When we set a : > device in D0 to D0, that's a no-op, however the messages seem to be : > confusing some people. Eventually, these messages will be parked : > behind a if (bootverbose). : > : > # I don't think this will fix any real bugs... : > : > Revision Changes Path : > 1.239 +10 -6 src/sys/dev/pci/pci.c : > : > --- src/sys/dev/pci/pci.c:1.238 Fri Apr 9 08:44:33 2004 : > +++ src/sys/dev/pci/pci.c Fri Apr 9 13:41:18 2004 : > @@ -1768,8 +1770,10 @@ : > */ : > cls = pci_get_class(dev); : > if (setstate && cls != PCIC_DISPLAY && cls != PCIC_MEMORY) { : > - pci_set_powerstate(dev, PCI_POWERSTATE_D3); : > - printf("pci%d:%d:%d: setting power state D3\n", dinfo->cfg.bus, : > - dinfo->cfg.slot, dinfo->cfg.func); : > + if (pci_get_powerstate(dev) != PCI_POWERSTATE_D3) { : > + printf("pci%d:%d:%d: setting power state D3\n", dinfo->cfg.bus, : > + dinfo->cfg.slot, dinfo->cfg.func); : > + pci_set_powerstate(dev, PCI_POWERSTATE_D3); : > + } : > } : > } : : You can only go to D0 from D3. Yes. I know that. However, that's not reflected in the code. I wanted to make sure that we didn't print a message when we went from D3 to D3. I should make the code a little smarter here by doing a Dx->D0 transition before the ->D3 transition if x != 0. D[12] -> D0 doesn't require restoration of bars. : Also, it might make sense to always call : the set_powerstate method but have it check for requested_state == : current_state and just return OK in that case. I thought it already did that, but it appears not to be the case. Good idea. Warner