sndev 98 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static int switchtec_ntb_part_op(struct switchtec_ntb *sndev, sndev 144 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_err(&sndev->stdev->dev, sndev 155 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static int switchtec_ntb_send_msg(struct switchtec_ntb *sndev, int idx, sndev 158 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (idx < 0 || idx >= ARRAY_SIZE(sndev->mmio_peer_dbmsg->omsg)) sndev 161 drivers/ntb/hw/mscc/ntb_hw_switchtec.c iowrite32(val, &sndev->mmio_peer_dbmsg->omsg[idx].msg); sndev 168 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = ntb_sndev(ntb); sndev 169 drivers/ntb/hw/mscc/ntb_hw_switchtec.c int nr_direct_mw = sndev->peer_nr_direct_mw; sndev 170 drivers/ntb/hw/mscc/ntb_hw_switchtec.c int nr_lut_mw = sndev->peer_nr_lut_mw - sndev->nr_rsvd_luts; sndev 181 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static int lut_index(struct switchtec_ntb *sndev, int mw_idx) sndev 183 drivers/ntb/hw/mscc/ntb_hw_switchtec.c return mw_idx - sndev->nr_direct_mw + sndev->nr_rsvd_luts; sndev 186 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static int peer_lut_index(struct switchtec_ntb *sndev, int mw_idx) sndev 188 drivers/ntb/hw/mscc/ntb_hw_switchtec.c return mw_idx - sndev->peer_nr_direct_mw + sndev->nr_rsvd_luts; sndev 196 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = ntb_sndev(ntb); sndev 203 drivers/ntb/hw/mscc/ntb_hw_switchtec.c lut = widx >= sndev->peer_nr_direct_mw; sndev 204 drivers/ntb/hw/mscc/ntb_hw_switchtec.c size = ioread64(&sndev->peer_shared->mw_sizes[widx]); sndev 221 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static void switchtec_ntb_mw_clr_direct(struct switchtec_ntb *sndev, int idx) sndev 223 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct ntb_ctrl_regs __iomem *ctl = sndev->mmio_peer_ctrl; sndev 224 drivers/ntb/hw/mscc/ntb_hw_switchtec.c int bar = sndev->peer_direct_mw_to_bar[idx]; sndev 232 drivers/ntb/hw/mscc/ntb_hw_switchtec.c iowrite64(sndev->self_partition, &ctl->bar_entry[bar].xlate_addr); sndev 235 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static void switchtec_ntb_mw_clr_lut(struct switchtec_ntb *sndev, int idx) sndev 237 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct ntb_ctrl_regs __iomem *ctl = sndev->mmio_peer_ctrl; sndev 239 drivers/ntb/hw/mscc/ntb_hw_switchtec.c iowrite64(0, &ctl->lut_entry[peer_lut_index(sndev, idx)]); sndev 242 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static void switchtec_ntb_mw_set_direct(struct switchtec_ntb *sndev, int idx, sndev 246 drivers/ntb/hw/mscc/ntb_hw_switchtec.c int bar = sndev->peer_direct_mw_to_bar[idx]; sndev 247 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct ntb_ctrl_regs __iomem *ctl = sndev->mmio_peer_ctrl; sndev 257 drivers/ntb/hw/mscc/ntb_hw_switchtec.c iowrite64(sndev->self_partition | addr, sndev 261 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static void switchtec_ntb_mw_set_lut(struct switchtec_ntb *sndev, int idx, sndev 264 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct ntb_ctrl_regs __iomem *ctl = sndev->mmio_peer_ctrl; sndev 266 drivers/ntb/hw/mscc/ntb_hw_switchtec.c iowrite64((NTB_CTRL_LUT_EN | (sndev->self_partition << 1) | addr), sndev 267 drivers/ntb/hw/mscc/ntb_hw_switchtec.c &ctl->lut_entry[peer_lut_index(sndev, idx)]); sndev 273 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = ntb_sndev(ntb); sndev 274 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct ntb_ctrl_regs __iomem *ctl = sndev->mmio_peer_ctrl; sndev 276 drivers/ntb/hw/mscc/ntb_hw_switchtec.c int nr_direct_mw = sndev->peer_nr_direct_mw; sndev 282 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_dbg(&sndev->stdev->dev, "MW %d: part %d addr %pad size %pap\n", sndev 299 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_err(&sndev->stdev->dev, sndev 304 drivers/ntb/hw/mscc/ntb_hw_switchtec.c rc = switchtec_ntb_part_op(sndev, ctl, NTB_CTRL_PART_OP_LOCK, sndev 311 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_mw_clr_direct(sndev, widx); sndev 313 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_mw_clr_lut(sndev, widx); sndev 316 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_mw_set_direct(sndev, widx, addr, size); sndev 318 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_mw_set_lut(sndev, widx, addr, size); sndev 321 drivers/ntb/hw/mscc/ntb_hw_switchtec.c rc = switchtec_ntb_part_op(sndev, ctl, NTB_CTRL_PART_OP_CFG, sndev 325 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_err(&sndev->stdev->dev, sndev 330 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_mw_clr_direct(sndev, widx); sndev 332 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_mw_clr_lut(sndev, widx); sndev 334 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_part_op(sndev, ctl, NTB_CTRL_PART_OP_CFG, sndev 343 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = ntb_sndev(ntb); sndev 344 drivers/ntb/hw/mscc/ntb_hw_switchtec.c int nr_lut_mw = sndev->nr_lut_mw - sndev->nr_rsvd_luts; sndev 346 drivers/ntb/hw/mscc/ntb_hw_switchtec.c return sndev->nr_direct_mw + (use_lut_mws ? nr_lut_mw : 0); sndev 349 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static int switchtec_ntb_direct_get_addr(struct switchtec_ntb *sndev, sndev 353 drivers/ntb/hw/mscc/ntb_hw_switchtec.c int bar = sndev->direct_mw_to_bar[idx]; sndev 366 drivers/ntb/hw/mscc/ntb_hw_switchtec.c offset = LUT_SIZE * sndev->nr_lut_mw; sndev 370 drivers/ntb/hw/mscc/ntb_hw_switchtec.c *base = pci_resource_start(sndev->ntb.pdev, bar) + offset; sndev 373 drivers/ntb/hw/mscc/ntb_hw_switchtec.c *size = pci_resource_len(sndev->ntb.pdev, bar) - offset; sndev 384 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static int switchtec_ntb_lut_get_addr(struct switchtec_ntb *sndev, sndev 388 drivers/ntb/hw/mscc/ntb_hw_switchtec.c int bar = sndev->direct_mw_to_bar[0]; sndev 391 drivers/ntb/hw/mscc/ntb_hw_switchtec.c offset = LUT_SIZE * lut_index(sndev, idx); sndev 394 drivers/ntb/hw/mscc/ntb_hw_switchtec.c *base = pci_resource_start(sndev->ntb.pdev, bar) + offset; sndev 406 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = ntb_sndev(ntb); sndev 408 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (idx < sndev->nr_direct_mw) sndev 409 drivers/ntb/hw/mscc/ntb_hw_switchtec.c return switchtec_ntb_direct_get_addr(sndev, idx, base, size); sndev 411 drivers/ntb/hw/mscc/ntb_hw_switchtec.c return switchtec_ntb_lut_get_addr(sndev, idx, base, size); sndev 416 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static void switchtec_ntb_part_link_speed(struct switchtec_ntb *sndev, sndev 421 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_dev *stdev = sndev->stdev; sndev 433 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static void switchtec_ntb_set_link_speed(struct switchtec_ntb *sndev) sndev 438 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (!sndev->link_is_up) { sndev 439 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->link_speed = NTB_SPEED_NONE; sndev 440 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->link_width = NTB_WIDTH_NONE; sndev 444 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_part_link_speed(sndev, sndev->self_partition, sndev 446 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_part_link_speed(sndev, sndev->peer_partition, sndev 449 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->link_speed = min(self_speed, peer_speed); sndev 450 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->link_width = min(self_width, peer_width); sndev 453 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static int crosslink_is_enabled(struct switchtec_ntb *sndev) sndev 455 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct ntb_info_regs __iomem *inf = sndev->mmio_ntb; sndev 457 drivers/ntb/hw/mscc/ntb_hw_switchtec.c return ioread8(&inf->ntp_info[sndev->peer_partition].xlink_enabled); sndev 460 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static void crosslink_init_dbmsgs(struct switchtec_ntb *sndev) sndev 465 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (!crosslink_is_enabled(sndev)) sndev 468 drivers/ntb/hw/mscc/ntb_hw_switchtec.c for (i = 0; i < ARRAY_SIZE(sndev->mmio_peer_dbmsg->imsg); i++) { sndev 469 drivers/ntb/hw/mscc/ntb_hw_switchtec.c int m = i | sndev->self_partition << 2; sndev 474 drivers/ntb/hw/mscc/ntb_hw_switchtec.c iowrite32(msg_map, &sndev->mmio_peer_dbmsg->msg_map); sndev 475 drivers/ntb/hw/mscc/ntb_hw_switchtec.c iowrite64(sndev->db_valid_mask << sndev->db_peer_shift, sndev 476 drivers/ntb/hw/mscc/ntb_hw_switchtec.c &sndev->mmio_peer_dbmsg->odb_mask); sndev 487 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static int switchtec_ntb_reinit_peer(struct switchtec_ntb *sndev); sndev 489 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static void switchtec_ntb_link_status_update(struct switchtec_ntb *sndev) sndev 492 drivers/ntb/hw/mscc/ntb_hw_switchtec.c int old = sndev->link_is_up; sndev 494 drivers/ntb/hw/mscc/ntb_hw_switchtec.c link_sta = sndev->self_shared->link_sta; sndev 496 drivers/ntb/hw/mscc/ntb_hw_switchtec.c u64 peer = ioread64(&sndev->peer_shared->magic); sndev 504 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->link_is_up = link_sta; sndev 505 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_set_link_speed(sndev); sndev 508 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_send_msg(sndev, LINK_MESSAGE, MSG_CHECK_LINK); sndev 509 drivers/ntb/hw/mscc/ntb_hw_switchtec.c ntb_link_event(&sndev->ntb); sndev 510 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_info(&sndev->stdev->dev, "ntb link %s\n", sndev 514 drivers/ntb/hw/mscc/ntb_hw_switchtec.c crosslink_init_dbmsgs(sndev); sndev 520 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev; sndev 522 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev = container_of(work, struct switchtec_ntb, sndev 525 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (sndev->link_force_down) { sndev 526 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->link_force_down = false; sndev 527 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_reinit_peer(sndev); sndev 529 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (sndev->link_is_up) { sndev 530 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->link_is_up = 0; sndev 531 drivers/ntb/hw/mscc/ntb_hw_switchtec.c ntb_link_event(&sndev->ntb); sndev 532 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_info(&sndev->stdev->dev, "ntb link forced down\n"); sndev 538 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_link_status_update(sndev); sndev 541 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static void switchtec_ntb_check_link(struct switchtec_ntb *sndev, sndev 545 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->link_force_down = true; sndev 547 drivers/ntb/hw/mscc/ntb_hw_switchtec.c schedule_work(&sndev->check_link_status_work); sndev 552 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = stdev->sndev; sndev 554 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_check_link(sndev, MSG_CHECK_LINK); sndev 561 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = ntb_sndev(ntb); sndev 564 drivers/ntb/hw/mscc/ntb_hw_switchtec.c *speed = sndev->link_speed; sndev 566 drivers/ntb/hw/mscc/ntb_hw_switchtec.c *width = sndev->link_width; sndev 568 drivers/ntb/hw/mscc/ntb_hw_switchtec.c return sndev->link_is_up; sndev 575 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = ntb_sndev(ntb); sndev 577 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_dbg(&sndev->stdev->dev, "enabling link\n"); sndev 579 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->self_shared->link_sta = 1; sndev 580 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_send_msg(sndev, LINK_MESSAGE, MSG_LINK_UP); sndev 582 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_link_status_update(sndev); sndev 589 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = ntb_sndev(ntb); sndev 591 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_dbg(&sndev->stdev->dev, "disabling link\n"); sndev 593 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->self_shared->link_sta = 0; sndev 594 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_send_msg(sndev, LINK_MESSAGE, MSG_LINK_DOWN); sndev 596 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_link_status_update(sndev); sndev 603 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = ntb_sndev(ntb); sndev 605 drivers/ntb/hw/mscc/ntb_hw_switchtec.c return sndev->db_valid_mask; sndev 615 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = ntb_sndev(ntb); sndev 620 drivers/ntb/hw/mscc/ntb_hw_switchtec.c return sndev->db_valid_mask; sndev 626 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = ntb_sndev(ntb); sndev 628 drivers/ntb/hw/mscc/ntb_hw_switchtec.c ret = ioread64(&sndev->mmio_self_dbmsg->idb) >> sndev->db_shift; sndev 630 drivers/ntb/hw/mscc/ntb_hw_switchtec.c return ret & sndev->db_valid_mask; sndev 635 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = ntb_sndev(ntb); sndev 637 drivers/ntb/hw/mscc/ntb_hw_switchtec.c iowrite64(db_bits << sndev->db_shift, &sndev->mmio_self_dbmsg->idb); sndev 645 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = ntb_sndev(ntb); sndev 647 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (db_bits & ~sndev->db_valid_mask) sndev 650 drivers/ntb/hw/mscc/ntb_hw_switchtec.c spin_lock_irqsave(&sndev->db_mask_lock, irqflags); sndev 652 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->db_mask |= db_bits << sndev->db_shift; sndev 653 drivers/ntb/hw/mscc/ntb_hw_switchtec.c iowrite64(~sndev->db_mask, &sndev->mmio_self_dbmsg->idb_mask); sndev 655 drivers/ntb/hw/mscc/ntb_hw_switchtec.c spin_unlock_irqrestore(&sndev->db_mask_lock, irqflags); sndev 663 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = ntb_sndev(ntb); sndev 665 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (db_bits & ~sndev->db_valid_mask) sndev 668 drivers/ntb/hw/mscc/ntb_hw_switchtec.c spin_lock_irqsave(&sndev->db_mask_lock, irqflags); sndev 670 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->db_mask &= ~(db_bits << sndev->db_shift); sndev 671 drivers/ntb/hw/mscc/ntb_hw_switchtec.c iowrite64(~sndev->db_mask, &sndev->mmio_self_dbmsg->idb_mask); sndev 673 drivers/ntb/hw/mscc/ntb_hw_switchtec.c spin_unlock_irqrestore(&sndev->db_mask_lock, irqflags); sndev 680 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = ntb_sndev(ntb); sndev 682 drivers/ntb/hw/mscc/ntb_hw_switchtec.c return (sndev->db_mask >> sndev->db_shift) & sndev->db_valid_mask; sndev 691 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = ntb_sndev(ntb); sndev 697 drivers/ntb/hw/mscc/ntb_hw_switchtec.c offset = (unsigned long)sndev->mmio_peer_dbmsg->odb - sndev 698 drivers/ntb/hw/mscc/ntb_hw_switchtec.c (unsigned long)sndev->stdev->mmio; sndev 700 drivers/ntb/hw/mscc/ntb_hw_switchtec.c offset += sndev->db_shift / 8; sndev 707 drivers/ntb/hw/mscc/ntb_hw_switchtec.c *db_data = BIT_ULL(db_bit) << sndev->db_peer_shift; sndev 714 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = ntb_sndev(ntb); sndev 716 drivers/ntb/hw/mscc/ntb_hw_switchtec.c iowrite64(db_bits << sndev->db_peer_shift, sndev 717 drivers/ntb/hw/mscc/ntb_hw_switchtec.c &sndev->mmio_peer_dbmsg->odb); sndev 724 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = ntb_sndev(ntb); sndev 726 drivers/ntb/hw/mscc/ntb_hw_switchtec.c return ARRAY_SIZE(sndev->self_shared->spad); sndev 731 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = ntb_sndev(ntb); sndev 733 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (idx < 0 || idx >= ARRAY_SIZE(sndev->self_shared->spad)) sndev 736 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (!sndev->self_shared) sndev 739 drivers/ntb/hw/mscc/ntb_hw_switchtec.c return sndev->self_shared->spad[idx]; sndev 744 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = ntb_sndev(ntb); sndev 746 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (idx < 0 || idx >= ARRAY_SIZE(sndev->self_shared->spad)) sndev 749 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (!sndev->self_shared) sndev 752 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->self_shared->spad[idx] = val; sndev 760 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = ntb_sndev(ntb); sndev 765 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (sidx < 0 || sidx >= ARRAY_SIZE(sndev->peer_shared->spad)) sndev 768 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (!sndev->peer_shared) sndev 771 drivers/ntb/hw/mscc/ntb_hw_switchtec.c return ioread32(&sndev->peer_shared->spad[sidx]); sndev 777 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = ntb_sndev(ntb); sndev 782 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (sidx < 0 || sidx >= ARRAY_SIZE(sndev->peer_shared->spad)) sndev 785 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (!sndev->peer_shared) sndev 788 drivers/ntb/hw/mscc/ntb_hw_switchtec.c iowrite32(val, &sndev->peer_shared->spad[sidx]); sndev 796 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = ntb_sndev(ntb); sndev 802 drivers/ntb/hw/mscc/ntb_hw_switchtec.c offset = (unsigned long)&sndev->peer_shared->spad[sidx] - sndev 803 drivers/ntb/hw/mscc/ntb_hw_switchtec.c (unsigned long)sndev->stdev->mmio; sndev 838 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static int switchtec_ntb_init_sndev(struct switchtec_ntb *sndev) sndev 845 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->ntb.pdev = sndev->stdev->pdev; sndev 846 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->ntb.topo = NTB_TOPO_SWITCH; sndev 847 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->ntb.ops = &switchtec_ntb_ops; sndev 849 drivers/ntb/hw/mscc/ntb_hw_switchtec.c INIT_WORK(&sndev->check_link_status_work, check_link_status_work); sndev 850 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->link_force_down = false; sndev 852 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->self_partition = sndev->stdev->partition; sndev 854 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->mmio_ntb = sndev->stdev->mmio_ntb; sndev 856 drivers/ntb/hw/mscc/ntb_hw_switchtec.c self = sndev->self_partition; sndev 857 drivers/ntb/hw/mscc/ntb_hw_switchtec.c tpart_vec = ioread32(&sndev->mmio_ntb->ntp_info[self].target_part_high); sndev 859 drivers/ntb/hw/mscc/ntb_hw_switchtec.c tpart_vec |= ioread32(&sndev->mmio_ntb->ntp_info[self].target_part_low); sndev 861 drivers/ntb/hw/mscc/ntb_hw_switchtec.c part_map = ioread64(&sndev->mmio_ntb->ep_map); sndev 862 drivers/ntb/hw/mscc/ntb_hw_switchtec.c part_map &= ~(1 << sndev->self_partition); sndev 865 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (sndev->stdev->partition_count != 2) { sndev 866 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_err(&sndev->stdev->dev, sndev 873 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_err(&sndev->stdev->dev, sndev 878 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->peer_partition = bit - 1; sndev 881 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_err(&sndev->stdev->dev, sndev 886 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->peer_partition = ffs(tpart_vec) - 1; sndev 887 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (!(part_map & (1ULL << sndev->peer_partition))) { sndev 888 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_err(&sndev->stdev->dev, sndev 894 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_dbg(&sndev->stdev->dev, "Partition ID %d of %d\n", sndev 895 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->self_partition, sndev->stdev->partition_count); sndev 897 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->mmio_ctrl = (void * __iomem)sndev->mmio_ntb + sndev 899 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->mmio_dbmsg = (void * __iomem)sndev->mmio_ntb + sndev 902 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->mmio_self_ctrl = &sndev->mmio_ctrl[sndev->self_partition]; sndev 903 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->mmio_peer_ctrl = &sndev->mmio_ctrl[sndev->peer_partition]; sndev 904 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->mmio_self_dbmsg = &sndev->mmio_dbmsg[sndev->self_partition]; sndev 905 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->mmio_peer_dbmsg = sndev->mmio_self_dbmsg; sndev 910 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static int config_rsvd_lut_win(struct switchtec_ntb *sndev, sndev 914 drivers/ntb/hw/mscc/ntb_hw_switchtec.c int peer_bar = sndev->peer_direct_mw_to_bar[0]; sndev 918 drivers/ntb/hw/mscc/ntb_hw_switchtec.c rc = switchtec_ntb_part_op(sndev, ctl, NTB_CTRL_PART_OP_LOCK, sndev 927 drivers/ntb/hw/mscc/ntb_hw_switchtec.c ctl_val |= (sndev->nr_lut_mw - 1) << 14; sndev 933 drivers/ntb/hw/mscc/ntb_hw_switchtec.c rc = switchtec_ntb_part_op(sndev, ctl, NTB_CTRL_PART_OP_CFG, sndev 940 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_err(&sndev->stdev->dev, sndev 949 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static int config_req_id_table(struct switchtec_ntb *sndev, sndev 958 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_err(&sndev->stdev->dev, sndev 963 drivers/ntb/hw/mscc/ntb_hw_switchtec.c rc = switchtec_ntb_part_op(sndev, mmio_ctrl, sndev 977 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_dbg(&sndev->stdev->dev, sndev 984 drivers/ntb/hw/mscc/ntb_hw_switchtec.c rc = switchtec_ntb_part_op(sndev, mmio_ctrl, sndev 990 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_err(&sndev->stdev->dev, sndev 998 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static int crosslink_setup_mws(struct switchtec_ntb *sndev, int ntb_lut_idx, sndev 1002 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct ntb_ctrl_regs __iomem *ctl = sndev->mmio_self_ctrl; sndev 1009 drivers/ntb/hw/mscc/ntb_hw_switchtec.c rc = switchtec_ntb_part_op(sndev, ctl, NTB_CTRL_PART_OP_LOCK, sndev 1014 drivers/ntb/hw/mscc/ntb_hw_switchtec.c for (i = 0; i < sndev->nr_lut_mw; i++) { sndev 1020 drivers/ntb/hw/mscc/ntb_hw_switchtec.c iowrite64((NTB_CTRL_LUT_EN | (sndev->peer_partition << 1) | sndev 1025 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->nr_direct_mw = min_t(int, sndev->nr_direct_mw, mw_count); sndev 1027 drivers/ntb/hw/mscc/ntb_hw_switchtec.c for (i = 0; i < sndev->nr_direct_mw; i++) { sndev 1028 drivers/ntb/hw/mscc/ntb_hw_switchtec.c bar = sndev->direct_mw_to_bar[i]; sndev 1029 drivers/ntb/hw/mscc/ntb_hw_switchtec.c offset = (i == 0) ? LUT_SIZE * sndev->nr_lut_mw : 0; sndev 1031 drivers/ntb/hw/mscc/ntb_hw_switchtec.c size = pci_resource_len(sndev->ntb.pdev, bar) - offset; sndev 1044 drivers/ntb/hw/mscc/ntb_hw_switchtec.c iowrite64(sndev->peer_partition | addr, sndev 1048 drivers/ntb/hw/mscc/ntb_hw_switchtec.c rc = switchtec_ntb_part_op(sndev, ctl, NTB_CTRL_PART_OP_CFG, sndev 1055 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_err(&sndev->stdev->dev, sndev 1064 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static int crosslink_setup_req_ids(struct switchtec_ntb *sndev, sndev 1072 drivers/ntb/hw/mscc/ntb_hw_switchtec.c proxy_id = ioread32(&sndev->mmio_self_ctrl->req_id_table[i]); sndev 1080 drivers/ntb/hw/mscc/ntb_hw_switchtec.c return config_req_id_table(sndev, mmio_ctrl, req_ids, i); sndev 1088 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static int crosslink_enum_partition(struct switchtec_ntb *sndev, sndev 1092 drivers/ntb/hw/mscc/ntb_hw_switchtec.c &sndev->stdev->mmio_part_cfg_all[sndev->peer_partition]; sndev 1095 drivers/ntb/hw/mscc/ntb_hw_switchtec.c &sndev->stdev->mmio_pff_csr[pff]; sndev 1108 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_dbg(&sndev->stdev->dev, sndev 1121 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static int switchtec_ntb_init_crosslink(struct switchtec_ntb *sndev) sndev 1124 drivers/ntb/hw/mscc/ntb_hw_switchtec.c int bar = sndev->direct_mw_to_bar[0]; sndev 1131 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (!crosslink_is_enabled(sndev)) sndev 1134 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_info(&sndev->stdev->dev, "Using crosslink configuration\n"); sndev 1135 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->ntb.topo = NTB_TOPO_CROSSLINK; sndev 1137 drivers/ntb/hw/mscc/ntb_hw_switchtec.c bar_cnt = crosslink_enum_partition(sndev, bar_addrs); sndev 1138 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (bar_cnt < sndev->nr_direct_mw + 1) { sndev 1139 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_err(&sndev->stdev->dev, sndev 1146 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sizeof(struct ntb_dbmsg_regs) * sndev->peer_partition); sndev 1151 drivers/ntb/hw/mscc/ntb_hw_switchtec.c rc = config_rsvd_lut_win(sndev, sndev->mmio_self_ctrl, ntb_lut_idx, sndev 1152 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->peer_partition, addr); sndev 1156 drivers/ntb/hw/mscc/ntb_hw_switchtec.c rc = crosslink_setup_mws(sndev, ntb_lut_idx, &bar_addrs[1], sndev 1161 drivers/ntb/hw/mscc/ntb_hw_switchtec.c rc = crosslink_setup_req_ids(sndev, sndev->mmio_peer_ctrl); sndev 1165 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->mmio_xlink_win = pci_iomap_range(sndev->stdev->pdev, bar, sndev 1167 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (!sndev->mmio_xlink_win) { sndev 1172 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->mmio_peer_dbmsg = sndev->mmio_xlink_win + offset; sndev 1173 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->nr_rsvd_luts++; sndev 1175 drivers/ntb/hw/mscc/ntb_hw_switchtec.c crosslink_init_dbmsgs(sndev); sndev 1180 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static void switchtec_ntb_deinit_crosslink(struct switchtec_ntb *sndev) sndev 1182 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (sndev->mmio_xlink_win) sndev 1183 drivers/ntb/hw/mscc/ntb_hw_switchtec.c pci_iounmap(sndev->stdev->pdev, sndev->mmio_xlink_win); sndev 1201 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static void switchtec_ntb_init_mw(struct switchtec_ntb *sndev) sndev 1203 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->nr_direct_mw = map_bars(sndev->direct_mw_to_bar, sndev 1204 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->mmio_self_ctrl); sndev 1206 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->nr_lut_mw = ioread16(&sndev->mmio_self_ctrl->lut_table_entries); sndev 1207 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->nr_lut_mw = rounddown_pow_of_two(sndev->nr_lut_mw); sndev 1209 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_dbg(&sndev->stdev->dev, "MWs: %d direct, %d lut\n", sndev 1210 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->nr_direct_mw, sndev->nr_lut_mw); sndev 1212 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->peer_nr_direct_mw = map_bars(sndev->peer_direct_mw_to_bar, sndev 1213 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->mmio_peer_ctrl); sndev 1215 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->peer_nr_lut_mw = sndev 1216 drivers/ntb/hw/mscc/ntb_hw_switchtec.c ioread16(&sndev->mmio_peer_ctrl->lut_table_entries); sndev 1217 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->peer_nr_lut_mw = rounddown_pow_of_two(sndev->peer_nr_lut_mw); sndev 1219 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_dbg(&sndev->stdev->dev, "Peer MWs: %d direct, %d lut\n", sndev 1220 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->peer_nr_direct_mw, sndev->peer_nr_lut_mw); sndev 1234 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static void switchtec_ntb_init_db(struct switchtec_ntb *sndev) sndev 1236 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->db_mask = 0x0FFFFFFFFFFFFFFFULL; sndev 1238 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (sndev->mmio_peer_dbmsg != sndev->mmio_self_dbmsg) { sndev 1239 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->db_shift = 0; sndev 1240 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->db_peer_shift = 0; sndev 1241 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->db_valid_mask = sndev->db_mask; sndev 1242 drivers/ntb/hw/mscc/ntb_hw_switchtec.c } else if (sndev->self_partition < sndev->peer_partition) { sndev 1243 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->db_shift = 0; sndev 1244 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->db_peer_shift = 32; sndev 1245 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->db_valid_mask = 0x0FFFFFFF; sndev 1247 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->db_shift = 32; sndev 1248 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->db_peer_shift = 0; sndev 1249 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->db_valid_mask = 0x0FFFFFFF; sndev 1252 drivers/ntb/hw/mscc/ntb_hw_switchtec.c iowrite64(~sndev->db_mask, &sndev->mmio_self_dbmsg->idb_mask); sndev 1253 drivers/ntb/hw/mscc/ntb_hw_switchtec.c iowrite64(sndev->db_valid_mask << sndev->db_peer_shift, sndev 1254 drivers/ntb/hw/mscc/ntb_hw_switchtec.c &sndev->mmio_peer_dbmsg->odb_mask); sndev 1256 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_dbg(&sndev->stdev->dev, "dbs: shift %d/%d, mask %016llx\n", sndev 1257 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->db_shift, sndev->db_peer_shift, sndev->db_valid_mask); sndev 1260 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static void switchtec_ntb_init_msgs(struct switchtec_ntb *sndev) sndev 1265 drivers/ntb/hw/mscc/ntb_hw_switchtec.c for (i = 0; i < ARRAY_SIZE(sndev->mmio_self_dbmsg->imsg); i++) { sndev 1266 drivers/ntb/hw/mscc/ntb_hw_switchtec.c int m = i | sndev->peer_partition << 2; sndev 1271 drivers/ntb/hw/mscc/ntb_hw_switchtec.c iowrite32(msg_map, &sndev->mmio_self_dbmsg->msg_map); sndev 1273 drivers/ntb/hw/mscc/ntb_hw_switchtec.c for (i = 0; i < ARRAY_SIZE(sndev->mmio_self_dbmsg->imsg); i++) sndev 1275 drivers/ntb/hw/mscc/ntb_hw_switchtec.c &sndev->mmio_self_dbmsg->imsg[i]); sndev 1279 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_init_req_id_table(struct switchtec_ntb *sndev) sndev 1291 drivers/ntb/hw/mscc/ntb_hw_switchtec.c req_ids[1] = ioread16(&sndev->mmio_ntb->requester_id); sndev 1293 drivers/ntb/hw/mscc/ntb_hw_switchtec.c return config_req_id_table(sndev, sndev->mmio_self_ctrl, req_ids, sndev 1297 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static void switchtec_ntb_init_shared(struct switchtec_ntb *sndev) sndev 1301 drivers/ntb/hw/mscc/ntb_hw_switchtec.c memset(sndev->self_shared, 0, LUT_SIZE); sndev 1302 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->self_shared->magic = SWITCHTEC_NTB_MAGIC; sndev 1303 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->self_shared->partition_id = sndev->stdev->partition; sndev 1305 drivers/ntb/hw/mscc/ntb_hw_switchtec.c for (i = 0; i < sndev->nr_direct_mw; i++) { sndev 1306 drivers/ntb/hw/mscc/ntb_hw_switchtec.c int bar = sndev->direct_mw_to_bar[i]; sndev 1307 drivers/ntb/hw/mscc/ntb_hw_switchtec.c resource_size_t sz = pci_resource_len(sndev->stdev->pdev, bar); sndev 1311 drivers/ntb/hw/mscc/ntb_hw_switchtec.c LUT_SIZE * sndev->nr_lut_mw); sndev 1313 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->self_shared->mw_sizes[i] = sz; sndev 1316 drivers/ntb/hw/mscc/ntb_hw_switchtec.c for (i = 0; i < sndev->nr_lut_mw; i++) { sndev 1317 drivers/ntb/hw/mscc/ntb_hw_switchtec.c int idx = sndev->nr_direct_mw + i; sndev 1319 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->self_shared->mw_sizes[idx] = LUT_SIZE; sndev 1323 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static int switchtec_ntb_init_shared_mw(struct switchtec_ntb *sndev) sndev 1325 drivers/ntb/hw/mscc/ntb_hw_switchtec.c int self_bar = sndev->direct_mw_to_bar[0]; sndev 1328 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->nr_rsvd_luts++; sndev 1329 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->self_shared = dma_alloc_coherent(&sndev->stdev->pdev->dev, sndev 1331 drivers/ntb/hw/mscc/ntb_hw_switchtec.c &sndev->self_shared_dma, sndev 1333 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (!sndev->self_shared) { sndev 1334 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_err(&sndev->stdev->dev, sndev 1339 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_init_shared(sndev); sndev 1341 drivers/ntb/hw/mscc/ntb_hw_switchtec.c rc = config_rsvd_lut_win(sndev, sndev->mmio_peer_ctrl, 0, sndev 1342 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->self_partition, sndev 1343 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->self_shared_dma); sndev 1347 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->peer_shared = pci_iomap(sndev->stdev->pdev, self_bar, LUT_SIZE); sndev 1348 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (!sndev->peer_shared) { sndev 1353 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_dbg(&sndev->stdev->dev, "Shared MW Ready\n"); sndev 1357 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dma_free_coherent(&sndev->stdev->pdev->dev, LUT_SIZE, sndev 1358 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->self_shared, sndev->self_shared_dma); sndev 1363 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static void switchtec_ntb_deinit_shared_mw(struct switchtec_ntb *sndev) sndev 1365 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (sndev->peer_shared) sndev 1366 drivers/ntb/hw/mscc/ntb_hw_switchtec.c pci_iounmap(sndev->stdev->pdev, sndev->peer_shared); sndev 1368 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (sndev->self_shared) sndev 1369 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dma_free_coherent(&sndev->stdev->pdev->dev, LUT_SIZE, sndev 1370 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->self_shared, sndev 1371 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->self_shared_dma); sndev 1372 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->nr_rsvd_luts--; sndev 1377 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = dev; sndev 1379 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_dbg(&sndev->stdev->dev, "doorbell\n"); sndev 1381 drivers/ntb/hw/mscc/ntb_hw_switchtec.c ntb_db_event(&sndev->ntb, 0); sndev 1389 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = dev; sndev 1391 drivers/ntb/hw/mscc/ntb_hw_switchtec.c for (i = 0; i < ARRAY_SIZE(sndev->mmio_self_dbmsg->imsg); i++) { sndev 1392 drivers/ntb/hw/mscc/ntb_hw_switchtec.c u64 msg = ioread64(&sndev->mmio_self_dbmsg->imsg[i]); sndev 1395 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_dbg(&sndev->stdev->dev, "message: %d %08x\n", sndev 1397 drivers/ntb/hw/mscc/ntb_hw_switchtec.c iowrite8(1, &sndev->mmio_self_dbmsg->imsg[i].status); sndev 1400 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_check_link(sndev, msg); sndev 1407 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static int switchtec_ntb_init_db_msg_irq(struct switchtec_ntb *sndev) sndev 1414 drivers/ntb/hw/mscc/ntb_hw_switchtec.c int idb_vecs = sizeof(sndev->mmio_self_dbmsg->idb_vec_map); sndev 1416 drivers/ntb/hw/mscc/ntb_hw_switchtec.c event_irq = ioread32(&sndev->stdev->mmio_part_cfg->vep_vector_number); sndev 1424 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_dbg(&sndev->stdev->dev, "irqs - event: %d, db: %d, msgs: %d\n", sndev 1429 drivers/ntb/hw/mscc/ntb_hw_switchtec.c &sndev->mmio_self_dbmsg->idb_vec_map[i]); sndev 1433 drivers/ntb/hw/mscc/ntb_hw_switchtec.c &sndev->mmio_self_dbmsg->idb_vec_map[i]); sndev 1435 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->doorbell_irq = pci_irq_vector(sndev->stdev->pdev, doorbell_irq); sndev 1436 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->message_irq = pci_irq_vector(sndev->stdev->pdev, message_irq); sndev 1438 drivers/ntb/hw/mscc/ntb_hw_switchtec.c rc = request_irq(sndev->doorbell_irq, sndev 1440 drivers/ntb/hw/mscc/ntb_hw_switchtec.c "switchtec_ntb_doorbell", sndev); sndev 1444 drivers/ntb/hw/mscc/ntb_hw_switchtec.c rc = request_irq(sndev->message_irq, sndev 1446 drivers/ntb/hw/mscc/ntb_hw_switchtec.c "switchtec_ntb_message", sndev); sndev 1448 drivers/ntb/hw/mscc/ntb_hw_switchtec.c free_irq(sndev->doorbell_irq, sndev); sndev 1455 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static void switchtec_ntb_deinit_db_msg_irq(struct switchtec_ntb *sndev) sndev 1457 drivers/ntb/hw/mscc/ntb_hw_switchtec.c free_irq(sndev->doorbell_irq, sndev); sndev 1458 drivers/ntb/hw/mscc/ntb_hw_switchtec.c free_irq(sndev->message_irq, sndev); sndev 1461 drivers/ntb/hw/mscc/ntb_hw_switchtec.c static int switchtec_ntb_reinit_peer(struct switchtec_ntb *sndev) sndev 1465 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (crosslink_is_enabled(sndev)) sndev 1468 drivers/ntb/hw/mscc/ntb_hw_switchtec.c dev_info(&sndev->stdev->dev, "reinitialize shared memory window\n"); sndev 1469 drivers/ntb/hw/mscc/ntb_hw_switchtec.c rc = config_rsvd_lut_win(sndev, sndev->mmio_peer_ctrl, 0, sndev 1470 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->self_partition, sndev 1471 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->self_shared_dma); sndev 1479 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev; sndev 1482 drivers/ntb/hw/mscc/ntb_hw_switchtec.c stdev->sndev = NULL; sndev 1487 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev = kzalloc_node(sizeof(*sndev), GFP_KERNEL, dev_to_node(dev)); sndev 1488 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (!sndev) sndev 1491 drivers/ntb/hw/mscc/ntb_hw_switchtec.c sndev->stdev = stdev; sndev 1492 drivers/ntb/hw/mscc/ntb_hw_switchtec.c rc = switchtec_ntb_init_sndev(sndev); sndev 1496 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_init_mw(sndev); sndev 1498 drivers/ntb/hw/mscc/ntb_hw_switchtec.c rc = switchtec_ntb_init_req_id_table(sndev); sndev 1502 drivers/ntb/hw/mscc/ntb_hw_switchtec.c rc = switchtec_ntb_init_crosslink(sndev); sndev 1506 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_init_db(sndev); sndev 1507 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_init_msgs(sndev); sndev 1509 drivers/ntb/hw/mscc/ntb_hw_switchtec.c rc = switchtec_ntb_init_shared_mw(sndev); sndev 1513 drivers/ntb/hw/mscc/ntb_hw_switchtec.c rc = switchtec_ntb_init_db_msg_irq(sndev); sndev 1522 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_send_msg(sndev, LINK_MESSAGE, MSG_LINK_FORCE_DOWN); sndev 1524 drivers/ntb/hw/mscc/ntb_hw_switchtec.c rc = ntb_register_device(&sndev->ntb); sndev 1528 drivers/ntb/hw/mscc/ntb_hw_switchtec.c stdev->sndev = sndev; sndev 1535 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_deinit_db_msg_irq(sndev); sndev 1537 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_deinit_shared_mw(sndev); sndev 1539 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_deinit_crosslink(sndev); sndev 1541 drivers/ntb/hw/mscc/ntb_hw_switchtec.c kfree(sndev); sndev 1550 drivers/ntb/hw/mscc/ntb_hw_switchtec.c struct switchtec_ntb *sndev = stdev->sndev; sndev 1552 drivers/ntb/hw/mscc/ntb_hw_switchtec.c if (!sndev) sndev 1556 drivers/ntb/hw/mscc/ntb_hw_switchtec.c stdev->sndev = NULL; sndev 1557 drivers/ntb/hw/mscc/ntb_hw_switchtec.c ntb_unregister_device(&sndev->ntb); sndev 1558 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_deinit_db_msg_irq(sndev); sndev 1559 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_deinit_shared_mw(sndev); sndev 1560 drivers/ntb/hw/mscc/ntb_hw_switchtec.c switchtec_ntb_deinit_crosslink(sndev); sndev 1561 drivers/ntb/hw/mscc/ntb_hw_switchtec.c kfree(sndev); sndev 391 include/linux/switchtec.h struct switchtec_ntb *sndev;