Date: Wed, 20 Oct 2010 16:47:09 +0000 (UTC) From: Jung-uk Kim <jkim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r214110 - in head/sys/dev: acpica pci Message-ID: <201010201647.o9KGl9SM062984@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jkim Date: Wed Oct 20 16:47:09 2010 New Revision: 214110 URL: http://svn.freebsd.org/changeset/base/214110 Log: Introduce a new tunable 'hw.pci.do_power_suspend'. This tunable lets you avoid PCI power state transition from D0 to D3 for suspending case. Default is 1 or enabled. Modified: head/sys/dev/acpica/acpi_pci.c head/sys/dev/pci/pci.c head/sys/dev/pci/pci_pci.c head/sys/dev/pci/pci_private.h Modified: head/sys/dev/acpica/acpi_pci.c ============================================================================== --- head/sys/dev/acpica/acpi_pci.c Wed Oct 20 16:40:14 2010 (r214109) +++ head/sys/dev/acpica/acpi_pci.c Wed Oct 20 16:47:09 2010 (r214110) @@ -179,7 +179,7 @@ acpi_pci_set_powerstate_method(device_t */ ACPI_SERIAL_BEGIN(pci_powerstate); old_state = pci_get_powerstate(child); - if (old_state < state) { + if (old_state < state && pci_do_power_suspend) { error = pci_set_powerstate_method(dev, child, state); if (error) goto out; Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Wed Oct 20 16:40:14 2010 (r214109) +++ head/sys/dev/pci/pci.c Wed Oct 20 16:47:09 2010 (r214110) @@ -257,6 +257,12 @@ SYSCTL_INT(_hw_pci, OID_AUTO, do_power_r &pci_do_power_resume, 1, "Transition from D3 -> D0 on resume."); +int pci_do_power_suspend = 1; +TUNABLE_INT("hw.pci.do_power_suspend", &pci_do_power_suspend); +SYSCTL_INT(_hw_pci, OID_AUTO, do_power_suspend, CTLFLAG_RW, + &pci_do_power_suspend, 1, + "Transition from D0 -> D3 on suspend."); + static int pci_do_msi = 1; TUNABLE_INT("hw.pci.enable_msi", &pci_do_msi); SYSCTL_INT(_hw_pci, OID_AUTO, enable_msi, CTLFLAG_RW, &pci_do_msi, 1, @@ -2954,7 +2960,9 @@ pci_suspend(device_t dev) free(devlist, M_TEMP); return (error); } - pci_set_power_children(dev, devlist, numdevs, PCI_POWERSTATE_D3); + if (pci_do_power_suspend) + pci_set_power_children(dev, devlist, numdevs, + PCI_POWERSTATE_D3); free(devlist, M_TEMP); return (0); } Modified: head/sys/dev/pci/pci_pci.c ============================================================================== --- head/sys/dev/pci/pci_pci.c Wed Oct 20 16:40:14 2010 (r214109) +++ head/sys/dev/pci/pci_pci.c Wed Oct 20 16:47:09 2010 (r214110) @@ -447,7 +447,7 @@ pcib_suspend(device_t dev) pcib_cfg_save(device_get_softc(dev)); error = bus_generic_suspend(dev); - if (error == 0) { + if (error == 0 && pci_do_power_suspend) { dstate = PCI_POWERSTATE_D3; pcib = device_get_parent(device_get_parent(dev)); if (PCIB_POWER_FOR_SLEEP(pcib, dev, &dstate) == 0) Modified: head/sys/dev/pci/pci_private.h ============================================================================== --- head/sys/dev/pci/pci_private.h Wed Oct 20 16:40:14 2010 (r214109) +++ head/sys/dev/pci/pci_private.h Wed Oct 20 16:47:09 2010 (r214110) @@ -39,6 +39,7 @@ DECLARE_CLASS(pci_driver); extern int pci_do_power_resume; +extern int pci_do_power_suspend; void pci_add_children(device_t dev, int domain, int busno, size_t dinfo_size);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010201647.o9KGl9SM062984>