[PATCH v2 1/5] PCI: Recognize Thunderbolt devices

Bjorn Helgaas bhelgaas at google.com
Fri Mar 10 20:47:04 UTC 2017


On Fri, Mar 10, 2017 at 2:23 PM, Lukas Wunner <lukas at wunner.de> wrote:

> +/**
> + * pci_is_thunderbolt_attached - whether device is on a Thunderbolt daisy chain
> + * @pdev: PCI device to check
> + *
> + * Walk upwards from @pdev and check for each encountered bridge if it's part
> + * of a Thunderbolt controller.  Reaching the host bridge means @pdev is not
> + * Thunderbolt-attached.  (But rather soldered to the mainboard usually.)

The "soldered to the mainboard" comment is misleading.  We'll reach
the host bridge and return "false" for any non-Thunderbolt-attached
device, including all plug-in PCI and PCIe devices.

> + */
> +static inline bool pci_is_thunderbolt_attached(struct pci_dev *pdev)
> +{
> +       struct pci_dev *parent = pdev;
> +
> +       if (pdev->is_thunderbolt)
> +               return true;
> +
> +       while ((parent = pci_upstream_bridge(parent)))
> +               if (parent->is_thunderbolt)
> +                       return true;
> +
> +       return false;
> +}
> +
>  /* provide the legacy pci_dma_* API */
>  #include <linux/pci-dma-compat.h>
>
> --
> 2.11.0
>


More information about the dri-devel mailing list