diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -437,6 +437,24 @@ return (1 << type); } +static inline int +pci_select_bars(struct pci_dev *pdev, unsigned long flags) +{ + int bars, bar; + + bars = 0; + /* We only support BARs here; Linux may support more types. */ + for (bar = PCIR_MAX_BAR_0; bar >= 0; bar--) { + int bar_flags; + + bar_flags = pci_resource_flags(pdev, bar); + if ((bar_flags & flags) != 0) + bars |= (1 << bar); + } + + return (bars); +} + static inline const char * pci_name(struct pci_dev *d) { @@ -1574,6 +1592,17 @@ return (-ENXIO); } +static inline int +pci_msix_vec_count(struct pci_dev *pdev) +{ + int avail; + + avail = pci_msix_count(pdev->dev.bsddev); + if (avail == 0) + return (-EINVAL); + return (avail); +} + static inline int pci_wake_from_d3(struct pci_dev *pdev, bool enable) {