void qpci_msix_enable(QPCIDevice *dev)

{

    uint8_t addr;

    uint16_t val;

    uint32_t table;

    uint8_t bir_table;

    uint8_t bir_pba;

    void *offset;



    addr = qpci_find_capability(dev, PCI_CAP_ID_MSIX);

    g_assert_cmphex(addr, !=, 0);



    val = qpci_config_readw(dev, addr + PCI_MSIX_FLAGS);

    qpci_config_writew(dev, addr + PCI_MSIX_FLAGS, val | PCI_MSIX_FLAGS_ENABLE);



    table = qpci_config_readl(dev, addr + PCI_MSIX_TABLE);

    bir_table = table & PCI_MSIX_FLAGS_BIRMASK;

    offset = qpci_iomap(dev, bir_table, NULL);

    dev->msix_table = offset + (table & ~PCI_MSIX_FLAGS_BIRMASK);



    table = qpci_config_readl(dev, addr + PCI_MSIX_PBA);

    bir_pba = table & PCI_MSIX_FLAGS_BIRMASK;

    if (bir_pba != bir_table) {

        offset = qpci_iomap(dev, bir_pba, NULL);

    }

    dev->msix_pba = offset + (table & ~PCI_MSIX_FLAGS_BIRMASK);



    g_assert(dev->msix_table != NULL);

    g_assert(dev->msix_pba != NULL);

    dev->msix_enabled = true;

}

void qpci_msix_enable(QPCIDevice *dev)

{

    uint8_t addr;

    uint16_t val;

    uint32_t table;

    uint8_t bir_table;

    uint8_t bir_pba;

    void *offset;



    addr = qpci_find_capability(dev, PCI_CAP_ID_MSIX);

    g_assert_cmphex(addr, !=, 0);



    val = qpci_config_readw(dev, addr + PCI_MSIX_FLAGS);

    qpci_config_writew(dev, addr + PCI_MSIX_FLAGS, val | PCI_MSIX_FLAGS_ENABLE);



    table = qpci_config_readl(dev, addr + PCI_MSIX_TABLE);

    bir_table = table & PCI_MSIX_FLAGS_BIRMASK;

    offset = qpci_iomap(dev, bir_table, NULL);

    dev->msix_table = offset + (table & ~PCI_MSIX_FLAGS_BIRMASK);



    table = qpci_config_readl(dev, addr + PCI_MSIX_PBA);

    bir_pba = table & PCI_MSIX_FLAGS_BIRMASK;

    if (bir_pba != bir_table) {

        offset = qpci_iomap(dev, bir_pba, NULL);

    }

    dev->msix_pba = offset + (table & ~PCI_MSIX_FLAGS_BIRMASK);



    g_assert(dev->msix_table != NULL);

    g_assert(dev->msix_pba != NULL);

    dev->msix_enabled = true;

}

    void *offset;     offset = qpci_iomap(dev, bir_table, NULL);     dev->msix_table = offset + (table & ~PCI_MSIX_FLAGS_BIRMASK);         offset = qpci_iomap(dev, bir_pba, NULL);     dev->msix_pba = offset + (table & ~PCI_MSIX_FLAGS_BIRMASK);     g_assert(dev->msix_table != NULL);     g_assert(dev->msix_pba != NULL);
void FUNC_0(QPCIDevice *VAR_0)

{

    uint8_t addr;

    uint16_t val;

    uint32_t table;

    uint8_t bir_table;

    uint8_t bir_pba;

    void *VAR_1;



    addr = qpci_find_capability(VAR_0, PCI_CAP_ID_MSIX);

    g_assert_cmphex(addr, !=, 0);



    val = qpci_config_readw(VAR_0, addr + PCI_MSIX_FLAGS);

    qpci_config_writew(VAR_0, addr + PCI_MSIX_FLAGS, val | PCI_MSIX_FLAGS_ENABLE);



    table = qpci_config_readl(VAR_0, addr + PCI_MSIX_TABLE);

    bir_table = table & PCI_MSIX_FLAGS_BIRMASK;

    VAR_1 = qpci_iomap(VAR_0, bir_table, NULL);

    VAR_0->msix_table = VAR_1 + (table & ~PCI_MSIX_FLAGS_BIRMASK);



    table = qpci_config_readl(VAR_0, addr + PCI_MSIX_PBA);

    bir_pba = table & PCI_MSIX_FLAGS_BIRMASK;

    if (bir_pba != bir_table) {

        VAR_1 = qpci_iomap(VAR_0, bir_pba, NULL);

    }

    VAR_0->msix_pba = VAR_1 + (table & ~PCI_MSIX_FLAGS_BIRMASK);



    g_assert(VAR_0->msix_table != NULL);

    g_assert(VAR_0->msix_pba != NULL);

    VAR_0->msix_enabled = true;

}

void FUNC_0(QPCIDevice *VAR_0)
{ uint8_t addr; uint16_t val; uint32_t table; uint8_t bir_table; uint8_t bir_pba; void *VAR_1; addr = qpci_find_capability(VAR_0, PCI_CAP_ID_MSIX); g_assert_cmphex(addr, !=, 0); val = qpci_config_readw(VAR_0, addr + PCI_MSIX_FLAGS); qpci_config_writew(VAR_0, addr + PCI_MSIX_FLAGS, val | PCI_MSIX_FLAGS_ENABLE); table = qpci_config_readl(VAR_0, addr + PCI_MSIX_TABLE); bir_table = table & PCI_MSIX_FLAGS_BIRMASK; VAR_1 = qpci_iomap(VAR_0, bir_table, NULL); VAR_0->msix_table = VAR_1 + (table & ~PCI_MSIX_FLAGS_BIRMASK); table = qpci_config_readl(VAR_0, addr + PCI_MSIX_PBA); bir_pba = table & PCI_MSIX_FLAGS_BIRMASK; if (bir_pba != bir_table) { VAR_1 = qpci_iomap(VAR_0, bir_pba, NULL); } VAR_0->msix_pba = VAR_1 + (table & ~PCI_MSIX_FLAGS_BIRMASK); g_assert(VAR_0->msix_table != NULL); g_assert(VAR_0->msix_pba != NULL); VAR_0->msix_enabled = true; }