diff --git a/src/libs/compat/freebsd_network/bus.cpp b/src/libs/compat/freebsd_network/bus.cpp index 6b20ac644d..90e85e59c8 100644 --- a/src/libs/compat/freebsd_network/bus.cpp +++ b/src/libs/compat/freebsd_network/bus.cpp @@ -846,6 +846,24 @@ pci_release_msi(device_t dev) } +int +pci_msix_table_bar(device_t dev) +{ + pci_info *info = &((struct root_device_softc *)dev->root->softc)->pci_info; + + uint8 capability_offset; + if (gPci->find_pci_capability(info->bus, info->device, info->function, + PCI_cap_id_msix, &capability_offset) != B_OK) + return -1; + + uint32 table_value = gPci->read_pci_config(info->bus, info->device, info->function, + capability_offset + PCI_msix_table, 4); + + uint32 bar = table_value & PCI_msix_bir_mask; + return PCIR_BAR(bar); +} + + int pci_msix_count(device_t dev) { diff --git a/src/libs/compat/freebsd_network/compat/dev/pci/pcivar.h b/src/libs/compat/freebsd_network/compat/dev/pci/pcivar.h index 12f302e6fb..69e6ff2c35 100644 --- a/src/libs/compat/freebsd_network/compat/dev/pci/pcivar.h +++ b/src/libs/compat/freebsd_network/compat/dev/pci/pcivar.h @@ -51,6 +51,8 @@ int pci_find_extcap(device_t dev, int capability, int *capreg); int pci_msi_count(device_t dev); int pci_alloc_msi(device_t dev, int *count); int pci_release_msi(device_t dev); + +int pci_msix_table_bar(device_t dev); int pci_msix_count(device_t dev); int pci_alloc_msix(device_t dev, int *count);