HomeFreeBSD

LinuxKPI: pci: implement pci_upstream_bridge()

Description

LinuxKPI: pci: implement pci_upstream_bridge()

Allow drivers to query the "upstream PCI bridge".
Currently we point back to ourselves on pdev->bus->self rather than
to the parent PCI bridge.
We keep this as status-quo with an extra comment and only on-demand
allocate a pci_dev for the parent bridge if we are asked for in
pci_upstream_bridge().
When releasing the pci_dev we check if pdev->bus->self has changed
and call pci_dev_put() to release the reference count on the parent
bridge as well.

This code moves pci_is_root_bus() higher up in pci.h but no functional
change there.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: hselasky, (jhb some earlier)
Thanks to: wulf for handling drm-kmod
Differential Revision: https://reviews.freebsd.org/D34305

Details

Provenance
bzAuthored on Feb 16 2022, 6:04 PM
Reviewer
hselasky
Differential Revision
D34305: LinuxKPI: pci: implement pci_upstream_bridge()
Parents
rGbb53dd56c30c: kern_tc.c/cputick2usec() (which is used to calculate cputime from
Branches
Unknown
Tags
Unknown