freebsd_network: Add pci_msix_table_bar().

Needed by the e1000 driver from FreeBSD 13. Tested in QEMU with e1000e.
This commit is contained in:
Augustin Cavalier
2021-10-20 19:13:19 -04:00
parent 047ebd5ac7
commit 82046b272c
2 changed files with 20 additions and 0 deletions
+18
View File
@@ -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)
{
@@ -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);