/*
* 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_mac.h>
do {\
cnt--;\
}
do {\
cnt--;\
}
do { \
NXGE_DELAY(interval); \
t_delay++; \
}
};
const char *xmac_name[] = {
"XTXMAC_SW_RST_REG",
"XRXMAC_SW_RST_REG",
"XTXMAC_STATUS_REG",
"XRXMAC_STATUS_REG",
"XMAC_CTRL_STAT_REG",
"XTXMAC_STAT_MSK_REG",
"XRXMAC_STAT_MSK_REG",
"XMAC_C_S_MSK_REG",
"XMAC_CONFIG_REG",
"XMAC_IPG_REG",
"XMAC_MIN_REG",
"XMAC_MAX_REG",
"XMAC_ADDR0_REG",
"XMAC_ADDR1_REG",
"XMAC_ADDR2_REG",
"XRXMAC_BT_CNT_REG",
"XRXMAC_BC_FRM_CNT_REG",
"XRXMAC_MC_FRM_CNT_REG",
"XRXMAC_FRAG_CNT_REG",
"XRXMAC_HIST_CNT1_REG",
"XRXMAC_HIST_CNT2_REG",
"XRXMAC_HIST_CNT3_REG",
"XRXMAC_HIST_CNT4_REG",
"XRXMAC_HIST_CNT5_REG",
"XRXMAC_HIST_CNT6_REG",
"XRXMAC_MPSZER_CNT_REG",
"XRXMAC_CRC_ER_CNT_REG",
"XRXMAC_CD_VIO_CNT_REG",
"XRXMAC_AL_ER_CNT_REG",
"XTXMAC_FRM_CNT_REG",
"XTXMAC_BYTE_CNT_REG",
"XMAC_LINK_FLT_CNT_REG",
"XRXMAC_HIST_CNT7_REG",
"XMAC_SM_REG",
"XMAC_INTERN1_REG",
"XMAC_INTERN2_REG",
"XMAC_ADDR_CMPEN_REG",
"XMAC_ADDR3_REG",
"XMAC_ADDR4_REG",
"XMAC_ADDR5_REG",
"XMAC_ADDR6_REG",
"XMAC_ADDR7_REG",
"XMAC_ADDR8_REG",
"XMAC_ADDR9_REG",
"XMAC_ADDR10_REG",
"XMAC_ADDR11_REG",
"XMAC_ADDR12_REG",
"XMAC_ADDR13_REG",
"XMAC_ADDR14_REG",
"XMAC_ADDR15_REG",
"XMAC_ADDR16_REG",
"XMAC_ADDR17_REG",
"XMAC_ADDR18_REG",
"XMAC_ADDR19_REG",
"XMAC_ADDR20_REG",
"XMAC_ADDR21_REG",
"XMAC_ADDR22_REG",
"XMAC_ADDR23_REG",
"XMAC_ADDR24_REG",
"XMAC_ADDR25_REG",
"XMAC_ADDR26_REG",
"XMAC_ADDR27_REG",
"XMAC_ADDR28_REG",
"XMAC_ADDR29_REG",
"XMAC_ADDR30_REG",
"XMAC_ADDR31_REG",
"XMAC_ADDR32_REG",
"XMAC_ADDR33_REG",
"XMAC_ADDR34_REG",
"XMAC_ADDR35_REG",
"XMAC_ADDR36_REG",
"XMAC_ADDR37_REG",
"XMAC_ADDR38_REG",
"XMAC_ADDR39_REG",
"XMAC_ADDR40_REG",
"XMAC_ADDR41_REG",
"XMAC_ADDR42_REG",
"XMAC_ADDR43_REG",
"XMAC_ADDR44_REG",
"XMAC_ADDR45_REG",
"XMAC_ADDR46_REG",
"XMAC_ADDR47_REG",
"XMAC_ADDR48_REG",
"XMAC_ADDR49_REG",
"XMAC_ADDR50_RE",
"XMAC_ADDR_FILT0_REG",
"XMAC_ADDR_FILT1_REG",
"XMAC_ADDR_FILT2_REG",
"XMAC_ADDR_FILT12_MASK_REG",
"XMAC_ADDR_FILT0_MASK_REG",
"XMAC_HASH_TBL0_REG",
"XMAC_HASH_TBL1_REG",
"XMAC_HASH_TBL2_REG",
"XMAC_HASH_TBL3_REG",
"XMAC_HASH_TBL4_REG",
"XMAC_HASH_TBL5_REG",
"XMAC_HASH_TBL6_REG",
"XMAC_HASH_TBL7_REG",
"XMAC_HASH_TBL8_REG",
"XMAC_HASH_TBL9_REG",
"XMAC_HASH_TBL10_REG",
"XMAC_HASH_TBL11_REG",
"XMAC_HASH_TBL12_REG",
"XMAC_HASH_TBL13_REG",
"XMAC_HASH_TBL14_REG",
"XMAC_HASH_TBL15_REG",
"XMAC_HOST_INF0_REG",
"XMAC_HOST_INF1_REG",
"XMAC_HOST_INF2_REG",
"XMAC_HOST_INF3_REG",
"XMAC_HOST_INF4_REG",
"XMAC_HOST_INF5_REG",
"XMAC_HOST_INF6_REG",
"XMAC_HOST_INF7_REG",
"XMAC_HOST_INF8_REG",
"XMAC_HOST_INF9_REG",
"XMAC_HOST_INF10_REG",
"XMAC_HOST_INF11_REG",
"XMAC_HOST_INF12_REG",
"XMAC_HOST_INF13_REG",
"XMAC_HOST_INF14_REG",
"XMAC_HOST_INF15_REG",
"XMAC_HOST_INF16_REG",
"XMAC_HOST_INF17_REG",
"XMAC_HOST_INF18_REG",
"XMAC_HOST_INF19_REG",
"XMAC_PA_DATA0_REG",
"XMAC_PA_DATA1_REG",
"XMAC_DEBUG_SEL_REG",
"XMAC_TRAINING_VECT_REG",
};
};
const char *bmac_name[] = {
"BTXMAC_SW_RST_REG",
"BRXMAC_SW_RST_REG",
"MAC_SEND_PAUSE_REG",
"BTXMAC_STATUS_REG",
"BRXMAC_STATUS_REG",
"BMAC_CTRL_STAT_REG",
"BTXMAC_STAT_MSK_REG",
"BRXMAC_STAT_MSK_REG",
"BMAC_C_S_MSK_REG",
"TXMAC_CONFIG_REG",
"RXMAC_CONFIG_REG",
"MAC_CTRL_CONFIG_REG",
"MAC_XIF_CONFIG_REG",
"BMAC_MIN_REG",
"BMAC_MAX_REG",
"MAC_PA_SIZE_REG",
"MAC_CTRL_TYPE_REG",
"BMAC_ADDR0_REG",
"BMAC_ADDR1_REG",
"BMAC_ADDR2_REG",
"BMAC_ADDR3_REG",
"BMAC_ADDR4_REG",
"BMAC_ADDR5_REG",
"BMAC_ADDR6_REG",
"BMAC_ADDR7_REG",
"BMAC_ADDR8_REG",
"BMAC_ADDR9_REG",
"BMAC_ADDR10_REG",
"BMAC_ADDR11_REG",
"BMAC_ADDR12_REG",
"BMAC_ADDR13_REG",
"BMAC_ADDR14_REG",
"BMAC_ADDR15_REG",
"BMAC_ADDR16_REG",
"BMAC_ADDR17_REG",
"BMAC_ADDR18_REG",
"BMAC_ADDR19_REG",
"BMAC_ADDR20_REG",
"BMAC_ADDR21_REG",
"BMAC_ADDR22_REG",
"BMAC_ADDR23_REG",
"MAC_FC_ADDR0_REG",
"MAC_FC_ADDR1_REG",
"MAC_FC_ADDR2_REG",
"MAC_ADDR_FILT0_REG",
"MAC_ADDR_FILT1_REG",
"MAC_ADDR_FILT2_REG",
"MAC_ADDR_FILT12_MASK_REG",
"MAC_ADDR_FILT00_MASK_REG",
"MAC_HASH_TBL0_REG",
"MAC_HASH_TBL1_REG",
"MAC_HASH_TBL2_REG",
"MAC_HASH_TBL3_REG",
"MAC_HASH_TBL4_REG",
"MAC_HASH_TBL5_REG",
"MAC_HASH_TBL6_REG",
"MAC_HASH_TBL7_REG",
"MAC_HASH_TBL8_REG",
"MAC_HASH_TBL9_REG",
"MAC_HASH_TBL10_REG",
"MAC_HASH_TBL11_REG",
"MAC_HASH_TBL12_REG",
"MAC_HASH_TBL13_REG",
"MAC_HASH_TBL14_REG",
"MAC_HASH_TBL15_REG",
"RXMAC_FRM_CNT_REG",
"MAC_LEN_ER_CNT_REG",
"BMAC_AL_ER_CNT_REG",
"BMAC_CRC_ER_CNT_REG",
"BMAC_CD_VIO_CNT_REG",
"BMAC_SM_REG",
"BMAC_ALTAD_CMPEN_REG",
"BMAC_HOST_INF0_REG",
"BMAC_HOST_INF1_REG",
"BMAC_HOST_INF2_REG",
"BMAC_HOST_INF3_REG",
"BMAC_HOST_INF4_REG",
"BMAC_HOST_INF5_REG",
"BMAC_HOST_INF6_REG",
"BMAC_HOST_INF7_REG",
"BMAC_HOST_INF8_REG",
"BTXMAC_BYTE_CNT_REG",
"BTXMAC_FRM_CNT_REG",
"BRXMAC_BYTE_CNT_REG",
};
{
int num_regs, i;
switch (port) {
case 0:
case 1:
"\nXMAC Register Dump for port %d\n",
port));
for (i = 0; i < num_regs; i++) {
#if defined(__i386)
&value);
#else
#endif
"%08llx %s\t %08llx \n",
}
"\n XMAC Register Dump for port %d done\n",
port));
break;
case 2:
case 3:
"\nBMAC Register Dump for port %d\n",
port));
for (i = 0; i < num_regs; i++) {
#if defined(__i386)
&value);
#else
#endif
"%08llx %s\t %08llx \n",
}
"\n BMAC Register Dump for port %d done\n",
port));
break;
}
return (NPI_SUCCESS);
}
{
return (NPI_SUCCESS);
}
{
return (NPI_SUCCESS);
}
{
return (NPI_SUCCESS);
}
{
return (NPI_SUCCESS);
}
{
NXGE_DELAY(20);
return (NPI_SUCCESS);
}
{
if (entryn >= MAC_MAX_HASH_ENTRY) {
" npi_mac_hashtab_entry"
" Invalid Input: entryn <0x%x>",
entryn));
}
} else {
}
} else {
} else {
}
}
return (NPI_SUCCESS);
}
{
if (entryn >= XMAC_MAX_HOST_INFO_ENTRY) {
" npi_mac_hostinfo_entry"
" Invalid Input: entryn <0x%x>",
entryn));
return (NPI_FAILURE |
}
} else {
if (entryn >= BMAC_MAX_HOST_INFO_ENTRY) {
" npi_mac_hostinfo_entry"
" Invalid Input: entryn <0x%x>",
entryn));
return (NPI_FAILURE |
}
}
} else {
}
} else {
} else {
}
}
return (NPI_SUCCESS);
}
{
if (addrn > XMAC_MAX_ALT_ADDR_ENTRY) {
" npi_mac_altaddr_enable"
" Invalid Input: addrn <0x%x>",
addrn));
return (NPI_FAILURE |
}
} else {
if (addrn > BMAC_MAX_ALT_ADDR_ENTRY) {
" npi_mac_altaddr_enable"
" Invalid Input: addrn <0x%x>",
addrn));
return (NPI_FAILURE |
}
}
return (NPI_SUCCESS);
}
/*
* While all bits of XMAC_ADDR_CMPEN_REG are for alternate MAC addresses,
* bit0 of BMAC_ALTAD_CMPEN_REG is for unique MAC address.
*/
{
if (addrn > XMAC_MAX_ALT_ADDR_ENTRY) {
" npi_mac_altaddr_disable"
" Invalid Input: addrn <0x%x>",
addrn));
return (NPI_FAILURE |
}
} else {
if (addrn > BMAC_MAX_ALT_ADDR_ENTRY) {
" npi_mac_altaddr_disable"
" Invalid Input: addrn <0x%x>",
addrn));
return (NPI_FAILURE |
}
}
return (NPI_SUCCESS);
}
{
if (entryn > XMAC_MAX_ALT_ADDR_ENTRY) {
" npi_mac_altaddr_entry"
" Invalid Input: entryn <0x%x>",
entryn));
return (NPI_FAILURE |
}
} else {
}
} else {
if (entryn > BMAC_MAX_ALT_ADDR_ENTRY) {
" npi_mac_altaddr_entry"
" Invalid Input: entryn <0x%x>",
entryn));
return (NPI_FAILURE |
}
} else {
}
}
return (NPI_SUCCESS);
}
{
case MAC_PORT_MODE:
switch (portn) {
case XMAC_PORT_0:
case XMAC_PORT_1:
(attr == MAC_GMII_MODE) || \
(attr == MAC_XGMII_MODE));
if ((attr != MAC_MII_MODE) &&
(attr != MAC_GMII_MODE) &&
(attr != MAC_XGMII_MODE)) {
" npi_mac_port_attr"
" Invalid Input:"
" MAC_PORT_MODE <0x%x>",
attr));
return (NPI_FAILURE |
}
&val);
switch (attr) {
case MAC_MII_MODE:
val |= (XMAC_XIF_MII_MODE <<
break;
case MAC_GMII_MODE:
val |= (XMAC_XIF_GMII_MODE <<
break;
case MAC_XGMII_MODE:
val |= (XMAC_XIF_XGMII_MODE <<
break;
default:
return (NPI_FAILURE |
}
val);
} else {
&val);
}
break;
case BMAC_PORT_0:
case BMAC_PORT_1:
" npi_mac_port_attr"
" Invalid Input:"
" MAC_PORT_MODE <0x%x>",
return (NPI_FAILURE |
default:
}
break;
case MAC_PORT_FRAME_SIZE: {
switch (portn) {
case XMAC_PORT_0:
case XMAC_PORT_1:
~XMAC_MIN_TX_FRM_SZ_MASK) == 0);
if ((min_fsize & ~XMAC_MIN_TX_FRM_SZ_MASK)
!= 0) {
" npi_mac_port_attr"
" MAC_PORT_FRAME_SIZE:"
" Invalid Input:"
" xmac_min_fsize <0x%x>",
min_fsize));
return (NPI_FAILURE |
}
~XMAC_MAX_FRM_SZ_MASK) == 0);
if ((max_fsize & ~XMAC_MAX_FRM_SZ_MASK)
!= 0) {
" npi_mac_port_attr"
" MAC_PORT_FRAME_SIZE:"
" Invalid Input:"
" xmac_max_fsize <0x%x>",
max_fsize));
return (NPI_FAILURE |
}
val &= ~(XMAC_MIN_TX_FRM_SZ_MASK |
} else {
}
break;
case BMAC_PORT_0:
case BMAC_PORT_1:
if ((min_fsize & ~BMAC_MIN_FRAME_MASK)
!= 0) {
" npi_mac_port_attr"
" MAC_FRAME_SIZE:"
" Invalid Input:"
" bmac_min_fsize <0x%x>",
min_fsize));
return (NPI_FAILURE |
}
if ((max_fsize & ~BMAC_MAX_FRAME_MASK)
!= 0) {
" npi_mac_port_attr"
" MAC_FRAME_SIZE:"
" Invalid Input:"
" bmac_max_fsize <0x%x>",
max_fsize));
return (NPI_FAILURE |
}
val &= ~BMAC_MAX_FRAME_MASK;
if (max_fsize <= MAX_FRAME_SZ1)
val |= MAX_FRAME_SZ1;
else if ((max_fsize > MAX_FRAME_SZ1) &&
(max_fsize <= MAX_FRAME_SZ2))
val |= MAX_FRAME_SZ2;
else if ((max_fsize > MAX_FRAME_SZ2) &&
(max_fsize <= MAX_FRAME_SZ3))
val |= MAX_FRAME_SZ3;
else if ((max_fsize > MAX_FRAME_SZ3) &&
(max_fsize <= MAX_FRAME_SZ4))
val |= MAX_FRAME_SZ4;
else if ((max_fsize > MAX_FRAME_SZ4) &&
(max_fsize <= MAX_FRAME_SZ5))
val |= MAX_FRAME_SZ5;
} else {
}
break;
default:
}
break;
}
case BMAC_PORT_MAX_BURST_SIZE: {
switch (portn) {
case XMAC_PORT_0:
case XMAC_PORT_1:
" npi_mac_port_attr"
" BMAC_PORT_MAX_BURST_SIZE:"
" Invalid Input: portn <%d>",
portn));
case BMAC_PORT_0:
case BMAC_PORT_1:
/* NOTE: Not used in Full duplex mode */
if ((burst_size & ~0x7FFF) != 0) {
" npi_mac_port_attr"
" BMAC_MAX_BURST_SIZE:"
" Invalid Input:"
" burst_size <0x%x>",
burst_size));
return (NPI_FAILURE |
}
val &= ~BMAC_MAX_BURST_MASK;
} else {
}
break;
default:
}
break;
}
case BMAC_PORT_PA_SIZE: {
switch (portn) {
case XMAC_PORT_0:
case XMAC_PORT_1:
" npi_mac_port_attr"
" BMAC_PORT_PA_SIZE:"
" Invalid Input: portn <%d>",
portn));
case BMAC_PORT_0:
case BMAC_PORT_1:
if ((pa_size & ~0x3FF) != 0) {
" npi_mac_port_attr"
" BMAC_PORT_PA_SIZE:"
" Invalid Input: pa_size <0x%x>",
pa_size));
return (NPI_FAILURE |
}
&val);
val &= ~BMAC_PA_SIZE_MASK;
val);
} else {
&val);
}
break;
default:
}
break;
}
case BMAC_PORT_CTRL_TYPE: {
switch (portn) {
case XMAC_PORT_0:
case XMAC_PORT_1:
" npi_mac_port_attr"
" BMAC_PORT_CTRL_TYPE:"
" Invalid Input: portn <%d>",
portn));
case BMAC_PORT_0:
case BMAC_PORT_1:
if ((ctrl_type & ~0xFFFF) != 0) {
" npi_mac_port_attr"
" BMAC_PORT_CTRL_TYPE:"
" Invalid Input:"
" ctrl_type <0x%x>",
ctrl_type));
return (NPI_FAILURE |
}
val);
} else {
&val);
}
break;
default:
}
break;
}
case XMAC_10G_PORT_IPG:
{
switch (portn) {
case XMAC_PORT_0:
case XMAC_PORT_1:
(ipg0 == XGMII_IPG_16_19) || \
(ipg0 == XGMII_IPG_20_23));
if ((ipg0 != XGMII_IPG_12_15) &&
(ipg0 != XGMII_IPG_16_19) &&
(ipg0 != XGMII_IPG_20_23)) {
" npi_mac_port_attr"
" MAC_10G_PORT_IPG:"
" Invalid Input:"
" xgmii_ipg <0x%x>",
ipg0));
return (NPI_FAILURE |
}
val &= ~(XMAC_IPG_VALUE_MASK |
switch (ipg0) {
case XGMII_IPG_12_15:
val |= (IPG_12_15_BYTE <<
break;
case XGMII_IPG_16_19:
val |= (IPG_16_19_BYTE <<
break;
case XGMII_IPG_20_23:
val |= (IPG_20_23_BYTE <<
break;
default:
return (NPI_FAILURE |
}
} else {
switch (ipg0) {
case IPG_12_15_BYTE:
break;
case IPG_16_19_BYTE:
break;
case IPG_20_23_BYTE:
break;
default:
return (NPI_FAILURE |
}
}
break;
case BMAC_PORT_0:
case BMAC_PORT_1:
" npi_mac_port_attr" "MAC_PORT_IPG:"
" Invalid Input: portn <%d>",
portn));
default:
}
break;
}
case XMAC_PORT_IPG:
{
switch (portn) {
case XMAC_PORT_0:
case XMAC_PORT_1:
(ipg1 == MII_GMII_IPG_13) || \
(ipg1 == MII_GMII_IPG_14) || \
(ipg1 == MII_GMII_IPG_15) || \
(ipg1 == MII_GMII_IPG_16));
if ((ipg1 != MII_GMII_IPG_12) &&
(ipg1 != MII_GMII_IPG_13) &&
(ipg1 != MII_GMII_IPG_14) &&
(ipg1 != MII_GMII_IPG_15) &&
(ipg1 != MII_GMII_IPG_16)) {
" npi_mac_port_attr"
" XMAC_PORT_IPG:"
" Invalid Input:"
" mii_gmii_ipg <0x%x>",
ipg1));
return (NPI_FAILURE |
}
val &= ~(XMAC_IPG_VALUE_MASK |
switch (ipg1) {
case MII_GMII_IPG_12:
val |= (IPG1_12_BYTES <<
break;
case MII_GMII_IPG_13:
val |= (IPG1_13_BYTES <<
break;
case MII_GMII_IPG_14:
val |= (IPG1_14_BYTES <<
break;
case MII_GMII_IPG_15:
val |= (IPG1_15_BYTES <<
break;
case MII_GMII_IPG_16:
val |= (IPG1_16_BYTES <<
break;
default:
return (NPI_FAILURE |
}
} else {
switch (ipg1) {
case IPG1_12_BYTES:
break;
case IPG1_13_BYTES:
break;
case IPG1_14_BYTES:
break;
case IPG1_15_BYTES:
break;
case IPG1_16_BYTES:
break;
default:
return (NPI_FAILURE |
}
}
break;
case BMAC_PORT_0:
case BMAC_PORT_1:
" npi_mac_port_attr"
" MAC_PORT_IPG:"
" Invalid Input: portn <%d>",
portn));
default:
}
break;
}
case MAC_PORT_ADDR: {
switch (portn) {
case XMAC_PORT_0:
case XMAC_PORT_1:
if ((addr0 & ~0xFFFF) != 0) {
" npi_mac_port_attr"
" MAC_PORT_ADDR:"
" Invalid Input:"
" addr0 <0x%x>", addr0));
return (NPI_FAILURE |
}
if ((addr1 & ~0xFFFF) != 0) {
" npi_mac_port_attr"
" MAC_PORT_ADDR:"
" Invalid Input:"
" addr1 <0x%x>", addr1));
return (NPI_FAILURE |
}
if ((addr2 & ~0xFFFF) != 0) {
" npi_mac_port_attr"
" MAC_PORT_ADDR:"
" Invalid Input:"
" addr2 <0x%x.",
addr2));
return (NPI_FAILURE |
}
addr0);
addr1);
addr2);
} else {
&addr0);
&addr1);
&addr2);
}
break;
case BMAC_PORT_0:
case BMAC_PORT_1:
if ((addr0 & ~0xFFFF) != 0) {
" npi_mac_port_attr"
" MAC_PORT_ADDR:"
" Invalid Input:"
" addr0 <0x%x>",
addr0));
return (NPI_FAILURE |
}
if ((addr1 & ~0xFFFF) != 0) {
" npi_mac_port_attr"
" MAC_PORT_ADDR:"
" Invalid Input:"
" addr1 <0x%x>",
addr1));
return (NPI_FAILURE |
}
if ((addr2 & ~0xFFFF) != 0) {
" npi_mac_port_attr"
" MAC_PORT_ADDR:"
" Invalid Input:"
" addr2 <0x%x>",
addr2));
return (NPI_FAILURE |
}
addr0);
addr1);
addr2);
} else {
&addr0);
&addr1);
&addr2);
}
break;
default:
}
break;
}
case MAC_PORT_ADDR_FILTER: {
switch (portn) {
case XMAC_PORT_0:
case XMAC_PORT_1:
if ((addr0 & ~0xFFFF) != 0) {
" npi_mac_port_attr"
" MAC_PORT_ADDR_FILTER:"
" Invalid Input:"
" addr0 <0x%x>",
addr0));
return (NPI_FAILURE |
}
if ((addr1 & ~0xFFFF) != 0) {
" npi_mac_port_attr"
" MAC_PORT_ADDR_FILTER:"
" Invalid Input:"
" addr1 <0x%x>",
addr1));
return (NPI_FAILURE |
}
if ((addr2 & ~0xFFFF) != 0) {
" npi_mac_port_attr"
" MAC_PORT_ADDR_FILTER:"
" Invalid Input:"
" addr2 <0x%x>",
addr2));
return (NPI_FAILURE |
}
} else {
}
break;
case BMAC_PORT_0:
case BMAC_PORT_1:
if ((addr0 & ~0xFFFF) != 0) {
" npi_mac_port_attr"
" MAC_PORT_ADDR_FILTER:"
" addr0",
addr0));
return (NPI_FAILURE |
}
if ((addr1 & ~0xFFFF) != 0) {
" npi_mac_port_attr"
" MAC_PORT_ADDR_FILTER:"
" Invalid Input:"
" addr1 <0x%x>",
addr1));
return (NPI_FAILURE |
}
if ((addr2 & ~0xFFFF) != 0) {
" npi_mac_port_attr"
" MAC_PORT_ADDR_FILTER:"
" Invalid Input:"
" addr2 <0x%x>",
addr2));
return (NPI_FAILURE |
}
addr0);
addr1);
addr2);
} else {
&addr0);
&addr1);
&addr2);
}
break;
default:
}
break;
}
case MAC_PORT_ADDR_FILTER_MASK: {
switch (portn) {
case XMAC_PORT_0:
case XMAC_PORT_1:
if ((mask_0 & ~0xFFFF) != 0) {
" npi_mac_port_attr"
" MAC_ADDR_FILTER_MASK:"
" Invalid Input:"
" mask_0 <0x%x>",
mask_0));
return (NPI_FAILURE |
}
if ((mask_1_2 & ~0xFF) != 0) {
" npi_mac_port_attr"
" MAC_ADDR_FILTER_MASK:"
" Invalid Input:"
" mask_1_2 <0x%x>",
mask_1_2));
return (NPI_FAILURE |
}
} else {
}
break;
case BMAC_PORT_0:
case BMAC_PORT_1:
} else {
}
break;
default:
}
break;
}
default:
" npi_mac_port_attr"
" Invalid Input:"
}
return (NPI_SUCCESS);
}
{
switch (mode) {
case XTX_MAC_REG_RESET:
break;
case XRX_MAC_REG_RESET:
break;
case XTX_MAC_LOGIC_RESET:
break;
case XRX_MAC_LOGIC_RESET:
break;
case XTX_MAC_RESET_ALL:
break;
case XRX_MAC_RESET_ALL:
break;
default:
" npi_mac_reset"
" Invalid Input: mode <0x%x>",
mode));
}
if (val != 0) {
" npi_xmac_reset"
" HW ERROR: MAC_RESET failed <0x%x>",
val));
if (txmac)
else
}
return (NPI_SUCCESS);
}
{
switch (op) {
case ENABLE:
case DISABLE:
" npi_xmac_xif_config"
" Invalid Input:"
" config <0x%x>", config));
}
if (config & CFG_XMAC_XIF_LED_FORCE)
if (config & CFG_XMAC_XIF_LED_POLARITY)
if (config & CFG_XMAC_XIF_TX_OUTPUT)
if (config & CFG_XMAC_XIF_LOOPBACK) {
val |= XMAC_XIF_LOOPBACK;
}
if (config & CFG_XMAC_XIF_LFS)
val &= ~XMAC_XIF_LFS_DISABLE;
if (config & CFG_XMAC_XIF_XPCS_BYPASS)
if (config & CFG_XMAC_XIF_1G_PCS_BYPASS)
if (config & CFG_XMAC_XIF_SEL_CLK_25MHZ)
} else {
if (config & CFG_XMAC_XIF_LED_FORCE)
val &= ~XMAC_XIF_FORCE_LED_ON;
if (config & CFG_XMAC_XIF_LED_POLARITY)
val &= ~XMAC_XIF_LED_POLARITY;
if (config & CFG_XMAC_XIF_TX_OUTPUT)
val &= ~XMAC_XIF_TX_OUTPUT_EN;
if (config & CFG_XMAC_XIF_LOOPBACK)
val &= ~XMAC_XIF_LOOPBACK;
if (config & CFG_XMAC_XIF_LFS)
if (config & CFG_XMAC_XIF_XPCS_BYPASS)
val &= ~XMAC_XIF_XPCS_BYPASS;
if (config & CFG_XMAC_XIF_1G_PCS_BYPASS)
if (config & CFG_XMAC_XIF_SEL_CLK_25MHZ)
}
break;
case INIT:
if ((config & ~CFG_XMAC_XIF_ALL) != 0) {
" npi_xmac_xif_config"
" Invalid Input: config <0x%x>",
config));
}
if (config & CFG_XMAC_XIF_LED_FORCE)
else
val &= ~XMAC_XIF_FORCE_LED_ON;
if (config & CFG_XMAC_XIF_LED_POLARITY)
else
val &= ~XMAC_XIF_LED_POLARITY;
else
if (config & CFG_XMAC_XIF_TX_OUTPUT)
else
val &= ~XMAC_XIF_TX_OUTPUT_EN;
if (config & CFG_XMAC_XIF_LOOPBACK) {
val |= XMAC_XIF_LOOPBACK;
#ifdef AXIS_DEBUG_LB
#endif
} else {
val &= ~XMAC_XIF_LOOPBACK;
}
if (config & CFG_XMAC_XIF_LFS)
val &= ~XMAC_XIF_LFS_DISABLE;
else
if (config & CFG_XMAC_XIF_XPCS_BYPASS)
else
val &= ~XMAC_XIF_XPCS_BYPASS;
if (config & CFG_XMAC_XIF_1G_PCS_BYPASS)
else
if (config & CFG_XMAC_XIF_SEL_CLK_25MHZ)
else
break;
default:
" npi_xmac_xif_config"
" Invalid Input: op <0x%x>", op));
}
return (NPI_SUCCESS);
}
{
switch (op) {
case ENABLE:
case DISABLE:
" npi_xmac_tx_config"
" Invalid Input: config <0x%x>",
config));
}
if (config & CFG_XMAC_TX)
if (config & CFG_XMAC_TX_STRETCH_MODE)
if (config & CFG_XMAC_VAR_IPG)
if (config & CFG_XMAC_TX_CRC)
} else {
if (config & CFG_XMAC_TX)
val &= ~XMAC_TX_CFG_TX_ENABLE;
if (config & CFG_XMAC_TX_STRETCH_MODE)
if (config & CFG_XMAC_VAR_IPG)
if (config & CFG_XMAC_TX_CRC)
}
break;
case INIT:
if ((config & ~CFG_XMAC_TX_ALL) != 0) {
" npi_xmac_tx_config"
" Invalid Input: config <0x%x>",
config));
}
if (config & CFG_XMAC_TX)
else
val &= ~XMAC_TX_CFG_TX_ENABLE;
if (config & CFG_XMAC_TX_STRETCH_MODE)
else
if (config & CFG_XMAC_VAR_IPG)
else
if (config & CFG_XMAC_TX_CRC)
else
break;
default:
" npi_xmac_tx_config"
" Invalid Input: op <0x%x>",
op));
}
return (NPI_SUCCESS);
}
{
switch (op) {
case ENABLE:
case DISABLE:
" npi_xmac_rx_config"
" Invalid Input: config <0x%x>",
config));
}
if (config & CFG_XMAC_RX)
if (config & CFG_XMAC_RX_PROMISCUOUS)
if (config & CFG_XMAC_RX_ERRCHK)
if (config & CFG_XMAC_RX_CRC_CHK)
if (config & CFG_XMAC_RX_RESV_MULTICAST)
if (config & CFG_XMAC_RX_CODE_VIO_CHK)
if (config & CFG_XMAC_RX_HASH_FILTER)
if (config & CFG_XMAC_RX_ADDR_FILTER)
if (config & CFG_XMAC_RX_STRIP_CRC)
if (config & CFG_XMAC_RX_PAUSE)
if (config & CFG_XMAC_RX_PASS_FC_FRAME)
} else {
if (config & CFG_XMAC_RX)
val &= ~XMAC_RX_CFG_RX_ENABLE;
if (config & CFG_XMAC_RX_PROMISCUOUS)
val &= ~XMAC_RX_CFG_PROMISC;
if (config & CFG_XMAC_RX_ERRCHK)
if (config & CFG_XMAC_RX_CRC_CHK)
if (config & CFG_XMAC_RX_RESV_MULTICAST)
if (config & CFG_XMAC_RX_CODE_VIO_CHK)
if (config & CFG_XMAC_RX_HASH_FILTER)
if (config & CFG_XMAC_RX_ADDR_FILTER)
if (config & CFG_XMAC_RX_STRIP_CRC)
val &= ~XMAC_RX_CFG_STRIP_CRC;
if (config & CFG_XMAC_RX_PAUSE)
if (config & CFG_XMAC_RX_PASS_FC_FRAME)
}
break;
case INIT:
if ((config & ~CFG_XMAC_RX_ALL) != 0) {
" npi_xmac_rx_config"
" Invalid Input: config <0x%x>",
config));
}
if (config & CFG_XMAC_RX)
else
val &= ~XMAC_RX_CFG_RX_ENABLE;
if (config & CFG_XMAC_RX_PROMISCUOUS)
else
val &= ~XMAC_RX_CFG_PROMISC;
else
if (config & CFG_XMAC_RX_ERRCHK)
else
if (config & CFG_XMAC_RX_CRC_CHK)
else
if (config & CFG_XMAC_RX_RESV_MULTICAST)
else
if (config & CFG_XMAC_RX_CODE_VIO_CHK)
else
if (config & CFG_XMAC_RX_HASH_FILTER)
else
if (config & CFG_XMAC_RX_ADDR_FILTER)
else
if (config & CFG_XMAC_RX_PAUSE)
else
if (config & CFG_XMAC_RX_STRIP_CRC)
else
val &= ~XMAC_RX_CFG_STRIP_CRC;
if (config & CFG_XMAC_RX_PASS_FC_FRAME)
else
break;
default:
" npi_xmac_rx_config"
" Invalid Input: op <0x%x>", op));
}
return (NPI_SUCCESS);
}
{
switch (op) {
case ENABLE:
case DISABLE:
" npi_xmac_tx_iconfig"
" Invalid Input: iconfig <0x%x>",
iconfig));
}
else
break;
case INIT:
if ((iconfig & ~ICFG_XMAC_TX_ALL) != 0) {
" npi_xmac_tx_iconfig"
" Invalid Input: iconfig <0x%x>",
iconfig));
}
break;
default:
" npi_xmac_tx_iconfig"
" Invalid Input: iconfig <0x%x>",
iconfig));
}
return (NPI_SUCCESS);
}
{
switch (op) {
case ENABLE:
case DISABLE:
" npi_xmac_rx_iconfig"
" Invalid Input: iconfig <0x%x>",
iconfig));
}
else
break;
case INIT:
if ((iconfig & ~ICFG_XMAC_RX_ALL) != 0) {
" npi_xmac_rx_iconfig"
" Invalid Input: iconfig <0x%x>",
iconfig));
}
break;
default:
" npi_xmac_rx_iconfig"
" Invalid Input: iconfig <0x%x>",
iconfig));
}
return (NPI_SUCCESS);
}
{
switch (op) {
case ENABLE:
case DISABLE:
((iconfig & ~ICFG_XMAC_CTRL_ALL) == 0));
" npi_xmac_ctl_iconfig"
" Invalid Input: iconfig <0x%x>",
iconfig));
}
else
break;
case INIT:
if ((iconfig & ~ICFG_XMAC_CTRL_ALL) != 0) {
" npi_xmac_ctl_iconfig"
" Invalid Input: iconfig <0x%x>",
iconfig));
}
break;
default:
" npi_xmac_ctl_iconfig"
" Invalid Input: iconfig <0x%x>",
iconfig));
}
return (NPI_SUCCESS);
}
{
return (NPI_SUCCESS);
}
{
return (NPI_SUCCESS);
}
{
return (NPI_SUCCESS);
}
{
val |= XPCS_CTRL1_RST;
NXGE_DELAY(10);
}
if (delay == 0) {
" npi_xmac_xpcs_reset portn <%d> failed", portn));
return (NPI_FAILURE);
}
return (NPI_SUCCESS);
}
{
return (NPI_SUCCESS);
}
{
val &= ~XPCS_CFG_XPCS_ENABLE;
return (NPI_SUCCESS);
}
{
switch (xpcs_reg) {
case XPCS_REG_CONTROL1:
break;
case XPCS_REG_STATUS1:
break;
case XPCS_REG_DEVICE_ID:
break;
case XPCS_REG_SPEED_ABILITY:
break;
case XPCS_REG_DEVICE_IN_PKG:
break;
case XPCS_REG_CONTROL2:
break;
case XPCS_REG_STATUS2:
break;
case XPCS_REG_PKG_ID:
break;
case XPCS_REG_STATUS:
break;
case XPCS_REG_TEST_CONTROL:
break;
case XPCS_REG_CONFIG_VENDOR1:
break;
case XPCS_REG_DIAG_VENDOR2:
break;
case XPCS_REG_MASK1:
break;
case XPCS_REG_PACKET_COUNTER:
break;
case XPCS_REG_TX_STATEMACHINE:
break;
break;
break;
break;
case XPCS_REG_TRAINING_VECTOR:
break;
default:
" npi_xmac_xpcs_read"
" Invalid Input: xpcs_reg <0x%x>",
xpcs_reg));
}
return (NPI_SUCCESS);
}
{
switch (xpcs_reg) {
case XPCS_REG_CONTROL1:
break;
case XPCS_REG_TEST_CONTROL:
break;
case XPCS_REG_CONFIG_VENDOR1:
break;
case XPCS_REG_DIAG_VENDOR2:
break;
case XPCS_REG_MASK1:
break;
case XPCS_REG_PACKET_COUNTER:
break;
break;
case XPCS_REG_TRAINING_VECTOR:
break;
default:
" npi_xmac_xpcs_write"
" Invalid Input: xpcs_reg <0x%x>",
xpcs_reg));
}
return (NPI_SUCCESS);
}
{
switch (mode) {
case TX_MAC_RESET:
break;
case RX_MAC_RESET:
break;
default:
" npi_bmac_reset"
" Invalid Input: mode <0x%x>",
mode));
}
if (val != 0) {
" npi_bmac_reset"
" BMAC_RESET HW Error: ret <0x%x>",
val));
if (txmac)
else
}
return (NPI_SUCCESS);
}
{
/* what to do here ? */
val |= PCS_MII_RESET;
NXGE_DELAY(10);
delay--;
}
if (delay == 0) {
" npi_bmac_pcs_reset portn <%d> failed", portn));
return (NPI_FAILURE);
}
return (NPI_SUCCESS);
}
{
if (val & PCS_MII_STATUS_LINK_STATUS) {
} else {
}
return (NPI_SUCCESS);
}
{
switch (op) {
case ENABLE:
case DISABLE:
" npi_bmac_tx_config"
" Invalid Input: config <0x%x>",
config));
}
if (config & CFG_BMAC_TX)
if (config & CFG_BMAC_TX_CRC)
val &= ~MAC_TX_CFG_NO_FCS;
} else {
if (config & CFG_BMAC_TX)
if (config & CFG_BMAC_TX_CRC)
val |= MAC_TX_CFG_NO_FCS;
}
break;
case INIT:
if ((config & ~CFG_BMAC_TX_ALL) != 0) {
" npi_bmac_tx_config"
" Invalid Input: config <0x%x>",
config));
}
if (config & CFG_BMAC_TX)
else
if (config & CFG_BMAC_TX_CRC)
val &= ~MAC_TX_CFG_NO_FCS;
else
val |= MAC_TX_CFG_NO_FCS;
break;
default:
" npi_bmac_tx_config"
" Invalid Input: op <0x%x>",
op));
}
return (NPI_SUCCESS);
}
{
switch (op) {
case ENABLE:
case DISABLE:
" npi_bmac_rx_config"
" Invalid Input: config <0x%x>",
config));
}
if (config & CFG_BMAC_RX)
if (config & CFG_BMAC_RX_STRIP_PAD)
if (config & CFG_BMAC_RX_STRIP_CRC)
if (config & CFG_BMAC_RX_PROMISCUOUS)
if (config & CFG_BMAC_RX_HASH_FILTER)
if (config & CFG_BMAC_RX_ADDR_FILTER)
if (config & CFG_BMAC_RX_DISCARD_ON_ERR)
} else {
if (config & CFG_BMAC_RX)
if (config & CFG_BMAC_RX_STRIP_PAD)
val &= ~MAC_RX_CFG_STRIP_PAD;
if (config & CFG_BMAC_RX_STRIP_CRC)
val &= ~MAC_RX_CFG_STRIP_FCS;
if (config & CFG_BMAC_RX_PROMISCUOUS)
val &= ~MAC_RX_CFG_PROMISC;
if (config & CFG_BMAC_RX_HASH_FILTER)
if (config & CFG_BMAC_RX_ADDR_FILTER)
if (config & CFG_BMAC_RX_DISCARD_ON_ERR)
}
break;
case INIT:
if ((config & ~CFG_BMAC_RX_ALL) != 0) {
" npi_bmac_rx_config"
" Invalid Input: config <0x%x>",
config));
}
if (config & CFG_BMAC_RX)
else
if (config & CFG_BMAC_RX_STRIP_PAD)
else
val &= ~MAC_RX_CFG_STRIP_PAD;
if (config & CFG_BMAC_RX_STRIP_CRC)
else
val &= ~MAC_RX_CFG_STRIP_FCS;
if (config & CFG_BMAC_RX_PROMISCUOUS)
else
val &= ~MAC_RX_CFG_PROMISC;
else
if (config & CFG_BMAC_RX_HASH_FILTER)
else
if (config & CFG_BMAC_RX_ADDR_FILTER)
else
if (config & CFG_BMAC_RX_DISCARD_ON_ERR)
else
break;
default:
" npi_bmac_rx_config"
" Invalid Input: op <0x%x>", op));
}
return (NPI_SUCCESS);
}
{
switch (op) {
case ENABLE:
case DISABLE:
" npi_bmac_rx_iconfig"
" Invalid Input: iconfig <0x%x>",
iconfig));
}
else
break;
case INIT:
if ((iconfig & ~ICFG_BMAC_RX_ALL) != 0) {
" npi_bmac_rx_iconfig"
" Invalid Input: iconfig <0x%x>",
iconfig));
}
break;
default:
" npi_bmac_rx_iconfig"
" Invalid Input: iconfig <0x%x>",
iconfig));
}
return (NPI_SUCCESS);
}
{
switch (op) {
case ENABLE:
case DISABLE:
" npi_bmac_xif_config"
" Invalid Input: config <0x%x>",
config));
}
if (config & CFG_BMAC_XIF_TX_OUTPUT)
if (config & CFG_BMAC_XIF_LOOPBACK)
if (config & CFG_BMAC_XIF_GMII_MODE)
val |= MAC_XIF_GMII_MODE;
if (config & CFG_BMAC_XIF_LINKLED)
val |= MAC_XIF_LINK_LED;
if (config & CFG_BMAC_XIF_LED_POLARITY)
if (config & CFG_BMAC_XIF_SEL_CLK_25MHZ)
} else {
if (config & CFG_BMAC_XIF_TX_OUTPUT)
val &= ~MAC_XIF_TX_OUTPUT_EN;
if (config & CFG_BMAC_XIF_LOOPBACK)
if (config & CFG_BMAC_XIF_GMII_MODE)
val &= ~MAC_XIF_GMII_MODE;
if (config & CFG_BMAC_XIF_LINKLED)
val &= ~MAC_XIF_LINK_LED;
if (config & CFG_BMAC_XIF_LED_POLARITY)
val &= ~MAC_XIF_LED_POLARITY;
if (config & CFG_BMAC_XIF_SEL_CLK_25MHZ)
val &= ~MAC_XIF_SEL_CLK_25MHZ;
}
break;
case INIT:
if ((config & ~CFG_BMAC_XIF_ALL) != 0) {
" npi_bmac_xif_config"
" Invalid Input: config <0x%x>",
config));
}
if (config & CFG_BMAC_XIF_TX_OUTPUT)
else
val &= ~MAC_XIF_TX_OUTPUT_EN;
if (config & CFG_BMAC_XIF_LOOPBACK)
else
if (config & CFG_BMAC_XIF_GMII_MODE)
val |= MAC_XIF_GMII_MODE;
else
val &= ~MAC_XIF_GMII_MODE;
if (config & CFG_BMAC_XIF_LINKLED)
val |= MAC_XIF_LINK_LED;
else
val &= ~MAC_XIF_LINK_LED;
if (config & CFG_BMAC_XIF_LED_POLARITY)
else
val &= ~MAC_XIF_LED_POLARITY;
if (config & CFG_BMAC_XIF_SEL_CLK_25MHZ)
else
val &= ~MAC_XIF_SEL_CLK_25MHZ;
break;
default:
" npi_bmac_xif_config"
" Invalid Input: op <0x%x>",
op));
}
return (NPI_SUCCESS);
}
{
switch (op) {
case ENABLE:
case DISABLE:
" npi_bmac_tx_iconfig"
" Invalid Input: iconfig <0x%x>",
iconfig));
}
else
break;
case INIT:
if ((iconfig & ~ICFG_XMAC_TX_ALL) != 0) {
" npi_bmac_tx_iconfig"
" Invalid Input: iconfig <0x%x>",
iconfig));
}
break;
default:
" npi_bmac_tx_iconfig"
" Invalid Input: iconfig <0x%x>",
iconfig));
}
return (NPI_SUCCESS);
}
{
switch (op) {
case ENABLE:
case DISABLE:
" npi_bmac_ctl_iconfig"
" Invalid Input: iconfig <0x%x>",
iconfig));
}
else
break;
case INIT:
if ((iconfig & ~ICFG_BMAC_RX_ALL) != 0) {
" npi_bmac_ctl_iconfig"
" Invalid Input: iconfig <0x%x>",
iconfig));
}
break;
default:
" npi_bmac_ctl_iconfig"
" Invalid Input: iconfig <0x%x>",
iconfig));
}
return (NPI_SUCCESS);
}
{
return (NPI_SUCCESS);
}
{
return (NPI_SUCCESS);
}
{
return (NPI_SUCCESS);
}
{
delay = 0;
"mdio read no response1\n"));
}
delay = 0;
"mdio read no response2\n"));
}
return (NPI_SUCCESS);
}
{
delay = 0;
if (delay == MAX_PIO_RETRIES)
"mif mii read port %d reg=0x%x frame=0x%x\n", portn,
return (NPI_SUCCESS);
}
{
delay = 0;
"mdio write no response1\n"));
}
delay = 0;
"mdio write no response2\n"));
}
return (NPI_SUCCESS);
}
{
delay = 0;
"mif mii write port %d reg=0x%x frame=0x%x\n", portn,
if (delay == MAX_PIO_RETRIES)
return (NPI_SUCCESS);
}
{
switch (xcvr_reg) {
case MII_CONTROL:
break;
case MII_STATUS:
}
break;
case NXGE_MII_ESR:
break;
case MII_AN_ADVERT:
break;
case MII_AN_LPABLE:
break;
case MII_AN_EXPANSION:
break;
case NXGE_MII_GSR:
break;
default:
" npi_mac_pcs_mii_read"
" Invalid Input: xcvr_reg <0x%x>",
xcvr_reg));
}
return (NPI_SUCCESS);
}
{
switch (xcvr_reg) {
case MII_CONTROL:
break;
case MII_AN_ADVERT:
break;
case NXGE_MII_GCR:
break;
default:
" npi_mac_pcs_mii_write"
" Invalid Input: xcvr_reg <0x%x>",
xcvr_reg));
}
return (NPI_SUCCESS);
}
{
if (xcvr_reg > NXGE_MAX_MII_REGS) {
" npi_mac_mif_link_intr_enable"
" Invalid Input: xcvr_reg <0x%x>",
xcvr_reg));
}
NXGE_DELAY(20);
return (NPI_SUCCESS);
}
{
delay = 0;
if (delay == MAX_PIO_RETRIES)
return (NPI_FAILURE);
NXGE_DELAY(20);
return (NPI_SUCCESS);
}
void
{
}
void
{
}
{
return (NPI_SUCCESS);
}
{
if (on_off) {
val &= ~XMAC_XIF_FORCE_LED_ON;
} else {
val &= ~XMAC_XIF_LED_POLARITY;
}
return (NPI_SUCCESS);
}
{
return (NPI_SUCCESS);
}
{
return (NPI_SUCCESS);
}