Commit 32a36585 authored by John W. Linville's avatar John W. Linville Committed by Linus Torvalds

[PATCH] pci: only call pci_restore_bars at boot

Certain (SGI?) ia64 boxes object to having their PCI BARs
restored unless absolutely necessary. This patch restricts calling
pci_restore_bars from pci_set_power_state unless the current state
is PCI_UNKNOWN, the actual (i.e. physical) state of the device is
PCI_D3hot, and the device indicates that it will lose its configuration
when transitioning to PCI_D0.
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 186051d7
...@@ -309,17 +309,25 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) ...@@ -309,17 +309,25 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state)
pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr); pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr);
/* If we're in D3, force entire word to 0. /* If we're (effectively) in D3, force entire word to 0.
* This doesn't affect PME_Status, disables PME_En, and * This doesn't affect PME_Status, disables PME_En, and
* sets PowerState to 0. * sets PowerState to 0.
*/ */
if (dev->current_state >= PCI_D3hot) { switch (dev->current_state) {
if (!(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET)) case PCI_UNKNOWN: /* Boot-up */
if ((pmcsr & PCI_PM_CTRL_STATE_MASK) == PCI_D3hot
&& !(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET))
need_restore = 1; need_restore = 1;
/* Fall-through: force to D0 */
case PCI_D3hot:
case PCI_D3cold:
case PCI_POWER_ERROR:
pmcsr = 0; pmcsr = 0;
} else { break;
default:
pmcsr &= ~PCI_PM_CTRL_STATE_MASK; pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
pmcsr |= state; pmcsr |= state;
break;
} }
/* enter specified state */ /* enter specified state */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment