int i, total_entries, table_off, bar_index;
struct pci_dev *pd = dev->pci_dev;
int fd;
+ int err;
id = pci_read_byte(pd, pos + PCI_CAP_LIST_ID);
PT_LOG("Error: Can't open /dev/mem: %s\n", strerror(errno));
goto error_out;
}
- dev->msix->phys_iomem_base = mmap(0, total_entries * 16,
+ PT_LOG("table_off = %llx, total_entries = %d\n",table_off,total_entries);
+ dev->msix->table_offset_adjust = table_off & 0x0fff;
+ dev->msix->phys_iomem_base = mmap(0, total_entries * 16 + dev->msix->table_offset_adjust,
PROT_WRITE | PROT_READ, MAP_SHARED | MAP_LOCKED,
- fd, dev->msix->table_base + table_off);
+ fd, dev->msix->table_base + table_off - dev->msix->table_offset_adjust);
+ dev->msix->phys_iomem_base = (void *)((char *)dev->msix->phys_iomem_base +
+ dev->msix->table_offset_adjust);
+ err = errno;
+ PT_LOG("errno = %d\n",err);
if ( dev->msix->phys_iomem_base == MAP_FAILED )
{
PT_LOG("Error: Can't map physical MSI-X table: %s\n", strerror(errno));
{
PT_LOG("unmapping physical MSI-X table from %lx\n",
(unsigned long)dev->msix->phys_iomem_base);
- munmap(dev->msix->phys_iomem_base, dev->msix->total_entries * 16);
+ munmap(dev->msix->phys_iomem_base, dev->msix->total_entries * 16 +
+ dev->msix->table_offset_adjust);
}
free(dev->msix);