xref: /onnv-gate/usr/src/uts/common/sys/nxge/nxge_txdma_hw.h (revision 6611:23ad7f0acb1d)
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 /*
226495Sspeer  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
233859Sml29623  * Use is subject to license terms.
243859Sml29623  */
253859Sml29623 
263859Sml29623 #ifndef	_SYS_NXGE_NXGE_TXDMA_HW_H
273859Sml29623 #define	_SYS_NXGE_NXGE_TXDMA_HW_H
283859Sml29623 
293859Sml29623 #pragma ident	"%Z%%M%	%I%	%E% SMI"
303859Sml29623 
313859Sml29623 #ifdef	__cplusplus
323859Sml29623 extern "C" {
333859Sml29623 #endif
343859Sml29623 
353859Sml29623 #include <nxge_defs.h>
363859Sml29623 #include <nxge_hw.h>
373859Sml29623 
383859Sml29623 #if !defined(_BIG_ENDIAN)
393859Sml29623 #define	SWAP(X)	(X)
403859Sml29623 #else
413859Sml29623 #define	SWAP(X)   \
423859Sml29623 	(((X >> 32) & 0x00000000ffffffff) | \
433859Sml29623 	((X << 32) & 0xffffffff00000000))
443859Sml29623 #endif
453859Sml29623 
463859Sml29623 /*
473859Sml29623  * Partitioning Suport: same as those defined for the RX
483859Sml29623  */
496495Sspeer 
503859Sml29623 /*
513859Sml29623  * TDC: Partitioning Support
523859Sml29623  *	(Each of the following registers is for each TDC)
533859Sml29623  */
543859Sml29623 #define	TX_LOG_REG_SIZE			512
553859Sml29623 #define	TX_LOG_DMA_OFFSET(channel)	(channel * TX_LOG_REG_SIZE)
563859Sml29623 
573859Sml29623 #define	TX_LOG_PAGE_VLD_REG		(FZC_DMC + 0x40000)
583859Sml29623 #define	TX_LOG_PAGE_MASK1_REG		(FZC_DMC + 0x40008)
593859Sml29623 #define	TX_LOG_PAGE_VAL1_REG		(FZC_DMC + 0x40010)
603859Sml29623 #define	TX_LOG_PAGE_MASK2_REG		(FZC_DMC + 0x40018)
613859Sml29623 #define	TX_LOG_PAGE_VAL2_REG		(FZC_DMC + 0x40020)
623859Sml29623 #define	TX_LOG_PAGE_RELO1_REG		(FZC_DMC + 0x40028)
633859Sml29623 #define	TX_LOG_PAGE_RELO2_REG		(FZC_DMC + 0x40030)
643859Sml29623 #define	TX_LOG_PAGE_HDL_REG		(FZC_DMC + 0x40038)
653859Sml29623 
663859Sml29623 /* Transmit Addressing Mode: Set to 1 to select 32-bit addressing mode */
673859Sml29623 #define	TX_ADDR_MD_REG			(FZC_DMC + 0x45000)
683859Sml29623 
693859Sml29623 #define	TX_ADDR_MD_SHIFT	0			/* bits 0:0 */
703859Sml29623 #define	TX_ADDR_MD_SET_32	0x0000000000000001ULL	/* 1 to select 32 bit */
713859Sml29623 #define	TX_ADDR_MD_MASK		0x0000000000000001ULL
723859Sml29623 
733859Sml29623 typedef union _tx_addr_md_t {
743859Sml29623 	uint64_t value;
753859Sml29623 	struct {
763859Sml29623 #if defined(_BIG_ENDIAN)
773859Sml29623 		uint32_t hdw;
783859Sml29623 #endif
793859Sml29623 		struct {
803859Sml29623 #if defined(_BIT_FIELDS_HTOL)
813859Sml29623 			uint32_t res1_1:31;
823859Sml29623 			uint32_t mode32:1;
833859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
843859Sml29623 			uint32_t mode32:1;
853859Sml29623 			uint32_t res1_1:31;
863859Sml29623 #endif
873859Sml29623 		} ldw;
883859Sml29623 #if !defined(_BIG_ENDIAN)
893859Sml29623 		uint32_t hdw;
903859Sml29623 #endif
913859Sml29623 	} bits;
923859Sml29623 } tx_addr_md_t, *p_tx_addr_md_t;
933859Sml29623 
943859Sml29623 /* Transmit Packet Descriptor Structure */
953859Sml29623 #define	TX_PKT_DESC_SAD_SHIFT		0		/* bits 43:0 */
963859Sml29623 #define	TX_PKT_DESC_SAD_MASK		0x00000FFFFFFFFFFFULL
973859Sml29623 #define	TX_PKT_DESC_TR_LEN_SHIFT	44		/* bits 56:44 */
983859Sml29623 #define	TX_PKT_DESC_TR_LEN_MASK		0x01FFF00000000000ULL
993859Sml29623 #define	TX_PKT_DESC_NUM_PTR_SHIFT	58		/* bits 61:58 */
1003859Sml29623 #define	TX_PKT_DESC_NUM_PTR_MASK	0x3C00000000000000ULL
1013859Sml29623 #define	TX_PKT_DESC_MARK_SHIFT		62		/* bit 62 */
1023859Sml29623 #define	TX_PKT_DESC_MARK		0x4000000000000000ULL
1033859Sml29623 #define	TX_PKT_DESC_MARK_MASK		0x4000000000000000ULL
1043859Sml29623 #define	TX_PKT_DESC_SOP_SHIFT		63		/* bit 63 */
1053859Sml29623 #define	TX_PKT_DESC_SOP			0x8000000000000000ULL
1063859Sml29623 #define	TX_PKT_DESC_SOP_MASK		0x8000000000000000ULL
1073859Sml29623 
1083859Sml29623 typedef union _tx_desc_t {
1093859Sml29623 	uint64_t value;
1103859Sml29623 	struct {
1113859Sml29623 #if defined(_BIG_ENDIAN)
1123859Sml29623 		struct {
1133859Sml29623 #if defined(_BIT_FIELDS_HTOL)
1143859Sml29623 			uint32_t sop:1;
1153859Sml29623 			uint32_t mark:1;
1163859Sml29623 			uint32_t num_ptr:4;
1173859Sml29623 			uint32_t res1:1;
1183859Sml29623 			uint32_t tr_len:13;
1193859Sml29623 			uint32_t sad:12;
1203859Sml29623 
1213859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
1223859Sml29623 			uint32_t sad:12;
1233859Sml29623 			uint32_t tr_len:13;
1243859Sml29623 			uint32_t res1:1;
1253859Sml29623 			uint32_t num_ptr:4;
1263859Sml29623 			uint32_t mark:1;
1273859Sml29623 			uint32_t sop:1;
1283859Sml29623 
1293859Sml29623 #endif
1303859Sml29623 		} hdw;
1313859Sml29623 #endif
1323859Sml29623 		struct {
1333859Sml29623 #if defined(_BIT_FIELDS_HTOL)
1343859Sml29623 			uint32_t sad:32;
1353859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
1363859Sml29623 			uint32_t sad:32;
1373859Sml29623 #endif
1383859Sml29623 		} ldw;
1393859Sml29623 #if !defined(_BIG_ENDIAN)
1403859Sml29623 		struct {
1413859Sml29623 
1423859Sml29623 #if defined(_BIT_FIELDS_HTOL)
1433859Sml29623 			uint32_t sop:1;
1443859Sml29623 			uint32_t mark:1;
1453859Sml29623 			uint32_t num_ptr:4;
1463859Sml29623 			uint32_t res1:1;
1473859Sml29623 			uint32_t tr_len:13;
1483859Sml29623 			uint32_t sad:12;
1493859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
1503859Sml29623 			uint32_t sad:12;
1513859Sml29623 			uint32_t tr_len:13;
1523859Sml29623 			uint32_t res1:1;
1533859Sml29623 			uint32_t num_ptr:4;
1543859Sml29623 			uint32_t mark:1;
1553859Sml29623 			uint32_t sop:1;
1563859Sml29623 #endif
1573859Sml29623 		} hdw;
1583859Sml29623 #endif
1593859Sml29623 	} bits;
1603859Sml29623 } tx_desc_t, *p_tx_desc_t;
1613859Sml29623 
1623859Sml29623 
1633859Sml29623 /* Transmit Ring Configuration (24 Channels) */
1643859Sml29623 #define	TX_RNG_CFIG_REG			(DMC + 0x40000)
1653859Sml29623 #if OLD
1663859Sml29623 #define	TX_RING_HDH_REG			(DMC + 0x40008)
1673859Sml29623 #endif
1683859Sml29623 #define	TX_RING_HDL_REG			(DMC + 0x40010)
1693859Sml29623 #define	TX_RING_KICK_REG		(DMC + 0x40018)
1703859Sml29623 #define	TX_ENT_MSK_REG			(DMC + 0x40020)
1713859Sml29623 #define	TX_CS_REG			(DMC + 0x40028)
1723859Sml29623 #define	TXDMA_MBH_REG			(DMC + 0x40030)
1733859Sml29623 #define	TXDMA_MBL_REG			(DMC + 0x40038)
1743859Sml29623 #define	TX_DMA_PRE_ST_REG		(DMC + 0x40040)
1753859Sml29623 #define	TX_RNG_ERR_LOGH_REG		(DMC + 0x40048)
1763859Sml29623 #define	TX_RNG_ERR_LOGL_REG		(DMC + 0x40050)
1773859Sml29623 #define	TDMC_INTR_DBG_REG		(DMC + 0x40060)
1783859Sml29623 #define	TX_CS_DBG_REG			(DMC + 0x40068)
1793859Sml29623 
1803859Sml29623 /* Transmit Ring Configuration */
1813859Sml29623 #define	TX_RNG_CFIG_STADDR_SHIFT	6			/* bits 18:6 */
1823859Sml29623 #define	TX_RNG_CFIG_STADDR_MASK		0x000000000007FFC0ULL
1833859Sml29623 #define	TX_RNG_CFIG_ADDR_MASK		0x00000FFFFFFFFFC0ULL
1843859Sml29623 #define	TX_RNG_CFIG_STADDR_BASE_SHIFT	19			/* bits 43:19 */
1853859Sml29623 #define	TX_RNG_CFIG_STADDR_BASE_MASK	0x00000FFFFFF80000ULL
1863859Sml29623 #define	TX_RNG_CFIG_LEN_SHIFT		48			/* bits 60:48 */
1873859Sml29623 #define	TX_RNG_CFIG_LEN_MASK		0xFFF8000000000000ULL
1883859Sml29623 
1893859Sml29623 #define	TX_RNG_HEAD_TAIL_SHIFT		3
1903859Sml29623 #define	TX_RNG_HEAD_TAIL_WRAP_SHIFT	19
1913859Sml29623 
1923859Sml29623 typedef union _tx_rng_cfig_t {
1933859Sml29623 	uint64_t value;
1943859Sml29623 	struct {
1953859Sml29623 #if defined(_BIG_ENDIAN)
1963859Sml29623 		struct {
1973859Sml29623 #if defined(_BIT_FIELDS_HTOL)
1983859Sml29623 			uint32_t res2:3;
1993859Sml29623 			uint32_t len:13;
2003859Sml29623 			uint32_t res1:4;
2013859Sml29623 			uint32_t staddr_base:12;
2023859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
2033859Sml29623 			uint32_t staddr_base:12;
2043859Sml29623 			uint32_t res1:4;
2053859Sml29623 			uint32_t len:13;
2063859Sml29623 			uint32_t res2:3;
2073859Sml29623 #endif
2083859Sml29623 		} hdw;
2093859Sml29623 #endif
2103859Sml29623 		struct {
2113859Sml29623 #if defined(_BIT_FIELDS_HTOL)
2123859Sml29623 			uint32_t staddr_base:13;
2133859Sml29623 			uint32_t staddr:13;
2143859Sml29623 			uint32_t res2:6;
2153859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
2163859Sml29623 			uint32_t res2:6;
2173859Sml29623 			uint32_t staddr:13;
2183859Sml29623 			uint32_t staddr_base:13;
2193859Sml29623 #endif
2203859Sml29623 		} ldw;
2213859Sml29623 #ifndef _BIG_ENDIAN
2223859Sml29623 		struct {
2233859Sml29623 #if defined(_BIT_FIELDS_HTOL)
2243859Sml29623 			uint32_t res2:3;
2253859Sml29623 			uint32_t len:13;
2263859Sml29623 			uint32_t res1:4;
2273859Sml29623 			uint32_t staddr_base:12;
2283859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
2293859Sml29623 			uint32_t staddr_base:12;
2303859Sml29623 			uint32_t res1:4;
2313859Sml29623 			uint32_t len:13;
2323859Sml29623 			uint32_t res2:3;
2333859Sml29623 #endif
2343859Sml29623 		} hdw;
2353859Sml29623 #endif
2363859Sml29623 	} bits;
2373859Sml29623 } tx_rng_cfig_t, *p_tx_rng_cfig_t;
2383859Sml29623 
2393859Sml29623 /* Transmit Ring Head Low */
2403859Sml29623 #define	TX_RING_HDL_SHIFT		3			/* bit 31:3 */
2413859Sml29623 #define	TX_RING_HDL_MASK		0x00000000FFFFFFF8ULL
2423859Sml29623 
2433859Sml29623 typedef union _tx_ring_hdl_t {
2443859Sml29623 	uint64_t value;
2453859Sml29623 	struct {
2463859Sml29623 #if defined(_BIG_ENDIAN)
2473859Sml29623 		uint32_t hdw;
2483859Sml29623 #endif
2493859Sml29623 		struct {
2503859Sml29623 #if defined(_BIT_FIELDS_HTOL)
2513859Sml29623 			uint32_t res0:12;
2523859Sml29623 			uint32_t wrap:1;
2533859Sml29623 			uint32_t head:16;
2543859Sml29623 			uint32_t res2:3;
2553859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
2563859Sml29623 			uint32_t res2:3;
2573859Sml29623 			uint32_t head:16;
2583859Sml29623 			uint32_t wrap:1;
2593859Sml29623 			uint32_t res0:12;
2603859Sml29623 #endif
2613859Sml29623 		} ldw;
2623859Sml29623 #ifndef _BIG_ENDIAN
2633859Sml29623 		uint32_t hdw;
2643859Sml29623 #endif
2653859Sml29623 	} bits;
2663859Sml29623 } tx_ring_hdl_t, *p_tx_ring_hdl_t;
2673859Sml29623 
2683859Sml29623 /* Transmit Ring Kick */
2693859Sml29623 #define	TX_RING_KICK_TAIL_SHIFT		3			/* bit 43:3 */
2703859Sml29623 #define	TX_RING_KICK_TAIL_MASK		0x000000FFFFFFFFFF8ULL
2713859Sml29623 
2723859Sml29623 typedef union _tx_ring_kick_t {
2733859Sml29623 	uint64_t value;
2743859Sml29623 	struct {
2753859Sml29623 #ifdef	_BIG_ENDIAN
2763859Sml29623 		uint32_t hdw;
2773859Sml29623 #endif
2783859Sml29623 		struct {
2793859Sml29623 #if defined(_BIT_FIELDS_HTOL)
2803859Sml29623 			uint32_t res0:12;
2813859Sml29623 			uint32_t wrap:1;
2823859Sml29623 			uint32_t tail:16;
2833859Sml29623 			uint32_t res2:3;
2843859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
2853859Sml29623 			uint32_t res2:3;
2863859Sml29623 			uint32_t tail:16;
2873859Sml29623 			uint32_t wrap:1;
2883859Sml29623 			uint32_t res0:12;
2893859Sml29623 #endif
2903859Sml29623 		} ldw;
2913859Sml29623 #ifndef _BIG_ENDIAN
2923859Sml29623 		uint32_t hdw;
2933859Sml29623 #endif
2943859Sml29623 	} bits;
2953859Sml29623 } tx_ring_kick_t, *p_tx_ring_kick_t;
2963859Sml29623 
2973859Sml29623 /* Transmit Event Mask (DMC + 0x40020) */
2983859Sml29623 #define	TX_ENT_MSK_PKT_PRT_ERR_SHIFT		0	/* bit 0: 0 to flag */
2993859Sml29623 #define	TX_ENT_MSK_PKT_PRT_ERR_MASK		0x0000000000000001ULL
3003859Sml29623 #define	TX_ENT_MSK_CONF_PART_ERR_SHIFT		1	/* bit 1: 0 to flag */
3013859Sml29623 #define	TX_ENT_MSK_CONF_PART_ERR_MASK		0x0000000000000002ULL
3023859Sml29623 #define	TX_ENT_MSK_NACK_PKT_RD_SHIFT		2	/* bit 2: 0 to flag */
3033859Sml29623 #define	TX_ENT_MSK_NACK_PKT_RD_MASK		0x0000000000000004ULL
3043859Sml29623 #define	TX_ENT_MSK_NACK_PREF_SHIFT		3	/* bit 3: 0 to flag */
3053859Sml29623 #define	TX_ENT_MSK_NACK_PREF_MASK		0x0000000000000008ULL
3063859Sml29623 #define	TX_ENT_MSK_PREF_BUF_ECC_ERR_SHIFT	4	/* bit 4: 0 to flag */
3073859Sml29623 #define	TX_ENT_MSK_PREF_BUF_ECC_ERR_MASK	0x0000000000000010ULL
3083859Sml29623 #define	TX_ENT_MSK_TX_RING_OFLOW_SHIFT		5	/* bit 5: 0 to flag */
3093859Sml29623 #define	TX_ENT_MSK_TX_RING_OFLOW_MASK		0x0000000000000020ULL
3103859Sml29623 #define	TX_ENT_MSK_PKT_SIZE_ERR_SHIFT		6	/* bit 6: 0 to flag */
3113859Sml29623 #define	TX_ENT_MSK_PKT_SIZE_ERR_MASK		0x0000000000000040ULL
3123859Sml29623 #define	TX_ENT_MSK_MBOX_ERR_SHIFT		7	/* bit 7: 0 to flag */
3133859Sml29623 #define	TX_ENT_MSK_MBOX_ERR_MASK		0x0000000000000080ULL
3143859Sml29623 #define	TX_ENT_MSK_MK_SHIFT			15	/* bit 15: 0 to flag */
3153859Sml29623 #define	TX_ENT_MSK_MK_MASK			0x0000000000008000ULL
3163859Sml29623 #define	TX_ENT_MSK_MK_ALL		(TX_ENT_MSK_PKT_PRT_ERR_MASK | \
3173859Sml29623 					TX_ENT_MSK_CONF_PART_ERR_MASK |	\
3183859Sml29623 					TX_ENT_MSK_NACK_PKT_RD_MASK |	\
3193859Sml29623 					TX_ENT_MSK_NACK_PREF_MASK |	\
3203859Sml29623 					TX_ENT_MSK_PREF_BUF_ECC_ERR_MASK | \
3213859Sml29623 					TX_ENT_MSK_TX_RING_OFLOW_MASK |	\
3223859Sml29623 					TX_ENT_MSK_PKT_SIZE_ERR_MASK | \
3233859Sml29623 					TX_ENT_MSK_MBOX_ERR_MASK | \
3243859Sml29623 					TX_ENT_MSK_MK_MASK)
3253859Sml29623 
3263859Sml29623 
3273859Sml29623 typedef union _tx_dma_ent_msk_t {
3283859Sml29623 	uint64_t value;
3293859Sml29623 	struct {
3303859Sml29623 #ifdef	_BIG_ENDIAN
3313859Sml29623 		uint32_t hdw;
3323859Sml29623 #endif
3333859Sml29623 		struct {
3343859Sml29623 #if defined(_BIT_FIELDS_HTOL)
3353859Sml29623 			uint32_t res1_1:16;
3363859Sml29623 			uint32_t mk:1;
3373859Sml29623 			uint32_t res2:7;
3383859Sml29623 			uint32_t mbox_err:1;
3393859Sml29623 			uint32_t pkt_size_err:1;
3403859Sml29623 			uint32_t tx_ring_oflow:1;
3413859Sml29623 			uint32_t pref_buf_ecc_err:1;
3423859Sml29623 			uint32_t nack_pref:1;
3433859Sml29623 			uint32_t nack_pkt_rd:1;
3443859Sml29623 			uint32_t conf_part_err:1;
3453859Sml29623 			uint32_t pkt_prt_err:1;
3463859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
3473859Sml29623 			uint32_t pkt_prt_err:1;
3483859Sml29623 			uint32_t conf_part_err:1;
3493859Sml29623 			uint32_t nack_pkt_rd:1;
3503859Sml29623 			uint32_t nack_pref:1;
3513859Sml29623 			uint32_t pref_buf_ecc_err:1;
3523859Sml29623 			uint32_t tx_ring_oflow:1;
3533859Sml29623 			uint32_t pkt_size_err:1;
3543859Sml29623 			uint32_t mbox_err:1;
3553859Sml29623 			uint32_t res2:7;
3563859Sml29623 			uint32_t mk:1;
3573859Sml29623 			uint32_t res1_1:16;
3583859Sml29623 #endif
3593859Sml29623 		} ldw;
3603859Sml29623 #ifndef _BIG_ENDIAN
3613859Sml29623 		uint32_t hdw;
3623859Sml29623 #endif
3633859Sml29623 	} bits;
3643859Sml29623 } tx_dma_ent_msk_t, *p_tx_dma_ent_msk_t;
3653859Sml29623 
3663859Sml29623 
3673859Sml29623 /* Transmit Control and Status  (DMC + 0x40028) */
3683859Sml29623 #define	TX_CS_PKT_PRT_ERR_SHIFT			0	/* RO, bit 0 */
3693859Sml29623 #define	TX_CS_PKT_PRT_ERR_MASK			0x0000000000000001ULL
3703859Sml29623 #define	TX_CS_CONF_PART_ERR_SHIF		1	/* RO, bit 1 */
3713859Sml29623 #define	TX_CS_CONF_PART_ERR_MASK		0x0000000000000002ULL
3723859Sml29623 #define	TX_CS_NACK_PKT_RD_SHIFT			2	/* RO, bit 2 */
3733859Sml29623 #define	TX_CS_NACK_PKT_RD_MASK			0x0000000000000004ULL
3743859Sml29623 #define	TX_CS_PREF_SHIFT			3	/* RO, bit 3 */
3753859Sml29623 #define	TX_CS_PREF_MASK				0x0000000000000008ULL
3763859Sml29623 #define	TX_CS_PREF_BUF_PAR_ERR_SHIFT		4	/* RO, bit 4 */
3773859Sml29623 #define	TX_CS_PREF_BUF_PAR_ERR_MASK		0x0000000000000010ULL
3783859Sml29623 #define	TX_CS_RING_OFLOW_SHIFT			5	/* RO, bit 5 */
3793859Sml29623 #define	TX_CS_RING_OFLOW_MASK			0x0000000000000020ULL
3803859Sml29623 #define	TX_CS_PKT_SIZE_ERR_SHIFT		6	/* RW, bit 6 */
3813859Sml29623 #define	TX_CS_PKT_SIZE_ERR_MASK			0x0000000000000040ULL
3823859Sml29623 #define	TX_CS_MMK_SHIFT				14	/* RC, bit 14 */
3833859Sml29623 #define	TX_CS_MMK_MASK				0x0000000000004000ULL
3843859Sml29623 #define	TX_CS_MK_SHIFT				15	/* RCW1C, bit 15 */
3853859Sml29623 #define	TX_CS_MK_MASK				0x0000000000008000ULL
3863859Sml29623 #define	TX_CS_SNG_SHIFT				27	/* RO, bit 27 */
3873859Sml29623 #define	TX_CS_SNG_MASK				0x0000000008000000ULL
3883859Sml29623 #define	TX_CS_STOP_N_GO_SHIFT			28	/* RW, bit 28 */
3893859Sml29623 #define	TX_CS_STOP_N_GO_MASK			0x0000000010000000ULL
3903859Sml29623 #define	TX_CS_MB_SHIFT				29	/* RO, bit 29 */
3913859Sml29623 #define	TX_CS_MB_MASK				0x0000000020000000ULL
3923859Sml29623 #define	TX_CS_RST_STATE_SHIFT			30	/* Rw, bit 30 */
3933859Sml29623 #define	TX_CS_RST_STATE_MASK			0x0000000040000000ULL
3943859Sml29623 #define	TX_CS_RST_SHIFT				31	/* Rw, bit 31 */
3953859Sml29623 #define	TX_CS_RST_MASK				0x0000000080000000ULL
3963859Sml29623 #define	TX_CS_LASTMASK_SHIFT			32	/* RW, bit 43:32 */
3973859Sml29623 #define	TX_CS_LASTMARK_MASK			0x00000FFF00000000ULL
3983859Sml29623 #define	TX_CS_PKT_CNT_SHIFT			48	/* RW, bit 59:48 */
3993859Sml29623 #define	TX_CS_PKT_CNT_MASK			0x0FFF000000000000ULL
4003859Sml29623 
4013859Sml29623 /* Trasnmit Control and Status */
4023859Sml29623 typedef union _tx_cs_t {
4033859Sml29623 	uint64_t value;
4043859Sml29623 	struct {
4053859Sml29623 #ifdef	_BIG_ENDIAN
4063859Sml29623 		struct {
4073859Sml29623 #if defined(_BIT_FIELDS_HTOL)
4083859Sml29623 			uint32_t res1:4;
4093859Sml29623 			uint32_t pkt_cnt:12;
4103859Sml29623 			uint32_t res2:4;
4113859Sml29623 			uint32_t lastmark:12;
4123859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
4133859Sml29623 			uint32_t lastmark:12;
4143859Sml29623 			uint32_t res2:4;
4153859Sml29623 			uint32_t pkt_cnt:12;
4163859Sml29623 			uint32_t res1:4;
4173859Sml29623 #endif
4183859Sml29623 		} hdw;
4193859Sml29623 
4203859Sml29623 #endif
4213859Sml29623 		struct {
4223859Sml29623 #if defined(_BIT_FIELDS_HTOL)
4233859Sml29623 			uint32_t rst:1;
4243859Sml29623 			uint32_t rst_state:1;
4253859Sml29623 			uint32_t mb:1;
4263859Sml29623 			uint32_t stop_n_go:1;
4273859Sml29623 			uint32_t sng_state:1;
4283859Sml29623 			uint32_t res1:11;
4293859Sml29623 			uint32_t mk:1;
4303859Sml29623 			uint32_t mmk:1;
4313859Sml29623 			uint32_t res2:6;
4323859Sml29623 			uint32_t mbox_err:1;
4333859Sml29623 			uint32_t pkt_size_err:1;
4343859Sml29623 			uint32_t tx_ring_oflow:1;
4353859Sml29623 			uint32_t pref_buf_par_err:1;
4363859Sml29623 			uint32_t nack_pref:1;
4373859Sml29623 			uint32_t nack_pkt_rd:1;
4383859Sml29623 			uint32_t conf_part_err:1;
4393859Sml29623 			uint32_t pkt_prt_err:1;
4403859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
4413859Sml29623 			uint32_t pkt_prt_err:1;
4423859Sml29623 			uint32_t conf_part_err:1;
4433859Sml29623 			uint32_t nack_pkt_rd:1;
4443859Sml29623 			uint32_t nack_pref:1;
4453859Sml29623 			uint32_t pref_buf_par_err:1;
4463859Sml29623 			uint32_t tx_ring_oflow:1;
4473859Sml29623 			uint32_t pkt_size_err:1;
4483859Sml29623 			uint32_t mbox_err:1;
4493859Sml29623 			uint32_t res2:6;
4503859Sml29623 			uint32_t mmk:1;
4513859Sml29623 			uint32_t mk:1;
4523859Sml29623 			uint32_t res1:11;
4533859Sml29623 			uint32_t sng_state:1;
4543859Sml29623 			uint32_t stop_n_go:1;
4553859Sml29623 			uint32_t mb:1;
4563859Sml29623 			uint32_t rst_state:1;
4573859Sml29623 			uint32_t rst:1;
4583859Sml29623 #endif
4593859Sml29623 		} ldw;
4603859Sml29623 #ifndef _BIG_ENDIAN
4613859Sml29623 		struct {
4623859Sml29623 #if defined(_BIT_FIELDS_HTOL)
4633859Sml29623 			uint32_t res1:4;
4643859Sml29623 			uint32_t pkt_cnt:12;
4653859Sml29623 			uint32_t res2:4;
4663859Sml29623 			uint32_t lastmark:12;
4673859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
4683859Sml29623 			uint32_t lastmark:12;
4693859Sml29623 			uint32_t res2:4;
4703859Sml29623 			uint32_t pkt_cnt:12;
4713859Sml29623 			uint32_t res1:4;
4723859Sml29623 #endif
4733859Sml29623 	} hdw;
4743859Sml29623 
4753859Sml29623 #endif
4763859Sml29623 	} bits;
4773859Sml29623 } tx_cs_t, *p_tx_cs_t;
4783859Sml29623 
4793859Sml29623 /* Trasnmit Mailbox High (DMC + 0x40030) */
4803859Sml29623 #define	TXDMA_MBH_SHIFT			0	/* bit 11:0 */
4813859Sml29623 #define	TXDMA_MBH_ADDR_SHIFT		32	/* bit 43:32 */
4823859Sml29623 #define	TXDMA_MBH_MASK			0x0000000000000FFFULL
4833859Sml29623 
4843859Sml29623 typedef union _txdma_mbh_t {
4853859Sml29623 	uint64_t value;
4863859Sml29623 	struct {
4873859Sml29623 #ifdef	_BIG_ENDIAN
4883859Sml29623 		uint32_t hdw;
4893859Sml29623 #endif
4903859Sml29623 		struct {
4913859Sml29623 #if defined(_BIT_FIELDS_HTOL)
4923859Sml29623 			uint32_t res1_1:20;
4933859Sml29623 			uint32_t mbaddr:12;
4943859Sml29623 
4953859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
4963859Sml29623 			uint32_t mbaddr:12;
4973859Sml29623 			uint32_t res1_1:20;
4983859Sml29623 #endif
4993859Sml29623 		} ldw;
5003859Sml29623 #ifndef _BIG_ENDIAN
5013859Sml29623 		uint32_t hdw;
5023859Sml29623 #endif
5033859Sml29623 	} bits;
5043859Sml29623 } txdma_mbh_t, *p_txdma_mbh_t;
5053859Sml29623 
5063859Sml29623 
5073859Sml29623 /* Trasnmit Mailbox Low (DMC + 0x40038) */
5083859Sml29623 #define	TXDMA_MBL_SHIFT			6	/* bit 31:6 */
5093859Sml29623 #define	TXDMA_MBL_MASK			0x00000000FFFFFFC0ULL
5103859Sml29623 
5113859Sml29623 typedef union _txdma_mbl_t {
5123859Sml29623 	uint64_t value;
5133859Sml29623 	struct {
5143859Sml29623 #ifdef	_BIG_ENDIAN
5153859Sml29623 		uint32_t hdw;
5163859Sml29623 #endif
5173859Sml29623 		struct {
5183859Sml29623 #if defined(_BIT_FIELDS_HTOL)
5193859Sml29623 			uint32_t mbaddr:26;
5203859Sml29623 			uint32_t res2:6;
5213859Sml29623 
5223859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
5233859Sml29623 			uint32_t res2:6;
5243859Sml29623 			uint32_t mbaddr:26;
5253859Sml29623 #endif
5263859Sml29623 		} ldw;
5273859Sml29623 #ifndef _BIG_ENDIAN
5283859Sml29623 		uint32_t hdw;
5293859Sml29623 #endif
5303859Sml29623 	} bits;
5313859Sml29623 } txdma_mbl_t, *p_txdma_mbl_t;
5323859Sml29623 
5333859Sml29623 /* Trasnmit Prefetch State High (DMC + 0x40040) */
5343859Sml29623 #define	TX_DMA_PREF_ST_SHIFT		0	/* bit 5:0 */
5353859Sml29623 #define	TX_DMA_PREF_ST_MASK		0x000000000000003FULL
5363859Sml29623 
5373859Sml29623 typedef union _tx_dma_pre_st_t {
5383859Sml29623 	uint64_t value;
5393859Sml29623 	struct {
5403859Sml29623 #ifdef	_BIG_ENDIAN
5413859Sml29623 		uint32_t hdw;
5423859Sml29623 #endif
5433859Sml29623 		struct {
5443859Sml29623 #if defined(_BIT_FIELDS_HTOL)
5453859Sml29623 			uint32_t res1_1:13;
5463859Sml29623 			uint32_t shadow_hd:19;
5473859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
5483859Sml29623 			uint32_t shadow_hd:19;
5493859Sml29623 			uint32_t res1_1:13;
5503859Sml29623 #endif
5513859Sml29623 		} ldw;
5523859Sml29623 #ifndef _BIG_ENDIAN
5533859Sml29623 		uint32_t hdw;
5543859Sml29623 #endif
5553859Sml29623 	} bits;
5563859Sml29623 } tx_dma_pre_st_t, *p_tx_dma_pre_st_t;
5573859Sml29623 
5583859Sml29623 /* Trasnmit Ring Error Log High (DMC + 0x40048) */
5593859Sml29623 #define	TX_RNG_ERR_LOGH_ERR_ADDR_SHIFT		0	/* RO bit 11:0 */
5603859Sml29623 #define	TX_RNG_ERR_LOGH_ERR_ADDR_MASK		0x0000000000000FFFULL
5613859Sml29623 #define	TX_RNG_ERR_LOGH_ADDR_SHIFT		32
5623859Sml29623 #define	TX_RNG_ERR_LOGH_ERRCODE_SHIFT		26	/* RO bit 29:26 */
5633859Sml29623 #define	TX_RNG_ERR_LOGH_ERRCODE_MASK		0x000000003C000000ULL
5643859Sml29623 #define	TX_RNG_ERR_LOGH_MERR_SHIFT		30	/* RO bit 30 */
5653859Sml29623 #define	TX_RNG_ERR_LOGH_MERR_MASK		0x0000000040000000ULL
5663859Sml29623 #define	TX_RNG_ERR_LOGH_ERR_SHIFT		31	/* RO bit 31 */
5673859Sml29623 #define	TX_RNG_ERR_LOGH_ERR_MASK		0x0000000080000000ULL
5683859Sml29623 
5693859Sml29623 /* Transmit Ring Error codes */
5703859Sml29623 #define	TXDMA_RING_PKT_PRT_ERR			0
5713859Sml29623 #define	TXDMA_RING_CONF_PART_ERR		0x01
5723859Sml29623 #define	TXDMA_RING_NACK_PKT_ERR			0x02
5733859Sml29623 #define	TXDMA_RING_NACK_PREF_ERR		0x03
5743859Sml29623 #define	TXDMA_RING_PREF_BUF_PAR_ERR		0x04
5753859Sml29623 #define	TXDMA_RING_TX_RING_OFLOW_ERR		0x05
5763859Sml29623 #define	TXDMA_RING_PKT_SIZE_ERR			0x06
5773859Sml29623 
5783859Sml29623 typedef union _tx_rng_err_logh_t {
5793859Sml29623 	uint64_t value;
5803859Sml29623 	struct {
5813859Sml29623 #ifdef	_BIG_ENDIAN
5823859Sml29623 		uint32_t hdw;
5833859Sml29623 #endif
5843859Sml29623 		struct {
5853859Sml29623 #if defined(_BIT_FIELDS_HTOL)
5863859Sml29623 			uint32_t err:1;
5873859Sml29623 			uint32_t merr:1;
5883859Sml29623 			uint32_t errcode:4;
5893859Sml29623 			uint32_t res2:14;
5903859Sml29623 			uint32_t err_addr:12;
5913859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
5923859Sml29623 			uint32_t err_addr:12;
5933859Sml29623 			uint32_t res2:14;
5943859Sml29623 			uint32_t errcode:4;
5953859Sml29623 			uint32_t merr:1;
5963859Sml29623 			uint32_t err:1;
5973859Sml29623 
5983859Sml29623 #endif
5993859Sml29623 		} ldw;
6003859Sml29623 #ifndef _BIG_ENDIAN
6013859Sml29623 		uint32_t hdw;
6023859Sml29623 #endif
6033859Sml29623 	} bits;
6043859Sml29623 } tx_rng_err_logh_t, *p_tx_rng_err_logh_t;
6053859Sml29623 
6063859Sml29623 
6073859Sml29623 /* Trasnmit Ring Error Log Log (DMC + 0x40050) */
6083859Sml29623 #define	TX_RNG_ERR_LOGL_ERR_ADDR_SHIFT		0	/* RO bit 31:0 */
6093859Sml29623 #define	TX_RNG_ERR_LOGL_ERR_ADDR_MASK		0x00000000FFFFFFFFULL
6103859Sml29623 
6113859Sml29623 typedef union _tx_rng_err_logl_t {
6123859Sml29623 	uint64_t value;
6133859Sml29623 	struct {
6143859Sml29623 #ifdef	_BIG_ENDIAN
6153859Sml29623 		uint32_t hdw;
6163859Sml29623 #endif
6173859Sml29623 		struct {
6183859Sml29623 #if defined(_BIT_FIELDS_HTOL)
6193859Sml29623 			uint32_t err_addr:32;
6203859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
6213859Sml29623 			uint32_t err_addr:32;
6223859Sml29623 
6233859Sml29623 #endif
6243859Sml29623 		} ldw;
6253859Sml29623 #ifndef _BIG_ENDIAN
6263859Sml29623 		uint32_t hdw;
6273859Sml29623 #endif
6283859Sml29623 	} bits;
6293859Sml29623 } tx_rng_err_logl_t, *p_tx_rng_err_logl_t;
6303859Sml29623 
6313859Sml29623 /*
6323859Sml29623  * TDMC_INTR_RBG_REG (DMC + 0x40060)
6333859Sml29623  */
6343859Sml29623 typedef union _tdmc_intr_dbg_t {
6353859Sml29623 	uint64_t value;
6363859Sml29623 	struct {
6373859Sml29623 #ifdef	_BIG_ENDIAN
6383859Sml29623 		uint32_t hdw;
6393859Sml29623 #endif
6403859Sml29623 		struct {
6413859Sml29623 #if defined(_BIT_FIELDS_HTOL)
6423859Sml29623 			uint32_t res:16;
6433859Sml29623 			uint32_t mk:1;
6443859Sml29623 			uint32_t rsvd:7;
6453859Sml29623 			uint32_t mbox_err:1;
6463859Sml29623 			uint32_t pkt_size_err:1;
6473859Sml29623 			uint32_t tx_ring_oflow:1;
6483859Sml29623 			uint32_t pref_buf_par_err:1;
6493859Sml29623 			uint32_t nack_pref:1;
6503859Sml29623 			uint32_t nack_pkt_rd:1;
6513859Sml29623 			uint32_t conf_part_err:1;
6523859Sml29623 			uint32_t pkt_part_err:1;
6533859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
6543859Sml29623 			uint32_t pkt_part_err:1;
6553859Sml29623 			uint32_t conf_part_err:1;
6563859Sml29623 			uint32_t nack_pkt_rd:1;
6573859Sml29623 			uint32_t nack_pref:1;
6583859Sml29623 			uint32_t pref_buf_par_err:1;
6593859Sml29623 			uint32_t tx_ring_oflow:1;
6603859Sml29623 			uint32_t pkt_size_err:1;
6613859Sml29623 			uint32_t mbox_err:1;
6623859Sml29623 			uint32_t rsvd:7;
6633859Sml29623 			uint32_t mk:1;
6643859Sml29623 			uint32_t res:16;
6653859Sml29623 #endif
6663859Sml29623 		} ldw;
6673859Sml29623 #ifndef _BIG_ENDIAN
6683859Sml29623 		uint32_t hdw;
6693859Sml29623 #endif
6703859Sml29623 	} bits;
6713859Sml29623 } tdmc_intr_dbg_t, *p_tdmc_intr_dbg_t;
6723859Sml29623 
6733859Sml29623 
6743859Sml29623 /*
6753859Sml29623  * TX_CS_DBG (DMC + 0x40068)
6763859Sml29623  */
6773859Sml29623 typedef union _tx_cs_dbg_t {
6783859Sml29623 	uint64_t value;
6793859Sml29623 	struct {
6803859Sml29623 #ifdef	_BIG_ENDIAN
6813859Sml29623 		struct {
6823859Sml29623 #if defined(_BIT_FIELDS_HTOL)
6833859Sml29623 			uint32_t res1:4;
6843859Sml29623 			uint32_t pkt_cnt:12;
6853859Sml29623 			uint32_t res2:16;
6863859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
6873859Sml29623 			uint32_t res2:16;
6883859Sml29623 			uint32_t pkt_cnt:12;
6893859Sml29623 			uint32_t res1:4;
6903859Sml29623 #endif
6913859Sml29623 		} hdw;
6923859Sml29623 
6933859Sml29623 #endif
6943859Sml29623 		struct {
6953859Sml29623 #if defined(_BIT_FIELDS_HTOL)
6963859Sml29623 			uint32_t rsvd:32;
6973859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
6983859Sml29623 			uint32_t rsvd:32;
6993859Sml29623 
7003859Sml29623 #endif
7013859Sml29623 		} ldw;
7023859Sml29623 
7033859Sml29623 #ifndef _BIG_ENDIAN
7043859Sml29623 		struct {
7053859Sml29623 #if defined(_BIT_FIELDS_HTOL)
7063859Sml29623 			uint32_t res1:4;
7073859Sml29623 			uint32_t pkt_cnt:12;
7083859Sml29623 			uint32_t res2:16;
7093859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
7103859Sml29623 			uint32_t res2:16;
7113859Sml29623 			uint32_t pkt_cnt:12;
7123859Sml29623 			uint32_t res1:4;
7133859Sml29623 #endif
7143859Sml29623 	} hdw;
7153859Sml29623 
7163859Sml29623 #endif
7173859Sml29623 	} bits;
7183859Sml29623 } tx_cs_dbg_t, *p_tx_cs_dbg_t;
7193859Sml29623 
7203859Sml29623 #define	TXDMA_MAILBOX_BYTE_LENGTH		64
7213859Sml29623 #define	TXDMA_MAILBOX_UNUSED			24
7223859Sml29623 
7233859Sml29623 typedef struct _txdma_mailbox_t {
7243859Sml29623 	tx_cs_t			tx_cs;				/* 8 bytes */
7253859Sml29623 	tx_dma_pre_st_t		tx_dma_pre_st;			/* 8 bytes */
7263859Sml29623 	tx_ring_hdl_t		tx_ring_hdl;			/* 8 bytes */
7273859Sml29623 	tx_ring_kick_t		tx_ring_kick;			/* 8 bytes */
7283859Sml29623 	uint32_t		tx_rng_err_logh;		/* 4 bytes */
7293859Sml29623 	uint32_t		tx_rng_err_logl;		/* 4 bytes */
7303859Sml29623 	uint32_t		resv[TXDMA_MAILBOX_UNUSED];
7313859Sml29623 } txdma_mailbox_t, *p_txdma_mailbox_t;
7323859Sml29623 
7333859Sml29623 #if OLD
7343859Sml29623 /* Transmit Ring Scheduler (per port) */
7353859Sml29623 #define	TX_DMA_MAP_OFFSET(port)		(port * 8 + TX_DMA_MAP_REG)
7363859Sml29623 #define	TX_DMA_MAP_PORT_OFFSET(port)	(port * 8)
7373859Sml29623 #define	TX_DMA_MAP_REG			(FZC_DMC + 0x50000)
7383859Sml29623 #define	TX_DMA_MAP0_REG			(FZC_DMC + 0x50000)
7393859Sml29623 #define	TX_DMA_MAP1_REG			(FZC_DMC + 0x50008)
7403859Sml29623 #define	TX_DMA_MAP2_REG			(FZC_DMC + 0x50010)
7413859Sml29623 #define	TX_DMA_MAP3_REG			(FZC_DMC + 0x50018)
7423859Sml29623 
7433859Sml29623 #define	TX_DMA_MAP_SHIFT		0	/* RO bit 31:0 */
7443859Sml29623 #define	TX_DMA_MAPMASK			0x00000000FFFFFFFFULL
7453859Sml29623 
7463859Sml29623 typedef union _tx_dma_map_t {
7473859Sml29623 	uint64_t value;
7483859Sml29623 	struct {
7493859Sml29623 #ifdef	_BIG_ENDIAN
7503859Sml29623 		uint32_t hdw;
7513859Sml29623 #endif
7523859Sml29623 		struct {
7533859Sml29623 #if defined(_BIT_FIELDS_HTOL)
7543859Sml29623 			uint32_t bind:32;
7553859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
7563859Sml29623 			uint32_t bind:32;
7573859Sml29623 
7583859Sml29623 #endif
7593859Sml29623 		} ldw;
7603859Sml29623 #ifndef _BIG_ENDIAN
7613859Sml29623 		uint32_t hdw;
7623859Sml29623 #endif
7633859Sml29623 	} bits;
7643859Sml29623 } tx_dma_map_t, *p_tx_dma_map_t;
7653859Sml29623 #endif
7663859Sml29623 
7673859Sml29623 #if OLD
7683859Sml29623 /* Transmit Ring Scheduler: DRR Weight (32 Channels) */
7693859Sml29623 #define	DRR_WT_REG			(FZC_DMC + 0x51000)
7703859Sml29623 #define	DRR_WT_SHIFT			0	/* RO bit 19:0 */
7713859Sml29623 #define	DRR_WT_MASK			0x00000000000FFFFFULL
7723859Sml29623 
7733859Sml29623 #define	TXDMA_DRR_RNG_USE_OFFSET(channel)	(channel * 16)
7743859Sml29623 
7753859Sml29623 typedef union _drr_wt_t {
7763859Sml29623 	uint64_t value;
7773859Sml29623 	struct {
7783859Sml29623 #ifdef	_BIG_ENDIAN
7793859Sml29623 		uint32_t hdw;
7803859Sml29623 #endif
7813859Sml29623 		struct {
7823859Sml29623 #if defined(_BIT_FIELDS_HTOL)
7833859Sml29623 			uint32_t res1_1:12;
7843859Sml29623 			uint32_t wt:20;
7853859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
7863859Sml29623 			uint32_t wt:20;
7873859Sml29623 			uint32_t res1_1:12;
7883859Sml29623 #endif
7893859Sml29623 		} ldw;
7903859Sml29623 #ifndef _BIG_ENDIAN
7913859Sml29623 		uint32_t hdw;
7923859Sml29623 #endif
7933859Sml29623 	} bits;
7943859Sml29623 } drr_wt_t, *p_drr_wt_t;
7953859Sml29623 #endif
7963859Sml29623 
7973859Sml29623 #if OLD
7983859Sml29623 
7993859Sml29623 /* Performance Monitoring (32 Channels) */
8003859Sml29623 #define	TXRNG_USE_REG			(FZC_DMC + 0x51008)
8013859Sml29623 #define	TXRNG_USE_CNT_SHIFT		0	/* RO bit 26:0 */
8023859Sml29623 #define	TXRNG_USE_CNT_MASK		0x0000000007FFFFFFULL
8033859Sml29623 #define	TXRNG_USE_OFLOW_SHIFT		0	/* RO bit 27 */
8043859Sml29623 #define	TXRNG_USE_OFLOW_MASK		0x0000000008000000ULL
8053859Sml29623 
8063859Sml29623 typedef union _txrng_use_t {
8073859Sml29623 	uint64_t value;
8083859Sml29623 	struct {
8093859Sml29623 #ifdef	_BIG_ENDIAN
8103859Sml29623 		uint32_t hdw;
8113859Sml29623 #endif
8123859Sml29623 		struct {
8133859Sml29623 #if defined(_BIT_FIELDS_HTOL)
8143859Sml29623 			uint32_t res1_1:4;
8153859Sml29623 			uint32_t oflow:1;
8163859Sml29623 			uint32_t cnt:27;
8173859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
8183859Sml29623 			uint32_t cnt:27;
8193859Sml29623 			uint32_t oflow:1;
8203859Sml29623 			uint32_t res1_1:4;
8213859Sml29623 
8223859Sml29623 #endif
8233859Sml29623 		} ldw;
8243859Sml29623 #ifndef _BIG_ENDIAN
8253859Sml29623 		uint32_t hdw;
8263859Sml29623 #endif
8273859Sml29623 	} bits;
8283859Sml29623 } txrng_use_t, *p_txrng_use_t;
8293859Sml29623 
8303859Sml29623 #endif
8313859Sml29623 
8323859Sml29623 /*
8333859Sml29623  * Internal Transmit Packet Format (16 bytes)
8343859Sml29623  */
8353859Sml29623 #define	TX_PKT_HEADER_SIZE			16
8363859Sml29623 #define	TX_MAX_GATHER_POINTERS			15
8373859Sml29623 #define	TX_GATHER_POINTERS_THRESHOLD		8
8383859Sml29623 /*
8393859Sml29623  * There is bugs in the hardware
8403859Sml29623  * and max sfter len is changed from 4096 to 4076.
8413859Sml29623  *
8423859Sml29623  * Jumbo from 9500 to 9216
8433859Sml29623  */
8443859Sml29623 #define	TX_MAX_TRANSFER_LENGTH			4076
8453859Sml29623 #define	TX_JUMBO_MTU				9216
8463859Sml29623 
8473859Sml29623 #define	TX_PKT_HEADER_PAD_SHIFT			0	/* bit 2:0 */
8483859Sml29623 #define	TX_PKT_HEADER_PAD_MASK			0x0000000000000007ULL
8493859Sml29623 #define	TX_PKT_HEADER_TOT_XFER_LEN_SHIFT	16	/* bit 16:29 */
8503859Sml29623 #define	TX_PKT_HEADER_TOT_XFER_LEN_MASK		0x000000000000FFF8ULL
8513859Sml29623 #define	TX_PKT_HEADER_L4STUFF_SHIFT		32	/* bit 37:32 */
8523859Sml29623 #define	TX_PKT_HEADER_L4STUFF_MASK		0x0000003F00000000ULL
8533859Sml29623 #define	TX_PKT_HEADER_L4START_SHIFT		40	/* bit 45:40 */
8543859Sml29623 #define	TX_PKT_HEADER_L4START_MASK		0x00003F0000000000ULL
8553859Sml29623 #define	TX_PKT_HEADER_L3START_SHIFT		48	/* bit 45:40 */
8563859Sml29623 #define	TX_PKT_HEADER_IHL_SHIFT			52	/* bit 52 */
8573859Sml29623 #define	TX_PKT_HEADER_VLAN__SHIFT		56	/* bit 56 */
8583859Sml29623 #define	TX_PKT_HEADER_TCP_UDP_CRC32C_SHIFT	57	/* bit 57 */
8593859Sml29623 #define	TX_PKT_HEADER_LLC_SHIFT			57	/* bit 57 */
8603859Sml29623 #define	TX_PKT_HEADER_TCP_UDP_CRC32C_SET	0x0200000000000000ULL
8613859Sml29623 #define	TX_PKT_HEADER_TCP_UDP_CRC32C_MASK	0x0200000000000000ULL
8623859Sml29623 #define	TX_PKT_HEADER_L4_PROTO_OP_SHIFT		2	/* bit 59:58 */
8633859Sml29623 #define	TX_PKT_HEADER_L4_PROTO_OP_MASK		0x0C00000000000000ULL
8643859Sml29623 #define	TX_PKT_HEADER_V4_HDR_CS_SHIFT		60	/* bit 60 */
8653859Sml29623 #define	TX_PKT_HEADER_V4_HDR_CS_SET		0x1000000000000000ULL
8663859Sml29623 #define	TX_PKT_HEADER_V4_HDR_CS_MASK		0x1000000000000000ULL
8673859Sml29623 #define	TX_PKT_HEADER_IP_VER_SHIFT		61	/* bit 61 */
8683859Sml29623 #define	TX_PKT_HEADER_IP_VER_MASK		0x2000000000000000ULL
8693859Sml29623 #define	TX_PKT_HEADER_PKT_TYPE_SHIFT		62	/* bit 62 */
8703859Sml29623 #define	TX_PKT_HEADER_PKT_TYPE_MASK		0x4000000000000000ULL
8713859Sml29623 
8723859Sml29623 /* L4 Prototol Operations */
8733859Sml29623 #define	TX_PKT_L4_PROTO_OP_NOP			0x00
8743859Sml29623 #define	TX_PKT_L4_PROTO_OP_FULL_L4_CSUM		0x01
8753859Sml29623 #define	TX_PKT_L4_PROTO_OP_L4_PAYLOAD_CSUM	0x02
8763859Sml29623 #define	TX_PKT_L4_PROTO_OP_SCTP_CRC32		0x04
8773859Sml29623 
8783859Sml29623 /* Transmit Packet Types */
8793859Sml29623 #define	TX_PKT_PKT_TYPE_NOP			0x00
8803859Sml29623 #define	TX_PKT_PKT_TYPE_TCP			0x01
8813859Sml29623 #define	TX_PKT_PKT_TYPE_UDP			0x02
8823859Sml29623 #define	TX_PKT_PKT_TYPE_SCTP			0x03
8833859Sml29623 
884*6611Sml29623 #define	TX_CKSUM_EN_PKT_TYPE_TCP	(1ull << TX_PKT_HEADER_PKT_TYPE_SHIFT)
885*6611Sml29623 #define	TX_CKSUM_EN_PKT_TYPE_UDP	(2ull << TX_PKT_HEADER_PKT_TYPE_SHIFT)
886*6611Sml29623 #define	TX_CKSUM_EN_PKT_TYPE_NOOP	(0ull << TX_PKT_HEADER_PKT_TYPE_SHIFT)
887*6611Sml29623 
8883859Sml29623 typedef union _tx_pkt_header_t {
8893859Sml29623 	uint64_t value;
8903859Sml29623 	struct {
8913859Sml29623 		struct {
8923859Sml29623 #if defined(_BIT_FIELDS_HTOL)
8933859Sml29623 			uint32_t pad:3;
8943859Sml29623 			uint32_t resv2:13;
8953859Sml29623 			uint32_t tot_xfer_len:14;
8963859Sml29623 			uint32_t resv1:2;
8973859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
8983859Sml29623 			uint32_t pad:3;
8993859Sml29623 			uint32_t resv2:13;
9003859Sml29623 			uint32_t tot_xfer_len:14;
9013859Sml29623 			uint32_t resv1:2;
9023859Sml29623 #endif
9033859Sml29623 		} ldw;
9043859Sml29623 		struct {
9053859Sml29623 #if defined(_BIT_FIELDS_HTOL)
9063859Sml29623 			uint32_t l4stuff:6;
9073859Sml29623 			uint32_t resv3:2;
9083859Sml29623 			uint32_t l4start:6;
9093859Sml29623 			uint32_t resv2:2;
9103859Sml29623 			uint32_t l3start:4;
9113859Sml29623 			uint32_t ihl:4;
9123859Sml29623 			uint32_t vlan:1;
9133859Sml29623 			uint32_t llc:1;
9143859Sml29623 			uint32_t res1:3;
9153859Sml29623 			uint32_t ip_ver:1;
9163859Sml29623 			uint32_t cksum_en_pkt_type:2;
9173859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
9183859Sml29623 			uint32_t l4stuff:6;
9193859Sml29623 			uint32_t resv3:2;
9203859Sml29623 			uint32_t l4start:6;
9213859Sml29623 			uint32_t resv2:2;
9223859Sml29623 			uint32_t l3start:4;
9233859Sml29623 			uint32_t ihl:4;
9243859Sml29623 			uint32_t vlan:1;
9253859Sml29623 			uint32_t llc:1;
9263859Sml29623 			uint32_t res1:3;
9273859Sml29623 			uint32_t ip_ver:1;
9283859Sml29623 			uint32_t cksum_en_pkt_type:2;
9293859Sml29623 #endif
9303859Sml29623 		} hdw;
9313859Sml29623 	} bits;
9323859Sml29623 } tx_pkt_header_t, *p_tx_pkt_header_t;
9333859Sml29623 
9343859Sml29623 typedef struct _tx_pkt_hdr_all_t {
9353859Sml29623 	tx_pkt_header_t		pkthdr;
9363859Sml29623 	uint64_t		reserved;
9373859Sml29623 } tx_pkt_hdr_all_t, *p_tx_pkt_hdr_all_t;
9383859Sml29623 
9393859Sml29623 /* Debug only registers */
9403859Sml29623 #define	TDMC_INJ_PAR_ERR_REG		(FZC_DMC + 0x45040)
9413859Sml29623 #define	TDMC_INJ_PAR_ERR_MASK		0x0000000000FFFFFFULL
9423859Sml29623 #define	TDMC_INJ_PAR_ERR_MASK_N2	0x000000000000FFFFULL
9433859Sml29623 
9443859Sml29623 typedef union _tdmc_inj_par_err_t {
9453859Sml29623 	uint64_t value;
9463859Sml29623 	struct {
9473859Sml29623 #ifdef	_BIG_ENDIAN
9483859Sml29623 		uint32_t hdw;
9493859Sml29623 #endif
9503859Sml29623 		struct {
9513859Sml29623 #if defined(_BIT_FIELDS_HTOL)
9523859Sml29623 			uint32_t rsvc:8;
9533859Sml29623 			uint32_t inject_parity_error:24;
9543859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
9553859Sml29623 			uint32_t inject_parity_error:24;
9563859Sml29623 			uint32_t rsvc:8;
9573859Sml29623 #endif
9583859Sml29623 		} ldw;
9593859Sml29623 #ifndef _BIG_ENDIAN
9603859Sml29623 		uint32_t hdw;
9613859Sml29623 #endif
9623859Sml29623 	} bits;
9633859Sml29623 } tdmc_inj_par_err_t, *p_tdmc_inj_par_err_t;
9643859Sml29623 
9653859Sml29623 typedef union _tdmc_inj_par_err_n2_t {
9663859Sml29623 	uint64_t value;
9673859Sml29623 	struct {
9683859Sml29623 #ifdef	_BIG_ENDIAN
9693859Sml29623 		uint32_t hdw;
9703859Sml29623 #endif
9713859Sml29623 		struct {
9723859Sml29623 #if defined(_BIT_FIELDS_HTOL)
9733859Sml29623 			uint32_t rsvc:16;
9743859Sml29623 			uint32_t inject_parity_error:16;
9753859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
9763859Sml29623 			uint32_t inject_parity_error:16;
9773859Sml29623 			uint32_t rsvc:16;
9783859Sml29623 #endif
9793859Sml29623 		} ldw;
9803859Sml29623 #ifndef _BIG_ENDIAN
9813859Sml29623 		uint32_t hdw;
9823859Sml29623 #endif
9833859Sml29623 	} bits;
9843859Sml29623 } tdmc_inj_par_err_n2_t, *p_tdmc_inj_par_err_n2_t;
9853859Sml29623 
9863859Sml29623 #define	TDMC_DBG_SEL_REG		(FZC_DMC + 0x45080)
9873859Sml29623 #define	TDMC_DBG_SEL_MASK		0x000000000000003FULL
9883859Sml29623 
9893859Sml29623 typedef union _tdmc_dbg_sel_t {
9903859Sml29623 	uint64_t value;
9913859Sml29623 	struct {
9923859Sml29623 #ifdef	_BIG_ENDIAN
9933859Sml29623 		uint32_t hdw;
9943859Sml29623 #endif
9953859Sml29623 		struct {
9963859Sml29623 #if defined(_BIT_FIELDS_HTOL)
9973859Sml29623 			uint32_t rsvc:26;
9983859Sml29623 			uint32_t dbg_sel:6;
9993859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
10003859Sml29623 			uint32_t dbg_sel:6;
10013859Sml29623 			uint32_t rsvc:26;
10023859Sml29623 #endif
10033859Sml29623 		} ldw;
10043859Sml29623 #ifndef _BIG_ENDIAN
10053859Sml29623 		uint32_t hdw;
10063859Sml29623 #endif
10073859Sml29623 	} bits;
10083859Sml29623 } tdmc_dbg_sel_t, *p_tdmc_dbg_sel_t;
10093859Sml29623 
10103859Sml29623 #define	TDMC_TRAINING_REG		(FZC_DMC + 0x45088)
10113859Sml29623 #define	TDMC_TRAINING_MASK		0x00000000FFFFFFFFULL
10123859Sml29623 
10133859Sml29623 typedef union _tdmc_training_t {
10143859Sml29623 	uint64_t value;
10153859Sml29623 	struct {
10163859Sml29623 #ifdef	_BIG_ENDIAN
10173859Sml29623 		uint32_t hdw;
10183859Sml29623 #endif
10193859Sml29623 		struct {
10203859Sml29623 #if defined(_BIT_FIELDS_HTOL)
10213859Sml29623 			uint32_t vec:32;
10223859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
10233859Sml29623 			uint32_t vec:6;
10243859Sml29623 #endif
10253859Sml29623 		} ldw;
10263859Sml29623 #ifndef _BIG_ENDIAN
10273859Sml29623 		uint32_t hdw;
10283859Sml29623 #endif
10293859Sml29623 	} bits;
10303859Sml29623 } tdmc_training_t, *p_tdmc_training_t;
10313859Sml29623 
10323859Sml29623 #ifdef	__cplusplus
10333859Sml29623 }
10343859Sml29623 #endif
10353859Sml29623 
10363859Sml29623 #endif	/* _SYS_NXGE_NXGE_TXDMA_HW_H */
1037