]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
LinuxKPI: pci: implement pci_upstream_bridge()
authorBjoern A. Zeeb <bz@FreeBSD.org>
Wed, 16 Feb 2022 18:04:08 +0000 (18:04 +0000)
committerBjoern A. Zeeb <bz@FreeBSD.org>
Sun, 27 Mar 2022 18:08:35 +0000 (18:08 +0000)
commit50136233846e59eeb53c95498fdd4f3e1acf0a16
tree822bacbbabd7d2d6bf3939887e60476917a8ed25
parent8ed3b807ca45da1e3dfbe38f92e60a5ddf2c571c
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
Reviewed by: hselasky, (jhb some earlier)
Thanks to: wulf for handling drm-kmod
Differential Revision: https://reviews.freebsd.org/D34305

(cherry picked from commit b3b836251f9fefa817d158784189f6d336917f7a)
sys/compat/linuxkpi/common/include/linux/pci.h
sys/compat/linuxkpi/common/src/linux_pci.c