aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/probe.c
diff options
context:
space:
mode:
authorRajat Jain <rajatxjain@gmail.com>2014-09-02 19:26:00 -0400
committerBjorn Helgaas <bhelgaas@google.com>2014-09-09 01:29:21 -0400
commitf3dbd802b3caf8da92173870bc270dda6b3f84ba (patch)
tree1654b661c98e637c36e244c0ea863be538c3c3a4 /drivers/pci/probe.c
parent89665a6a71408796565bfd29cfa6a7877b17a667 (diff)
PCI: Enable CRS Software Visibility for root port if it is supported
Per PCIe r3.0, sec 2.3.2, an endpoint may respond to a Configuration Request with a Completion with Configuration Request Retry Status (CRS). This terminates the Configuration Request. When the CRS Software Visibility feature is disabled (as it is by default), a Root Complex must handle a CRS Completion by re-issuing the Configuration Request. This is invisible to software. From the CPU's point of view, an endpoint that always responds with CRS causes a hang because the Root Complex never supplies data to complete the CPU read. When CRS Software Visibility is enabled, a Root Complex that receives a CRS Completion for a read of the Vendor ID must return data of 0x0001. The Vendor ID of 0x0001 indicates to software that the endpoint is not ready. We now have more devices that require CRS Software Visibility. For example, a PLX 8713 NT bridge may respond with CRS until it has been configured via I2C, and the I2C configuration is completely independent of PCI enumeration. Enable CRS Software Visibility if it is supported. This allows a system with such a device to work (though the PCI core times out waiting for it to become ready, and we have to rescan the bus after it is ready). This essentially reverts ad7edfe04908 ("[PCI] Do not enable CRS Software Visibility by default"). The failures that led to ad7edfe04908 should be addressed by 89665a6a7140 ("PCI: Check only the Vendor ID to identify Configuration Request Retry"). [bhelgaas: changelog] Link: http://lkml.kernel.org/r/20071029061532.5d10dfc6@snowcone Link: http://lkml.kernel.org/r/alpine.LFD.0.9999.0712271023090.21557@woody.linux-foundation.org Signed-off-by: Rajat Jain <rajatxjain@gmail.com> Signed-off-by: Rajat Jain <rajatjain@juniper.net> Signed-off-by: Guenter Roeck <groeck@juniper.net> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r--drivers/pci/probe.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 9c26663c91d2..e02cdaa5bf0c 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -740,6 +740,17 @@ struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
740} 740}
741EXPORT_SYMBOL(pci_add_new_bus); 741EXPORT_SYMBOL(pci_add_new_bus);
742 742
743static void pci_enable_crs(struct pci_dev *pdev)
744{
745 u16 root_cap = 0;
746
747 /* Enable CRS Software Visibility if supported */
748 pcie_capability_read_word(pdev, PCI_EXP_RTCAP, &root_cap);
749 if (root_cap & PCI_EXP_RTCAP_CRSVIS)
750 pcie_capability_set_word(pdev, PCI_EXP_RTCTL,
751 PCI_EXP_RTCTL_CRSSVE);
752}
753
743/* 754/*
744 * If it's a bridge, configure it and scan the bus behind it. 755 * If it's a bridge, configure it and scan the bus behind it.
745 * For CardBus bridges, we don't scan behind as the devices will 756 * For CardBus bridges, we don't scan behind as the devices will
@@ -787,6 +798,8 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass)
787 pci_write_config_word(dev, PCI_BRIDGE_CONTROL, 798 pci_write_config_word(dev, PCI_BRIDGE_CONTROL,
788 bctl & ~PCI_BRIDGE_CTL_MASTER_ABORT); 799 bctl & ~PCI_BRIDGE_CTL_MASTER_ABORT);
789 800
801 pci_enable_crs(dev);
802
790 if ((secondary || subordinate) && !pcibios_assign_all_busses() && 803 if ((secondary || subordinate) && !pcibios_assign_all_busses() &&
791 !is_cardbus && !broken) { 804 !is_cardbus && !broken) {
792 unsigned int cmax; 805 unsigned int cmax;