Date: Fri, 9 Apr 2004 13:56:08 -0700 (PDT) From: Nate Lawson <nate@root.org> To: Warner Losh <imp@FreeBSD.org> Cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/pci pci.c Message-ID: <20040409134654.J49998@root.org> In-Reply-To: <20040409204143.57F6816A4D9@hub.freebsd.org> References: <20040409204143.57F6816A4D9@hub.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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. 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.
-Nate
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040409134654.J49998>
