| Summary: | Critical typos in setting power state routines | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Dmitry Remesov <dmitry> | ||||
| Component: | kern | Assignee: | Warner Losh <imp> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | 5.2-CURRENT | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
Responsible Changed From-To: freebsd-bugs->imp Over to power specialist. State Changed From-To: open->closed Fixed. Thanks! |
1. There is an error in sys/dev/acpica/acpi_pci.c that prevents setting power state from high values to low (D3 -> D0). 2. In pci_set_powerstate_method(dev,child,state) in file sys/dev/pci/pci.c a check is made on current powerstate of device not for device child but for device dev 3. It is stated in UPDATING that the default is to do powerstate changes on startup and shutdown (hw.pci.do_powerstate is 1 by default) but it is not These problems seem to be typos Fix: Here are pacthes -static int pci_do_powerstate = 0; +static int pci_do_powerstate = 1; TUNABLE_INT("hw.pci.do_powerstate", (int *)&pci_do_powerstate); SYSCTL_INT(_hw_pci, OID_AUTO, do_powerstate, CTLFLAG_RW, - &pci_do_powerstate, 0, + &pci_do_powerstate, 1, "Enable setting the power states of the PCI devices. This means that we\n\ set devices into D0 before probe/attach, and D3 if they fail to attach. It\n\ also means we set devices into D3 state before shutdown."); @@ -495,7 +495,7 @@ /* * Dx -> Dx is a nop always. */ - if (pci_get_powerstate(dev) == state) + if (pci_get_powerstate(child) == state) return (0); if (cfg->pp.pp_cap != 0) {--rDxKkxD5QAdNYSWoOCee5375b2SXvyk0o3FQ5XVNOcUSeSj1 Content-Type: text/plain; name="file.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="file.diff" --- sys/dev/acpica/acpi_pci.c.orig Wed Apr 14 21:46:21 2004 +++ sys/dev/acpica/acpi_pci.c Sun Apr 25 23:35:13 2004 @@ -207,7 +207,7 @@ acpi_state, device_get_nameunit(child), AcpiFormatException(status)); } - if (state > old_state) + if (state < old_state) return (pci_set_powerstate_method(dev, child, state)); else return (0);