Lines Matching refs:msix
956 cfg->msix.msix_location = ptr; in pci_read_cap()
957 cfg->msix.msix_ctrl = REG(ptr + PCIR_MSIX_CTRL, 2); in pci_read_cap()
959 cfg->msix.msix_table_bar = PCIR_BAR(val & in pci_read_cap()
961 cfg->msix.msix_table_offset = val & ~PCIM_MSIX_BIR_MASK; in pci_read_cap()
963 cfg->msix.msix_pba_bar = PCIR_BAR(val & in pci_read_cap()
965 cfg->msix.msix_pba_offset = val & ~PCIM_MSIX_BIR_MASK; in pci_read_cap()
1687 struct pcicfg_msix *msix = &dinfo->cfg.msix; in pci_write_msix_entry() local
1690 KASSERT(msix->msix_table_len > index, ("bogus index")); in pci_write_msix_entry()
1691 offset = msix->msix_table_offset + index * 16; in pci_write_msix_entry()
1692 bus_write_4(msix->msix_table_res, offset, address & 0xffffffff); in pci_write_msix_entry()
1693 bus_write_4(msix->msix_table_res, offset + 4, address >> 32); in pci_write_msix_entry()
1694 bus_write_4(msix->msix_table_res, offset + 8, data); in pci_write_msix_entry()
1704 struct pcicfg_msix *msix = &dinfo->cfg.msix; in pci_enable_msix_method() local
1715 msix->msix_location + PCIR_MSIX_CTRL, in pci_enable_msix_method()
1716 msix->msix_ctrl & ~PCIM_MSIXCTRL_MSIX_ENABLE, 2); in pci_enable_msix_method()
1729 struct pcicfg_msix *msix = &dinfo->cfg.msix; in pci_mask_msix() local
1732 KASSERT(PCI_MSIX_MSGNUM(msix->msix_ctrl) > index, ("bogus index")); in pci_mask_msix()
1733 offset = msix->msix_table_offset + index * 16 + 12; in pci_mask_msix()
1734 val = bus_read_4(msix->msix_table_res, offset); in pci_mask_msix()
1741 bus_write_4(msix->msix_table_res, offset, val); in pci_mask_msix()
1748 struct pcicfg_msix *msix = &dinfo->cfg.msix; in pci_unmask_msix() local
1751 KASSERT(PCI_MSIX_MSGNUM(msix->msix_ctrl) > index, ("bogus index")); in pci_unmask_msix()
1752 offset = msix->msix_table_offset + index * 16 + 12; in pci_unmask_msix()
1753 val = bus_read_4(msix->msix_table_res, offset); in pci_unmask_msix()
1760 bus_write_4(msix->msix_table_res, offset, val); in pci_unmask_msix()
1767 struct pcicfg_msix *msix = &dinfo->cfg.msix; in pci_pending_msix() local
1770 KASSERT(msix->msix_table_len > index, ("bogus index")); in pci_pending_msix()
1771 offset = msix->msix_pba_offset + (index / 32) * 4; in pci_pending_msix()
1773 return (bus_read_4(msix->msix_pba_res, offset) & bit); in pci_pending_msix()
1785 struct pcicfg_msix *msix = &dinfo->cfg.msix; in pci_resume_msix() local
1790 if (msix->msix_alloc > 0) { in pci_resume_msix()
1791 msgnum = PCI_MSIX_MSGNUM(msix->msix_ctrl); in pci_resume_msix()
1798 for (i = 0; i < msix->msix_table_len; i++) { in pci_resume_msix()
1799 mte = &msix->msix_table[i]; in pci_resume_msix()
1802 mv = &msix->msix_vectors[mte->mte_vector - 1]; in pci_resume_msix()
1808 pci_write_config(dev, msix->msix_location + PCIR_MSIX_CTRL, in pci_resume_msix()
1809 msix->msix_ctrl, 2); in pci_resume_msix()
1837 if (cfg->msi.msi_alloc != 0 || cfg->msix.msix_alloc != 0) in pci_alloc_msix_method()
1845 if (cfg->msix.msix_location == 0 || !pci_do_msix) in pci_alloc_msix_method()
1850 cfg->msix.msix_table_bar); in pci_alloc_msix_method()
1854 cfg->msix.msix_table_res = rle->res; in pci_alloc_msix_method()
1855 if (cfg->msix.msix_pba_bar != cfg->msix.msix_table_bar) { in pci_alloc_msix_method()
1857 cfg->msix.msix_pba_bar); in pci_alloc_msix_method()
1862 cfg->msix.msix_pba_res = rle->res; in pci_alloc_msix_method()
1864 ctrl = pci_read_config(child, cfg->msix.msix_location + PCIR_MSIX_CTRL, in pci_alloc_msix_method()
1934 cfg->msix.msix_ctrl = ctrl; in pci_alloc_msix_method()
1939 cfg->msix.msix_vectors = mallocarray(actual, sizeof(struct msix_vector), in pci_alloc_msix_method()
1941 cfg->msix.msix_table = mallocarray(actual, in pci_alloc_msix_method()
1945 cfg->msix.msix_vectors[i].mv_irq = rle->start; in pci_alloc_msix_method()
1946 cfg->msix.msix_table[i].mte_vector = i + 1; in pci_alloc_msix_method()
1951 pci_write_config(child, cfg->msix.msix_location + PCIR_MSIX_CTRL, in pci_alloc_msix_method()
1953 cfg->msix.msix_ctrl = ctrl; in pci_alloc_msix_method()
1956 cfg->msix.msix_alloc = actual; in pci_alloc_msix_method()
1957 cfg->msix.msix_table_len = actual; in pci_alloc_msix_method()
2006 struct pcicfg_msix *msix = &dinfo->cfg.msix; in pci_remap_msix_method() local
2016 if (count < 1 || count > PCI_MSIX_MSGNUM(msix->msix_ctrl)) in pci_remap_msix_method()
2021 if (vectors[i] > msix->msix_alloc) in pci_remap_msix_method()
2029 used = mallocarray(msix->msix_alloc, sizeof(*used), M_DEVBUF, M_WAITOK | in pci_remap_msix_method()
2034 for (i = 0; i < msix->msix_alloc - 1; i++) in pci_remap_msix_method()
2045 for (i = 0; i < msix->msix_table_len; i++) { in pci_remap_msix_method()
2046 if (msix->msix_table[i].mte_vector == 0) in pci_remap_msix_method()
2048 if (msix->msix_table[i].mte_handlers > 0) { in pci_remap_msix_method()
2061 for (i = 0; i < msix->msix_table_len; i++) { in pci_remap_msix_method()
2062 if (msix->msix_table[i].mte_vector == 0) in pci_remap_msix_method()
2071 free(msix->msix_table, M_DEVBUF); in pci_remap_msix_method()
2072 msix->msix_table = mallocarray(count, sizeof(struct msix_table_entry), in pci_remap_msix_method()
2075 msix->msix_table[i].mte_vector = vectors[i]; in pci_remap_msix_method()
2076 msix->msix_table_len = count; in pci_remap_msix_method()
2079 j = msix->msix_alloc - 1; in pci_remap_msix_method()
2085 msix->msix_vectors[j].mv_irq); in pci_remap_msix_method()
2090 bcopy(msix->msix_vectors, vec, sizeof(struct msix_vector) * in pci_remap_msix_method()
2092 free(msix->msix_vectors, M_DEVBUF); in pci_remap_msix_method()
2093 msix->msix_vectors = vec; in pci_remap_msix_method()
2094 msix->msix_alloc = j + 1; in pci_remap_msix_method()
2102 irq = msix->msix_vectors[vectors[i] - 1].mv_irq; in pci_remap_msix_method()
2116 msix->msix_vectors[vectors[i] - 1].mv_irq); in pci_remap_msix_method()
2128 struct pcicfg_msix *msix = &dinfo->cfg.msix; in pci_release_msix() local
2133 if (msix->msix_alloc == 0) in pci_release_msix()
2137 for (i = 0; i < msix->msix_table_len; i++) { in pci_release_msix()
2138 if (msix->msix_table[i].mte_vector == 0) in pci_release_msix()
2140 if (msix->msix_table[i].mte_handlers > 0) in pci_release_msix()
2149 msix->msix_ctrl &= ~PCIM_MSIXCTRL_MSIX_ENABLE; in pci_release_msix()
2150 pci_write_config(child, msix->msix_location + PCIR_MSIX_CTRL, in pci_release_msix()
2151 msix->msix_ctrl, 2); in pci_release_msix()
2154 for (i = 0; i < msix->msix_table_len; i++) { in pci_release_msix()
2155 if (msix->msix_table[i].mte_vector == 0) in pci_release_msix()
2159 free(msix->msix_table, M_DEVBUF); in pci_release_msix()
2160 msix->msix_table_len = 0; in pci_release_msix()
2163 for (i = 0; i < msix->msix_alloc; i++) in pci_release_msix()
2165 msix->msix_vectors[i].mv_irq); in pci_release_msix()
2166 free(msix->msix_vectors, M_DEVBUF); in pci_release_msix()
2167 msix->msix_alloc = 0; in pci_release_msix()
2181 struct pcicfg_msix *msix = &dinfo->cfg.msix; in pci_msix_count_method() local
2184 if (pci_do_msix && msix->msix_location != 0) { in pci_msix_count_method()
2185 ctrl = pci_read_config(child, msix->msix_location + in pci_msix_count_method()
2196 struct pcicfg_msix *msix = &dinfo->cfg.msix; in pci_msix_pba_bar_method() local
2198 if (pci_do_msix && msix->msix_location != 0) in pci_msix_pba_bar_method()
2199 return (msix->msix_pba_bar); in pci_msix_pba_bar_method()
2207 struct pcicfg_msix *msix = &dinfo->cfg.msix; in pci_msix_table_bar_method() local
2209 if (pci_do_msix && msix->msix_location != 0) in pci_msix_table_bar_method()
2210 return (msix->msix_table_bar); in pci_msix_table_bar_method()
2490 if (cfg->msix.msix_alloc > 0) { in pci_remap_intr_method()
2493 for (i = 0; i < cfg->msix.msix_alloc; i++) { in pci_remap_intr_method()
2494 mv = &cfg->msix.msix_vectors[i]; in pci_remap_intr_method()
2502 for (j = 0; j < cfg->msix.msix_table_len; j++) { in pci_remap_intr_method()
2503 mte = &cfg->msix.msix_table[j]; in pci_remap_intr_method()
2635 if (cfg->msi.msi_alloc != 0 || cfg->msix.msix_alloc != 0) in pci_alloc_msi_method()
3112 if (cfg->msix.msix_location) { in pci_print_verbose()
3115 msgnum = PCI_MSIX_MSGNUM(cfg->msix.msix_ctrl); in pci_print_verbose()
3118 if (cfg->msix.msix_table_bar == cfg->msix.msix_pba_bar) in pci_print_verbose()
3120 cfg->msix.msix_table_bar); in pci_print_verbose()
3123 cfg->msix.msix_table_bar, in pci_print_verbose()
3124 cfg->msix.msix_pba_bar); in pci_print_verbose()
4876 KASSERT(dinfo->cfg.msix.msix_alloc > 0, in pci_setup_intr()
4878 KASSERT(rid <= dinfo->cfg.msix.msix_table_len, in pci_setup_intr()
4880 mte = &dinfo->cfg.msix.msix_table[rid - 1]; in pci_setup_intr()
4882 mv = &dinfo->cfg.msix.msix_vectors[mte->mte_vector - 1]; in pci_setup_intr()
4972 KASSERT(dinfo->cfg.msix.msix_alloc > 0, in pci_teardown_intr()
4974 KASSERT(rid <= dinfo->cfg.msix.msix_table_len, in pci_teardown_intr()
4976 mte = &dinfo->cfg.msix.msix_table[rid - 1]; in pci_teardown_intr()
5180 if (dinfo->cfg.msi.msi_alloc != 0 || dinfo->cfg.msix.msix_alloc != 0) { in pci_child_detached()
5186 "vectors\n", dinfo->cfg.msix.msix_alloc); in pci_child_detached()
5640 cfg->msix.msix_alloc > 0)) in pci_alloc_multi_resource()
6333 if (dinfo->cfg.msix.msix_location != 0) in pci_cfg_restore()