npi_txc.c revision 6f45ec7b0b964c3be967c4880e8867ac1e7763a5
/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <npi_txc.h>
/*
* Transmit Controller (TXC) Functions.
*/
uint64_t txc_fzc_dmc_offset[] = {
};
const char *txc_fzc_dmc_name[] = {
"TXC_DMA_MAX_BURST_REG",
"TXC_DMA_MAX_LENGTH_REG"
};
uint64_t txc_fzc_offset [] = {
};
const char *txc_fzc_name [] = {
"TXC_CONTROL_REG",
"TXC_TRAINING_REG",
"TXC_DEBUG_SELECT_REG",
"TXC_MAX_REORDER_REG",
"TXC_INT_STAT_DBG_REG",
"TXC_INT_STAT_REG",
"TXC_INT_MASK_REG"
};
uint64_t txc_fzc_port_offset[] = {
};
const char *txc_fzc_port_name[] = {
"TXC_PORT_CTL_REG",
"TXC_PORT_DMA_ENABLE_REG",
"TXC_PKT_STUFFED_REG",
"TXC_PKT_XMIT_REG",
"TXC_ROECC_CTL_REG",
"TXC_ROECC_ST_REG",
"TXC_RO_DATA0_REG",
"TXC_RO_DATA1_REG",
"TXC_RO_DATA2_REG",
"TXC_RO_DATA3_REG",
"TXC_RO_DATA4_REG",
"TXC_SFECC_CTL_REG",
"TXC_SFECC_ST_REG",
"TXC_SF_DATA0_REG",
"TXC_SF_DATA1_REG",
"TXC_SF_DATA2_REG",
"TXC_SF_DATA3_REG",
"TXC_SF_DATA4_REG",
"TXC_RO_TIDS_REG",
"TXC_RO_STATE0_REG",
"TXC_RO_STATE1_REG",
"TXC_RO_STATE2_REG",
"TXC_RO_STATE3_REG",
"TXC_RO_CTL_REG",
"TXC_RO_ST_DATA0_REG",
"TXC_RO_ST_DATA1_REG",
"TXC_RO_ST_DATA2_REG",
"TXC_RO_ST_DATA3_REG",
"TXC_PORT_PACKET_REQ_REG"
};
/*
* npi_txc_dump_tdc_fzc_regs
* Dumps the contents of TXC csrs and fzc registers
*
* Input:
* handle - NPI handle
* tdc: TX DMA number
*
* return:
* NPI_SUCCESS
* NPI_FAILURE
* NPI_TXC_CHANNEL_INVALID
*
*/
{
int num_regs, i;
if (!TXDMA_CHANNEL_VALID(tdc)) {
"npi_txc_dump_tdc_fzc_regs"
" Invalid TDC number %d \n",
tdc));
}
"\nTXC FZC DMC Register Dump for Channel %d\n",
tdc));
for (i = 0; i < num_regs; i++) {
"%s\t 0x%08llx \n",
}
"\n TXC FZC Register Dump for Channel %d done\n", tdc));
return (NPI_SUCCESS);
}
/*
* npi_txc_dump_fzc_regs
* Dumps the contents of txc csrs and fzc registers
*
*
* return:
* NPI_SUCCESS
* NPI_FAILURE
*
*/
{
int num_regs, i;
"\nTXC FZC Common Register Dump\n"));
for (i = 0; i < num_regs; i++) {
"%s\t 0x%08llx \n",
}
"\n TXC FZC Common Register Dump Done \n"));
return (NPI_SUCCESS);
}
/*
* npi_txc_dump_port_fzc_regs
* Dumps the contents of TXC csrs and fzc registers
*
* Input:
* handle - NPI handle
* port: port number
*
* return:
* NPI_SUCCESS
* NPI_FAILURE
*
*/
{
int num_regs, i;
"\nTXC FZC PORT Register Dump for port %d\n", port));
for (i = 0; i < num_regs; i++) {
"%s\t 0x%08llx \n",
}
"\n TXC FZC Register Dump for port %d done\n", port));
return (NPI_SUCCESS);
}
/*
* npi_txc_dma_max_burst():
* This function is called to configure the max burst bytes.
*
* Parameters:
* handle - NPI handle
* op_mode - OP_GET: get max burst value
* - OP_SET: set max burst value
* channel - channel number (0 - 23)
* dma_max_burst_p - pointer to store or used for max burst value.
* Return:
* NPI_SUCCESS - If operation is complete successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXC_OPCODE_INVALID
* NPI_TXC_CHANNEL_INVALID
*/
{
if (!TXDMA_CHANNEL_VALID(channel)) {
" npi_txc_dma_max_burst"
" Invalid Input: channel <0x%x>",
channel));
}
switch (op_mode) {
case OP_GET:
&val);
break;
case OP_SET:
break;
default:
" npi_txc_dma_max_burst"
" Invalid Input: burst <0x%x>",
op_mode));
}
return (NPI_SUCCESS);
}
/*
* npi_txc_dma_max_burst_set():
* This function is called to set the max burst bytes.
*
* Parameters:
* handle - NPI handle
* channel - channel number (0 - 23)
* max_burst - max burst to set
* Return:
* NPI_SUCCESS - If operation is complete successfully.
*
* Error:
* NPI_FAILURE -
*/
{
if (!TXDMA_CHANNEL_VALID(channel)) {
" npi_txc_dma_max_burst_set"
" Invalid Input: channel <0x%x>",
channel));
}
return (NPI_SUCCESS);
}
/*
* npi_txc_dma_bytes_transmitted():
* This function is called to get # of bytes transmitted by
* DMA (hardware register is cleared on read).
*
* Parameters:
* handle - NPI handle
* channel - channel number (0 - 23)
* dma_bytes_p - pointer to store bytes transmitted.
* Return:
* NPI_SUCCESS - If get is complete successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXC_PORT_INVALID
*/
{
if (!TXDMA_CHANNEL_VALID(channel)) {
" npi_txc_dma_bytes_transmitted"
" Invalid Input: channel %d",
channel));
}
return (NPI_SUCCESS);
}
/*
* npi_txc_control():
* This function is called to get or set the control register.
*
* Parameters:
* handle - NPI handle
* op_mode - OP_GET: get control register value
* OP_SET: set control register value
* txc_control_p - pointer to hardware defined data structure.
* Return:
* NPI_SUCCESS - If operation is complete successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXC_OPCODE_INVALID
* NPI_TXC_PORT_INVALID
*/
{
switch (op_mode) {
case OP_GET:
break;
case OP_SET:
break;
default:
" npi_txc_control"
" Invalid Input: control 0x%x",
op_mode));
}
return (NPI_SUCCESS);
}
/*
* npi_txc_global_enable():
* This function is called to globally enable TXC.
*
* Parameters:
* handle - NPI handle
* Return:
* NPI_SUCCESS - If enable is complete successfully.
*
* Error:
*/
{
return (NPI_SUCCESS);
}
/*
* npi_txc_global_disable():
* This function is called to globally disable TXC.
*
* Parameters:
* handle - NPI handle
* Return:
* NPI_SUCCESS - If disable is complete successfully.
*
* Error:
*/
{
return (NPI_SUCCESS);
}
/*
* npi_txc_control_clear():
* This function is called to clear all bits.
*
* Parameters:
* handle - NPI handle
* Return:
* NPI_SUCCESS - If reset all bits to 0s is complete successfully.
*
* Error:
*/
{
return (NPI_SUCCESS);
}
/*
* npi_txc_training_set():
* This function is called to set the debug training vector.
*
* Parameters:
* handle - NPI handle
* vector - training vector to set.
* Return:
* NPI_SUCCESS
*
* Error:
* NPI_FAILURE -
*/
{
return (NPI_SUCCESS);
}
/*
* npi_txc_training_get():
* This function is called to get the debug training vector.
*
* Parameters:
* handle - NPI handle
* vector_p - pointer to store training vector.
* Return:
* NPI_SUCCESS
*
* Error:
* NPI_FAILURE -
*/
{
&val);
return (NPI_SUCCESS);
}
/*
* npi_txc_port_enable():
* This function is called to enable a particular port.
*
* Parameters:
* handle - NPI handle
* port - port number (0 - 3)
* Return:
* NPI_SUCCESS - If port is enabled successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXC_PORT_INVALID
*/
{
return (NPI_SUCCESS);
}
/*
* npi_txc_port_disable():
* This function is called to disable a particular port.
*
* Parameters:
* handle - NPI handle
* port - port number (0 - 3)
* Return:
* NPI_SUCCESS - If port is disabled successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXC_PORT_INVALID
*/
{
return (NPI_SUCCESS);
}
/*
* npi_txc_port_dma_enable():
* This function is called to bind DMA channels (bitmap) to a port.
*
* Parameters:
* handle - NPI handle
* port - port number (0 - 3)
* port_dma_list_bitmap - channels bitmap
* Return:
* NPI_SUCCESS - If channels are bound successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXC_PORT_INVALID
*/
{
return (NPI_SUCCESS);
}
{
return (NPI_SUCCESS);
}
/*
* npi_txc_port_dma_channel_enable():
* This function is called to bind a channel to a port.
*
* Parameters:
* handle - NPI handle
* port - port number (0 - 3)
* channel - channel number (0 - 23)
* Return:
* NPI_SUCCESS - If channel is bound successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXC_PORT_INVALID -
*/
{
if (!TXDMA_CHANNEL_VALID(channel)) {
" npi_txc_port_dma_channel_enable"
" Invalid Input: channel <0x%x>", channel));
}
return (NPI_SUCCESS);
}
/*
* npi_txc_port_dma_channel_disable():
* This function is called to unbind a channel to a port.
*
* Parameters:
* handle - NPI handle
* port - port number (0 - 3)
* channel - channel number (0 - 23)
* Return:
* NPI_SUCCESS - If channel is unbound successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXC_PORT_INVALID -
*/
{
if (!TXDMA_CHANNEL_VALID(channel)) {
" npi_txc_port_dma_channel_disable"
" Invalid Input: channel <0x%x>", channel));
}
return (NPI_SUCCESS);
}
/*
* npi_txc_max_reorder_set():
* This function is called to set the per port reorder resources
*
* Parameters:
* handle - NPI handle
* port - port to set
* reorder - reorder resources (4 bits)
* Return:
* NPI_SUCCESS
*
* Error:
* NPI_FAILURE -
*/
{
return (NPI_SUCCESS);
}
/*
* npi_txc_reorder_get():
* This function is called to get the txc reorder resources.
*
* Parameters:
* handle - NPI handle
* port - port to get
* reorder - data to be stored at
* Return:
* NPI_SUCCESS
*
* Error:
* NPI_FAILURE -
*/
{
return (NPI_SUCCESS);
}
/*
* npi_txc_pkt_stuffed_get():
* This function is called to get total # of packets processed
* by reorder engine and packetAssy engine.
*
* Parameters:
* handle - NPI handle
* port - port number (0 - 3)
* pkt_assy_p - packets processed by Assy engine.
* pkt_reorder_p - packets processed by reorder engine.
*
* Return:
* NPI_SUCCESS - If get is complete successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXC_PORT_INVALID
*/
{
return (NPI_SUCCESS);
}
/*
* npi_txc_pkt_xmt_to_mac_get():
* This function is called to get total # of packets transmitted
* to the MAC.
*
* Parameters:
* handle - NPI handle
* port - port number (0 - 3)
* mac_bytes_p - bytes transmitted to the MAC.
* mac_pkts_p - packets transmitted to the MAC.
*
* Return:
* NPI_SUCCESS - If get is complete successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXC_PORT_INVALID
*/
{
return (NPI_SUCCESS);
}
/*
* npi_txc_get_ro_states():
* This function is called to get TXC's reorder state-machine states.
*
* Parameters:
* handle - NPI handle
* port - port number
* *states - TXC Re-order states.
*
* Return:
* NPI_SUCCESS - If get is complete successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXC_PORT_INVALID
*/
{
}
return (NPI_SUCCESS);
}
{
return (NPI_SUCCESS);
}
/*
* npi_txc_sf_states_get():
* This function is called to get TXC's store-forward state-machine states.
*
* Parameters:
* handle - NPI handle
* port - port number
* states - TXC Store-forward states
*
* Return:
* NPI_SUCCESS - If get is complete successfully.
*
* Error:
* NPI_FAILURE -
* NPI_TXC_PORT_INVALID
*/
#ifdef lint
/*ARGSUSED*/
#endif
{
}
return (NPI_SUCCESS);
}
{
return (NPI_SUCCESS);
}
/*
* npi_txc_global_istatus_get():
* This function is called to get TXC's global interrupt status.
*
* Parameters:
* handle - NPI handle
* istatus - TXC global interrupt status
*
* Return:
*/
void
{
}
/*
* npi_txc_global_istatus_clear():
* This function is called to clear TXC's global interrupt status.
*
* Parameters:
* handle - NPI handle
* istatus - TXC global interrupt status
*
* Return:
*/
void
{
}
void
{
switch (portn) {
case 0:
val &= 0xFFFFFF00;
break;
case 1:
val &= 0xFFFF00FF;
break;
case 2:
val &= 0xFF00FFFF;
break;
case 3:
val &= 0x00FFFFFF;
break;
default:
;
}
}