Date: Thu, 23 Feb 2023 19:34:40 GMT From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 4fa10614c773 - releng/13.2 - LinuxKPI: pci: add more functions Message-ID: <202302231934.31NJYe1T020462@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch releng/13.2 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=4fa10614c77369ae4edd09a065a70fd20e526d43 commit 4fa10614c77369ae4edd09a065a70fd20e526d43 Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2023-01-28 15:02:51 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2023-02-23 19:33:24 +0000 LinuxKPI: pci: add more functions Add a dummy pci_assign_resource() and an implementation of pci_irq_vector() returning the irq for MSI-X, MSI, and legacy interrupt. Both are needed by wirless drivers. Sponsored by: The FreeBSD Foundation Reviewed by: jhb Approved by: re (cperciva) Differential Revision: https://reviews.freebsd.org/D38237 (cherry picked from commit fd1a2f3dfc0e8fb20d0d397d586000bb918aab47) (cherry picked from commit 7b65e6f377ca0005a986c59f1e31a0421d92660f) --- sys/compat/linuxkpi/common/include/linux/pci.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 5e028774f079..3d43595df047 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -1694,4 +1694,30 @@ pci_is_enabled(struct pci_dev *pdev) PCIM_CMD_BUSMASTEREN) != 0); } +static inline int +pci_assign_resource(struct pci_dev *pdev, int bar) +{ + + return (0); +} + +static inline int +pci_irq_vector(struct pci_dev *pdev, unsigned int vector) +{ + + if (!pdev->msix_enabled && !pdev->msi_enabled) { + if (vector != 0) + return (-EINVAL); + return (pdev->irq); + } + + if (pdev->msix_enabled || pdev->msi_enabled) { + if ((pdev->dev.irq_start + vector) >= pdev->dev.irq_end) + return (-EINVAL); + return (pdev->dev.irq_start + vector); + } + + return (-ENXIO); +} + #endif /* _LINUXKPI_LINUX_PCI_H_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302231934.31NJYe1T020462>