diff options
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/pci.c | 24 | ||||
-rw-r--r-- | sys/dev/pci/pci_if.m | 16 | ||||
-rw-r--r-- | sys/dev/pci/pci_private.h | 2 | ||||
-rw-r--r-- | sys/dev/pci/pcivar.h | 12 |
4 files changed, 54 insertions, 0 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index e08237b..cef2db4 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -182,6 +182,8 @@ static device_method_t pci_methods[] = { DEVMETHOD(pci_release_msi, pci_release_msi_method), DEVMETHOD(pci_msi_count, pci_msi_count_method), DEVMETHOD(pci_msix_count, pci_msix_count_method), + DEVMETHOD(pci_msix_pba_bar, pci_msix_pba_bar_method), + DEVMETHOD(pci_msix_table_bar, pci_msix_table_bar_method), DEVMETHOD(pci_get_rid, pci_get_rid_method), DEVMETHOD(pci_child_added, pci_child_added_method), @@ -1827,6 +1829,28 @@ pci_msix_count_method(device_t dev, device_t child) return (0); } +int +pci_msix_pba_bar_method(device_t dev, device_t child) +{ + struct pci_devinfo *dinfo = device_get_ivars(child); + struct pcicfg_msix *msix = &dinfo->cfg.msix; + + if (pci_do_msix && msix->msix_location != 0) + return (msix->msix_pba_bar); + return (-1); +} + +int +pci_msix_table_bar_method(device_t dev, device_t child) +{ + struct pci_devinfo *dinfo = device_get_ivars(child); + struct pcicfg_msix *msix = &dinfo->cfg.msix; + + if (pci_do_msix && msix->msix_location != 0) + return (msix->msix_table_bar); + return (-1); +} + /* * HyperTransport MSI mapping control */ diff --git a/sys/dev/pci/pci_if.m b/sys/dev/pci/pci_if.m index 227d362..a44a641 100644 --- a/sys/dev/pci/pci_if.m +++ b/sys/dev/pci/pci_if.m @@ -36,6 +36,12 @@ CODE { { return (0); } + + static int + null_msix_bar(device_t dev, device_t child) + { + return (-1); + } }; @@ -180,6 +186,16 @@ METHOD int msix_count { device_t child; } DEFAULT null_msi_count; +METHOD int msix_pba_bar { + device_t dev; + device_t child; +} DEFAULT null_msix_bar; + +METHOD int msix_table_bar { + device_t dev; + device_t child; +} DEFAULT null_msix_bar; + METHOD uint16_t get_rid { device_t dev; device_t child; diff --git a/sys/dev/pci/pci_private.h b/sys/dev/pci/pci_private.h index 5a90ce9..e446dc5 100644 --- a/sys/dev/pci/pci_private.h +++ b/sys/dev/pci/pci_private.h @@ -100,6 +100,8 @@ int pci_remap_msix_method(device_t dev, device_t child, int pci_release_msi_method(device_t dev, device_t child); int pci_msi_count_method(device_t dev, device_t child); int pci_msix_count_method(device_t dev, device_t child); +int pci_msix_pba_bar_method(device_t dev, device_t child); +int pci_msix_table_bar_method(device_t dev, device_t child); struct resource *pci_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags); diff --git a/sys/dev/pci/pcivar.h b/sys/dev/pci/pcivar.h index d5d8c77..14132bf 100644 --- a/sys/dev/pci/pcivar.h +++ b/sys/dev/pci/pcivar.h @@ -495,6 +495,18 @@ pci_msix_count(device_t dev) return (PCI_MSIX_COUNT(device_get_parent(dev), dev)); } +static __inline int +pci_msix_pba_bar(device_t dev) +{ + return (PCI_MSIX_PBA_BAR(device_get_parent(dev), dev)); +} + +static __inline int +pci_msix_table_bar(device_t dev) +{ + return (PCI_MSIX_TABLE_BAR(device_get_parent(dev), dev)); +} + static __inline uint16_t pci_get_rid(device_t dev) { |