mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 12:16:20 +00:00
PCI: don't enable ASPM on devices with mixed PCIe/PCI functions
The Slot 03:00.* of JMicron controller has two functions, but one is PCIE endpoint the other isn't PCIE device, very strange. PCIE spec defines all functions should have the same config for ASPM, so disable ASPM for the whole slot in this case. Signed-off-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
This commit is contained in:
parent
c1f69db782
commit
ddc9753fcd
1 changed files with 20 additions and 0 deletions
|
@ -506,6 +506,23 @@ static void free_link_state(struct pci_dev *pdev)
|
|||
pdev->link_state = NULL;
|
||||
}
|
||||
|
||||
static int pcie_aspm_sanity_check(struct pci_dev *pdev)
|
||||
{
|
||||
struct pci_dev *child_dev;
|
||||
int child_pos;
|
||||
|
||||
/*
|
||||
* Some functions in a slot might not all be PCIE functions, very
|
||||
* strange. Disable ASPM for the whole slot
|
||||
*/
|
||||
list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) {
|
||||
child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP);
|
||||
if (!child_pos)
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* pcie_aspm_init_link_state: Initiate PCI express link state.
|
||||
* It is called after the pcie and its children devices are scaned.
|
||||
|
@ -526,6 +543,9 @@ void pcie_aspm_init_link_state(struct pci_dev *pdev)
|
|||
if (list_empty(&pdev->subordinate->devices))
|
||||
goto out;
|
||||
|
||||
if (pcie_aspm_sanity_check(pdev))
|
||||
goto out;
|
||||
|
||||
mutex_lock(&aspm_lock);
|
||||
|
||||
link_state = kzalloc(sizeof(*link_state), GFP_KERNEL);
|
||||
|
|
Loading…
Reference in a new issue