summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/io/nxge/nxge_txc.c
blob: 7f9e34dbfa1e4d380b2bffe3a0fcc997a70cc610 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
/*
 * 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
 * or http://www.opensolaris.org/os/licensing.
 * 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.
 */

#include <sys/nxge/nxge_impl.h>
#include <sys/nxge/nxge_txc.h>

static nxge_status_t
nxge_txc_handle_port_errors(p_nxge_t, uint32_t);
static void
nxge_txc_inject_port_err(uint8_t, txc_int_stat_dbg_t *,
			uint8_t istats);
extern nxge_status_t nxge_tx_port_fatal_err_recover(p_nxge_t);

nxge_status_t
nxge_txc_init(p_nxge_t nxgep)
{
	uint8_t			port;
	npi_handle_t		handle;
	npi_status_t		rs = NPI_SUCCESS;

	handle = NXGE_DEV_NPI_HANDLE(nxgep);
	port = NXGE_GET_PORT_NUM(nxgep->function_num);

	NXGE_DEBUG_MSG((nxgep, TX_CTL, "==> nxge_txc_init: portn %d", port));

	/*
	 * Enable the TXC controller.
	 */
	if ((rs = npi_txc_global_enable(handle)) != NPI_SUCCESS) {
		goto fail;
	}

	/* Enable this port within the TXC. */
	if ((rs = npi_txc_port_enable(handle, port)) != NPI_SUCCESS) {
		goto fail;
	}

	/* Bind DMA channels to this port. */
	if ((rs = npi_txc_port_dma_enable(handle, port,
	    TXDMA_PORT_BITMAP(nxgep))) != NPI_SUCCESS) {
		goto fail;
	}

	/* Unmask all TXC interrupts */
	npi_txc_global_imask_set(handle, port, 0);

	NXGE_DEBUG_MSG((nxgep, TX_CTL, "<== nxge_txc_init: portn %d", port));

	return (NXGE_OK);
fail:
	NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
	    "nxge_txc_init: Failed to initialize txc on port %d",
	    port));

	return (NXGE_ERROR | rs);
}

nxge_status_t
nxge_txc_uninit(p_nxge_t nxgep)
{
	uint8_t			port;
	npi_handle_t		handle;
	npi_status_t		rs = NPI_SUCCESS;

	handle = NXGE_DEV_NPI_HANDLE(nxgep);
	port = NXGE_GET_PORT_NUM(nxgep->function_num);

	NXGE_DEBUG_MSG((nxgep, TX_CTL, "==> nxge_txc_uninit: portn %d", port));

	/*
	 * disable the TXC controller.
	 */
	if ((rs = npi_txc_global_disable(handle)) != NPI_SUCCESS) {
		goto fail;
	}

	/* disable this port within the TXC. */
	if ((rs = npi_txc_port_disable(handle, port)) != NPI_SUCCESS) {
		goto fail;
	}

	/* unbind DMA channels to this port. */
	if ((rs = npi_txc_port_dma_enable(handle, port, 0)) != NPI_SUCCESS) {
		goto fail;
	}

	NXGE_DEBUG_MSG((nxgep, TX_CTL, "<== nxge_txc_uninit: portn %d", port));

	return (NXGE_OK);
fail:
	NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
	    "nxge_txc_init: Failed to initialize txc on port %d",
	    port));

	return (NXGE_ERROR | rs);
}

/*
 * nxge_txc_tdc_bind
 *
 *	Bind a TDC to a port.
 *
 * Arguments:
 * 	nxgep
 * 	channel		The channel to bind.
 *
 * Notes:
 *
 * NPI/NXGE function calls:
 *	npi_txc_control()
 *	npi_txc_global_imask_set()
 *	npi_txc_port_dma_enable()
 *
 * Registers accessed:
 *	TXC_CONTROL
 *	TXC_PORT_DMA
 *	TXC_INT_MASK
 *
 * Context:
 *	Service domain
 */
nxge_status_t
nxge_txc_tdc_bind(
	p_nxge_t nxgep,
	int channel)
{
	uint8_t		port;
	uint64_t	bitmap;
	npi_handle_t	handle;
	npi_status_t	rs = NPI_SUCCESS;
	txc_control_t	txc_control;

	port = NXGE_GET_PORT_NUM(nxgep->function_num);

	NXGE_DEBUG_MSG((nxgep, TX_CTL,
	    "==> nxge_txc_tdc_bind(port %d, channel %d)", port, channel));

	handle = NXGE_DEV_NPI_HANDLE(nxgep);

	/* Get the current value of TXC_CONTROL. */
	(void) npi_txc_control(handle, OP_GET, &txc_control);

	/* Mask all TXC interrupts for <port>. */
	if (txc_control.value & (1 << port)) {
		npi_txc_global_imask_set(handle, port, TXC_INT_MASK_IVAL);
	}

	/* Bind <channel> to <port>. */
	/* Read in the old bitmap. */
	TXC_FZC_CNTL_REG_READ64(handle, TXC_PORT_DMA_ENABLE_REG, port,
	    &bitmap);

	if (bitmap & (1 << channel)) {
		NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
		    "nxge_txc_tdc_bind: channel %d already bound on port %d",
		    channel, port));
	} else {
		/* Bind the new channel. */
		bitmap |= (1 << channel);
		NXGE_DEBUG_MSG((nxgep, TX_CTL,
		    "==> nxge_txc_tdc_bind(): bitmap = %lx", bitmap));

		/* Write out the new bitmap. */
		if ((rs = npi_txc_port_dma_enable(handle, port,
		    (uint32_t)bitmap)) != NPI_SUCCESS) {
			goto fail;
		}
	}

	/* Enable this port, if necessary. */
	if (!(txc_control.value & (1 << port))) {
		if ((rs = npi_txc_port_enable(handle, port)) != NPI_SUCCESS) {
			goto fail;
		}
	}

	/*
	 * Enable the TXC controller, if necessary.
	 */
	if (txc_control.bits.ldw.txc_enabled == 0) {
		if ((rs = npi_txc_global_enable(handle)) != NPI_SUCCESS) {
			goto fail;
		}
	}

	/* Unmask all TXC interrupts on <port> */
	npi_txc_global_imask_set(handle, port, 0);

	NXGE_DEBUG_MSG((nxgep, TX_CTL,
	    "<== nxge_txc_tdc_bind(port %d, channel %d)", port, channel));

	return (NXGE_OK);
fail:
	NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
	    "nxge_txc_tdc_bind(port %d, channel %d) failed", port, channel));

	return (NXGE_ERROR | rs);
}

/*
 * nxge_txc_tdc_unbind
 *
 *	Unbind a TDC from a port.
 *
 * Arguments:
 * 	nxgep
 * 	channel		The channel to unbind.
 *
 * Notes:
 *
 * NPI/NXGE function calls:
 *	npi_txc_control()
 *	npi_txc_global_imask_set()
 *	npi_txc_port_dma_enable()
 *
 * Registers accessed:
 *	TXC_CONTROL
 *	TXC_PORT_DMA
 *	TXC_INT_MASK
 *
 * Context:
 *	Service domain
 */
nxge_status_t
nxge_txc_tdc_unbind(
	p_nxge_t nxgep,
	int channel)
{
	uint8_t		port;
	uint64_t	bitmap;
	npi_handle_t	handle;
	npi_status_t	rs = NPI_SUCCESS;

	handle = NXGE_DEV_NPI_HANDLE(nxgep);
	port = NXGE_GET_PORT_NUM(nxgep->function_num);

	NXGE_DEBUG_MSG((nxgep, TX_CTL,
	    "==> nxge_txc_tdc_unbind(port %d, channel %d)", port, channel));

	/* Mask all TXC interrupts for <port>. */
	npi_txc_global_imask_set(handle, port, TXC_INT_MASK_IVAL);

	/* Unbind <channel>. */
	/* Read in the old bitmap. */
	TXC_FZC_CNTL_REG_READ64(handle, TXC_PORT_DMA_ENABLE_REG, port,
	    &bitmap);

	bitmap &= (~(1 << channel));

	/* Write out the new bitmap. */
	if ((rs = npi_txc_port_dma_enable(handle, port,
	    (uint32_t)bitmap)) != NPI_SUCCESS) {
		NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
		    "npi_txc_port_dma_enable(%d, %d) failed: %x",
		    port, channel, rs));
	}

	/* Unmask all TXC interrupts on <port> */
	if (bitmap)
		npi_txc_global_imask_set(handle, port, 0);

	NXGE_DEBUG_MSG((nxgep, TX_CTL,
	    "<== nxge_txc_tdc_unbind(port %d, channel %d)", port, channel));

	return (NXGE_OK);
fail:
	NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
	    "nxge_txc_tdc_unbind(port %d, channel %d) failed", port, channel));

	return (NXGE_ERROR | rs);
}

void
nxge_txc_regs_dump(p_nxge_t nxgep)
{
	uint32_t		cnt1, cnt2;
	npi_handle_t		handle;
	txc_control_t		control;
	uint32_t		bitmap = 0;

	NXGE_DEBUG_MSG((nxgep, TX_CTL, "\nTXC dump: func # %d:\n",
	    nxgep->function_num));

	handle = NXGE_DEV_NPI_HANDLE(nxgep);

	(void) npi_txc_control(handle, OP_GET, &control);
	(void) npi_txc_port_dma_list_get(handle, nxgep->function_num, &bitmap);

	NXGE_DEBUG_MSG((nxgep, TX_CTL, "\n\tTXC port control 0x%0llx",
	    (long long)control.value));
	NXGE_DEBUG_MSG((nxgep, TX_CTL, "\n\tTXC port bitmap 0x%x", bitmap));

	(void) npi_txc_pkt_xmt_to_mac_get(handle, nxgep->function_num,
	    &cnt1, &cnt2);
	NXGE_DEBUG_MSG((nxgep, TX_CTL, "\n\tTXC bytes to MAC %d "
	    "packets to MAC %d",
	    cnt1, cnt2));

	(void) npi_txc_pkt_stuffed_get(handle, nxgep->function_num,
	    &cnt1, &cnt2);
	NXGE_DEBUG_MSG((nxgep, TX_CTL,
	    "\n\tTXC ass packets %d reorder packets %d",
	    cnt1 & 0xffff, cnt2 & 0xffff));

	(void) npi_txc_reorder_get(handle, nxgep->function_num, &cnt1);
	NXGE_DEBUG_MSG((nxgep, TX_CTL,
	    "\n\tTXC reorder resource %d", cnt1 & 0xff));
}

nxge_status_t
nxge_txc_handle_sys_errors(p_nxge_t nxgep)
{
	npi_handle_t		handle;
	txc_int_stat_t		istatus;
	uint32_t		err_status;
	uint8_t			err_portn;
	boolean_t		my_err = B_FALSE;
	nxge_status_t		status = NXGE_OK;

	handle = nxgep->npi_handle;
	npi_txc_global_istatus_get(handle, (txc_int_stat_t *)&istatus.value);
	switch (nxgep->mac.portnum) {
	case 0:
		if (istatus.bits.ldw.port0_int_status) {
			my_err = B_TRUE;
			err_portn = 0;
			err_status = istatus.bits.ldw.port0_int_status;
		}
		break;
	case 1:
		if (istatus.bits.ldw.port1_int_status) {
			my_err = B_TRUE;
			err_portn = 1;
			err_status = istatus.bits.ldw.port1_int_status;
		}
		break;
	case 2:
		if (istatus.bits.ldw.port2_int_status) {
			my_err = B_TRUE;
			err_portn = 2;
			err_status = istatus.bits.ldw.port2_int_status;
		}
		break;
	case 3:
		if (istatus.bits.ldw.port3_int_status) {
			my_err = B_TRUE;
			err_portn = 3;
			err_status = istatus.bits.ldw.port3_int_status;
		}
		break;
	default:
		return (NXGE_ERROR);
	}
	NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
	    " nxge_txc_handle_sys_errors: errored port %d",
	    err_portn));
	if (my_err) {
		status = nxge_txc_handle_port_errors(nxgep, err_status);
	}

	return (status);
}

static nxge_status_t
nxge_txc_handle_port_errors(p_nxge_t nxgep, uint32_t err_status)
{
	npi_handle_t		handle;
	npi_status_t		rs = NPI_SUCCESS;
	p_nxge_txc_stats_t	statsp;
	txc_int_stat_t		istatus;
	boolean_t		txport_fatal = B_FALSE;
	uint8_t			portn;
	nxge_status_t		status = NXGE_OK;

	handle = nxgep->npi_handle;
	statsp = (p_nxge_txc_stats_t)&nxgep->statsp->txc_stats;
	portn = nxgep->mac.portnum;
	istatus.value = 0;

	if ((err_status & TXC_INT_STAT_RO_CORR_ERR) ||
	    (err_status & TXC_INT_STAT_RO_CORR_ERR) ||
	    (err_status & TXC_INT_STAT_RO_UNCORR_ERR) ||
	    (err_status & TXC_INT_STAT_REORDER_ERR)) {
		if ((rs = npi_txc_ro_states_get(handle, portn,
		    &statsp->errlog.ro_st)) != NPI_SUCCESS) {
			return (NXGE_ERROR | rs);
		}

		if (err_status & TXC_INT_STAT_RO_CORR_ERR) {
			statsp->ro_correct_err++;
			NXGE_FM_REPORT_ERROR(nxgep, portn, 0,
			    NXGE_FM_EREPORT_TXC_RO_CORRECT_ERR);
			NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
			    "nxge_txc_err_evnts: "
			    "RO FIFO correctable error"));
		}
		if (err_status & TXC_INT_STAT_RO_UNCORR_ERR) {
			statsp->ro_uncorrect_err++;
			NXGE_FM_REPORT_ERROR(nxgep, portn, 0,
			    NXGE_FM_EREPORT_TXC_RO_UNCORRECT_ERR);
			NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
			    "nxge_txc_err_evnts: "
			    "RO FIFO uncorrectable error"));
		}
		if (err_status & TXC_INT_STAT_REORDER_ERR) {
			statsp->reorder_err++;
			NXGE_FM_REPORT_ERROR(nxgep, portn, 0,
			    NXGE_FM_EREPORT_TXC_REORDER_ERR);
			NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
			    "nxge_txc_err_evnts: "
			    "fatal error: Reorder error"));
			txport_fatal = B_TRUE;
		}

		if ((err_status & TXC_INT_STAT_RO_CORR_ERR) ||
		    (err_status & TXC_INT_STAT_RO_CORR_ERR) ||
		    (err_status & TXC_INT_STAT_RO_UNCORR_ERR)) {

			if ((rs = npi_txc_ro_ecc_state_clr(handle, portn))
			    != NPI_SUCCESS)
				return (NXGE_ERROR | rs);
			/*
			 * Making sure that error source is cleared if this is
			 * an injected error.
			 */
			TXC_FZC_CNTL_REG_WRITE64(handle, TXC_ROECC_CTL_REG,
			    portn, 0);
		}
	}

	if ((err_status & TXC_INT_STAT_SF_CORR_ERR) ||
	    (err_status & TXC_INT_STAT_SF_UNCORR_ERR)) {
		if ((rs = npi_txc_sf_states_get(handle, portn,
		    &statsp->errlog.sf_st)) != NPI_SUCCESS) {
			return (NXGE_ERROR | rs);
		}
		if (err_status & TXC_INT_STAT_SF_CORR_ERR) {
			statsp->sf_correct_err++;
			NXGE_FM_REPORT_ERROR(nxgep, portn, 0,
			    NXGE_FM_EREPORT_TXC_SF_CORRECT_ERR);
			NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
			    "nxge_txc_err_evnts: "
			    "SF FIFO correctable error"));
		}
		if (err_status & TXC_INT_STAT_SF_UNCORR_ERR) {
			statsp->sf_uncorrect_err++;
			NXGE_FM_REPORT_ERROR(nxgep, portn, 0,
			    NXGE_FM_EREPORT_TXC_SF_UNCORRECT_ERR);
			NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
			    "nxge_txc_err_evnts: "
			    "SF FIFO uncorrectable error"));
		}
		if ((rs = npi_txc_sf_ecc_state_clr(handle, portn))
		    != NPI_SUCCESS)
			return (NXGE_ERROR | rs);
		/*
		 * Making sure that error source is cleared if this is
		 * an injected error.
		 */
		TXC_FZC_CNTL_REG_WRITE64(handle, TXC_SFECC_CTL_REG, portn, 0);
	}

	/* Clear corresponding errors */
	switch (portn) {
	case 0:
		istatus.bits.ldw.port0_int_status = err_status;
		break;
	case 1:
		istatus.bits.ldw.port1_int_status = err_status;
		break;
	case 2:
		istatus.bits.ldw.port2_int_status = err_status;
		break;
	case 3:
		istatus.bits.ldw.port3_int_status = err_status;
		break;
	default:
		return (NXGE_ERROR);
	}

	npi_txc_global_istatus_clear(handle, istatus.value);

	if (txport_fatal) {
		NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
		    " nxge_txc_handle_port_errors:"
		    " fatal Error on Port#%d\n",
		    portn));
		status = nxge_tx_port_fatal_err_recover(nxgep);
		if (status == NXGE_OK) {
			FM_SERVICE_RESTORED(nxgep);
		}
	}

	return (status);
}

void
nxge_txc_inject_err(p_nxge_t nxgep, uint32_t err_id)
{
	txc_int_stat_dbg_t	txcs;
	txc_roecc_ctl_t		ro_ecc_ctl;
	txc_sfecc_ctl_t		sf_ecc_ctl;
	uint8_t			portn = nxgep->mac.portnum;

	cmn_err(CE_NOTE, "!TXC error Inject\n");
	switch (err_id) {
	case NXGE_FM_EREPORT_TXC_RO_CORRECT_ERR:
	case NXGE_FM_EREPORT_TXC_RO_UNCORRECT_ERR:
		ro_ecc_ctl.value = 0;
		ro_ecc_ctl.bits.ldw.all_pkts = 1;
		ro_ecc_ctl.bits.ldw.second_line_pkt = 1;
		if (err_id == NXGE_FM_EREPORT_TXC_RO_CORRECT_ERR)
			ro_ecc_ctl.bits.ldw.single_bit_err = 1;
		else
			ro_ecc_ctl.bits.ldw.double_bit_err = 1;
#if defined(__i386)
		cmn_err(CE_NOTE, "!Write 0x%llx to TXC_ROECC_CTL_REG\n",
		    ro_ecc_ctl.value);
#else
		cmn_err(CE_NOTE, "!Write 0x%lx to TXC_ROECC_CTL_REG\n",
		    ro_ecc_ctl.value);
#endif
		TXC_FZC_CNTL_REG_WRITE64(nxgep->npi_handle, TXC_ROECC_CTL_REG,
		    portn, ro_ecc_ctl.value);
		break;
	case NXGE_FM_EREPORT_TXC_SF_CORRECT_ERR:
	case NXGE_FM_EREPORT_TXC_SF_UNCORRECT_ERR:
		sf_ecc_ctl.value = 0;
		sf_ecc_ctl.bits.ldw.all_pkts = 1;
		sf_ecc_ctl.bits.ldw.second_line_pkt = 1;
		if (err_id == NXGE_FM_EREPORT_TXC_SF_CORRECT_ERR)
			sf_ecc_ctl.bits.ldw.single_bit_err = 1;
		else
			sf_ecc_ctl.bits.ldw.double_bit_err = 1;
#if defined(__i386)
		cmn_err(CE_NOTE, "!Write 0x%llx to TXC_SFECC_CTL_REG\n",
		    sf_ecc_ctl.value);
#else
		cmn_err(CE_NOTE, "!Write 0x%lx to TXC_SFECC_CTL_REG\n",
		    sf_ecc_ctl.value);
#endif
		TXC_FZC_CNTL_REG_WRITE64(nxgep->npi_handle, TXC_SFECC_CTL_REG,
		    portn, sf_ecc_ctl.value);
		break;
	case NXGE_FM_EREPORT_TXC_REORDER_ERR:
		NXGE_REG_RD64(nxgep->npi_handle, TXC_INT_STAT_DBG_REG,
		    &txcs.value);
		nxge_txc_inject_port_err(portn, &txcs,
		    TXC_INT_STAT_REORDER_ERR);
#if defined(__i386)
		cmn_err(CE_NOTE, "!Write 0x%llx to TXC_INT_STAT_DBG_REG\n",
		    txcs.value);
#else
		cmn_err(CE_NOTE, "!Write 0x%lx to TXC_INT_STAT_DBG_REG\n",
		    txcs.value);
#endif
		NXGE_REG_WR64(nxgep->npi_handle, TXC_INT_STAT_DBG_REG,
		    txcs.value);
		break;
	default:
		NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL,
		    "nxge_txc_inject_err: Unknown err_id"));
	}
}

static void
nxge_txc_inject_port_err(uint8_t portn, txc_int_stat_dbg_t *txcs,
				uint8_t istats)
{
	switch (portn) {
	case 0:
		txcs->bits.ldw.port0_int_status |= istats;
		break;
	case 1:
		txcs->bits.ldw.port1_int_status |= istats;
		break;
	case 2:
		txcs->bits.ldw.port2_int_status |= istats;
		break;
	case 3:
		txcs->bits.ldw.port3_int_status |= istats;
		break;
	default:
		;
	}
}