提交 777e61ea 编写于 作者: Y Yijing Wang 提交者: Bjorn Helgaas

PCI: Use dev->has_secondary_link to find downstream PCIe links

Previously we assumed that PCIe Root Ports and Downstream Ports had Links
on their secondary side.  That is true in most systems, but it is possible
to connect a switch with either an Upstream or a Downstream Port leading
downstream.

Instead of relying on the component type to identify devices that have
links leading downstream, use the "dev->has_secondary_link" field.

[bhelgaas: changelog]
Signed-off-by: NYijing Wang <wangyijing@huawei.com>
Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
上级 c8fc9339
...@@ -425,8 +425,7 @@ static pci_ers_result_t reset_link(struct pci_dev *dev) ...@@ -425,8 +425,7 @@ static pci_ers_result_t reset_link(struct pci_dev *dev)
if (driver && driver->reset_link) { if (driver && driver->reset_link) {
status = driver->reset_link(udev); status = driver->reset_link(udev);
} else if (pci_pcie_type(udev) == PCI_EXP_TYPE_DOWNSTREAM || } else if (udev->has_secondary_link) {
pci_pcie_type(udev) == PCI_EXP_TYPE_ROOT_PORT) {
status = default_reset_link(udev); status = default_reset_link(udev);
} else { } else {
dev_printk(KERN_DEBUG, &dev->dev, dev_printk(KERN_DEBUG, &dev->dev,
......
...@@ -1629,7 +1629,7 @@ static int only_one_child(struct pci_bus *bus) ...@@ -1629,7 +1629,7 @@ static int only_one_child(struct pci_bus *bus)
return 0; return 0;
if (pci_pcie_type(parent) == PCI_EXP_TYPE_ROOT_PORT) if (pci_pcie_type(parent) == PCI_EXP_TYPE_ROOT_PORT)
return 1; return 1;
if (pci_pcie_type(parent) == PCI_EXP_TYPE_DOWNSTREAM && if (parent->has_secondary_link &&
!pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS)) !pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS))
return 1; return 1;
return 0; return 0;
......
...@@ -108,8 +108,7 @@ static void pci_vc_enable(struct pci_dev *dev, int pos, int res) ...@@ -108,8 +108,7 @@ static void pci_vc_enable(struct pci_dev *dev, int pos, int res)
struct pci_dev *link = NULL; struct pci_dev *link = NULL;
/* Enable VCs from the downstream device */ /* Enable VCs from the downstream device */
if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT || if (!dev->has_secondary_link)
pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM)
return; return;
ctrl_pos = pos + PCI_VC_RES_CTRL + (res * PCI_CAP_VC_PER_VC_SIZEOF); ctrl_pos = pos + PCI_VC_RES_CTRL + (res * PCI_CAP_VC_PER_VC_SIZEOF);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册