Page MenuHomeFreeBSD

Add a helper method to find a PCI-e root port of a device.
ClosedPublic

Authored by jhb on Nov 5 2015, 8:33 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 8, 11:25 PM
Unknown Object (File)
Dec 23 2023, 2:23 AM
Unknown Object (File)
Nov 10 2023, 2:22 PM
Unknown Object (File)
Nov 8 2023, 12:45 AM
Unknown Object (File)
Nov 6 2023, 10:18 PM
Unknown Object (File)
Oct 9 2023, 1:12 PM
Unknown Object (File)
Oct 6 2023, 11:42 PM
Unknown Object (File)
Oct 5 2023, 9:15 PM
Subscribers
None

Details

Summary

Add a new helper function for PCI devices to locate the upstream
PCI-express root port of a given PCI device.

This function is of limited usefulness. I use it in a pending change to
cxgbe(4), but I put it in pci.c since it is a generic PCI function. If
the function is dubbed to be too dubious I can just leave it internal
to cxgbe(4) instead of exposing it publically.

Test Plan
  • I use this in a pending change to cxgbe(4).

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb retitled this revision from to Add a helper method to find a PCI-e root port of a device..
jhb updated this object.
jhb edited the test plan for this revision. (Show Details)
jhb added reviewers: imp, kib.
kib edited edge metadata.

You added me because jah and I managed to produce sys/x86/iommu/busdma_dmar.c:dmar_get_requester(), right ? pci_find_pcie_root_port() is mostly a simplified version of the dmar_get_requester(). The later e.g. handles buggy pcie-pci bridges which do not report pcie capability (I have one of them in my test machine).

Ideally, the functions would be merged someday.

This revision is now accepted and ready to land.Nov 5 2015, 8:50 PM

Yes, I did use the dmar bits as a reference though I think we discussed those when you implemented them. It's not quite the same as the dmar routine though (I wanted to pull out a shared routine initially). We could possibly have something like 'is_a_pci_device(device_t dev)' that checked if the parent had the pci devclass, but that wouldn't be efficient to use in a walk like this.

This revision was automatically updated to reflect the committed changes.