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
This commit is contained in:
Bjoern A. Zeeb 2023-01-28 15:02:51 +00:00
parent 70b97048a0
commit fd1a2f3dfc

View File

@ -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_ */