diff options
Diffstat (limited to 'drivers/pci/pci.c')
| -rw-r--r-- | drivers/pci/pci.c | 47 | 
1 files changed, 15 insertions, 32 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 11c36654c95..393cf095a0c 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -450,7 +450,7 @@ static struct pci_platform_pm_ops *pci_platform_pm;  int pci_set_platform_pm(struct pci_platform_pm_ops *ops)  {  	if (!ops->is_manageable || !ops->set_state || !ops->choose_state -	    || !ops->sleep_wake || !ops->can_wakeup) +	    || !ops->sleep_wake)  		return -EINVAL;  	pci_platform_pm = ops;  	return 0; @@ -473,11 +473,6 @@ static inline pci_power_t platform_pci_choose_state(struct pci_dev *dev)  			pci_platform_pm->choose_state(dev) : PCI_POWER_ERROR;  } -static inline bool platform_pci_can_wakeup(struct pci_dev *dev) -{ -	return pci_platform_pm ? pci_platform_pm->can_wakeup(dev) : false; -} -  static inline int platform_pci_sleep_wake(struct pci_dev *dev, bool enable)  {  	return pci_platform_pm ? @@ -1984,25 +1979,6 @@ void pci_pm_init(struct pci_dev *dev)  	}  } -/** - * platform_pci_wakeup_init - init platform wakeup if present - * @dev: PCI device - * - * Some devices don't have PCI PM caps but can still generate wakeup - * events through platform methods (like ACPI events).  If @dev supports - * platform wakeup events, set the device flag to indicate as much.  This - * may be redundant if the device also supports PCI PM caps, but double - * initialization should be safe in that case. - */ -void platform_pci_wakeup_init(struct pci_dev *dev) -{ -	if (!platform_pci_can_wakeup(dev)) -		return; - -	device_set_wakeup_capable(&dev->dev, true); -	platform_pci_sleep_wake(dev, false); -} -  static void pci_add_saved_cap(struct pci_dev *pci_dev,  	struct pci_cap_saved_state *new_cap)  { @@ -2066,10 +2042,13 @@ void pci_free_cap_save_buffers(struct pci_dev *dev)  }  /** - * pci_enable_ari - enable ARI forwarding if hardware support it + * pci_configure_ari - enable or disable ARI forwarding   * @dev: the PCI device + * + * If @dev and its upstream bridge both support ARI, enable ARI in the + * bridge.  Otherwise, disable ARI in the bridge.   */ -void pci_enable_ari(struct pci_dev *dev) +void pci_configure_ari(struct pci_dev *dev)  {  	u32 cap;  	struct pci_dev *bridge; @@ -2077,9 +2056,6 @@ void pci_enable_ari(struct pci_dev *dev)  	if (pcie_ari_disabled || !pci_is_pcie(dev) || dev->devfn)  		return; -	if (!pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ARI)) -		return; -  	bridge = dev->bus->self;  	if (!bridge)  		return; @@ -2088,8 +2064,15 @@ void pci_enable_ari(struct pci_dev *dev)  	if (!(cap & PCI_EXP_DEVCAP2_ARI))  		return; -	pcie_capability_set_word(bridge, PCI_EXP_DEVCTL2, PCI_EXP_DEVCTL2_ARI); -	bridge->ari_enabled = 1; +	if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ARI)) { +		pcie_capability_set_word(bridge, PCI_EXP_DEVCTL2, +					 PCI_EXP_DEVCTL2_ARI); +		bridge->ari_enabled = 1; +	} else { +		pcie_capability_clear_word(bridge, PCI_EXP_DEVCTL2, +					   PCI_EXP_DEVCTL2_ARI); +		bridge->ari_enabled = 0; +	}  }  /**  |