xref: /onnv-gate/usr/src/uts/common/sys/nxge/nxge_ipp_hw.h (revision 5523:04f3e2f192d3)
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 /*
22*5523Syc148097  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
233859Sml29623  * Use is subject to license terms.
243859Sml29623  */
253859Sml29623 
263859Sml29623 #ifndef _SYS_NXGE_NXGE_IPP_HW_H
273859Sml29623 #define	_SYS_NXGE_NXGE_IPP_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 
373859Sml29623 /* IPP Registers */
383859Sml29623 #define	IPP_CONFIG_REG				0x000
393859Sml29623 #define	IPP_DISCARD_PKT_CNT_REG			0x020
40*5523Syc148097 #define	IPP_BAD_CKSUM_ERR_CNT_REG		0x028
413859Sml29623 #define	IPP_ECC_ERR_COUNTER_REG			0x030
423859Sml29623 #define	IPP_INT_STATUS_REG			0x040
433859Sml29623 #define	IPP_INT_MASK_REG			0x048
443859Sml29623 
453859Sml29623 #define	IPP_PFIFO_RD_DATA0_REG			0x060
463859Sml29623 #define	IPP_PFIFO_RD_DATA1_REG			0x068
473859Sml29623 #define	IPP_PFIFO_RD_DATA2_REG			0x070
483859Sml29623 #define	IPP_PFIFO_RD_DATA3_REG			0x078
493859Sml29623 #define	IPP_PFIFO_RD_DATA4_REG			0x080
503859Sml29623 #define	IPP_PFIFO_WR_DATA0_REG			0x088
513859Sml29623 #define	IPP_PFIFO_WR_DATA1_REG			0x090
523859Sml29623 #define	IPP_PFIFO_WR_DATA2_REG			0x098
533859Sml29623 #define	IPP_PFIFO_WR_DATA3_REG			0x0a0
543859Sml29623 #define	IPP_PFIFO_WR_DATA4_REG			0x0a8
553859Sml29623 #define	IPP_PFIFO_RD_PTR_REG			0x0b0
563859Sml29623 #define	IPP_PFIFO_WR_PTR_REG			0x0b8
573859Sml29623 #define	IPP_DFIFO_RD_DATA0_REG			0x0c0
583859Sml29623 #define	IPP_DFIFO_RD_DATA1_REG			0x0c8
593859Sml29623 #define	IPP_DFIFO_RD_DATA2_REG			0x0d0
603859Sml29623 #define	IPP_DFIFO_RD_DATA3_REG			0x0d8
613859Sml29623 #define	IPP_DFIFO_RD_DATA4_REG			0x0e0
623859Sml29623 #define	IPP_DFIFO_WR_DATA0_REG			0x0e8
633859Sml29623 #define	IPP_DFIFO_WR_DATA1_REG			0x0f0
643859Sml29623 #define	IPP_DFIFO_WR_DATA2_REG			0x0f8
653859Sml29623 #define	IPP_DFIFO_WR_DATA3_REG			0x100
663859Sml29623 #define	IPP_DFIFO_WR_DATA4_REG			0x108
673859Sml29623 #define	IPP_DFIFO_RD_PTR_REG			0x110
683859Sml29623 #define	IPP_DFIFO_WR_PTR_REG			0x118
693859Sml29623 #define	IPP_STATE_MACHINE_REG			0x120
703859Sml29623 #define	IPP_CKSUM_STATUS_REG			0x128
713859Sml29623 #define	IPP_FFLP_CKSUM_INFO_REG			0x130
723859Sml29623 #define	IPP_DEBUG_SELECT_REG			0x138
733859Sml29623 #define	IPP_DFIFO_ECC_SYNDROME_REG		0x140
743859Sml29623 #define	IPP_DFIFO_EOPM_RD_PTR_REG		0x148
753859Sml29623 #define	IPP_ECC_CTRL_REG			0x150
763859Sml29623 
773859Sml29623 #define	IPP_PORT_OFFSET				0x4000
783859Sml29623 #define	IPP_PORT0_OFFSET			0
793859Sml29623 #define	IPP_PORT1_OFFSET			0x8000
803859Sml29623 #define	IPP_PORT2_OFFSET			0x4000
813859Sml29623 #define	IPP_PORT3_OFFSET			0xc000
823859Sml29623 #define	IPP_REG_ADDR(port_num, reg)\
833859Sml29623 	((port_num == 0) ? FZC_IPP + reg : \
843859Sml29623 	FZC_IPP + reg + (((port_num % 2) * IPP_PORT_OFFSET) + \
853859Sml29623 	((port_num / 3) * IPP_PORT_OFFSET) + IPP_PORT_OFFSET))
863859Sml29623 #define	IPP_PORT_ADDR(port_num)\
873859Sml29623 	((port_num == 0) ? FZC_IPP: \
883859Sml29623 	FZC_IPP + (((port_num % 2) * IPP_PORT_OFFSET) + \
893859Sml29623 	((port_num / 3) * IPP_PORT_OFFSET) + IPP_PORT_OFFSET))
903859Sml29623 
913859Sml29623 /* IPP Configuration Register */
923859Sml29623 
933859Sml29623 #define	IPP_SOFT_RESET				(1ULL << 31)
943859Sml29623 #define	IPP_IP_MAX_PKT_BYTES_SHIFT		8
953859Sml29623 #define	IPP_IP_MAX_PKT_BYTES_MASK		0x1FFFF
963859Sml29623 #define	IPP_FFLP_CKSUM_INFO_PIO_WR_EN		(1 << 7)
973859Sml29623 #define	IPP_PRE_FIFO_PIO_WR_EN			(1 << 6)
983859Sml29623 #define	IPP_DFIFO_PIO_WR_EN			(1 << 5)
993859Sml29623 #define	IPP_TCP_UDP_CKSUM_EN			(1 << 4)
1003859Sml29623 #define	IPP_DROP_BAD_CRC_EN			(1 << 3)
1013859Sml29623 #define	IPP_DFIFO_ECC_CORRECT_EN		(1 << 2)
1023859Sml29623 #define	IPP_EN					(1 << 0)
1033859Sml29623 
1043859Sml29623 /* IPP Interrupt Status Registers */
1053859Sml29623 
1063859Sml29623 #define	IPP_DFIFO_MISSED_SOP			(1ULL << 31)
1073859Sml29623 #define	IPP_DFIFO_MISSED_EOP			(1 << 30)
1083859Sml29623 #define	IPP_DFIFO_ECC_UNCORR_ERR_MASK		0x3
1093859Sml29623 #define	IPP_DFIFO_ECC_UNCORR_ERR_SHIFT		28
1103859Sml29623 #define	IPP_DFIFO_ECC_CORR_ERR_MASK		0x3
1113859Sml29623 #define	IPP_DFIFO_ECC_CORR_ERR_SHIFT		26
1123859Sml29623 #define	IPP_DFIFO_ECC_ERR_MASK			0x3
1133859Sml29623 #define	IPP_DFIFO_ECC_ERR_SHIFT			24
1143859Sml29623 #define	IPP_DFIFO_NO_ECC_ERR			(1 << 23)
1153859Sml29623 #define	IPP_DFIFO_ECC_ERR_ENTRY_INDEX_MASK	0x7FF
1163859Sml29623 #define	IPP_DFIFO_ECC_ERR_ENTRY_INDEX_SHIFT	12
1173859Sml29623 #define	IPP_PRE_FIFO_PERR			(1 << 11)
1183859Sml29623 #define	IPP_ECC_ERR_CNT_MAX			(1 << 10)
1193859Sml29623 #define	IPP_PRE_FIFO_PERR_ENTRY_INDEX_MASK	0x3F
1203859Sml29623 #define	IPP_PRE_FIFO_PERR_ENTRY_INDEX_SHIFT	4
1213859Sml29623 #define	IPP_PRE_FIFO_OVERRUN			(1 << 3)
1223859Sml29623 #define	IPP_PRE_FIFO_UNDERRUN			(1 << 2)
1233859Sml29623 #define	IPP_BAD_TCPIP_CHKSUM_CNT_MAX		(1 << 1)
1243859Sml29623 #define	IPP_PKT_DISCARD_CNT_MAX			(1 << 0)
1253859Sml29623 
1263859Sml29623 #define	IPP_P0_P1_DFIFO_ENTRIES			2048
1273859Sml29623 #define	IPP_P2_P3_DFIFO_ENTRIES			1024
1283859Sml29623 #define	IPP_NIU_DFIFO_ENTRIES			1024
1293859Sml29623 
1303859Sml29623 typedef	union _ipp_status {
1313859Sml29623 	uint64_t value;
1323859Sml29623 
1333859Sml29623 	struct {
1343859Sml29623 #if defined(_BIG_ENDIAN)
1353859Sml29623 		uint32_t	w1;
1363859Sml29623 #endif
1373859Sml29623 		struct {
1383859Sml29623 #if defined(_BIT_FIELDS_HTOL)
1393859Sml29623 		uint32_t dfifo_missed_sop	: 1;
1403859Sml29623 		uint32_t dfifo_missed_eop	: 1;
1413859Sml29623 		uint32_t dfifo_uncorr_ecc_err	: 2;
1423859Sml29623 		uint32_t dfifo_corr_ecc_err	: 2;
1433859Sml29623 		uint32_t dfifo_ecc_err		: 2;
1443859Sml29623 		uint32_t dfifo_no_ecc_err	: 1;
1453859Sml29623 		uint32_t dfifo_ecc_err_idx	: 11;
1463859Sml29623 		uint32_t pre_fifo_perr		: 1;
1473859Sml29623 		uint32_t ecc_err_cnt_ovfl	: 1;
1483859Sml29623 		uint32_t pre_fifo_perr_idx	: 6;
1493859Sml29623 		uint32_t pre_fifo_overrun	: 1;
1503859Sml29623 		uint32_t pre_fifo_underrun	: 1;
1513859Sml29623 		uint32_t bad_cksum_cnt_ovfl	: 1;
1523859Sml29623 		uint32_t pkt_discard_cnt_ovfl	: 1;
1533859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
1543859Sml29623 		uint32_t pkt_discard_cnt_ovfl	: 1;
1553859Sml29623 		uint32_t bad_cksum_cnt_ovfl	: 1;
1563859Sml29623 		uint32_t pre_fifo_underrun	: 1;
1573859Sml29623 		uint32_t pre_fifo_overrun	: 1;
1583859Sml29623 		uint32_t pre_fifo_perr_idx	: 6;
1593859Sml29623 		uint32_t ecc_err_cnt_ovfl	: 1;
1603859Sml29623 		uint32_t pre_fifo_perr		: 1;
1613859Sml29623 		uint32_t dfifo_ecc_err_idx	: 11;
1623859Sml29623 		uint32_t dfifo_no_ecc_err	: 1;
1633859Sml29623 		uint32_t dfifo_ecc_err		: 2;
1643859Sml29623 		uint32_t dfifo_corr_ecc_err	: 2;
1653859Sml29623 		uint32_t dfifo_uncorr_ecc_err	: 2;
1663859Sml29623 		uint32_t dfifo_missed_eop	: 1;
1673859Sml29623 		uint32_t dfifo_missed_sop	: 1;
1683859Sml29623 #else
1693859Sml29623 #error	one of _BIT_FIELDS_HTOL or _BIT_FIELDS_LTOH must be defined
1703859Sml29623 #endif
1713859Sml29623 	} w0;
1723859Sml29623 
1733859Sml29623 #if !defined(_BIG_ENDIAN)
1743859Sml29623 		uint32_t	w1;
1753859Sml29623 #endif
1763859Sml29623 	} bits;
1773859Sml29623 } ipp_status_t;
1783859Sml29623 
1793859Sml29623 typedef	union _ipp_ecc_ctrl {
1803859Sml29623 	uint64_t value;
1813859Sml29623 
1823859Sml29623 	struct {
1833859Sml29623 #if defined(_BIG_ENDIAN)
1843859Sml29623 		uint32_t	w1;
1853859Sml29623 #endif
1863859Sml29623 		struct {
1873859Sml29623 #if defined(_BIT_FIELDS_HTOL)
1883859Sml29623 		uint32_t dis_dbl	: 1;
1893859Sml29623 		uint32_t res3		: 13;
1903859Sml29623 		uint32_t cor_dbl	: 1;
1913859Sml29623 		uint32_t cor_sng	: 1;
1923859Sml29623 		uint32_t rsvd		: 5;
1933859Sml29623 		uint32_t cor_all	: 1;
1943859Sml29623 		uint32_t res2		: 1;
1953859Sml29623 		uint32_t cor_1		: 1;
1963859Sml29623 		uint32_t res1		: 5;
1973859Sml29623 		uint32_t cor_lst	: 1;
1983859Sml29623 		uint32_t cor_snd	: 1;
1993859Sml29623 		uint32_t cor_fst	: 1;
2003859Sml29623 #elif defined(_BIT_FIELDS_LTOH)
2013859Sml29623 		uint32_t cor_fst	: 1;
2023859Sml29623 		uint32_t cor_snd	: 1;
2033859Sml29623 		uint32_t cor_lst	: 1;
2043859Sml29623 		uint32_t res1		: 5;
2053859Sml29623 		uint32_t cor_1		: 1;
2063859Sml29623 		uint32_t res2		: 1;
2073859Sml29623 		uint32_t cor_all	: 1;
2083859Sml29623 		uint32_t rsvd		: 5;
2093859Sml29623 		uint32_t cor_sng	: 1;
2103859Sml29623 		uint32_t cor_dbl	: 1;
2113859Sml29623 		uint32_t res3		: 13;
2123859Sml29623 		uint32_t dis_dbl	: 1;
2133859Sml29623 #else
2143859Sml29623 #error	one of _BIT_FIELDS_HTOL or _BIT_FIELDS_LTOH must be defined
2153859Sml29623 #endif
2163859Sml29623 	} w0;
2173859Sml29623 
2183859Sml29623 #if !defined(_BIG_ENDIAN)
2193859Sml29623 		uint32_t	w1;
2203859Sml29623 #endif
2213859Sml29623 	} bits;
2223859Sml29623 } ipp_ecc_ctrl_t;
2233859Sml29623 
2243859Sml29623 
2253859Sml29623 /* IPP Interrupt Mask Registers */
2263859Sml29623 
2273859Sml29623 #define	IPP_ECC_ERR_CNT_MAX_INTR_DIS		(1 << 7)
2283859Sml29623 #define	IPP_DFIFO_MISSING_EOP_SOP_INTR_DIS	(1 << 6)
2293859Sml29623 #define	IPP_DFIFO_ECC_UNCORR_ERR_INTR_DIS	(1 << 5)
2303859Sml29623 #define	IPP_PRE_FIFO_PERR_INTR_DIS		(1 << 4)
2313859Sml29623 #define	IPP_PRE_FIFO_OVERRUN_INTR_DIS		(1 << 3)
2323859Sml29623 #define	IPP_PRE_FIFO_UNDERRUN_INTR_DIS		(1 << 2)
2333859Sml29623 #define	IPP_BAD_TCPIP_CKSUM_CNT_INTR_DIS	(1 << 1)
2343859Sml29623 #define	IPP_PKT_DISCARD_CNT_INTR_DIS		(1 << 0)
2353859Sml29623 
2363859Sml29623 #define	IPP_RESET_WAIT				10
2373859Sml29623 
2383859Sml29623 /* DFIFO RD/WR pointers mask */
2393859Sml29623 
2403859Sml29623 #define	IPP_XMAC_DFIFO_PTR_MASK			0x7FF
2413859Sml29623 #define	IPP_BMAC_DFIFO_PTR_MASK			0x3FF
2423859Sml29623 
2433859Sml29623 #define	IPP_ECC_CNT_MASK			0xFF
2443859Sml29623 #define	IPP_BAD_CS_CNT_MASK			0x3FFF
2453859Sml29623 #define	IPP_PKT_DIS_CNT_MASK			0x3FFF
2463859Sml29623 
2473859Sml29623 #ifdef	__cplusplus
2483859Sml29623 }
2493859Sml29623 #endif
2503859Sml29623 
2513859Sml29623 #endif	/* _SYS_NXGE_NXGE_IPP_HW_H */
252