]> 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>
Mon, 21 Mar 2022 14:35:23 +0000 (14:35 +0000)
commitb3b836251f9fefa817d158784189f6d336917f7a
tree91bd280929d8b5fab4ba9f35dda3ecac7cd2b7e4
parentbb53dd56c30c6360fc82be762ed98b0af6b9f69f
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
sys/compat/linuxkpi/common/include/linux/pci.h
sys/compat/linuxkpi/common/src/linux_pci.c