Lines Matching refs:mbox

623 	int mbox;  in tsi721_omsg_msix()  local
625 mbox = (irq - priv->msix[TSI721_VECT_OMB0_DONE].vector) % RIO_MAX_MBOX; in tsi721_omsg_msix()
626 tsi721_omsg_handler(priv, mbox); in tsi721_omsg_msix()
640 int mbox; in tsi721_imsg_msix() local
642 mbox = (irq - priv->msix[TSI721_VECT_IMB0_RCV].vector) % RIO_MAX_MBOX; in tsi721_imsg_msix()
643 tsi721_imsg_handler(priv, mbox + 4); in tsi721_imsg_msix()
1301 tsi721_add_outb_message(struct rio_mport *mport, struct rio_dev *rdev, int mbox, in tsi721_add_outb_message() argument
1308 if (!priv->omsg_init[mbox] || in tsi721_add_outb_message()
1312 tx_slot = priv->omsg_ring[mbox].tx_slot; in tsi721_add_outb_message()
1315 memcpy(priv->omsg_ring[mbox].omq_base[tx_slot], buffer, len); in tsi721_add_outb_message()
1321 desc = priv->omsg_ring[mbox].omd_base; in tsi721_add_outb_message()
1327 cpu_to_le32((mport->sys_size << 26) | (mbox << 22) | in tsi721_add_outb_message()
1330 cpu_to_le32((u64)priv->omsg_ring[mbox].omq_phys[tx_slot] & in tsi721_add_outb_message()
1333 cpu_to_le32((u64)priv->omsg_ring[mbox].omq_phys[tx_slot] >> 32); in tsi721_add_outb_message()
1335 priv->omsg_ring[mbox].wr_count++; in tsi721_add_outb_message()
1338 if (++priv->omsg_ring[mbox].tx_slot == priv->omsg_ring[mbox].size) { in tsi721_add_outb_message()
1339 priv->omsg_ring[mbox].tx_slot = 0; in tsi721_add_outb_message()
1341 priv->omsg_ring[mbox].wr_count++; in tsi721_add_outb_message()
1347 iowrite32(priv->omsg_ring[mbox].wr_count, in tsi721_add_outb_message()
1348 priv->regs + TSI721_OBDMAC_DWRCNT(mbox)); in tsi721_add_outb_message()
1349 ioread32(priv->regs + TSI721_OBDMAC_DWRCNT(mbox)); in tsi721_add_outb_message()
1490 int mbox, int entries) in tsi721_open_outb_mbox() argument
1498 (!is_power_of_2(entries)) || mbox >= RIO_MAX_MBOX) { in tsi721_open_outb_mbox()
1503 priv->omsg_ring[mbox].dev_id = dev_id; in tsi721_open_outb_mbox()
1504 priv->omsg_ring[mbox].size = entries; in tsi721_open_outb_mbox()
1505 priv->omsg_ring[mbox].sts_rdptr = 0; in tsi721_open_outb_mbox()
1506 spin_lock_init(&priv->omsg_ring[mbox].lock); in tsi721_open_outb_mbox()
1511 priv->omsg_ring[mbox].omq_base[i] = in tsi721_open_outb_mbox()
1514 &priv->omsg_ring[mbox].omq_phys[i], in tsi721_open_outb_mbox()
1516 if (priv->omsg_ring[mbox].omq_base[i] == NULL) { in tsi721_open_outb_mbox()
1519 " MBOX%d\n", mbox); in tsi721_open_outb_mbox()
1526 priv->omsg_ring[mbox].omd_base = dma_alloc_coherent( in tsi721_open_outb_mbox()
1529 &priv->omsg_ring[mbox].omd_phys, GFP_KERNEL); in tsi721_open_outb_mbox()
1530 if (priv->omsg_ring[mbox].omd_base == NULL) { in tsi721_open_outb_mbox()
1533 "for MBOX%d\n", mbox); in tsi721_open_outb_mbox()
1538 priv->omsg_ring[mbox].tx_slot = 0; in tsi721_open_outb_mbox()
1541 priv->omsg_ring[mbox].sts_size = roundup_pow_of_two(entries + 1); in tsi721_open_outb_mbox()
1542 priv->omsg_ring[mbox].sts_base = dma_zalloc_coherent(&priv->pdev->dev, in tsi721_open_outb_mbox()
1543 priv->omsg_ring[mbox].sts_size * in tsi721_open_outb_mbox()
1545 &priv->omsg_ring[mbox].sts_phys, GFP_KERNEL); in tsi721_open_outb_mbox()
1546 if (priv->omsg_ring[mbox].sts_base == NULL) { in tsi721_open_outb_mbox()
1549 "for MBOX%d\n", mbox); in tsi721_open_outb_mbox()
1559 iowrite32(((u64)priv->omsg_ring[mbox].omd_phys >> 32), in tsi721_open_outb_mbox()
1560 priv->regs + TSI721_OBDMAC_DPTRH(mbox)); in tsi721_open_outb_mbox()
1561 iowrite32(((u64)priv->omsg_ring[mbox].omd_phys & in tsi721_open_outb_mbox()
1563 priv->regs + TSI721_OBDMAC_DPTRL(mbox)); in tsi721_open_outb_mbox()
1566 iowrite32(((u64)priv->omsg_ring[mbox].sts_phys >> 32), in tsi721_open_outb_mbox()
1567 priv->regs + TSI721_OBDMAC_DSBH(mbox)); in tsi721_open_outb_mbox()
1568 iowrite32(((u64)priv->omsg_ring[mbox].sts_phys & in tsi721_open_outb_mbox()
1570 priv->regs + TSI721_OBDMAC_DSBL(mbox)); in tsi721_open_outb_mbox()
1571 iowrite32(TSI721_DMAC_DSSZ_SIZE(priv->omsg_ring[mbox].sts_size), in tsi721_open_outb_mbox()
1572 priv->regs + (u32)TSI721_OBDMAC_DSSZ(mbox)); in tsi721_open_outb_mbox()
1580 priv->msix[TSI721_VECT_OMB0_DONE + mbox].vector, in tsi721_open_outb_mbox()
1582 priv->msix[TSI721_VECT_OMB0_DONE + mbox].irq_name, in tsi721_open_outb_mbox()
1588 "OBOX%d-DONE\n", mbox); in tsi721_open_outb_mbox()
1592 rc = request_irq(priv->msix[TSI721_VECT_OMB0_INT + mbox].vector, in tsi721_open_outb_mbox()
1594 priv->msix[TSI721_VECT_OMB0_INT + mbox].irq_name, in tsi721_open_outb_mbox()
1600 "MBOX%d-INT\n", mbox); in tsi721_open_outb_mbox()
1602 priv->msix[TSI721_VECT_OMB0_DONE + mbox].vector, in tsi721_open_outb_mbox()
1609 tsi721_omsg_interrupt_enable(priv, mbox, TSI721_OBDMAC_INT_ALL); in tsi721_open_outb_mbox()
1612 bd_ptr = priv->omsg_ring[mbox].omd_base; in tsi721_open_outb_mbox()
1616 cpu_to_le32((u64)priv->omsg_ring[mbox].omd_phys & in tsi721_open_outb_mbox()
1619 cpu_to_le32((u64)priv->omsg_ring[mbox].omd_phys >> 32); in tsi721_open_outb_mbox()
1620 priv->omsg_ring[mbox].wr_count = 0; in tsi721_open_outb_mbox()
1624 iowrite32(TSI721_OBDMAC_CTL_INIT, priv->regs + TSI721_OBDMAC_CTL(mbox)); in tsi721_open_outb_mbox()
1625 ioread32(priv->regs + TSI721_OBDMAC_DWRCNT(mbox)); in tsi721_open_outb_mbox()
1628 priv->omsg_init[mbox] = 1; in tsi721_open_outb_mbox()
1635 priv->omsg_ring[mbox].sts_size * sizeof(struct tsi721_dma_sts), in tsi721_open_outb_mbox()
1636 priv->omsg_ring[mbox].sts_base, in tsi721_open_outb_mbox()
1637 priv->omsg_ring[mbox].sts_phys); in tsi721_open_outb_mbox()
1639 priv->omsg_ring[mbox].sts_base = NULL; in tsi721_open_outb_mbox()
1645 priv->omsg_ring[mbox].omd_base, in tsi721_open_outb_mbox()
1646 priv->omsg_ring[mbox].omd_phys); in tsi721_open_outb_mbox()
1648 priv->omsg_ring[mbox].omd_base = NULL; in tsi721_open_outb_mbox()
1651 for (i = 0; i < priv->omsg_ring[mbox].size; i++) { in tsi721_open_outb_mbox()
1652 if (priv->omsg_ring[mbox].omq_base[i]) { in tsi721_open_outb_mbox()
1655 priv->omsg_ring[mbox].omq_base[i], in tsi721_open_outb_mbox()
1656 priv->omsg_ring[mbox].omq_phys[i]); in tsi721_open_outb_mbox()
1658 priv->omsg_ring[mbox].omq_base[i] = NULL; in tsi721_open_outb_mbox()
1671 static void tsi721_close_outb_mbox(struct rio_mport *mport, int mbox) in tsi721_close_outb_mbox() argument
1676 if (!priv->omsg_init[mbox]) in tsi721_close_outb_mbox()
1678 priv->omsg_init[mbox] = 0; in tsi721_close_outb_mbox()
1682 tsi721_omsg_interrupt_disable(priv, mbox, TSI721_OBDMAC_INT_ALL); in tsi721_close_outb_mbox()
1686 free_irq(priv->msix[TSI721_VECT_OMB0_DONE + mbox].vector, in tsi721_close_outb_mbox()
1688 free_irq(priv->msix[TSI721_VECT_OMB0_INT + mbox].vector, in tsi721_close_outb_mbox()
1695 priv->omsg_ring[mbox].sts_size * sizeof(struct tsi721_dma_sts), in tsi721_close_outb_mbox()
1696 priv->omsg_ring[mbox].sts_base, in tsi721_close_outb_mbox()
1697 priv->omsg_ring[mbox].sts_phys); in tsi721_close_outb_mbox()
1699 priv->omsg_ring[mbox].sts_base = NULL; in tsi721_close_outb_mbox()
1703 (priv->omsg_ring[mbox].size + 1) * in tsi721_close_outb_mbox()
1705 priv->omsg_ring[mbox].omd_base, in tsi721_close_outb_mbox()
1706 priv->omsg_ring[mbox].omd_phys); in tsi721_close_outb_mbox()
1708 priv->omsg_ring[mbox].omd_base = NULL; in tsi721_close_outb_mbox()
1711 for (i = 0; i < priv->omsg_ring[mbox].size; i++) { in tsi721_close_outb_mbox()
1712 if (priv->omsg_ring[mbox].omq_base[i]) { in tsi721_close_outb_mbox()
1715 priv->omsg_ring[mbox].omq_base[i], in tsi721_close_outb_mbox()
1716 priv->omsg_ring[mbox].omq_phys[i]); in tsi721_close_outb_mbox()
1718 priv->omsg_ring[mbox].omq_base[i] = NULL; in tsi721_close_outb_mbox()
1732 u32 mbox = ch - 4; in tsi721_imsg_handler() local
1735 spin_lock(&priv->imsg_ring[mbox].lock); in tsi721_imsg_handler()
1741 mbox); in tsi721_imsg_handler()
1745 mbox); in tsi721_imsg_handler()
1749 "IB MBOX%d IB free queue low\n", mbox); in tsi721_imsg_handler()
1756 priv->mport->inb_msg[mbox].mcback) in tsi721_imsg_handler()
1757 priv->mport->inb_msg[mbox].mcback(priv->mport, in tsi721_imsg_handler()
1758 priv->imsg_ring[mbox].dev_id, mbox, -1); in tsi721_imsg_handler()
1769 spin_unlock(&priv->imsg_ring[mbox].lock); in tsi721_imsg_handler()
1780 int mbox, int entries) in tsi721_open_inb_mbox() argument
1783 int ch = mbox + 4; in tsi721_open_inb_mbox()
1790 (!is_power_of_2(entries)) || mbox >= RIO_MAX_MBOX) { in tsi721_open_inb_mbox()
1796 priv->imsg_ring[mbox].dev_id = dev_id; in tsi721_open_inb_mbox()
1797 priv->imsg_ring[mbox].size = entries; in tsi721_open_inb_mbox()
1798 priv->imsg_ring[mbox].rx_slot = 0; in tsi721_open_inb_mbox()
1799 priv->imsg_ring[mbox].desc_rdptr = 0; in tsi721_open_inb_mbox()
1800 priv->imsg_ring[mbox].fq_wrptr = 0; in tsi721_open_inb_mbox()
1801 for (i = 0; i < priv->imsg_ring[mbox].size; i++) in tsi721_open_inb_mbox()
1802 priv->imsg_ring[mbox].imq_base[i] = NULL; in tsi721_open_inb_mbox()
1803 spin_lock_init(&priv->imsg_ring[mbox].lock); in tsi721_open_inb_mbox()
1806 priv->imsg_ring[mbox].buf_base = in tsi721_open_inb_mbox()
1809 &priv->imsg_ring[mbox].buf_phys, in tsi721_open_inb_mbox()
1812 if (priv->imsg_ring[mbox].buf_base == NULL) { in tsi721_open_inb_mbox()
1814 "Failed to allocate buffers for IB MBOX%d\n", mbox); in tsi721_open_inb_mbox()
1820 priv->imsg_ring[mbox].imfq_base = in tsi721_open_inb_mbox()
1823 &priv->imsg_ring[mbox].imfq_phys, in tsi721_open_inb_mbox()
1826 if (priv->imsg_ring[mbox].imfq_base == NULL) { in tsi721_open_inb_mbox()
1828 "Failed to allocate free queue for IB MBOX%d\n", mbox); in tsi721_open_inb_mbox()
1834 priv->imsg_ring[mbox].imd_base = in tsi721_open_inb_mbox()
1837 &priv->imsg_ring[mbox].imd_phys, GFP_KERNEL); in tsi721_open_inb_mbox()
1839 if (priv->imsg_ring[mbox].imd_base == NULL) { in tsi721_open_inb_mbox()
1842 mbox); in tsi721_open_inb_mbox()
1848 free_ptr = priv->imsg_ring[mbox].imfq_base; in tsi721_open_inb_mbox()
1851 (u64)(priv->imsg_ring[mbox].buf_phys) + in tsi721_open_inb_mbox()
1872 iowrite32(((u64)priv->imsg_ring[mbox].imfq_phys >> 32), in tsi721_open_inb_mbox()
1874 iowrite32(((u64)priv->imsg_ring[mbox].imfq_phys & in tsi721_open_inb_mbox()
1881 iowrite32(((u64)priv->imsg_ring[mbox].imd_phys >> 32), in tsi721_open_inb_mbox()
1883 iowrite32(((u32)priv->imsg_ring[mbox].imd_phys & in tsi721_open_inb_mbox()
1894 rc = request_irq(priv->msix[TSI721_VECT_IMB0_RCV + mbox].vector, in tsi721_open_inb_mbox()
1896 priv->msix[TSI721_VECT_IMB0_RCV + mbox].irq_name, in tsi721_open_inb_mbox()
1902 "IBOX%d-DONE\n", mbox); in tsi721_open_inb_mbox()
1906 rc = request_irq(priv->msix[TSI721_VECT_IMB0_INT + mbox].vector, in tsi721_open_inb_mbox()
1908 priv->msix[TSI721_VECT_IMB0_INT + mbox].irq_name, in tsi721_open_inb_mbox()
1914 "IBOX%d-INT\n", mbox); in tsi721_open_inb_mbox()
1916 priv->msix[TSI721_VECT_IMB0_RCV + mbox].vector, in tsi721_open_inb_mbox()
1929 priv->imsg_ring[mbox].fq_wrptr = entries - 1; in tsi721_open_inb_mbox()
1932 priv->imsg_init[mbox] = 1; in tsi721_open_inb_mbox()
1938 priv->imsg_ring[mbox].size * sizeof(struct tsi721_imsg_desc), in tsi721_open_inb_mbox()
1939 priv->imsg_ring[mbox].imd_base, in tsi721_open_inb_mbox()
1940 priv->imsg_ring[mbox].imd_phys); in tsi721_open_inb_mbox()
1942 priv->imsg_ring[mbox].imd_base = NULL; in tsi721_open_inb_mbox()
1947 priv->imsg_ring[mbox].size * 8, in tsi721_open_inb_mbox()
1948 priv->imsg_ring[mbox].imfq_base, in tsi721_open_inb_mbox()
1949 priv->imsg_ring[mbox].imfq_phys); in tsi721_open_inb_mbox()
1951 priv->imsg_ring[mbox].imfq_base = NULL; in tsi721_open_inb_mbox()
1955 priv->imsg_ring[mbox].size * TSI721_MSG_BUFFER_SIZE, in tsi721_open_inb_mbox()
1956 priv->imsg_ring[mbox].buf_base, in tsi721_open_inb_mbox()
1957 priv->imsg_ring[mbox].buf_phys); in tsi721_open_inb_mbox()
1959 priv->imsg_ring[mbox].buf_base = NULL; in tsi721_open_inb_mbox()
1970 static void tsi721_close_inb_mbox(struct rio_mport *mport, int mbox) in tsi721_close_inb_mbox() argument
1974 int ch = mbox + 4; in tsi721_close_inb_mbox()
1976 if (!priv->imsg_init[mbox]) /* mbox isn't initialized yet */ in tsi721_close_inb_mbox()
1978 priv->imsg_init[mbox] = 0; in tsi721_close_inb_mbox()
1987 free_irq(priv->msix[TSI721_VECT_IMB0_RCV + mbox].vector, in tsi721_close_inb_mbox()
1989 free_irq(priv->msix[TSI721_VECT_IMB0_INT + mbox].vector, in tsi721_close_inb_mbox()
1995 for (rx_slot = 0; rx_slot < priv->imsg_ring[mbox].size; rx_slot++) in tsi721_close_inb_mbox()
1996 priv->imsg_ring[mbox].imq_base[rx_slot] = NULL; in tsi721_close_inb_mbox()
2000 priv->imsg_ring[mbox].size * TSI721_MSG_BUFFER_SIZE, in tsi721_close_inb_mbox()
2001 priv->imsg_ring[mbox].buf_base, in tsi721_close_inb_mbox()
2002 priv->imsg_ring[mbox].buf_phys); in tsi721_close_inb_mbox()
2004 priv->imsg_ring[mbox].buf_base = NULL; in tsi721_close_inb_mbox()
2008 priv->imsg_ring[mbox].size * 8, in tsi721_close_inb_mbox()
2009 priv->imsg_ring[mbox].imfq_base, in tsi721_close_inb_mbox()
2010 priv->imsg_ring[mbox].imfq_phys); in tsi721_close_inb_mbox()
2012 priv->imsg_ring[mbox].imfq_base = NULL; in tsi721_close_inb_mbox()
2016 priv->imsg_ring[mbox].size * sizeof(struct tsi721_imsg_desc), in tsi721_close_inb_mbox()
2017 priv->imsg_ring[mbox].imd_base, in tsi721_close_inb_mbox()
2018 priv->imsg_ring[mbox].imd_phys); in tsi721_close_inb_mbox()
2020 priv->imsg_ring[mbox].imd_base = NULL; in tsi721_close_inb_mbox()
2029 static int tsi721_add_inb_buffer(struct rio_mport *mport, int mbox, void *buf) in tsi721_add_inb_buffer() argument
2035 rx_slot = priv->imsg_ring[mbox].rx_slot; in tsi721_add_inb_buffer()
2036 if (priv->imsg_ring[mbox].imq_base[rx_slot]) { in tsi721_add_inb_buffer()
2044 priv->imsg_ring[mbox].imq_base[rx_slot] = buf; in tsi721_add_inb_buffer()
2046 if (++priv->imsg_ring[mbox].rx_slot == priv->imsg_ring[mbox].size) in tsi721_add_inb_buffer()
2047 priv->imsg_ring[mbox].rx_slot = 0; in tsi721_add_inb_buffer()
2060 static void *tsi721_get_inb_message(struct rio_mport *mport, int mbox) in tsi721_get_inb_message() argument
2069 int ch = mbox + 4; in tsi721_get_inb_message()
2072 if (!priv->imsg_init[mbox]) in tsi721_get_inb_message()
2075 desc = priv->imsg_ring[mbox].imd_base; in tsi721_get_inb_message()
2076 desc += priv->imsg_ring[mbox].desc_rdptr; in tsi721_get_inb_message()
2081 rx_slot = priv->imsg_ring[mbox].rx_slot; in tsi721_get_inb_message()
2082 while (priv->imsg_ring[mbox].imq_base[rx_slot] == NULL) { in tsi721_get_inb_message()
2083 if (++rx_slot == priv->imsg_ring[mbox].size) in tsi721_get_inb_message()
2090 rx_virt = priv->imsg_ring[mbox].buf_base + in tsi721_get_inb_message()
2091 (rx_phys - (u64)priv->imsg_ring[mbox].buf_phys); in tsi721_get_inb_message()
2093 buf = priv->imsg_ring[mbox].imq_base[rx_slot]; in tsi721_get_inb_message()
2099 priv->imsg_ring[mbox].imq_base[rx_slot] = NULL; in tsi721_get_inb_message()
2102 if (++priv->imsg_ring[mbox].desc_rdptr == priv->imsg_ring[mbox].size) in tsi721_get_inb_message()
2103 priv->imsg_ring[mbox].desc_rdptr = 0; in tsi721_get_inb_message()
2105 iowrite32(priv->imsg_ring[mbox].desc_rdptr, in tsi721_get_inb_message()
2109 free_ptr = priv->imsg_ring[mbox].imfq_base; in tsi721_get_inb_message()
2110 free_ptr[priv->imsg_ring[mbox].fq_wrptr] = cpu_to_le64(rx_phys); in tsi721_get_inb_message()
2112 if (++priv->imsg_ring[mbox].fq_wrptr == priv->imsg_ring[mbox].size) in tsi721_get_inb_message()
2113 priv->imsg_ring[mbox].fq_wrptr = 0; in tsi721_get_inb_message()
2115 iowrite32(priv->imsg_ring[mbox].fq_wrptr, in tsi721_get_inb_message()