diff options
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r-- | drivers/pci/pci.c | 84 |
1 files changed, 70 insertions, 14 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 54858838f098..5cb5820fae40 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -86,7 +86,7 @@ enum pcie_bus_config_types pcie_bus_config = PCIE_BUS_TUNE_OFF; | |||
86 | * the dfl or actual value as it sees fit. Don't forget this is | 86 | * the dfl or actual value as it sees fit. Don't forget this is |
87 | * measured in 32-bit words, not bytes. | 87 | * measured in 32-bit words, not bytes. |
88 | */ | 88 | */ |
89 | u8 pci_dfl_cache_line_size __devinitdata = L1_CACHE_BYTES >> 2; | 89 | u8 pci_dfl_cache_line_size = L1_CACHE_BYTES >> 2; |
90 | u8 pci_cache_line_size; | 90 | u8 pci_cache_line_size; |
91 | 91 | ||
92 | /* | 92 | /* |
@@ -1333,6 +1333,19 @@ void pcim_pin_device(struct pci_dev *pdev) | |||
1333 | dr->pinned = 1; | 1333 | dr->pinned = 1; |
1334 | } | 1334 | } |
1335 | 1335 | ||
1336 | /* | ||
1337 | * pcibios_add_device - provide arch specific hooks when adding device dev | ||
1338 | * @dev: the PCI device being added | ||
1339 | * | ||
1340 | * Permits the platform to provide architecture specific functionality when | ||
1341 | * devices are added. This is the default implementation. Architecture | ||
1342 | * implementations can override this. | ||
1343 | */ | ||
1344 | int __weak pcibios_add_device (struct pci_dev *dev) | ||
1345 | { | ||
1346 | return 0; | ||
1347 | } | ||
1348 | |||
1336 | /** | 1349 | /** |
1337 | * pcibios_disable_device - disable arch specific PCI resources for device dev | 1350 | * pcibios_disable_device - disable arch specific PCI resources for device dev |
1338 | * @dev: the PCI device to disable | 1351 | * @dev: the PCI device to disable |
@@ -1578,15 +1591,25 @@ void pci_pme_active(struct pci_dev *dev, bool enable) | |||
1578 | 1591 | ||
1579 | pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, pmcsr); | 1592 | pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, pmcsr); |
1580 | 1593 | ||
1581 | /* PCI (as opposed to PCIe) PME requires that the device have | 1594 | /* |
1582 | its PME# line hooked up correctly. Not all hardware vendors | 1595 | * PCI (as opposed to PCIe) PME requires that the device have |
1583 | do this, so the PME never gets delivered and the device | 1596 | * its PME# line hooked up correctly. Not all hardware vendors |
1584 | remains asleep. The easiest way around this is to | 1597 | * do this, so the PME never gets delivered and the device |
1585 | periodically walk the list of suspended devices and check | 1598 | * remains asleep. The easiest way around this is to |
1586 | whether any have their PME flag set. The assumption is that | 1599 | * periodically walk the list of suspended devices and check |
1587 | we'll wake up often enough anyway that this won't be a huge | 1600 | * whether any have their PME flag set. The assumption is that |
1588 | hit, and the power savings from the devices will still be a | 1601 | * we'll wake up often enough anyway that this won't be a huge |
1589 | win. */ | 1602 | * hit, and the power savings from the devices will still be a |
1603 | * win. | ||
1604 | * | ||
1605 | * Although PCIe uses in-band PME message instead of PME# line | ||
1606 | * to report PME, PME does not work for some PCIe devices in | ||
1607 | * reality. For example, there are devices that set their PME | ||
1608 | * status bits, but don't really bother to send a PME message; | ||
1609 | * there are PCI Express Root Ports that don't bother to | ||
1610 | * trigger interrupts when they receive PME messages from the | ||
1611 | * devices below. So PME poll is used for PCIe devices too. | ||
1612 | */ | ||
1590 | 1613 | ||
1591 | if (dev->pme_poll) { | 1614 | if (dev->pme_poll) { |
1592 | struct pci_pme_device *pme_dev; | 1615 | struct pci_pme_device *pme_dev; |
@@ -1858,6 +1881,38 @@ bool pci_dev_run_wake(struct pci_dev *dev) | |||
1858 | } | 1881 | } |
1859 | EXPORT_SYMBOL_GPL(pci_dev_run_wake); | 1882 | EXPORT_SYMBOL_GPL(pci_dev_run_wake); |
1860 | 1883 | ||
1884 | void pci_config_pm_runtime_get(struct pci_dev *pdev) | ||
1885 | { | ||
1886 | struct device *dev = &pdev->dev; | ||
1887 | struct device *parent = dev->parent; | ||
1888 | |||
1889 | if (parent) | ||
1890 | pm_runtime_get_sync(parent); | ||
1891 | pm_runtime_get_noresume(dev); | ||
1892 | /* | ||
1893 | * pdev->current_state is set to PCI_D3cold during suspending, | ||
1894 | * so wait until suspending completes | ||
1895 | */ | ||
1896 | pm_runtime_barrier(dev); | ||
1897 | /* | ||
1898 | * Only need to resume devices in D3cold, because config | ||
1899 | * registers are still accessible for devices suspended but | ||
1900 | * not in D3cold. | ||
1901 | */ | ||
1902 | if (pdev->current_state == PCI_D3cold) | ||
1903 | pm_runtime_resume(dev); | ||
1904 | } | ||
1905 | |||
1906 | void pci_config_pm_runtime_put(struct pci_dev *pdev) | ||
1907 | { | ||
1908 | struct device *dev = &pdev->dev; | ||
1909 | struct device *parent = dev->parent; | ||
1910 | |||
1911 | pm_runtime_put(dev); | ||
1912 | if (parent) | ||
1913 | pm_runtime_put_sync(parent); | ||
1914 | } | ||
1915 | |||
1861 | /** | 1916 | /** |
1862 | * pci_pm_init - Initialize PM functions of given PCI device | 1917 | * pci_pm_init - Initialize PM functions of given PCI device |
1863 | * @dev: PCI device to handle. | 1918 | * @dev: PCI device to handle. |
@@ -1868,6 +1923,8 @@ void pci_pm_init(struct pci_dev *dev) | |||
1868 | u16 pmc; | 1923 | u16 pmc; |
1869 | 1924 | ||
1870 | pm_runtime_forbid(&dev->dev); | 1925 | pm_runtime_forbid(&dev->dev); |
1926 | pm_runtime_set_active(&dev->dev); | ||
1927 | pm_runtime_enable(&dev->dev); | ||
1871 | device_enable_async_suspend(&dev->dev); | 1928 | device_enable_async_suspend(&dev->dev); |
1872 | dev->wakeup_prepared = false; | 1929 | dev->wakeup_prepared = false; |
1873 | 1930 | ||
@@ -3825,7 +3882,7 @@ static int __init pci_resource_alignment_sysfs_init(void) | |||
3825 | 3882 | ||
3826 | late_initcall(pci_resource_alignment_sysfs_init); | 3883 | late_initcall(pci_resource_alignment_sysfs_init); |
3827 | 3884 | ||
3828 | static void __devinit pci_no_domains(void) | 3885 | static void pci_no_domains(void) |
3829 | { | 3886 | { |
3830 | #ifdef CONFIG_PCI_DOMAINS | 3887 | #ifdef CONFIG_PCI_DOMAINS |
3831 | pci_domains_supported = 0; | 3888 | pci_domains_supported = 0; |
@@ -3833,14 +3890,13 @@ static void __devinit pci_no_domains(void) | |||
3833 | } | 3890 | } |
3834 | 3891 | ||
3835 | /** | 3892 | /** |
3836 | * pci_ext_cfg_enabled - can we access extended PCI config space? | 3893 | * pci_ext_cfg_avail - can we access extended PCI config space? |
3837 | * @dev: The PCI device of the root bridge. | ||
3838 | * | 3894 | * |
3839 | * Returns 1 if we can access PCI extended config space (offsets | 3895 | * Returns 1 if we can access PCI extended config space (offsets |
3840 | * greater than 0xff). This is the default implementation. Architecture | 3896 | * greater than 0xff). This is the default implementation. Architecture |
3841 | * implementations can override this. | 3897 | * implementations can override this. |
3842 | */ | 3898 | */ |
3843 | int __weak pci_ext_cfg_avail(struct pci_dev *dev) | 3899 | int __weak pci_ext_cfg_avail(void) |
3844 | { | 3900 | { |
3845 | return 1; | 3901 | return 1; |
3846 | } | 3902 | } |