UBUNTU: SAUCE: PCI/ASPM: Introduce a new helper to report ASPM capability

BugLink: https://bugs.launchpad.net/bugs/1946433

Introduce a new helper, pcie_aspm_capable(), to report ASPM capability.

The user will be introduced by next patch.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
(cherry picked from https://patchwork.ozlabs.org/project/linux-pci/patch/20211007161552.272771-2-kai.heng.feng@canonical.com/)
Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
This commit is contained in:
Kai-Heng Feng
2021-10-11 12:16:24 +08:00
committed by Paolo Pisati
parent 07a56967e8
commit a2b9c5bf9e
2 changed files with 13 additions and 0 deletions
+11
View File
@@ -1272,6 +1272,17 @@ bool pcie_aspm_enabled(struct pci_dev *pdev)
}
EXPORT_SYMBOL_GPL(pcie_aspm_enabled);
bool pcie_aspm_capable(struct pci_dev *pdev)
{
struct pcie_link_state *link = pcie_aspm_get_link(pdev);
if (!link)
return false;
return link->aspm_capable;
}
EXPORT_SYMBOL_GPL(pcie_aspm_capable);
static ssize_t aspm_attr_show_common(struct device *dev,
struct device_attribute *attr,
char *buf, u8 state)
+2
View File
@@ -1841,6 +1841,7 @@ int pci_enable_link_state_locked(struct pci_dev *pdev, int state);
void pcie_no_aspm(void);
bool pcie_aspm_support_enabled(void);
bool pcie_aspm_enabled(struct pci_dev *pdev);
bool pcie_aspm_capable(struct pci_dev *pdev);
#else
static inline int pci_disable_link_state(struct pci_dev *pdev, int state)
{ return 0; }
@@ -1853,6 +1854,7 @@ static inline int pci_enable_link_state_locked(struct pci_dev *pdev, int state)
static inline void pcie_no_aspm(void) { }
static inline bool pcie_aspm_support_enabled(void) { return false; }
static inline bool pcie_aspm_enabled(struct pci_dev *pdev) { return false; }
static inline bool pcie_aspm_capable(struct pci_dev *pdev) { return false; }
#endif
#ifdef CONFIG_PCIEAER