Lines Matching refs:ntb
84 static int amd_ntb_mw_count(struct ntb_dev *ntb, int pidx) in amd_ntb_mw_count() argument
89 return ntb_ndev(ntb)->mw_count; in amd_ntb_mw_count()
92 static int amd_ntb_mw_get_align(struct ntb_dev *ntb, int pidx, int idx, in amd_ntb_mw_get_align() argument
97 struct amd_ntb_dev *ndev = ntb_ndev(ntb); in amd_ntb_mw_get_align()
114 *size_max = pci_resource_len(ndev->ntb.pdev, bar); in amd_ntb_mw_get_align()
119 static int amd_ntb_mw_set_trans(struct ntb_dev *ntb, int pidx, int idx, in amd_ntb_mw_set_trans() argument
122 struct amd_ntb_dev *ndev = ntb_ndev(ntb); in amd_ntb_mw_set_trans()
136 mw_size = pci_resource_len(ntb->pdev, bar); in amd_ntb_mw_set_trans()
145 base_addr = pci_resource_start(ntb->pdev, bar); in amd_ntb_mw_set_trans()
206 if (ndev->ntb.topo == NTB_TOPO_SEC) { in amd_ntb_get_link_status()
208 pci_swds = pci_upstream_bridge(ndev->ntb.pdev); in amd_ntb_get_link_status()
227 } else if (ndev->ntb.topo == NTB_TOPO_PRI) { in amd_ntb_get_link_status()
232 pdev = ndev->ntb.pdev; in amd_ntb_get_link_status()
295 if (ndev->ntb.topo == NTB_TOPO_PRI) { in amd_link_is_up()
313 static u64 amd_ntb_link_is_up(struct ntb_dev *ntb, in amd_ntb_link_is_up() argument
317 struct amd_ntb_dev *ndev = ntb_ndev(ntb); in amd_ntb_link_is_up()
326 dev_dbg(&ntb->pdev->dev, "link is up.\n"); in amd_ntb_link_is_up()
335 dev_dbg(&ntb->pdev->dev, "link is down.\n"); in amd_ntb_link_is_up()
341 static int amd_ntb_link_enable(struct ntb_dev *ntb, in amd_ntb_link_enable() argument
345 struct amd_ntb_dev *ndev = ntb_ndev(ntb); in amd_ntb_link_enable()
352 if (ndev->ntb.topo == NTB_TOPO_SEC) in amd_ntb_link_enable()
354 dev_dbg(&ntb->pdev->dev, "Enabling Link.\n"); in amd_ntb_link_enable()
359 static int amd_ntb_link_disable(struct ntb_dev *ntb) in amd_ntb_link_disable() argument
361 struct amd_ntb_dev *ndev = ntb_ndev(ntb); in amd_ntb_link_disable()
368 if (ndev->ntb.topo == NTB_TOPO_SEC) in amd_ntb_link_disable()
370 dev_dbg(&ntb->pdev->dev, "Enabling Link.\n"); in amd_ntb_link_disable()
375 static int amd_ntb_peer_mw_count(struct ntb_dev *ntb) in amd_ntb_peer_mw_count() argument
378 return ntb_ndev(ntb)->mw_count; in amd_ntb_peer_mw_count()
381 static int amd_ntb_peer_mw_get_addr(struct ntb_dev *ntb, int idx, in amd_ntb_peer_mw_get_addr() argument
384 struct amd_ntb_dev *ndev = ntb_ndev(ntb); in amd_ntb_peer_mw_get_addr()
392 *base = pci_resource_start(ndev->ntb.pdev, bar); in amd_ntb_peer_mw_get_addr()
395 *size = pci_resource_len(ndev->ntb.pdev, bar); in amd_ntb_peer_mw_get_addr()
400 static u64 amd_ntb_db_valid_mask(struct ntb_dev *ntb) in amd_ntb_db_valid_mask() argument
402 return ntb_ndev(ntb)->db_valid_mask; in amd_ntb_db_valid_mask()
405 static int amd_ntb_db_vector_count(struct ntb_dev *ntb) in amd_ntb_db_vector_count() argument
407 return ntb_ndev(ntb)->db_count; in amd_ntb_db_vector_count()
410 static u64 amd_ntb_db_vector_mask(struct ntb_dev *ntb, int db_vector) in amd_ntb_db_vector_mask() argument
412 struct amd_ntb_dev *ndev = ntb_ndev(ntb); in amd_ntb_db_vector_mask()
417 return ntb_ndev(ntb)->db_valid_mask & (1ULL << db_vector); in amd_ntb_db_vector_mask()
420 static u64 amd_ntb_db_read(struct ntb_dev *ntb) in amd_ntb_db_read() argument
422 struct amd_ntb_dev *ndev = ntb_ndev(ntb); in amd_ntb_db_read()
428 static int amd_ntb_db_clear(struct ntb_dev *ntb, u64 db_bits) in amd_ntb_db_clear() argument
430 struct amd_ntb_dev *ndev = ntb_ndev(ntb); in amd_ntb_db_clear()
438 static int amd_ntb_db_set_mask(struct ntb_dev *ntb, u64 db_bits) in amd_ntb_db_set_mask() argument
440 struct amd_ntb_dev *ndev = ntb_ndev(ntb); in amd_ntb_db_set_mask()
455 static int amd_ntb_db_clear_mask(struct ntb_dev *ntb, u64 db_bits) in amd_ntb_db_clear_mask() argument
457 struct amd_ntb_dev *ndev = ntb_ndev(ntb); in amd_ntb_db_clear_mask()
472 static int amd_ntb_peer_db_set(struct ntb_dev *ntb, u64 db_bits) in amd_ntb_peer_db_set() argument
474 struct amd_ntb_dev *ndev = ntb_ndev(ntb); in amd_ntb_peer_db_set()
482 static int amd_ntb_spad_count(struct ntb_dev *ntb) in amd_ntb_spad_count() argument
484 return ntb_ndev(ntb)->spad_count; in amd_ntb_spad_count()
487 static u32 amd_ntb_spad_read(struct ntb_dev *ntb, int idx) in amd_ntb_spad_read() argument
489 struct amd_ntb_dev *ndev = ntb_ndev(ntb); in amd_ntb_spad_read()
500 static int amd_ntb_spad_write(struct ntb_dev *ntb, in amd_ntb_spad_write() argument
503 struct amd_ntb_dev *ndev = ntb_ndev(ntb); in amd_ntb_spad_write()
516 static u32 amd_ntb_peer_spad_read(struct ntb_dev *ntb, int pidx, int sidx) in amd_ntb_peer_spad_read() argument
518 struct amd_ntb_dev *ndev = ntb_ndev(ntb); in amd_ntb_peer_spad_read()
529 static int amd_ntb_peer_spad_write(struct ntb_dev *ntb, int pidx, in amd_ntb_peer_spad_write() argument
532 struct amd_ntb_dev *ndev = ntb_ndev(ntb); in amd_ntb_peer_spad_write()
582 struct device *dev = &ndev->ntb.pdev->dev; in amd_handle_event()
606 ntb_link_event(&ndev->ntb); in amd_handle_event()
623 ntb_link_event(&ndev->ntb); in amd_handle_event()
652 struct device *dev = &ndev->ntb.pdev->dev; in amd_handle_db_event()
655 status = amd_ntb_db_read(&ndev->ntb); in amd_handle_db_event()
665 ntb_db_clear(&ndev->ntb, BIT(ndev->db_last_bit)); in amd_handle_db_event()
667 ntb_link_event(&ndev->ntb); in amd_handle_db_event()
682 dev_dbg(&ndev->ntb.pdev->dev, "vec %d\n", vec); in ndev_interrupt()
689 ntb_db_event(&ndev->ntb, vec); in ndev_interrupt()
706 return ndev_interrupt(ndev, irq - ndev->ntb.pdev->irq); in ndev_irq_isr()
715 pdev = ndev->ntb.pdev; in ndev_init_isr()
816 pdev = ndev->ntb.pdev; in ndev_deinit_isr()
864 ntb_topo_string(ndev->ntb.topo)); in ndev_debugfs_read()
942 debugfs_create_dir(pci_name(ndev->ntb.pdev), in ndev_init_debugfs()
962 ndev->ntb.pdev = pdev; in ndev_init_struct()
963 ndev->ntb.topo = NTB_TOPO_NONE; in ndev_init_struct()
964 ndev->ntb.ops = &amd_ntb_ops; in ndev_init_struct()
977 dev_dbg(&ndev->ntb.pdev->dev, "%s: reg_val = 0x%x.\n", __func__, reg); in amd_poll_link()
991 ntb_link_event(&ndev->ntb); in amd_link_hb()
1069 switch (ndev->ntb.topo) { in amd_init_ntb()
1073 if (ndev->ntb.topo == NTB_TOPO_PRI) { in amd_init_ntb()
1086 dev_err(&ndev->ntb.pdev->dev, in amd_init_ntb()
1115 pdev = ndev->ntb.pdev; in amd_init_dev()
1117 ndev->ntb.topo = amd_get_topo(ndev); in amd_init_dev()
1119 ntb_topo_string(ndev->ntb.topo)); in amd_init_dev()
1216 struct pci_dev *pdev = ndev->ntb.pdev; in amd_ntb_deinit_pci()
1259 rc = ntb_register_device(&ndev->ntb); in amd_ntb_pci_probe()
1288 ntb_peer_db_set(&ndev->ntb, BIT_ULL(ndev->db_last_bit)); in amd_ntb_pci_remove()
1289 ntb_unregister_device(&ndev->ntb); in amd_ntb_pci_remove()
1301 ntb_link_event(&ndev->ntb); in amd_ntb_pci_shutdown()
1304 ntb_peer_db_set(&ndev->ntb, BIT_ULL(ndev->db_last_bit)); in amd_ntb_pci_shutdown()
1305 ntb_unregister_device(&ndev->ntb); in amd_ntb_pci_shutdown()