xref: /onnv-gate/usr/src/uts/common/io/nxge/nxge_txc.c (revision 5125:43f30c4f3307)
13859Sml29623 /*
23859Sml29623  * CDDL HEADER START
33859Sml29623  *
43859Sml29623  * The contents of this file are subject to the terms of the
53859Sml29623  * Common Development and Distribution License (the "License").
63859Sml29623  * You may not use this file except in compliance with the License.
73859Sml29623  *
83859Sml29623  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
93859Sml29623  * or http://www.opensolaris.org/os/licensing.
103859Sml29623  * See the License for the specific language governing permissions
113859Sml29623  * and limitations under the License.
123859Sml29623  *
133859Sml29623  * When distributing Covered Code, include this CDDL HEADER in each
143859Sml29623  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
153859Sml29623  * If applicable, add the following below this CDDL HEADER, with the
163859Sml29623  * fields enclosed by brackets "[]" replaced with your own identifying
173859Sml29623  * information: Portions Copyright [yyyy] [name of copyright owner]
183859Sml29623  *
193859Sml29623  * CDDL HEADER END
203859Sml29623  */
213859Sml29623 /*
223859Sml29623  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
233859Sml29623  * Use is subject to license terms.
243859Sml29623  */
253859Sml29623 
263859Sml29623 #pragma ident	"%Z%%M%	%I%	%E% SMI"
273859Sml29623 
283859Sml29623 #include <sys/nxge/nxge_impl.h>
293859Sml29623 #include <sys/nxge/nxge_txc.h>
303859Sml29623 
313859Sml29623 static nxge_status_t
323859Sml29623 nxge_txc_handle_port_errors(p_nxge_t, uint32_t);
333859Sml29623 static void
343859Sml29623 nxge_txc_inject_port_err(uint8_t, txc_int_stat_dbg_t *,
353859Sml29623 			uint8_t istats);
363859Sml29623 extern nxge_status_t nxge_tx_port_fatal_err_recover(p_nxge_t);
373859Sml29623 
383859Sml29623 nxge_status_t
393859Sml29623 nxge_txc_init(p_nxge_t nxgep)
403859Sml29623 {
413859Sml29623 	uint8_t			port;
423859Sml29623 	npi_handle_t		handle;
433859Sml29623 	npi_status_t		rs = NPI_SUCCESS;
443859Sml29623 
453859Sml29623 	handle = NXGE_DEV_NPI_HANDLE(nxgep);
463859Sml29623 	port = NXGE_GET_PORT_NUM(nxgep->function_num);
473859Sml29623 
483859Sml29623 	NXGE_DEBUG_MSG((nxgep, TX_CTL, "==> nxge_txc_init: portn %d", port));
493859Sml29623 
503859Sml29623 	/*
513859Sml29623 	 * Enable the TXC controller.
523859Sml29623 	 */
533859Sml29623 	if ((rs = npi_txc_global_enable(handle)) != NPI_SUCCESS) {
543859Sml29623 		goto fail;
553859Sml29623 	}
563859Sml29623 
573859Sml29623 	/* Enable this port within the TXC. */
583859Sml29623 	if ((rs = npi_txc_port_enable(handle, port)) != NPI_SUCCESS) {
593859Sml29623 		goto fail;
603859Sml29623 	}
613859Sml29623 
623859Sml29623 	/* Bind DMA channels to this port. */
633859Sml29623 	if ((rs = npi_txc_port_dma_enable(handle, port,
643859Sml29623 			TXDMA_PORT_BITMAP(nxgep))) != NPI_SUCCESS) {
653859Sml29623 		goto fail;
663859Sml29623 	}
673859Sml29623 
683859Sml29623 	/* Unmask all TXC interrupts */
693859Sml29623 	npi_txc_global_imask_set(handle, port, 0);
703859Sml29623 
713859Sml29623 	NXGE_DEBUG_MSG((nxgep, TX_CTL, "<== nxge_txc_init: portn %d", port));
723859Sml29623 
733859Sml29623 	return (NXGE_OK);
743859Sml29623 fail:
753859Sml29623 	NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
763859Sml29623 			"nxge_txc_init: Failed to initialize txc on port %d",
773859Sml29623 			port));
783859Sml29623 
793859Sml29623 	return (NXGE_ERROR | rs);
803859Sml29623 }
813859Sml29623 
823859Sml29623 nxge_status_t
833859Sml29623 nxge_txc_uninit(p_nxge_t nxgep)
843859Sml29623 {
853859Sml29623 	uint8_t			port;
863859Sml29623 	npi_handle_t		handle;
873859Sml29623 	npi_status_t		rs = NPI_SUCCESS;
883859Sml29623 
893859Sml29623 	handle = NXGE_DEV_NPI_HANDLE(nxgep);
903859Sml29623 	port = NXGE_GET_PORT_NUM(nxgep->function_num);
913859Sml29623 
923859Sml29623 	NXGE_DEBUG_MSG((nxgep, TX_CTL, "==> nxge_txc_uninit: portn %d", port));
933859Sml29623 
943859Sml29623 	/*
953859Sml29623 	 * disable the TXC controller.
963859Sml29623 	 */
973859Sml29623 	if ((rs = npi_txc_global_disable(handle)) != NPI_SUCCESS) {
983859Sml29623 		goto fail;
993859Sml29623 	}
1003859Sml29623 
1013859Sml29623 	/* disable this port within the TXC. */
1023859Sml29623 	if ((rs = npi_txc_port_disable(handle, port)) != NPI_SUCCESS) {
1033859Sml29623 		goto fail;
1043859Sml29623 	}
1053859Sml29623 
1063859Sml29623 	/* unbind DMA channels to this port. */
1073859Sml29623 	if ((rs = npi_txc_port_dma_enable(handle, port, 0)) != NPI_SUCCESS) {
1083859Sml29623 		goto fail;
1093859Sml29623 	}
1103859Sml29623 
1113859Sml29623 	NXGE_DEBUG_MSG((nxgep, TX_CTL, "<== nxge_txc_uninit: portn %d", port));
1123859Sml29623 
1133859Sml29623 	return (NXGE_OK);
1143859Sml29623 fail:
1153859Sml29623 	NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
1163859Sml29623 			"nxge_txc_init: Failed to initialize txc on port %d",
1173859Sml29623 			port));
1183859Sml29623 
1193859Sml29623 	return (NXGE_ERROR | rs);
1203859Sml29623 }
1213859Sml29623 
1223859Sml29623 void
1233859Sml29623 nxge_txc_regs_dump(p_nxge_t nxgep)
1243859Sml29623 {
1253859Sml29623 	uint32_t		cnt1, cnt2;
1263859Sml29623 	npi_handle_t		handle;
1273859Sml29623 	txc_control_t		control;
1283859Sml29623 	uint32_t		bitmap = 0;
1293859Sml29623 
1303859Sml29623 	NXGE_DEBUG_MSG((nxgep, TX_CTL, "\nTXC dump: func # %d:\n",
1313859Sml29623 		nxgep->function_num));
1323859Sml29623 
1333859Sml29623 	handle = NXGE_DEV_NPI_HANDLE(nxgep);
1343859Sml29623 
1353859Sml29623 	(void) npi_txc_control(handle, OP_GET, &control);
1363859Sml29623 	(void) npi_txc_port_dma_list_get(handle, nxgep->function_num, &bitmap);
1373859Sml29623 
1383859Sml29623 	NXGE_DEBUG_MSG((nxgep, TX_CTL, "\n\tTXC port control 0x%0llx",
1393859Sml29623 		(long long)control.value));
1403859Sml29623 	NXGE_DEBUG_MSG((nxgep, TX_CTL, "\n\tTXC port bitmap 0x%x", bitmap));
1413859Sml29623 
1423859Sml29623 	(void) npi_txc_pkt_xmt_to_mac_get(handle, nxgep->function_num,
1433859Sml29623 	    &cnt1, &cnt2);
1443859Sml29623 	NXGE_DEBUG_MSG((nxgep, TX_CTL, "\n\tTXC bytes to MAC %d "
1453859Sml29623 		"packets to MAC %d",
1463859Sml29623 		cnt1, cnt2));
1473859Sml29623 
1483859Sml29623 	(void) npi_txc_pkt_stuffed_get(handle, nxgep->function_num,
1493859Sml29623 					    &cnt1, &cnt2);
1503859Sml29623 	NXGE_DEBUG_MSG((nxgep, TX_CTL,
1513859Sml29623 		"\n\tTXC ass packets %d reorder packets %d",
1523859Sml29623 		cnt1 & 0xffff, cnt2 & 0xffff));
1533859Sml29623 
1543859Sml29623 	(void) npi_txc_reorder_get(handle, nxgep->function_num, &cnt1);
1553859Sml29623 	NXGE_DEBUG_MSG((nxgep, TX_CTL,
1563859Sml29623 		"\n\tTXC reorder resource %d", cnt1 & 0xff));
1573859Sml29623 }
1583859Sml29623 
1593859Sml29623 nxge_status_t
1603859Sml29623 nxge_txc_handle_sys_errors(p_nxge_t nxgep)
1613859Sml29623 {
1623859Sml29623 	npi_handle_t		handle;
1633859Sml29623 	txc_int_stat_t		istatus;
1643859Sml29623 	uint32_t		err_status;
1653859Sml29623 	uint8_t			err_portn;
1663859Sml29623 	boolean_t		my_err = B_FALSE;
1673859Sml29623 	nxge_status_t		status = NXGE_OK;
1683859Sml29623 
1693859Sml29623 	handle = nxgep->npi_handle;
1703859Sml29623 	npi_txc_global_istatus_get(handle, (txc_int_stat_t *)&istatus.value);
1713859Sml29623 	switch (nxgep->mac.portnum) {
1723859Sml29623 	case 0:
1733859Sml29623 		if (istatus.bits.ldw.port0_int_status) {
1743859Sml29623 			my_err = B_TRUE;
1753859Sml29623 			err_portn = 0;
1763859Sml29623 			err_status = istatus.bits.ldw.port0_int_status;
1773859Sml29623 		}
1783859Sml29623 		break;
1793859Sml29623 	case 1:
1803859Sml29623 		if (istatus.bits.ldw.port1_int_status) {
1813859Sml29623 			my_err = B_TRUE;
1823859Sml29623 			err_portn = 1;
1833859Sml29623 			err_status = istatus.bits.ldw.port1_int_status;
1843859Sml29623 		}
1853859Sml29623 		break;
1863859Sml29623 	case 2:
1873859Sml29623 		if (istatus.bits.ldw.port2_int_status) {
1883859Sml29623 			my_err = B_TRUE;
1893859Sml29623 			err_portn = 2;
1903859Sml29623 			err_status = istatus.bits.ldw.port2_int_status;
1913859Sml29623 		}
1923859Sml29623 		break;
1933859Sml29623 	case 3:
1943859Sml29623 		if (istatus.bits.ldw.port3_int_status) {
1953859Sml29623 			my_err = B_TRUE;
1963859Sml29623 			err_portn = 3;
1973859Sml29623 			err_status = istatus.bits.ldw.port3_int_status;
1983859Sml29623 		}
1993859Sml29623 		break;
2003859Sml29623 	default:
2013859Sml29623 		return (NXGE_ERROR);
2023859Sml29623 	}
2033859Sml29623 	NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
2043859Sml29623 			    " nxge_txc_handle_sys_errors: errored port %d",
2053859Sml29623 			    err_portn));
2063859Sml29623 	if (my_err) {
2073859Sml29623 		status = nxge_txc_handle_port_errors(nxgep, err_status);
2083859Sml29623 	}
2093859Sml29623 
2103859Sml29623 	return (status);
2113859Sml29623 }
2123859Sml29623 
2133859Sml29623 static nxge_status_t
2143859Sml29623 nxge_txc_handle_port_errors(p_nxge_t nxgep, uint32_t err_status)
2153859Sml29623 {
2163859Sml29623 	npi_handle_t		handle;
2173859Sml29623 	npi_status_t		rs = NPI_SUCCESS;
2183859Sml29623 	p_nxge_txc_stats_t	statsp;
2193859Sml29623 	txc_int_stat_t		istatus;
2203859Sml29623 	boolean_t		txport_fatal = B_FALSE;
2213859Sml29623 	uint8_t			portn;
2223859Sml29623 	nxge_status_t		status = NXGE_OK;
2233859Sml29623 
2243859Sml29623 	handle = nxgep->npi_handle;
2253859Sml29623 	statsp = (p_nxge_txc_stats_t)&nxgep->statsp->txc_stats;
2263859Sml29623 	portn = nxgep->mac.portnum;
2273859Sml29623 	istatus.value = 0;
2283859Sml29623 
2293859Sml29623 	if ((err_status & TXC_INT_STAT_RO_CORR_ERR) ||
2303859Sml29623 			(err_status & TXC_INT_STAT_RO_CORR_ERR) ||
2313859Sml29623 			(err_status & TXC_INT_STAT_RO_UNCORR_ERR) ||
2323859Sml29623 			(err_status & TXC_INT_STAT_REORDER_ERR)) {
2333859Sml29623 		if ((rs = npi_txc_ro_states_get(handle, portn,
2343859Sml29623 				&statsp->errlog.ro_st)) != NPI_SUCCESS) {
2353859Sml29623 			return (NXGE_ERROR | rs);
2363859Sml29623 		}
2373859Sml29623 
2383859Sml29623 		if (err_status & TXC_INT_STAT_RO_CORR_ERR) {
2393859Sml29623 			statsp->ro_correct_err++;
2403859Sml29623 			NXGE_FM_REPORT_ERROR(nxgep, portn, NULL,
2413859Sml29623 					NXGE_FM_EREPORT_TXC_RO_CORRECT_ERR);
2423859Sml29623 			NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
2433859Sml29623 				"nxge_txc_err_evnts: "
2443859Sml29623 				"RO FIFO correctable error"));
2453859Sml29623 		}
2463859Sml29623 		if (err_status & TXC_INT_STAT_RO_UNCORR_ERR) {
2473859Sml29623 			statsp->ro_uncorrect_err++;
2483859Sml29623 			NXGE_FM_REPORT_ERROR(nxgep, portn, NULL,
2493859Sml29623 					NXGE_FM_EREPORT_TXC_RO_UNCORRECT_ERR);
2503859Sml29623 			NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
2513859Sml29623 				"nxge_txc_err_evnts: "
2523859Sml29623 				"RO FIFO uncorrectable error"));
2533859Sml29623 		}
2543859Sml29623 		if (err_status & TXC_INT_STAT_REORDER_ERR) {
2553859Sml29623 			statsp->reorder_err++;
2563859Sml29623 			NXGE_FM_REPORT_ERROR(nxgep, portn, NULL,
2573859Sml29623 					NXGE_FM_EREPORT_TXC_REORDER_ERR);
2583859Sml29623 			NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
2593859Sml29623 				"nxge_txc_err_evnts: "
2603859Sml29623 				"fatal error: Reorder error"));
2613859Sml29623 			txport_fatal = B_TRUE;
2623859Sml29623 		}
2633859Sml29623 
2643859Sml29623 		if ((err_status & TXC_INT_STAT_RO_CORR_ERR) ||
2653859Sml29623 			(err_status & TXC_INT_STAT_RO_CORR_ERR) ||
2663859Sml29623 			(err_status & TXC_INT_STAT_RO_UNCORR_ERR)) {
2673859Sml29623 
2683859Sml29623 			if ((rs = npi_txc_ro_ecc_state_clr(handle, portn))
2693859Sml29623 							!= NPI_SUCCESS)
2703859Sml29623 				return (NXGE_ERROR | rs);
2713859Sml29623 			/*
2723859Sml29623 			 * Making sure that error source is cleared if this is
2733859Sml29623 			 * an injected error.
2743859Sml29623 			 */
2753859Sml29623 			TXC_FZC_CNTL_REG_WRITE64(handle, TXC_ROECC_CTL_REG,
2763859Sml29623 								portn, 0);
2773859Sml29623 		}
2783859Sml29623 	}
2793859Sml29623 
2803859Sml29623 	if ((err_status & TXC_INT_STAT_SF_CORR_ERR) ||
2813859Sml29623 			(err_status & TXC_INT_STAT_SF_UNCORR_ERR)) {
2823859Sml29623 		if ((rs = npi_txc_sf_states_get(handle, portn,
2833859Sml29623 				&statsp->errlog.sf_st)) != NPI_SUCCESS) {
2843859Sml29623 			return (NXGE_ERROR | rs);
2853859Sml29623 		}
2863859Sml29623 		if (err_status & TXC_INT_STAT_SF_CORR_ERR) {
2873859Sml29623 			statsp->sf_correct_err++;
2883859Sml29623 			NXGE_FM_REPORT_ERROR(nxgep, portn, NULL,
2893859Sml29623 					NXGE_FM_EREPORT_TXC_SF_CORRECT_ERR);
2903859Sml29623 			NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
2913859Sml29623 				"nxge_txc_err_evnts: "
2923859Sml29623 				"SF FIFO correctable error"));
2933859Sml29623 		}
2943859Sml29623 		if (err_status & TXC_INT_STAT_SF_UNCORR_ERR) {
2953859Sml29623 			statsp->sf_uncorrect_err++;
2963859Sml29623 			NXGE_FM_REPORT_ERROR(nxgep, portn, NULL,
2973859Sml29623 					NXGE_FM_EREPORT_TXC_SF_UNCORRECT_ERR);
2983859Sml29623 			NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
2993859Sml29623 				"nxge_txc_err_evnts: "
3003859Sml29623 				"SF FIFO uncorrectable error"));
3013859Sml29623 		}
3023859Sml29623 		if ((rs = npi_txc_sf_ecc_state_clr(handle, portn))
3033859Sml29623 							!= NPI_SUCCESS)
3043859Sml29623 			return (NXGE_ERROR | rs);
3053859Sml29623 		/*
3063859Sml29623 		 * Making sure that error source is cleared if this is
3073859Sml29623 		 * an injected error.
3083859Sml29623 		 */
3093859Sml29623 		TXC_FZC_CNTL_REG_WRITE64(handle, TXC_SFECC_CTL_REG, portn, 0);
3103859Sml29623 	}
3113859Sml29623 
3123859Sml29623 	/* Clear corresponding errors */
3133859Sml29623 	switch (portn) {
3143859Sml29623 	case 0:
3153859Sml29623 		istatus.bits.ldw.port0_int_status = err_status;
3163859Sml29623 		break;
3173859Sml29623 	case 1:
3183859Sml29623 		istatus.bits.ldw.port1_int_status = err_status;
3193859Sml29623 		break;
3203859Sml29623 	case 2:
3213859Sml29623 		istatus.bits.ldw.port2_int_status = err_status;
3223859Sml29623 		break;
3233859Sml29623 	case 3:
3243859Sml29623 		istatus.bits.ldw.port3_int_status = err_status;
3253859Sml29623 		break;
3263859Sml29623 	default:
3273859Sml29623 		return (NXGE_ERROR);
3283859Sml29623 	}
3293859Sml29623 
3303859Sml29623 	npi_txc_global_istatus_clear(handle, istatus.value);
3313859Sml29623 
3323859Sml29623 	if (txport_fatal) {
3333859Sml29623 		NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
3343859Sml29623 				" nxge_txc_handle_port_errors:"
3353859Sml29623 				" fatal Error on Port#%d\n",
3363859Sml29623 				portn));
3373859Sml29623 		status = nxge_tx_port_fatal_err_recover(nxgep);
3383859Sml29623 		if (status == NXGE_OK) {
3393859Sml29623 			FM_SERVICE_RESTORED(nxgep);
3403859Sml29623 		}
3413859Sml29623 	}
3423859Sml29623 
3433859Sml29623 	return (status);
3443859Sml29623 }
3453859Sml29623 
3463859Sml29623 void
3473859Sml29623 nxge_txc_inject_err(p_nxge_t nxgep, uint32_t err_id)
3483859Sml29623 {
3493859Sml29623 	txc_int_stat_dbg_t	txcs;
3503859Sml29623 	txc_roecc_ctl_t		ro_ecc_ctl;
3513859Sml29623 	txc_sfecc_ctl_t		sf_ecc_ctl;
3523859Sml29623 	uint8_t			portn = nxgep->mac.portnum;
3533859Sml29623 
3543859Sml29623 	cmn_err(CE_NOTE, "!TXC error Inject\n");
3553859Sml29623 	switch (err_id) {
3563859Sml29623 	case NXGE_FM_EREPORT_TXC_RO_CORRECT_ERR:
3573859Sml29623 	case NXGE_FM_EREPORT_TXC_RO_UNCORRECT_ERR:
3583859Sml29623 		ro_ecc_ctl.value = 0;
3593859Sml29623 		ro_ecc_ctl.bits.ldw.all_pkts = 1;
3603859Sml29623 		ro_ecc_ctl.bits.ldw.second_line_pkt = 1;
3613859Sml29623 		if (err_id == NXGE_FM_EREPORT_TXC_RO_CORRECT_ERR)
3623859Sml29623 			ro_ecc_ctl.bits.ldw.single_bit_err = 1;
3633859Sml29623 		else
3643859Sml29623 			ro_ecc_ctl.bits.ldw.double_bit_err = 1;
365*5125Sjoycey #if defined(__i386)
366*5125Sjoycey 		cmn_err(CE_NOTE, "!Write 0x%llx to TXC_ROECC_CTL_REG\n",
367*5125Sjoycey 					ro_ecc_ctl.value);
368*5125Sjoycey #else
3693859Sml29623 		cmn_err(CE_NOTE, "!Write 0x%lx to TXC_ROECC_CTL_REG\n",
3703859Sml29623 					ro_ecc_ctl.value);
371*5125Sjoycey #endif
3723859Sml29623 		TXC_FZC_CNTL_REG_WRITE64(nxgep->npi_handle, TXC_ROECC_CTL_REG,
3733859Sml29623 					portn, ro_ecc_ctl.value);
3743859Sml29623 		break;
3753859Sml29623 	case NXGE_FM_EREPORT_TXC_SF_CORRECT_ERR:
3763859Sml29623 	case NXGE_FM_EREPORT_TXC_SF_UNCORRECT_ERR:
3773859Sml29623 		sf_ecc_ctl.value = 0;
3783859Sml29623 		sf_ecc_ctl.bits.ldw.all_pkts = 1;
3793859Sml29623 		sf_ecc_ctl.bits.ldw.second_line_pkt = 1;
3803859Sml29623 		if (err_id == NXGE_FM_EREPORT_TXC_SF_CORRECT_ERR)
3813859Sml29623 			sf_ecc_ctl.bits.ldw.single_bit_err = 1;
3823859Sml29623 		else
3833859Sml29623 			sf_ecc_ctl.bits.ldw.double_bit_err = 1;
384*5125Sjoycey #if defined(__i386)
385*5125Sjoycey 		cmn_err(CE_NOTE, "!Write 0x%llx to TXC_SFECC_CTL_REG\n",
386*5125Sjoycey 					sf_ecc_ctl.value);
387*5125Sjoycey #else
3883859Sml29623 		cmn_err(CE_NOTE, "!Write 0x%lx to TXC_SFECC_CTL_REG\n",
3893859Sml29623 					sf_ecc_ctl.value);
390*5125Sjoycey #endif
3913859Sml29623 		TXC_FZC_CNTL_REG_WRITE64(nxgep->npi_handle, TXC_SFECC_CTL_REG,
3923859Sml29623 					portn, sf_ecc_ctl.value);
3933859Sml29623 		break;
3943859Sml29623 	case NXGE_FM_EREPORT_TXC_REORDER_ERR:
3953859Sml29623 		NXGE_REG_RD64(nxgep->npi_handle, TXC_INT_STAT_DBG_REG,
3963859Sml29623 					&txcs.value);
3973859Sml29623 		nxge_txc_inject_port_err(portn, &txcs,
3983859Sml29623 						TXC_INT_STAT_REORDER_ERR);
399*5125Sjoycey #if defined(__i386)
400*5125Sjoycey 		cmn_err(CE_NOTE, "!Write 0x%llx to TXC_INT_STAT_DBG_REG\n",
401*5125Sjoycey 					txcs.value);
402*5125Sjoycey #else
4033859Sml29623 		cmn_err(CE_NOTE, "!Write 0x%lx to TXC_INT_STAT_DBG_REG\n",
4043859Sml29623 					txcs.value);
405*5125Sjoycey #endif
4063859Sml29623 		NXGE_REG_WR64(nxgep->npi_handle, TXC_INT_STAT_DBG_REG,
4073859Sml29623 					txcs.value);
4083859Sml29623 		break;
4093859Sml29623 	default:
4103859Sml29623 		NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
4113859Sml29623 				"nxge_txc_inject_err: Unknown err_id"));
4123859Sml29623 	}
4133859Sml29623 }
4143859Sml29623 
4153859Sml29623 static void
4163859Sml29623 nxge_txc_inject_port_err(uint8_t portn, txc_int_stat_dbg_t *txcs,
4173859Sml29623 				uint8_t istats)
4183859Sml29623 {
4193859Sml29623 	switch (portn) {
4203859Sml29623 	case 0:
4213859Sml29623 		txcs->bits.ldw.port0_int_status |= istats;
4223859Sml29623 		break;
4233859Sml29623 	case 1:
4243859Sml29623 		txcs->bits.ldw.port1_int_status |= istats;
4253859Sml29623 		break;
4263859Sml29623 	case 2:
4273859Sml29623 		txcs->bits.ldw.port2_int_status |= istats;
4283859Sml29623 		break;
4293859Sml29623 	case 3:
4303859Sml29623 		txcs->bits.ldw.port3_int_status |= istats;
4313859Sml29623 		break;
4323859Sml29623 	default:
4333859Sml29623 		;
4343859Sml29623 	}
4353859Sml29623 }
436