Lines Matching refs:ntb
133 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
140 static int epf_ntb_link_up(struct epf_ntb *ntb, bool link_up)
152 ntb_epc = ntb->epc[type];
178 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
235 static int epf_ntb_configure_mw(struct epf_ntb *ntb,
248 ntb_epc = ntb->epc[type];
251 peer_ntb_epc = ntb->epc[!type];
262 if (size > ntb->mws_size[mw]) {
266 ntb->mws_size[mw]);
287 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
294 static void epf_ntb_teardown_mw(struct epf_ntb *ntb,
305 ntb_epc = ntb->epc[type];
308 peer_ntb_epc = ntb->epc[!type];
324 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
383 static int epf_ntb_configure_msi(struct epf_ntb *ntb,
396 ntb_epc = ntb->epc[type];
399 peer_ntb_epc = ntb->epc[!type];
427 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
487 static int epf_ntb_configure_msix(struct epf_ntb *ntb,
505 ntb_epc = ntb->epc[type];
511 peer_ntb_epc = ntb->epc[!type];
546 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
554 static int epf_ntb_configure_db(struct epf_ntb *ntb,
565 ntb_epc = ntb->epc[type];
569 ret = epf_ntb_configure_msix(ntb, type, db_count);
571 ret = epf_ntb_configure_msi(ntb, type, db_count);
583 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
589 epf_ntb_teardown_db(struct epf_ntb *ntb, enum pci_epc_interface_type type)
598 ntb_epc = ntb->epc[type];
601 peer_ntb_epc = ntb->epc[!type];
626 struct epf_ntb *ntb;
644 ntb = ntb_epc->epf_ntb;
645 dev = &ntb->epf->dev;
651 ret = epf_ntb_configure_db(ntb, type, db_count, is_msix);
658 epf_ntb_teardown_db(ntb, type);
662 ret = epf_ntb_configure_mw(ntb, type, argument);
669 epf_ntb_teardown_mw(ntb, type, argument);
674 if (ntb->epc[PRIMARY_INTERFACE]->linkup &&
675 ntb->epc[SECONDARY_INTERFACE]->linkup) {
676 ret = epf_ntb_link_up(ntb, true);
687 ret = epf_ntb_link_up(ntb, false);
751 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
779 static int epf_ntb_peer_spad_bar_set(struct epf_ntb *ntb,
791 dev = &ntb->epf->dev;
793 peer_ntb_epc = ntb->epc[!type];
797 ntb_epc = ntb->epc[type];
900 struct epf_ntb *ntb;
905 ntb = ntb_epc->epf_ntb;
906 dev = &ntb->epf->dev;
927 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
948 static void epf_ntb_config_spad_bar_free(struct epf_ntb *ntb)
955 epf = ntb->epf;
957 ntb_epc = ntb->epc[type];
967 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
993 static int epf_ntb_config_spad_bar_alloc(struct epf_ntb *ntb,
1009 epf = ntb->epf;
1011 ntb_epc = ntb->epc[type];
1018 peer_ntb_epc = ntb->epc[!type];
1027 spad_count = ntb->spad_count;
1034 msix_table_size = PCI_MSIX_ENTRY_SIZE * ntb->db_count;
1039 pba_size = ALIGN(DIV_ROUND_UP(ntb->db_count, 8), 8);
1082 ctrl->num_mws = ntb->num_mws;
1092 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
1097 static int epf_ntb_config_spad_bar_alloc_interface(struct epf_ntb *ntb)
1103 dev = &ntb->epf->dev;
1106 ret = epf_ntb_config_spad_bar_alloc(ntb, type);
1246 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
1252 static void epf_ntb_db_mw_bar_cleanup(struct epf_ntb *ntb,
1257 ntb_epc = ntb->epc[type];
1258 peer_ntb_epc = ntb->epc[!type];
1266 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
1272 static int epf_ntb_configure_interrupt(struct epf_ntb *ntb,
1284 ntb_epc = ntb->epc[type];
1285 dev = &ntb->epf->dev;
1299 db_count = ntb->db_count;
1305 ntb->db_count = db_count;
1423 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
1429 static int epf_ntb_db_mw_bar_init(struct epf_ntb *ntb,
1446 ntb_epc = ntb->epc[type];
1447 peer_ntb_epc = ntb->epc[!type];
1449 dev = &ntb->epf->dev;
1455 num_mws = ntb->num_mws;
1456 db_count = ntb->db_count;
1462 size = ALIGN(size, ntb->mws_size[i]);
1465 size += ntb->mws_size[i];
1467 size = ntb->mws_size[i];
1492 epf_ntb_db_mw_bar_cleanup(ntb, type);
1499 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
1505 static void epf_ntb_epc_destroy_interface(struct epf_ntb *ntb,
1515 epf = ntb->epf;
1516 ntb_epc = ntb->epc[type];
1526 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
1530 static void epf_ntb_epc_destroy(struct epf_ntb *ntb)
1535 epf_ntb_epc_destroy_interface(ntb, type);
1540 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
1546 static int epf_ntb_epc_create_interface(struct epf_ntb *ntb,
1557 dev = &ntb->epf->dev;
1563 epf = ntb->epf;
1579 ntb_epc->epf_ntb = ntb;
1586 ntb->epc[type] = ntb_epc;
1593 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
1600 static int epf_ntb_epc_create(struct epf_ntb *ntb)
1606 epf = ntb->epf;
1609 ret = epf_ntb_epc_create_interface(ntb, epf->epc, PRIMARY_INTERFACE);
1615 ret = epf_ntb_epc_create_interface(ntb, epf->sec_epc,
1625 epf_ntb_epc_destroy_interface(ntb, PRIMARY_INTERFACE);
1633 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
1639 static int epf_ntb_init_epc_bar_interface(struct epf_ntb *ntb,
1651 ntb_epc = ntb->epc[type];
1652 num_mws = ntb->num_mws;
1653 dev = &ntb->epf->dev;
1671 ntb->num_mws = i;
1683 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
1689 static int epf_ntb_init_epc_bar(struct epf_ntb *ntb)
1695 dev = &ntb->epf->dev;
1697 ret = epf_ntb_init_epc_bar_interface(ntb, type);
1710 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
1717 static int epf_ntb_epc_init_interface(struct epf_ntb *ntb,
1727 ntb_epc = ntb->epc[type];
1728 epf = ntb->epf;
1734 ret = epf_ntb_config_sspad_bar_set(ntb->epc[type]);
1741 ret = epf_ntb_peer_spad_bar_set(ntb, type);
1748 ret = epf_ntb_configure_interrupt(ntb, type);
1755 ret = epf_ntb_db_mw_bar_init(ntb, type);
1771 INIT_DELAYED_WORK(&ntb->epc[type]->cmd_handler, epf_ntb_cmd_handler);
1772 queue_work(kpcintb_workqueue, &ntb->epc[type]->cmd_handler.work);
1777 epf_ntb_db_mw_bar_cleanup(ntb, type);
1780 epf_ntb_peer_spad_bar_clear(ntb->epc[type]);
1783 epf_ntb_config_sspad_bar_clear(ntb->epc[type]);
1790 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
1795 static void epf_ntb_epc_cleanup_interface(struct epf_ntb *ntb,
1803 ntb_epc = ntb->epc[type];
1805 epf_ntb_db_mw_bar_cleanup(ntb, type);
1812 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
1816 static void epf_ntb_epc_cleanup(struct epf_ntb *ntb)
1821 epf_ntb_epc_cleanup_interface(ntb, type);
1826 * @ntb: NTB device that facilitates communication between HOST1 and HOST2
1831 static int epf_ntb_epc_init(struct epf_ntb *ntb)
1837 dev = &ntb->epf->dev;
1840 ret = epf_ntb_epc_init_interface(ntb, type);
1851 epf_ntb_epc_cleanup_interface(ntb, type - 1);
1867 struct epf_ntb *ntb = epf_get_drvdata(epf);
1881 ret = epf_ntb_epc_create(ntb);
1887 ret = epf_ntb_init_epc_bar(ntb);
1893 ret = epf_ntb_config_spad_bar_alloc_interface(ntb);
1899 ret = epf_ntb_epc_init(ntb);
1905 epf_set_drvdata(epf, ntb);
1910 epf_ntb_config_spad_bar_free(ntb);
1913 epf_ntb_epc_destroy(ntb);
1926 struct epf_ntb *ntb = epf_get_drvdata(epf);
1928 epf_ntb_epc_cleanup(ntb);
1929 epf_ntb_config_spad_bar_free(ntb);
1930 epf_ntb_epc_destroy(ntb);
1938 struct epf_ntb *ntb = to_epf_ntb(group); \
1940 return sysfs_emit(page, "%d\n", ntb->_name); \
1948 struct epf_ntb *ntb = to_epf_ntb(group); \
1954 ntb->_name = val; \
1964 struct epf_ntb *ntb = to_epf_ntb(group); \
1969 return sysfs_emit(page, "%lld\n", ntb->mws_size[win_no - 1]); \
1977 struct epf_ntb *ntb = to_epf_ntb(group); \
1978 struct device *dev = &ntb->epf->dev; \
1988 if (ntb->num_mws < win_no) { \
1989 dev_err(dev, "Invalid num_nws: %d value\n", ntb->num_mws); \
1993 ntb->mws_size[win_no - 1] = val; \
2002 struct epf_ntb *ntb = to_epf_ntb(group);
2011 ntb->num_mws = val;
2066 struct epf_ntb *ntb = epf_get_drvdata(epf);
2067 struct config_group *ntb_group = &ntb->group;
2086 struct epf_ntb *ntb;
2091 ntb = devm_kzalloc(dev, sizeof(*ntb), GFP_KERNEL);
2092 if (!ntb)
2096 ntb->epf = epf;
2097 epf_set_drvdata(epf, ntb);
2132 pr_err("Failed to register pci epf ntb driver --> %d\n", ret);