/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <npi_txdma.h>
#include <npi_tx_rd64.h>
#include <npi_tx_wr64.h>
};
const char *tdc_dmc_name[] = {
"TX_RNG_CFIG_REG",
"TX_RING_HDL_REG",
"TX_RING_KICK_REG",
"TX_ENT_MSK_REG",
"TX_CS_REG",
"TXDMA_MBH_REG",
"TXDMA_MBL_REG",
"TX_DMA_PRE_ST_REG",
"TX_RNG_ERR_LOGH_REG",
"TX_RNG_ERR_LOGL_REG",
"TDMC_INTR_DBG_REG",
"TX_CS_DBG_REG"
};
};
const char *tdc_fzc_name [] = {
"TX_LOG_PAGE_VLD_REG",
"TX_LOG_PAGE_MASK1_REG",
"TX_LOG_PAGE_VAL1_REG",
"TX_LOG_PAGE_MASK2_REG",
"TX_LOG_PAGE_VAL2_REG",
"TX_LOG_PAGE_RELO1_REG",
"TX_LOG_PAGE_RELO2_REG",
"TX_LOG_PAGE_HDL_REG"
};
};
const char *tx_fzc_name[] = {
"TX_ADDR_MD_REG",
"TDMC_INJ_PAR_ERR_REG",
"TDMC_DBG_SEL_REG",
"TDMC_TRAINING_REG",
"TXC_PORT_DMA_ENABLE_REG",
"TXC_DMA_MAX_BURST_REG"
};
/*
* npi_txdma_dump_tdc_regs
* Dumps the contents of tdc csrs and fzc registers
*
* Input:
* tdc: TX DMA number
*
* return:
* NPI_SUCCESS
* NPI_FAILURE
* NPI_TXDMA_CHANNEL_INVALID
*
*/
{
int num_regs, i;
if (!TXDMA_CHANNEL_VALID(tdc)) {
"npi_txdma_dump_tdc_regs"
" Invalid TDC number %d \n",
tdc));
}
"\nTXDMA DMC Register Dump for Channel %d\n",
tdc));
for (i = 0; i < num_regs; i++) {
tdc);
"%s\t 0x%016llx \n",
offset, tdc_dmc_name[i],
value));
}
"\n TXDMA Register Dump for Channel %d done\n", tdc));
return (NPI_SUCCESS);
}
/*
* npi_txdma_dump_fzc_regs
* Dumps the contents of tdc csrs and fzc registers
*
* Input:
* tdc: TX DMA number
*
* return:
* NPI_SUCCESS
* NPI_FAILURE
* NPI_TXDMA_CHANNEL_INVALID
*
*/
{
int num_regs, i;
"\nFZC_DMC Common Register Dump\n"));
for (i = 0; i < num_regs; i++) {
#if defined(__i386)
#else
#endif
"%s\t 0x%08llx \n",
tx_fzc_offset[i],
tx_fzc_name[i], value));
}
"\n TXDMA FZC_DMC Register Dump Done \n"));
return (NPI_SUCCESS);
}
{
int num_regs, i;
if (!TXDMA_CHANNEL_VALID(tdc)) {
"npi_txdma_tdc_regs_zero"
" InvaliInvalid TDC number %d \n",
tdc));
}
"\nTXDMA DMC Register (zero) for Channel %d\n",
tdc));
value = 0;
for (i = 0; i < num_regs; i++) {
}
"\nTXDMA FZC_DMC Register clear for Channel %d\n",
tdc));
"\n TXDMA Register Clear to 0s for Channel %d done\n", tdc));
return (NPI_SUCCESS);
}
/*
* npi_txdma_address_mode32_set():
* This function is called to only support 32 bit addressing.
*
* Parameters:
* handle - NPI handle
* mode_enable - B_TRUE (enable 32 bit mode)
* B_FALSE (disable 32 bit mode)
*
* Return:
* NPI_SUCCESS - If set is complete successfully.
*
* Error:
* NONE
*/
{
if (mode_enable) {
} else {
}
return (NPI_SUCCESS);
}
/*
* npi_txdma_log_page_set():
* This function is called to configure a logical page
* (valid bit, mask, value, relocation).
*
* Parameters:
* handle - NPI handle
* cfgp - pointer to NPI defined data structure:
* - page valid
* - mask
* - value
* - relocation
* channel - hardware TXDMA channel from 0 to 23.
*
* Return:
* NPI_SUCCESS - If configurations are set successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_CHANNEL_INVALID -
* NPI_TXDMA_FUNC_INVALID -
* NPI_TXDMA_PAGE_INVALID -
*/
{
int status;
status);
if (status) {
" npi_txdma_log_page_set"
" npi_status <0x%x>", status));
return (status);
}
"\n==> npi_txdma_log_page_set: WRITE 0 and "
" READ back 0x%llx\n ", val));
val &= 0x3;
} else {
}
"\n==> npi_txdma_log_page_set: vld value "
" 0x%llx function %d page_valid01 0x%x\n",
return (status);
}
/*
* npi_txdma_log_page_get():
* This function is called to get a logical page
* (valid bit, mask, value, relocation).
*
* Parameters:
* handle - NPI handle
* cfgp - Get the following values (NPI defined structure):
* - page valid
* - mask
* - value
* - relocation
* channel - hardware TXDMA channel from 0 to 23.
*
* Return:
* NPI_SUCCESS - If configurations are read successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_CHANNEL_INVALID -
* NPI_TXDMA_FUNC_INVALID -
* NPI_TXDMA_PAGE_INVALID -
*/
{
int status;
if (status) {
" npi_txdma_log_page_get"
" npi_status <0x%x>", status));
return (status);
}
"\n==> npi_txdma_log_page_get: read value "
" function %d value 0x%llx\n",
} else {
}
return (status);
}
/*
* npi_txdma_log_page_handle_set():
* This function is called to program a page handle
* (bits [63:44] of a 64-bit address to generate
* a 64 bit address)
*
* Parameters:
* handle - NPI handle
* hdl_p - pointer to a logical page handle
* hardware data structure (log_page_hdl_t).
* channel - hardware TXDMA channel from 0 to 23.
*
* Return:
* NPI_SUCCESS - If configurations are set successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_CHANNEL_INVALID -
* NPI_TXDMA_FUNC_INVALID -
* NPI_TXDMA_PAGE_INVALID -
*/
{
if (!TXDMA_CHANNEL_VALID(channel)) {
" npi_txdma_log_page_handle_set"
" Invalid Input: channel <0x%x>",
channel));
}
return (status);
}
/*
* npi_txdma_log_page_config():
* This function is called to IO operations on
* a logical page to set, get, clear
* valid bit, mask, value, relocation).
*
* Parameters:
* handle - NPI handle
* op_mode - OP_GET, OP_SET, OP_CLEAR
* type - NPI specific config type
* TXDMA_LOG_PAGE_MASK
* TXDMA_LOG_PAGE_VALUE
* TXDMA_LOG_PAGE_RELOC
* TXDMA_LOG_PAGE_VALID
* TXDMA_LOG_PAGE_ALL
* channel - hardware TXDMA channel from 0 to 23.
* cfgp - pointer to the NPI config structure.
* Return:
* NPI_SUCCESS - If configurations are read successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_OPCODE_INVALID -
* NPI_TXDMA_CHANNEL_INVALID -
* NPI_TXDMA_FUNC_INVALID -
* NPI_TXDMA_PAGE_INVALID -
*/
{
if (!TXDMA_CHANNEL_VALID(channel)) {
" npi_txdma_log_page_config"
" Invalid Input: channel <0x%x>",
channel));
}
switch (op_mode) {
case OP_GET:
switch (type) {
case TXDMA_LOG_PAGE_ALL:
cfgp));
case TXDMA_LOG_PAGE_MASK:
} else {
}
break;
case TXDMA_LOG_PAGE_VALUE:
} else {
}
break;
case TXDMA_LOG_PAGE_RELOC:
} else {
}
break;
default:
" npi_txdma_log_page_config"
" Invalid Input: pageconfig <0x%x>",
type));
return (NPI_FAILURE |
}
break;
case OP_SET:
case OP_CLEAR:
}
switch (type) {
case TXDMA_LOG_PAGE_ALL:
cfgp));
case TXDMA_LOG_PAGE_MASK:
} else {
}
break;
case TXDMA_LOG_PAGE_VALUE:
} else {
}
break;
case TXDMA_LOG_PAGE_RELOC:
} else {
}
break;
default:
" npi_txdma_log_page_config"
" Invalid Input: pageconfig <0x%x>",
type));
return (NPI_FAILURE |
}
break;
default:
" npi_txdma_log_page_config"
" Invalid Input: op <0x%x>",
op_mode));
}
return (status);
}
/*
* npi_txdma_log_page_vld_config():
* This function is called to configure the logical
* page valid register.
*
* Parameters:
* handle - NPI handle
* op_mode - OP_GET: get valid page configuration
* OP_SET: set valid page configuration
* OP_UPDATE: update valid page configuration
* OP_CLEAR: reset both valid pages to
* not defined (0).
* channel - hardware TXDMA channel from 0 to 23.
* vld_p - pointer to hardware defined log page valid register.
* Return:
* NPI_SUCCESS - If set is complete successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_CHANNEL_INVALID -
* NPI_TXDMA_OPCODE_INVALID -
*/
{
if (!TXDMA_CHANNEL_VALID(channel)) {
" npi_txdma_log_page_vld_config"
" Invalid Input: channel <0x%x>",
channel));
}
switch (op_mode) {
case OP_GET:
break;
case OP_SET:
break;
case OP_UPDATE:
break;
case OP_CLEAR:
channel, 0);
break;
default:
" npi_txdma_log_pag_vld_cofig"
" Invalid Input: pagevld <0x%x>",
op_mode));
}
return (status);
}
/*
* npi_txdma_channel_reset():
* This function is called to reset a transmit DMA channel.
* (This function is used to reset a channel and reinitialize
* all other bits except RST_STATE).
*
* Parameters:
* handle - NPI handle (virtualization flag must be defined).
* channel - logical TXDMA channel from 0 to 23.
* (If virtualization flag is not set, then
* logical channel is the same as the hardware
* channel number).
*
* Return:
* NPI_SUCCESS - If reset is complete successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_CHANNEL_INVALID -
* NPI_TXDMA_RESET_FAILED -
*/
{
" npi_txdma_channel_reset"
" RESETTING",
channel));
}
/*
* npi_txdma_channel_init_enable():
* This function is called to start a transmit DMA channel after reset.
*
* Parameters:
* handle - NPI handle (virtualization flag must be defined).
* channel - logical TXDMA channel from 0 to 23.
* (If virtualization flag is not set, then
* logical channel is the same as the hardware
* channel number).
* Return:
* NPI_SUCCESS - If DMA channel is started successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_CHANNEL_INVALID -
*/
{
}
/*
* npi_txdma_channel_enable():
* This function is called to start a transmit DMA channel.
*
* Parameters:
* handle - NPI handle (virtualization flag must be defined).
* channel - logical TXDMA channel from 0 to 23.
* (If virtualization flag is not set, then
* logical channel is the same as the hardware
* channel number).
* Return:
* NPI_SUCCESS - If DMA channel is stopped successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_CHANNEL_INVALID -
*/
{
}
/*
* npi_txdma_channel_disable():
* This function is called to stop a transmit DMA channel.
*
* Parameters:
* handle - NPI handle (virtualization flag must be defined).
* channel - logical TXDMA channel from 0 to 23.
* (If virtualization flag is not set, then
* logical channel is the same as the hardware
* channel number).
* Return:
* NPI_SUCCESS - If DMA channel is stopped successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_CHANNEL_INVALID -
* NPI_TXDMA_STOP_FAILED -
*/
{
}
/*
* npi_txdma_channel_resume():
* This function is called to restart a transmit DMA channel.
*
* Parameters:
* handle - NPI handle (virtualization flag must be defined).
* channel - logical TXDMA channel from 0 to 23.
* (If virtualization flag is not set, then
* logical channel is the same as the hardware
* channel number).
* Return:
* NPI_SUCCESS - If DMA channel is stopped successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_CHANNEL_INVALID -
* NPI_TXDMA_RESUME_FAILED -
*/
{
}
/*
* npi_txdma_channel_mmk_clear():
* This function is called to clear MMK bit.
*
* Parameters:
* handle - NPI handle (virtualization flag must be defined).
* channel - logical TXDMA channel from 0 to 23.
* (If virtualization flag is not set, then
* logical channel is the same as the hardware
* channel number).
* Return:
* NPI_SUCCESS - If MMK is reset successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_CHANNEL_INVALID -
*/
{
}
/*
* npi_txdma_channel_mbox_enable():
* This function is called to enable the mailbox update.
*
* Parameters:
* handle - NPI handle (virtualization flag must be defined).
* channel - logical TXDMA channel from 0 to 23.
* (If virtualization flag is not set, then
* logical channel is the same as the hardware
* channel number).
* Return:
* NPI_SUCCESS - If mailbox is enabled successfully.
*
* Error:
* NPI_HW_ERROR -
* NPI_FAILURE -
* NPI_TXDMA_CHANNEL_INVALID -
*/
{
}
/*
* npi_txdma_channel_control():
* This function is called to control a transmit DMA channel
* for reset, start or stop.
*
* Parameters:
* handle - NPI handle (virtualization flag must be defined).
* control - NPI defined control type supported
* - TXDMA_INIT_RESET
* - TXDMA_INIT_START
* - TXDMA_RESET
* - TXDMA_START
* - TXDMA_STOP
* channel - logical TXDMA channel from 0 to 23.
* (If virtualization flag is not set, then
* logical channel is the same as the hardware
*
* Return:
* NPI_SUCCESS - If reset is complete successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_OPCODE_INVALID -
* NPI_TXDMA_CHANNEL_INVALID -
* NPI_TXDMA_RESET_FAILED -
* NPI_TXDMA_STOP_FAILED -
* NPI_TXDMA_RESUME_FAILED -
*/
{
if (!TXDMA_CHANNEL_VALID(channel)) {
" npi_txdma_channel_control"
" Invalid Input: channel <0x%x>",
channel));
}
switch (control) {
case TXDMA_INIT_RESET:
case TXDMA_INIT_START:
break;
case TXDMA_RESET:
/*
* Sets reset bit only (Hardware will reset all
* the RW bits but leave the RO bits alone.
*/
case TXDMA_START:
/* Enable the DMA channel */
break;
case TXDMA_STOP:
/* Disable the DMA channel */
if (status) {
"Cannot stop channel %d (TXC hung!)",
channel));
}
break;
case TXDMA_RESUME:
/* Resume the packet transmission after stopping */
case TXDMA_CLEAR_MMK:
/* Write 1 to MK bit to clear the MMK bit */
break;
case TXDMA_MBOX_ENABLE:
/*
* Write 1 to MB bit to enable mailbox update
* (cleared to 0 by hardware after update).
*/
break;
default:
" npi_txdma_channel_control"
" Invalid Input: control <0x%x>",
control));
}
return (status);
}
/*
* npi_txdma_control_status():
* This function is called to operate on the control
* and status register.
*
* Parameters:
* handle - NPI handle
* op_mode - OP_GET: get hardware control and status
* OP_SET: set hardware control and status
* OP_UPDATE: update hardware control and status.
* OP_CLEAR: clear control and status register to 0s.
* channel - hardware TXDMA channel from 0 to 23.
* cs_p - pointer to hardware defined control and status
* structure.
* Return:
* NPI_SUCCESS - If set is complete successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_OPCODE_INVALID -
* NPI_TXDMA_CHANNEL_INVALID -
* NPI_TXDMA_FUNC_INVALID -
*/
{
if (!TXDMA_CHANNEL_VALID(channel)) {
" npi_txdma_control_status"
" Invalid Input: channel <0x%x>",
channel));
}
switch (op_mode) {
case OP_GET:
break;
case OP_SET:
break;
case OP_UPDATE:
break;
default:
" npi_txdma_control_status"
" Invalid Input: control <0x%x>",
op_mode));
}
return (status);
}
/*
* npi_txdma_event_mask():
* This function is called to operate on the event mask
* register which is used for generating interrupts..
* and status register.
*
* Parameters:
* handle - NPI handle
* op_mode - OP_GET: get hardware event mask
* OP_SET: set hardware interrupt event masks
* OP_CLEAR: clear control and status register to 0s.
* channel - hardware TXDMA channel from 0 to 23.
* mask_p - pointer to hardware defined event mask
* structure.
* Return:
* NPI_SUCCESS - If set is complete successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_OPCODE_INVALID -
* NPI_TXDMA_CHANNEL_INVALID -
*/
{
if (!TXDMA_CHANNEL_VALID(channel)) {
" npi_txdma_event_mask"
" Invalid Input: channel <0x%x>",
channel));
}
switch (op_mode) {
case OP_GET:
break;
case OP_SET:
break;
case OP_UPDATE:
break;
default:
" npi_txdma_event_mask"
" Invalid Input: eventmask <0x%x>",
op_mode));
}
return (status);
}
/*
* npi_txdma_event_mask_config():
* This function is called to operate on the event mask
* register which is used for generating interrupts..
* and status register.
*
* Parameters:
* handle - NPI handle
* op_mode - OP_GET: get hardware event mask
* OP_SET: set hardware interrupt event masks
* OP_CLEAR: clear control and status register to 0s.
* channel - hardware TXDMA channel from 0 to 23.
* cfgp - pointer to NPI defined event mask
* enum data type.
* Return:
* NPI_SUCCESS - If set is complete successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_OPCODE_INVALID -
* NPI_TXDMA_CHANNEL_INVALID -
*/
{
if (!TXDMA_CHANNEL_VALID(channel)) {
" npi_txdma_event_mask_config"
" Invalid Input: channel <0x%x>",
channel));
}
switch (op_mode) {
case OP_GET:
break;
case OP_SET:
break;
case OP_UPDATE:
configuration | value);
break;
case OP_CLEAR:
break;
default:
" npi_txdma_event_mask_config"
" Invalid Input: eventmask <0x%x>",
op_mode));
}
return (status);
}
/*
* npi_txdma_event_mask_mk_out():
* This function is called to mask out the packet transmit marked event.
*
* Parameters:
* handle - NPI handle
* channel - hardware TXDMA channel from 0 to 23.
* enum data type.
* Return:
* NPI_SUCCESS - If set is complete successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_CHANNEL_INVALID -
*/
{
if (!TXDMA_CHANNEL_VALID(channel)) {
" npi_txdma_event_mask_mk_out"
" Invalid Input: channel <0x%x>",
channel));
}
event_mask & (~TX_ENT_MSK_MK_MASK));
return (status);
}
/*
* npi_txdma_event_mask_mk_in():
* This function is called to set the mask for the the packet marked event.
*
* Parameters:
* handle - NPI handle
* channel - hardware TXDMA channel from 0 to 23.
* enum data type.
* Return:
* NPI_SUCCESS - If set is complete successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_CHANNEL_INVALID -
*/
{
if (!TXDMA_CHANNEL_VALID(channel)) {
" npi_txdma_event_mask_mk_in"
" Invalid Input: channel <0x%x>",
channel));
}
return (status);
}
/*
* npi_txdma_ring_addr_set():
* This function is called to configure the transmit descriptor
* ring address and its size.
*
* Parameters:
* handle - NPI handle (virtualization flag must be defined
* if its register pointer is from the virtual region).
* channel - logical TXDMA channel from 0 to 23.
* (If virtualization flag is not set, then
* logical channel is the same as the hardware
* channel number).
* start_addr - starting address of the descriptor
* len - maximum length of the descriptor
* (in number of 64 bytes block).
* Return:
* NPI_SUCCESS - If set is complete successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_OPCODE_INVALID -
* NPI_TXDMA_CHANNEL_INVALID -
*/
{
if (!TXDMA_CHANNEL_VALID(channel)) {
" npi_txdma_ring_addr_set"
" Invalid Input: channel <0x%x>",
channel));
}
return (status);
}
/*
* npi_txdma_ring_config():
* This function is called to config a descriptor ring
* by using the hardware defined data.
*
* Parameters:
* handle - NPI handle (virtualization flag must be defined
* if its register pointer is from the virtual region).
* channel - logical TXDMA channel from 0 to 23.
* (If virtualization flag is not set, then
* logical channel is the same as the hardware
* channel number).
* op_mode - OP_GET: get transmit ring configuration
* OP_SET: set transmit ring configuration
* reg_data - pointer to hardware defined transmit ring
* configuration data structure.
* Return:
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_CHANNEL_INVALID -
*/
{
if (!TXDMA_CHANNEL_VALID(channel)) {
" npi_txdma_ring_config"
" Invalid Input: channel <0x%x>",
channel));
}
switch (op_mode) {
case OP_GET:
break;
case OP_SET:
*reg_data);
break;
default:
" npi_txdma_ring_config"
" Invalid Input: ring_config <0x%x>",
op_mode));
}
return (status);
}
/*
* npi_txdma_mbox_config():
* This function is called to config the mailbox address
*
* Parameters:
* handle - NPI handle (virtualization flag must be defined
* if its register pointer is from the virtual region).
* channel - logical TXDMA channel from 0 to 23.
* (If virtualization flag is not set, then
* logical channel is the same as the hardware
* channel number).
* op_mode - OP_GET: get the mailbox address
* OP_SET: set the mailbox address
* reg_data - pointer to the mailbox address.
* Return:
* NPI_SUCCESS - If set is complete successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_OPCODE_INVALID -
* NPI_TXDMA_CHANNEL_INVALID -
*/
{
if (!TXDMA_CHANNEL_VALID(channel)) {
" npi_txdma_mbox_config"
" Invalid Input: channel <0x%x>",
channel));
}
switch (op_mode) {
case OP_GET:
break;
case OP_SET:
break;
default:
" npi_txdma_mbox_config"
" Invalid Input: mbox <0x%x>",
op_mode));
}
return (status);
}
/*
* npi_txdma_desc_gather_set():
* This function is called to set up a transmit descriptor entry.
*
* Parameters:
* handle - NPI handle (register pointer is the
* descriptor address in memory).
* desc_p - pointer to a descriptor
* gather_index - which entry (starts from index 0 to 15)
* mark - mark bit (only valid if it is the first gather).
* ngathers - number of gather pointers to set to the first gather.
* dma_ioaddr - starting dma address of an IO buffer to write.
* (SAD)
* transfer_len - transfer len.
* Return:
* NPI_SUCCESS - If set is complete successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_OPCODE_INVALID -
* NPI_TXDMA_CHANNEL_INVALID -
* NPI_TXDMA_XFER_LEN_INVALID -
*/
{
int status;
if (status) {
" npi_txdma_desc_gather_set"
" Invalid Input: gather_index <0x%x>",
gather_index));
return (status);
}
if (transfer_len > TX_MAX_TRANSFER_LENGTH) {
" npi_txdma_desc_gather_set"
" Invalid Input: tr_len <0x%x>",
transfer_len));
return (NPI_FAILURE | NPI_TXDMA_XFER_LEN_INVALID);
}
if (gather_index == 0) {
"npi_txdma_gather_set: SOP len %d (%d)",
}
"npi_txdma_gather_set: xfer len %d to set (%d)",
return (status);
}
/*
* npi_txdma_desc_sop_set():
* This function is called to set up the first gather entry.
*
* Parameters:
* handle - NPI handle (register pointer is the
* descriptor address in memory).
* desc_p - pointer to a descriptor
* mark - mark bit (only valid if it is the first gather).
* ngathers - number of gather pointers to set to the first gather.
* Return:
* NPI_SUCCESS - If set is complete successfully.
*
* Error:
*/
{
return (status);
}
{
return (status);
}
{
"npi_set_xfer_len: len %d (%d)",
return (status);
}
{
int i;
/*
* Assume no wrapped around.
*/
offset = 0;
for (i = 0; i < entries; i++) {
offset += (i * TXDMA_DESC_SIZE);
}
return (NPI_SUCCESS);
}
{
return (status);
}
/*
* npi_txdma_desc_kick_reg_set():
* This function is called to kick the transmit to start transmission.
*
* Parameters:
* handle - NPI handle (virtualization flag must be defined).
* channel - logical TXDMA channel from 0 to 23.
* (If virtualization flag is not set, then
* logical channel is the same as the hardware
* channel number).
* tail_index - index into the transmit descriptor
* wrap - toggle bit to indicate if the tail index is
* wrapped around.
*
* Return:
* NPI_SUCCESS - If set is complete successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_CHANNEL_INVALID -
*/
{
if (!TXDMA_CHANNEL_VALID(channel)) {
" npi_txdma_desc_kick_reg_set"
" Invalid Input: channel <0x%x>",
channel));
}
" npi_txdma_desc_kick_reg_set: "
" KICKING channel %d",
channel));
/* Toggle the wrap around bit */
/* Kick start the Transmit kick register */
return (status);
}
/*
* npi_txdma_desc_kick_reg_get():
* This function is called to kick the transmit to start transmission.
*
* Parameters:
* handle - NPI handle (virtualization flag must be defined).
* channel - logical TXDMA channel from 0 to 23.
* (If virtualization flag is not set, then
* logical channel is the same as the hardware
* channel number).
* tail_index - index into the transmit descriptor
* wrap - toggle bit to indicate if the tail index is
* wrapped around.
*
* Return:
* NPI_SUCCESS - If get is complete successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_CHANNEL_INVALID -
*/
{
if (!TXDMA_CHANNEL_VALID(channel)) {
" npi_txdma_desc_kick_reg_get"
" Invalid Input: channel <0x%x>",
channel));
}
return (status);
}
/*
* npi_txdma_ring_head_get():
* This function is called to get the transmit ring head index.
*
* Parameters:
* handle - NPI handle (virtualization flag must be defined).
* channel - logical TXDMA channel from 0 to 23.
* (If virtualization flag is not set, then
* logical channel is the same as the hardware
* channel number).
* hdl_p - pointer to the hardware defined transmit
* ring header data (head index and wrap bit).
*
* Return:
* NPI_SUCCESS - If get is complete successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXDMA_CHANNEL_INVALID -
*/
{
if (!TXDMA_CHANNEL_VALID(channel)) {
" npi_txdma_ring_head_get"
" Invalid Input: channel <0x%x>",
channel));
}
return (status);
}
/*ARGSUSED*/
{
return (status);
}
{
if (!TXDMA_CHANNEL_VALID(channel)) {
" npi_txdma_channel_pre_state_get"
" Invalid Input: channel <0x%x>",
channel));
}
return (status);
}
{
if (!TXDMA_CHANNEL_VALID(channel)) {
" npi_txdma_ring_error_get"
" Invalid Input: channel <0x%x>",
channel));
}
return (status);
}
{
return (NPI_SUCCESS);
}
{
return (NPI_SUCCESS);
}
{
return (NPI_SUCCESS);
}
{
return (NPI_SUCCESS);
}
{
return (NPI_SUCCESS);
}
{
return (NPI_SUCCESS);
}
/*
* npi_txdma_dump_desc_one(npi_handle_t handle, p_tx_desc_t desc_p,
* int desc_index)
*
* Dumps the contents of transmit descriptors.
*
* Parameters:
* handle - NPI handle (register pointer is the
* descriptor address in memory).
* desc_p - pointer to place the descriptor contents
* desc_index - descriptor index
*
*/
/*ARGSUSED*/
void
{
#ifdef NXGE_DEBUG
int xfer_len;
#endif
"\n==> npi_txdma_dump_desc_one: dump "
" desc_p $%p descriptor entry %d\n",
desc_p, desc_index));
#ifdef NXGE_DEBUG
#endif
"\t\tsad $%p\ttr_len %d len %d\tnptrs %d\tmark %d sop %d\n",
sad,
"\n<== npi_txdma_dump_desc_one: Done \n"));
}
/*ARGSUSED*/
void
{
"\n==> npi_txdma_dump_hdr: dump\n"));
"\n\t: value 0x%llx\n"
"\t\tpkttype 0x%x\tip_ver %d\tllc %d\tvlan %d \tihl %d\n"
"\t\tl3start %d\tl4start %d\tl4stuff %d\n"
"\t\txferlen %d\tpad %d\n",
"\n<== npi_txdma_dump_hdr: Done \n"));
}
{
if (!TXDMA_CHANNEL_VALID(channel)) {
" npi_txdma_inj_int_error_set"
" Invalid Input: channel <0x%x>",
channel));
}
return (status);
}
/*
* Static functions start here.
*/
static npi_status_t
{
int loop = 0;
do {
return (NPI_SUCCESS);
}
loop++;
} while (loop < TXDMA_WAIT_LOOP);
if (loop == TXDMA_WAIT_LOOP) {
"npi_txdma_control_reset_wait: RST bit not "
return (NPI_FAILURE | NPI_TXDMA_RESET_FAILED);
}
return (NPI_SUCCESS);
}
static npi_status_t
{
int loop = 0;
do {
return (NPI_SUCCESS);
}
loop++;
} while (loop < TXDMA_WAIT_LOOP);
if (loop == TXDMA_WAIT_LOOP) {
"npi_txdma_control_stop_wait: SNG_STATE not "
return (NPI_FAILURE | NPI_TXDMA_STOP_FAILED);
}
return (NPI_SUCCESS);
}
static npi_status_t
{
int loop = 0;
do {
return (NPI_SUCCESS);
}
loop++;
} while (loop < TXDMA_WAIT_LOOP);
if (loop == TXDMA_WAIT_LOOP) {
"npi_txdma_control_resume_wait: sng_state not "
return (NPI_FAILURE | NPI_TXDMA_RESUME_FAILED);
}
return (NPI_SUCCESS);
}