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.
This commit is contained in:
imp 2005-09-21 19:47:00 +00:00
parent 1a0332c39b
commit a89ff69ad6

View File

@ -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;