git: fd1a2f3dfc0e - main - LinuxKPI: pci: add more functions
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 05 Feb 2023 20:33:01 UTC
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=fd1a2f3dfc0e8fb20d0d397d586000bb918aab47 commit fd1a2f3dfc0e8fb20d0d397d586000bb918aab47 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-05 20:31:40 +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 MFC after: 3 days Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D38237 --- 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 3b9403a61ecd..e722b77261c0 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -1684,4 +1684,30 @@ pci_wait_for_pending_transaction(struct pci_dev *pdev) return (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_ */