From: Sinan Kaya Date: Tue, 29 Aug 2017 19:45:44 +0000 (-0500) Subject: PCI: Add pci_bus_crs_vendor_id() to detect CRS response data X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=62bc6a6f7468bc6d6cb39177504e79df401aea76;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git PCI: Add pci_bus_crs_vendor_id() to detect CRS response data Add pci_bus_crs_vendor_id() to determine whether data returned for a config read of the Vendor ID indicates a Configuration Request Retry Status (CRS) response. Per PCIe r3.1, sec 2.3.2, this data is only returned if: - CRS Software Visibility is enabled, - a config read includes both bytes of the Vendor ID, and - the read receives a CRS completion Signed-off-by: Sinan Kaya [bhelgaas: changelog, change name to pci_bus_crs_vendor_id(), make static in probe.c, use it in pci_bus_read_dev_vendor_id()] Signed-off-by: Bjorn Helgaas --- diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 150093817c59..5e001bbc2392 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1853,6 +1853,11 @@ struct pci_dev *pci_alloc_dev(struct pci_bus *bus) } EXPORT_SYMBOL(pci_alloc_dev); +static bool pci_bus_crs_vendor_id(u32 l) +{ + return (l & 0xffff) == 0x0001; +} + bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l, int crs_timeout) { @@ -1872,7 +1877,7 @@ bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l, * by the PCIe spec. Ignore the device ID and only check for * (vendor id == 1). */ - while ((*l & 0xffff) == 0x0001) { + while (pci_bus_crs_vendor_id(*l)) { if (!crs_timeout) return false;