summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2005-09-21 19:47:00 +0000
committerimp <imp@FreeBSD.org>2005-09-21 19:47:00 +0000
commita89ff69ad67bb0b86cb431c115a845b2e8e5c497 (patch)
tree924c3cc0875934d160403dc950c27f81ee569f56 /sys/dev
parent1a0332c39b1de6788d654c7b5c29ac0157b6c589 (diff)
downloadFreeBSD-src-a89ff69ad67bb0b86cb431c115a845b2e8e5c497.zip
FreeBSD-src-a89ff69ad67bb0b86cb431c115a845b2e8e5c497.tar.gz
Split power state control into two variables. hw.pci.do_powerstate
has been removed. It has been replaced by hw.pci.do_power_nodriver and hw.pci.do_power_resume. The former defaults to 0 while the latter defaults to 1. When do_powerstate was set to 0, it broke suspend/resume for a lot of people as an unintended consequence. This change will only affect the areas that were intended to affect. This change will have no effect on servers, but will help laptops quite a bit. MFC After: 3 days.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/pci.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 0d8bd1c..af40ca8 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -183,18 +183,20 @@ SYSCTL_INT(_hw_pci, OID_AUTO, enable_io_modes, CTLFLAG_RW,
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 = 1;
-TUNABLE_INT("hw.pci.do_powerstate", &pci_do_powerstate);
-SYSCTL_INT(_hw_pci, OID_AUTO, do_powerstate, CTLFLAG_RW,
- &pci_do_powerstate, 1,
- "Controls the behvior of the pci driver when it encounters\n\
-devices which no driver claims. Set to 0 causes the pci to leave\n\
-the device in D0. Set to 1 causes pci to conservatively devices\n\
-into D3 state. These are devices which have had issues in the past.\n\
-Set to 2 causes the bus driver to agressively place devices into D3 state.\n\
-The only devices it excludes are devices for which no drivers generally\n\
-exist in FreeBSD. Set to 3 causes the bus driver to place all unattached\n\
-devices into D3 state.");
+static int pci_do_power_nodriver = 0;
+TUNABLE_INT("hw.pci.do_power_nodriver", &pci_do_power_nodriver);
+SYSCTL_INT(_hw_pci, OID_AUTO, do_power_nodriver, CTLFLAG_RW,
+ &pci_do_power_nodriver, 0,
+ "Place a function into D3 state when no driver attaches to it. 0 means\n\
+disable. 1 means conservatively place devices into D3 state. 2 means\n\
+agressively place devices into D3 state. 3 means put absolutely everything\n\
+in D3 state.");
+
+static int pci_do_power_resume = 1;
+TUNABLE_INT("hw.pci.do_power_resume", &pci_do_power_resume);
+SYSCTL_INT(_hw_pci, OID_AUTO, do_power_resume, CTLFLAG_RW,
+ &pci_do_power_resume, 1,
+ "Transition from D3 -> D0 on resume.");
/* Find a device_t by bus/slot/function */
@@ -1071,7 +1073,7 @@ pci_suspend(device_t dev)
* device in the appropriate power state for this sleep state.
*/
acpi_dev = NULL;
- if (pci_do_powerstate)
+ if (pci_do_power_resume)
acpi_dev = devclass_get_device(devclass_find("acpi"), 0);
device_get_children(dev, &devlist, &numdevs);
for (i = 0; i < numdevs; i++) {
@@ -1118,7 +1120,7 @@ pci_resume(device_t dev)
* Set each child to D0 and restore its PCI configuration space.
*/
acpi_dev = NULL;
- if (pci_do_powerstate)
+ if (pci_do_power_resume)
acpi_dev = devclass_get_device(devclass_find("acpi"), 0);
device_get_children(dev, &devlist, &numdevs);
for (i = 0; i < numdevs; i++) {
@@ -1335,7 +1337,7 @@ pci_probe_nomatch(device_t dev, device_t child)
}
printf(" at device %d.%d (no driver attached)\n",
pci_get_slot(child), pci_get_function(child));
- if (pci_do_powerstate)
+ if (pci_do_power_nodriver)
pci_cfg_save(child,
(struct pci_devinfo *) device_get_ivars(child), 1);
return;
@@ -2011,7 +2013,7 @@ pci_cfg_save(device_t dev, struct pci_devinfo *dinfo, int setstate)
cls = pci_get_class(dev);
if (!setstate)
return;
- switch (pci_do_powerstate)
+ switch (pci_do_power_nodriver)
{
case 0: /* NO powerdown at all */
return;
OpenPOWER on IntegriCloud