Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Feb 2023 23:45:03 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: 7b65e6f377ca - stable/13 - LinuxKPI: pci: add more functions
Message-ID:  <202302172345.31HNj3Rp025371@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=7b65e6f377ca0005a986c59f1e31a0421d92660f

commit 7b65e6f377ca0005a986c59f1e31a0421d92660f
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-17 23:42:16 +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
    
    (cherry picked from commit fd1a2f3dfc0e8fb20d0d397d586000bb918aab47)
---
 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 5fdfc3a46d8b..48bdabda9f21 100644
--- a/sys/compat/linuxkpi/common/include/linux/pci.h
+++ b/sys/compat/linuxkpi/common/include/linux/pci.h
@@ -1706,4 +1706,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_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302172345.31HNj3Rp025371>