3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * CDDL HEADER START
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * The contents of this file are subject to the terms of the
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * Common Development and Distribution License (the "License").
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * You may not use this file except in compliance with the License.
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * See the License for the specific language governing permissions
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * and limitations under the License.
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * When distributing Covered Code, include this CDDL HEADER in each
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * If applicable, add the following below this CDDL HEADER, with the
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * fields enclosed by brackets "[]" replaced with your own identifying
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * information: Portions Copyright [yyyy] [name of copyright owner]
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * CDDL HEADER END
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * Use is subject to license terms.
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs#pragma ident "%Z%%M% %I% %E% SMI"
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qsstatic hpi_status_t hpi_txdma_control_reset_wait(hpi_handle_t handle,
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qshpi_txdma_log_page_handle_set(hpi_handle_t handle, uint8_t channel,
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs " hpi_txdma_log_page_handle_set"
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs return (HPI_FAILURE | HPI_TXDMA_CHANNEL_INVALID(channel));
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs TXDMA_REG_WRITE64(handle, TDC_PAGE_HANDLE, channel, hdl_p->value);
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qshpi_txdma_channel_reset(hpi_handle_t handle, uint8_t channel)
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs return (hpi_txdma_channel_control(handle, TXDMA_RESET, channel));
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qshpi_txdma_channel_init_enable(hpi_handle_t handle, uint8_t channel)
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs return (hpi_txdma_channel_control(handle, TXDMA_INIT_START, channel));
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qshpi_txdma_channel_enable(hpi_handle_t handle, uint8_t channel)
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs return (hpi_txdma_channel_control(handle, TXDMA_START, channel));
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qshpi_txdma_channel_disable(hpi_handle_t handle, uint8_t channel)
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs return (hpi_txdma_channel_control(handle, TXDMA_STOP, channel));
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qshpi_txdma_channel_mbox_enable(hpi_handle_t handle, uint8_t channel)
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs return (hpi_txdma_channel_control(handle, TXDMA_MBOX_ENABLE, channel));
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qshpi_txdma_channel_control(hpi_handle_t handle, txdma_cs_cntl_t control,
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs " hpi_txdma_channel_control"
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs return (HPI_FAILURE | HPI_TXDMA_CHANNEL_INVALID(channel));
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs TXDMA_REG_READ64(handle, TDC_TDR_CFG, channel, &cfg.value);
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs TXDMA_REG_WRITE64(handle, TDC_TDR_CFG, channel, cfg.value);
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs TXDMA_REG_READ64(handle, TDC_TDR_CFG, channel, &cfg.value);
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs TXDMA_REG_WRITE64(handle, TDC_TDR_CFG, channel, cfg.value);
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * Sets reset bit only (Hardware will reset all the RW bits but
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * leave the RO bits alone.
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs TXDMA_REG_WRITE64(handle, TDC_TDR_CFG, channel, cfg.value);
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs /* Enable the DMA channel */
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs TXDMA_REG_READ64(handle, TDC_TDR_CFG, channel, &cfg.value);
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs TXDMA_REG_WRITE64(handle, TDC_TDR_CFG, channel, cfg.value);
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs /* Disable the DMA channel */
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs TXDMA_REG_READ64(handle, TDC_TDR_CFG, channel, &cfg.value);
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs TXDMA_REG_WRITE64(handle, TDC_TDR_CFG, channel, cfg.value);
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * Write 1 to MB bit to enable mailbox update (cleared to 0 by
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * hardware after update).
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs status = (HPI_FAILURE | HPI_TXDMA_OPCODE_INVALID(channel));
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs " hpi_txdma_channel_control"
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qshpi_txdma_control_status(hpi_handle_t handle, io_op_t op_mode, uint8_t channel,
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs " hpi_txdma_control_status"
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs return (HPI_FAILURE | HPI_TXDMA_CHANNEL_INVALID(channel));
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs TXDMA_REG_READ64(handle, TDC_STAT, channel, &cs_p->value);
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs TXDMA_REG_WRITE64(handle, TDC_STAT, channel, cs_p->value);
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs TXDMA_REG_READ64(handle, TDC_STAT, channel, &txcs.value);
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs " hpi_txdma_control_status"
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs return (HPI_FAILURE | HPI_TXDMA_OPCODE_INVALID(channel));
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qshpi_txdma_event_mask(hpi_handle_t handle, io_op_t op_mode, uint8_t channel,
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs " hpi_txdma_event_mask Invalid Input: channel <0x%x>",
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs return (HPI_FAILURE | HPI_TXDMA_CHANNEL_INVALID(channel));
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs TXDMA_REG_READ64(handle, TDC_INT_MASK, channel, &mask_p->value);
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs TXDMA_REG_WRITE64(handle, TDC_INT_MASK, channel, mask_p->value);
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs TXDMA_REG_READ64(handle, TDC_INT_MASK, channel, &mask.value);
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs " hpi_txdma_event_mask Invalid Input: eventmask <0x%x>",
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs return (HPI_FAILURE | HPI_TXDMA_OPCODE_INVALID(channel));
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qshpi_txdma_ring_config(hpi_handle_t handle, io_op_t op_mode,
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs " hpi_txdma_ring_config"
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs return (HPI_FAILURE | HPI_TXDMA_CHANNEL_INVALID(channel));
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs TXDMA_REG_READ64(handle, TDC_TDR_CFG, channel, reg_data);
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs TXDMA_REG_WRITE64(handle, TDC_TDR_CFG, channel, *reg_data);
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs " hpi_txdma_ring_config"
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs return (HPI_FAILURE | HPI_TXDMA_OPCODE_INVALID(channel));
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qshpi_txdma_mbox_config(hpi_handle_t handle, io_op_t op_mode,
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs " hpi_txdma_mbox_config Invalid Input: channel <0x%x>",
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs return (HPI_FAILURE | HPI_TXDMA_CHANNEL_INVALID(channel));
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs ml.bits.mbaddr = ((*mbox_addr & TDC_MBL_MASK) >> TDC_MBL_SHIFT);
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs " hpi_txdma_mbox_config Invalid Input: mbox <0x%x>",
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs return (HPI_FAILURE | HPI_TXDMA_OPCODE_INVALID(channel));
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * This function is called to set up a transmit descriptor entry.
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qshpi_txdma_desc_gather_set(hpi_handle_t handle, p_tx_desc_t desc_p,
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs " hpi_txdma_desc_gather_set"
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs " hpi_txdma_desc_gather_set"
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs "hpi_txdma_gather_set: SOP len %d (%d)",
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs "hpi_txdma_gather_set: xfer len %d to set (%d)",
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qshpi_txdma_desc_set_zero(hpi_handle_t handle, uint16_t entries)
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * Assume no wrapped around.
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs for (i = 0; i < entries; i++) {
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * This function is called to get the transmit ring head index.
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qshpi_txdma_ring_head_get(hpi_handle_t handle, uint8_t channel,
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs " hpi_txdma_ring_head_get"
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs return (HPI_FAILURE | HPI_TXDMA_CHANNEL_INVALID(channel));
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs TXDMA_REG_READ64(handle, TDC_TDR_HEAD, channel, &hdl_p->value);
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * Dumps the contents of transmit descriptors.
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs/*ARGSUSED*/
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qshpi_txdma_dump_desc_one(hpi_handle_t handle, p_tx_desc_t desc_p, int desc_index)
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs "\n==> hpi_txdma_dump_desc_one: dump "
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs " desc_p $%p descriptor entry %d\n", desc_p, desc_index));
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs HPI_DEBUG_MSG((handle.function, HPI_TDC_CTL, "\n\t: value 0x%llx\n"
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs "\t\tsad $%p\ttr_len %d len %d\tnptrs %d\tmark %d sop %d\n",
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs "\n<== hpi_txdma_dump_desc_one: Done \n"));
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * Static functions start here.
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qshpi_txdma_control_reset_wait(hpi_handle_t handle, uint8_t channel)
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs TXDMA_REG_READ64(handle, TDC_TDR_CFG, channel, &txcs.value);
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs * Reset completes when this bit is set to 1 by hw
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs "hpi_txdma_control_reset_wait: RST bit not "
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qshpi_txdma_control_stop_wait(hpi_handle_t handle, uint8_t channel)
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs TXDMA_REG_READ64(handle, TDC_TDR_CFG, channel, &txcs.value);
3dec9fcdd56adf1b4a563137b4915c8f2d83b881qs "hpi_txdma_control_stop_wait: SNG_STATE not "