From: Bjorn Helgaas Date: Fri, 24 Aug 2012 00:32:36 +0000 (-0600) Subject: Merge branch 'pci/bjorn-find-next-ext-cap' into next X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a28afda8cc6a45b2c5a4f98cf8fcddd877597701;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git Merge branch 'pci/bjorn-find-next-ext-cap' into next * pci/bjorn-find-next-ext-cap: PCI: Add Vendor-Specific Extended Capability header info PCI: Add pci_find_next_ext_capability() Conflicts: drivers/pci/pci.c --- a28afda8cc6a45b2c5a4f98cf8fcddd877597701 diff --cc drivers/pci/pci.c index fac08f508d09,d34415ba0f64..5ba60dd71faa --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@@ -253,21 -253,50 +253,18 @@@ int pci_bus_find_capability(struct pci_ return pos; } -/** - * pci_pcie_cap2 - query for devices' PCI_CAP_ID_EXP v2 capability structure - * @dev: PCI device to check - * - * Like pci_pcie_cap() but also checks that the PCIe capability version is - * >= 2. Note that v1 capability structures could be sparse in that not - * all register fields were required. v2 requires the entire structure to - * be present size wise, while still allowing for non-implemented registers - * to exist but they must be hardwired to 0. - * - * Due to the differences in the versions of capability structures, one - * must be careful not to try and access non-existant registers that may - * exist in early versions - v1 - of Express devices. - * - * Returns the offset of the PCIe capability structure as long as the - * capability version is >= 2; otherwise 0 is returned. - */ -static int pci_pcie_cap2(struct pci_dev *dev) -{ - u16 flags; - int pos; - - pos = pci_pcie_cap(dev); - if (pos) { - pci_read_config_word(dev, pos + PCI_EXP_FLAGS, &flags); - if ((flags & PCI_EXP_FLAGS_VERS) < 2) - pos = 0; - } - - return pos; -} - /** - * pci_find_ext_capability - Find an extended capability + * pci_find_next_ext_capability - Find an extended capability * @dev: PCI device to query + * @start: address at which to start looking (0 to start at beginning of list) * @cap: capability code * - * Returns the address of the requested extended capability structure + * Returns the address of the next matching extended capability structure * within the device's PCI configuration space or 0 if the device does - * not support it. Possible values for @cap: - * - * %PCI_EXT_CAP_ID_ERR Advanced Error Reporting - * %PCI_EXT_CAP_ID_VC Virtual Channel - * %PCI_EXT_CAP_ID_DSN Device Serial Number - * %PCI_EXT_CAP_ID_PWR Power Budgeting + * not support it. Some capabilities can occur several times, e.g., the + * vendor-specific capability, and this provides a way to find them all. */ - int pci_find_ext_capability(struct pci_dev *dev, int cap) + int pci_find_next_ext_capability(struct pci_dev *dev, int start, int cap) { u32 header; int ttl;