summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2012-03-21 19:11:44 +0000
committerShaun Ruffell <sruffell@digium.com>2012-03-21 19:11:44 +0000
commitafeb6f6ded7dcb5f52f7ddb976542c67bbc0c762 (patch)
treeafa0c114e6e37249cc6f424d3b8729c5f13f15c8 /drivers
parent98f1fa92461b25cc2aa0255b950a18c0ce0709cf (diff)
dahdi: Add dahdi_pci_disable_link_state for kernel < 2.6.25.
Will allow the ASPM (Active State Power Management) state to be disabled on PCIe devices before kernel version 2.6.25. Signed-off-by: Shaun Ruffell <sruffell@digium.com> Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10556 git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/branches/2.6@10564 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers')
-rw-r--r--drivers/dahdi/dahdi-base.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c
index c690b94..3137bde 100644
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -10045,6 +10045,24 @@ failed_driver_init:
return res;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
+#ifdef CONFIG_PCI
+void dahdi_pci_disable_link_state(struct pci_dev *pdev, int state)
+{
+ u16 reg16;
+ int pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
+ state &= (PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 |
+ PCIE_LINK_STATE_CLKPM);
+ if (!pos)
+ return;
+ pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, &reg16);
+ reg16 &= ~(state);
+ pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16);
+}
+EXPORT_SYMBOL(dahdi_pci_disable_link_state);
+#endif /* CONFIG_PCI */
+#endif /* 2.6.25 */
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
static inline void flush_find_master_work(void)
{