xref: /onnv-gate/usr/src/uts/common/sys/nxge/nxge_common.h (revision 11304:3092d1e303d6)
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*11304SJanie.Lu@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
233859Sml29623  * Use is subject to license terms.
243859Sml29623  */
253859Sml29623 
263859Sml29623 #ifndef	_SYS_NXGE_NXGE_COMMON_H
273859Sml29623 #define	_SYS_NXGE_NXGE_COMMON_H
283859Sml29623 
293859Sml29623 #ifdef	__cplusplus
303859Sml29623 extern "C" {
313859Sml29623 #endif
323859Sml29623 
333859Sml29623 #define	NXGE_DMA_START			B_TRUE
343859Sml29623 #define	NXGE_DMA_STOP			B_FALSE
353859Sml29623 
363859Sml29623 /*
373859Sml29623  * Default DMA configurations.
383859Sml29623  */
393859Sml29623 #define	NXGE_RDMA_PER_NIU_PORT		(NXGE_MAX_RDCS/NXGE_PORTS_NIU)
403859Sml29623 #define	NXGE_TDMA_PER_NIU_PORT		(NXGE_MAX_TDCS_NIU/NXGE_PORTS_NIU)
413859Sml29623 #define	NXGE_RDMA_PER_NEP_PORT		(NXGE_MAX_RDCS/NXGE_PORTS_NEPTUNE)
423859Sml29623 #define	NXGE_TDMA_PER_NEP_PORT		(NXGE_MAX_TDCS/NXGE_PORTS_NEPTUNE)
433859Sml29623 #define	NXGE_RDCGRP_PER_NIU_PORT	(NXGE_MAX_RDC_GROUPS/NXGE_PORTS_NIU)
443859Sml29623 #define	NXGE_RDCGRP_PER_NEP_PORT	(NXGE_MAX_RDC_GROUPS/NXGE_PORTS_NEPTUNE)
453859Sml29623 
463859Sml29623 #define	NXGE_TIMER_RESO			2
473859Sml29623 
483859Sml29623 #define	NXGE_TIMER_LDG			2
493859Sml29623 
503859Sml29623 /*
513859Sml29623  * Receive and Transmit DMA definitions
523859Sml29623  */
533859Sml29623 #if	defined(sun4v) && defined(NIU_LP_WORKAROUND)
543859Sml29623 /*
553859Sml29623  * N2/NIU: Maximum descriptors if we need to call
563859Sml29623  *	   Hypervisor to set up the logical pages
573859Sml29623  *	   and the driver must use contiguous memory.
583859Sml29623  */
593859Sml29623 #define	NXGE_NIU_MAX_ENTRY		(1 << 9) /* 512 */
603859Sml29623 #define	NXGE_NIU_CONTIG_RBR_MAX		(NXGE_NIU_MAX_ENTRY)
613859Sml29623 #define	NXGE_NIU_CONTIG_RCR_MAX		(NXGE_NIU_MAX_ENTRY)
623859Sml29623 #define	NXGE_NIU_CONTIG_TX_MAX		(NXGE_NIU_MAX_ENTRY)
633859Sml29623 #endif
643859Sml29623 
653859Sml29623 #ifdef	_DMA_USES_VIRTADDR
663859Sml29623 #ifdef	NIU_PA_WORKAROUND
673859Sml29623 #define	NXGE_DMA_BLOCK		(16 * 64 * 4)
683859Sml29623 #else
693859Sml29623 #define	NXGE_DMA_BLOCK		1
703859Sml29623 #endif
713859Sml29623 #else
723859Sml29623 #define	NXGE_DMA_BLOCK		(64 * 64)
733859Sml29623 #endif
743859Sml29623 
753859Sml29623 #define	NXGE_RBR_RBB_MIN	(128)
763859Sml29623 #define	NXGE_RBR_RBB_MAX	(64 * 128 -1)
773859Sml29623 
783859Sml29623 #if	defined(sun4v) && defined(NIU_LP_WORKAROUND)
793859Sml29623 #define	NXGE_RBR_RBB_DEFAULT	512
803859Sml29623 #define	NXGE_RBR_SPARE		0
813859Sml29623 #else
825759Smisaki #if	defined(__i386)
835759Smisaki #define	NXGE_RBR_RBB_DEFAULT	256
845759Smisaki #else
853859Sml29623 #define	NXGE_RBR_RBB_DEFAULT	(64 * 16) /* x86 hello */
865759Smisaki #endif
873859Sml29623 #define	NXGE_RBR_SPARE		0
883859Sml29623 #endif
893859Sml29623 
903859Sml29623 
913859Sml29623 #define	NXGE_RCR_MIN		(NXGE_RBR_RBB_MIN * 2)
923859Sml29623 
933859Sml29623 #if	defined(sun4v) && defined(NIU_LP_WORKAROUND)
945770Sml29623 #define	NXGE_RCR_MAX		(8192)
953859Sml29623 #define	NXGE_RCR_DEFAULT	(512)
963859Sml29623 #define	NXGE_TX_RING_DEFAULT	(512)
973859Sml29623 #else
983859Sml29623 #ifndef	NIU_PA_WORKAROUND
993859Sml29623 #define	NXGE_RCR_MAX		(65355) /* MAX hardware supported */
1003859Sml29623 #if defined(_BIG_ENDIAN)
1013859Sml29623 #define	NXGE_RCR_DEFAULT	(NXGE_RBR_RBB_DEFAULT * 8)
1023859Sml29623 #else
1033859Sml29623 #ifdef USE_RX_BIG_BUF
1043859Sml29623 #define	NXGE_RCR_DEFAULT	(NXGE_RBR_RBB_DEFAULT * 8)
1053859Sml29623 #else
1063859Sml29623 #define	NXGE_RCR_DEFAULT	(NXGE_RBR_RBB_DEFAULT * 4)
1073859Sml29623 #endif
1083859Sml29623 #endif
1095759Smisaki #if	defined(__i386)
1105759Smisaki #define	NXGE_TX_RING_DEFAULT	(256)
1115759Smisaki #else
1123859Sml29623 #define	NXGE_TX_RING_DEFAULT	(1024)
1135759Smisaki #endif
1143859Sml29623 #define	NXGE_TX_RING_MAX	(64 * 128 - 1)
1153859Sml29623 #else
1165759Smisaki #if	defined(__i386)
1175759Smisaki #define	NXGE_RCR_DEFAULT	(256)
1185759Smisaki #define	NXGE_TX_RING_DEFAULT	(256)
1195759Smisaki #else
1203859Sml29623 #define	NXGE_RCR_DEFAULT	(512)
1213859Sml29623 #define	NXGE_TX_RING_DEFAULT	(512)
1225759Smisaki #endif
1233859Sml29623 #define	NXGE_RCR_MAX		(1024)
1243859Sml29623 #define	NXGE_TX_RING_MAX	(1024)
1253859Sml29623 #endif
1263859Sml29623 #endif
1273859Sml29623 
1283859Sml29623 #define	NXGE_TX_RECLAIM 	32
1293859Sml29623 
1303859Sml29623 /* per receive DMA channel configuration data structure */
1313859Sml29623 typedef struct  nxge_rdc_cfg {
1323859Sml29623 	uint32_t	flag;		/* 0: not configured, 1: configured */
1333859Sml29623 	struct nxge_hw_list *nxge_hw_p;
1343859Sml29623 	uint32_t	partition_id;
1353859Sml29623 	uint32_t	port;		/* function number */
1363859Sml29623 	uint32_t	rx_group_id;
1373859Sml29623 
1383859Sml29623 	/* Partitioning, DMC function zero. */
1393859Sml29623 	uint32_t	rx_log_page_vld_page0;	/* TRUE or FALSE */
1403859Sml29623 	uint32_t	rx_log_page_vld_page1;	/* TRUE or FALSE */
1413859Sml29623 	uint64_t	rx_log_mask1;
1423859Sml29623 	uint64_t	rx_log_value1;
1433859Sml29623 	uint64_t	rx_log_mask2;
1443859Sml29623 	uint64_t	rx_log_value2;
1453859Sml29623 	uint64_t	rx_log_page_relo1;
1463859Sml29623 	uint64_t	rx_log_page_relo2;
1473859Sml29623 	uint64_t	rx_log_page_hdl;
1483859Sml29623 
1493859Sml29623 	/* WRED parameters, DMC function zero */
1503859Sml29623 	uint32_t	red_enable;
1513859Sml29623 
1523859Sml29623 	uint32_t	thre_syn;
1533859Sml29623 	uint32_t	win_syn;
1543859Sml29623 	uint32_t	threshold;
1553859Sml29623 	uint32_t	win_non_syn;
1563859Sml29623 
1573859Sml29623 	/* RXDMA configuration, DMC */
1583859Sml29623 	char		*rdc_mbaddr_p;	/* mailbox address */
1593859Sml29623 	uint32_t	min_flag;	/* TRUE for 18 bytes header */
1603859Sml29623 
1613859Sml29623 	/* Software Reserved Packet Buffer Offset, DMC */
1623859Sml29623 	uint32_t	sw_offset;
1633859Sml29623 
1643859Sml29623 	/* RBR Configuration A */
1653859Sml29623 	uint64_t	rbr_staddr;	/* starting address of RBR */
1663859Sml29623 	uint32_t	rbr_nblks;	/* # of RBR entries */
1673859Sml29623 	uint32_t	rbr_len;	/* # of RBR entries in 64B lines */
1683859Sml29623 
1693859Sml29623 	/* RBR Configuration B */
1703859Sml29623 	uint32_t	bksize;		/* Block size is fixed. */
1713859Sml29623 #define	RBR_BKSIZE_4K			0
1723859Sml29623 #define	RBR_BKSIZE_4K_BYTES		(4 * 1024)
1733859Sml29623 #define	RBR_BKSIZE_8K			1
1743859Sml29623 #define	RBR_BKSIZE_8K_BYTES		(8 * 1024)
1753859Sml29623 #define	RBR_BKSIZE_16K			2
1763859Sml29623 #define	RBR_BKSIZE_16K_BYTES		(16 * 1024)
1773859Sml29623 #define	RBR_BKSIZE_32K			3
1783859Sml29623 #define	RBR_BKSIZE_32K_BYTES		(32 * 1024)
1793859Sml29623 
1803859Sml29623 	uint32_t	bufsz2;
1813859Sml29623 #define	RBR_BUFSZ2_2K			0
1823859Sml29623 #define	RBR_BUFSZ2_2K_BYTES		(2 * 1024)
1833859Sml29623 #define	RBR_BUFSZ2_4K			1
1843859Sml29623 #define	RBR_BUFSZ2_4K_BYTES		(4 * 1024)
1853859Sml29623 #define	RBR_BUFSZ2_8K			2
1863859Sml29623 #define	RBR_BUFSZ2_8K_BYTES		(8 * 1024)
1873859Sml29623 #define	RBR_BUFSZ2_16K			3
1883859Sml29623 #define	RBR_BUFSZ2_16K_BYTES		(16 * 1024)
1893859Sml29623 
1903859Sml29623 	uint32_t	bufsz1;
1913859Sml29623 #define	RBR_BUFSZ1_1K			0
1923859Sml29623 #define	RBR_BUFSZ1_1K_BYTES		1024
1933859Sml29623 #define	RBR_BUFSZ1_2K			1
1943859Sml29623 #define	RBR_BUFSZ1_2K_BYTES		(2 * 1024)
1953859Sml29623 #define	RBR_BUFSZ1_4K			2
1963859Sml29623 #define	RBR_BUFSZ1_4K_BYTES		(4 * 1024)
1973859Sml29623 #define	RBR_BUFSZ1_8K			3
1983859Sml29623 #define	RBR_BUFSZ1_8K_BYTES		(8 * 1024)
1993859Sml29623 
2003859Sml29623 	uint32_t	bufsz0;
2013859Sml29623 #define	RBR_BUFSZ0_256B			0
2023859Sml29623 #define	RBR_BUFSZ0_256_BYTES		256
2033859Sml29623 #define	RBR_BUFSZ0_512B			1
2043859Sml29623 #define	RBR_BUFSZ0_512B_BYTES		512
2053859Sml29623 #define	RBR_BUFSZ0_1K			2
2063859Sml29623 #define	RBR_BUFSZ0_1K_BYTES		(1024)
2073859Sml29623 #define	RBR_BUFSZ0_2K			3
2083859Sml29623 #define	RBR_BUFSZ0_2K_BYTES		(2 * 1024)
2093859Sml29623 
2103859Sml29623 	/* Receive buffers added by the software */
2113859Sml29623 	uint32_t	bkadd;		/* maximum size is 1 million */
2123859Sml29623 
2133859Sml29623 	/* Receive Completion Ring Configuration A */
2143859Sml29623 	uint32_t	rcr_len;	/* # of 64B blocks, each RCR is 8B */
2153859Sml29623 	uint64_t	rcr_staddr;
2163859Sml29623 
2173859Sml29623 	/* Receive Completion Ring Configuration B */
2183859Sml29623 	uint32_t	pthres;		/* packet threshold */
2193859Sml29623 	uint32_t	entout;		/* enable timeout */
2203859Sml29623 	uint32_t	timeout;	/* timeout value */
2213859Sml29623 
2223859Sml29623 	/* Logical Device Group Number */
2233859Sml29623 	uint16_t	rx_ldg;
2243859Sml29623 	uint16_t	rx_ld_state_flags;
2253859Sml29623 
2263859Sml29623 	/* Receive DMA Channel Event Mask */
2273859Sml29623 	uint64_t	rx_dma_ent_mask;
2283859Sml29623 
2293859Sml29623 	/* 32 bit (set to 1) or 64 bit (set to 0) addressing mode */
2303859Sml29623 	uint32_t	rx_addr_md;
2313859Sml29623 } nxge_rdc_cfg_t, *p_nxge_rdc_cfg_t;
2323859Sml29623 
2333859Sml29623 /*
2343859Sml29623  * Per Transmit DMA Channel Configuration Data Structure (32 TDC)
2353859Sml29623  */
2363859Sml29623 typedef struct  nxge_tdc_cfg {
2373859Sml29623 	uint32_t	flag;		/* 0: not configured 1: configured */
2383859Sml29623 	struct nxge_hw_list *nxge_hw_p;
2393859Sml29623 	uint32_t	port; 		/* function number */
2403859Sml29623 	/* partitioning, DMC function zero (All 0s for non-partitioning) */
2413859Sml29623 	uint32_t	tx_log_page_vld_page0;	/* TRUE or FALSE */
2423859Sml29623 	uint32_t	tx_log_page_vld_page1;	/* TRUE or FALSE */
2433859Sml29623 	uint64_t	tx_log_mask1;
2443859Sml29623 	uint64_t	tx_log_value1;
2453859Sml29623 	uint64_t	tx_log_mask2;
2463859Sml29623 	uint64_t	tx_log_value2;
2473859Sml29623 	uint64_t	tx_log_page_relo1;
2483859Sml29623 	uint64_t	tx_log_page_relo2;
2493859Sml29623 	uint64_t	tx_log_page_hdl;
2503859Sml29623 
2513859Sml29623 	/* Transmit Ring Configuration */
2523859Sml29623 	uint64_t	tx_staddr;
2533859Sml29623 	uint64_t	tx_rng_len;	/* in 64 B Blocks */
2543859Sml29623 #define	TX_MAX_BUF_SIZE			4096
2553859Sml29623 
2563859Sml29623 	/* TXDMA configuration, DMC */
2573859Sml29623 	char		*tdc_mbaddr_p;	/* mailbox address */
2583859Sml29623 
2593859Sml29623 	/* Logical Device Group Number */
2603859Sml29623 	uint16_t	tx_ldg;
2613859Sml29623 	uint16_t	tx_ld_state_flags;
2623859Sml29623 
2633859Sml29623 	/* TXDMA event flags */
2643859Sml29623 	uint64_t	tx_event_mask;
2653859Sml29623 
2663859Sml29623 	/* Transmit threshold before reclamation */
2673859Sml29623 	uint32_t	tx_rng_threshold;
2683859Sml29623 #define	TX_RING_THRESHOLD		(TX_DEFAULT_MAX_GPS/4)
2693859Sml29623 #define	TX_RING_JUMBO_THRESHOLD		(TX_DEFAULT_JUMBO_MAX_GPS/4)
2703859Sml29623 
2713859Sml29623 	/* For reclaim: a wrap-around counter (packets transmitted) */
2723859Sml29623 	uint32_t	tx_pkt_cnt;
2733859Sml29623 	/* last packet with the mark bit set */
2743859Sml29623 	uint32_t	tx_lastmark;
2753859Sml29623 } nxge_tdc_cfg_t, *p_nxge_tdc_cfg_t;
2763859Sml29623 
2773859Sml29623 #define	RDC_TABLE_ENTRY_METHOD_SEQ	0
2783859Sml29623 #define	RDC_TABLE_ENTRY_METHOD_REP	1
2793859Sml29623 
2808275SEric Cheng /* per transmit DMA channel table group data structure */
2818275SEric Cheng typedef struct nxge_tdc_grp {
2828275SEric Cheng 	uint32_t	start_tdc;	/* assume assigned in sequence */
2838275SEric Cheng 	uint8_t		max_tdcs;
2848275SEric Cheng 	dc_map_t	map;
2858275SEric Cheng 	uint8_t		grp_index;	/* nxge_t.tx_set.group[grp_index] */
2868275SEric Cheng } nxge_tdc_grp_t, *p_nxge_tdc_grp_t;
2878275SEric Cheng 
2883859Sml29623 /* per receive DMA channel table group data structure */
2893859Sml29623 typedef struct nxge_rdc_grp {
2908275SEric Cheng 	boolean_t	flag;		/* 0: not configured 1: configured */
2916495Sspeer 	uint8_t		port;
2928275SEric Cheng 	uint32_t	start_rdc;	/* assume assigned in sequence	*/
2936495Sspeer 	uint8_t		max_rdcs;
2946495Sspeer 	uint8_t		def_rdc;
2956495Sspeer 	dc_map_t	map;
2963859Sml29623 	uint16_t	config_method;
2978275SEric Cheng 	uint8_t		grp_index;	/* nxge_t.rx_set.group[grp_index] */
2983859Sml29623 } nxge_rdc_grp_t, *p_nxge_rdc_grp_t;
2993859Sml29623 
3006495Sspeer #define	RDC_MAP_IN(map, rdc) \
3016495Sspeer 	(map |= (1 << rdc))
3026495Sspeer 
3036495Sspeer #define	RDC_MAP_OUT(map, rdc) \
3046495Sspeer 	(map &= (~(1 << rdc)))
3056495Sspeer 
3063859Sml29623 /* Common RDC and TDC configuration of DMC */
3073859Sml29623 typedef struct _nxge_dma_common_cfg_t {
3083859Sml29623 	uint16_t	rdc_red_ran_init; /* RED initial seed value */
3093859Sml29623 
3103859Sml29623 	/* Transmit Ring */
3113859Sml29623 } nxge_dma_common_cfg_t, *p_nxge_dma_common_cfg_t;
3123859Sml29623 
3133859Sml29623 /*
3143859Sml29623  * VLAN and MAC table configurations:
3153859Sml29623  *  Each VLAN ID should belong to at most one RDC group.
3163859Sml29623  *  Each port could own multiple RDC groups.
3173859Sml29623  *  Each MAC should belong to one RDC group.
3183859Sml29623  */
3193859Sml29623 typedef struct nxge_mv_cfg {
3203859Sml29623 	uint8_t		flag;			/* 0:unconfigure 1:configured */
3213859Sml29623 	uint8_t		rdctbl;			/* RDC channel table group */
3223859Sml29623 	uint8_t		mpr_npr;		/* MAC and VLAN preference */
3233859Sml29623 } nxge_mv_cfg_t, *p_nxge_mv_cfg_t;
3243859Sml29623 
3253859Sml29623 typedef struct nxge_param_map {
3263859Sml29623 #if defined(_BIG_ENDIAN)
3273859Sml29623 	uint32_t		rsrvd2:2;	/* [30:31] rsrvd */
3283859Sml29623 	uint32_t		remove:1;	/* [29] Remove */
3293859Sml29623 	uint32_t		pref:1;		/* [28] preference */
3303859Sml29623 	uint32_t		rsrv:4;		/* [27:24] preference */
3313859Sml29623 	uint32_t		map_to:8;	/* [23:16] map to resource */
3323859Sml29623 	uint32_t		param_id:16;	/* [15:0] Param ID */
3333859Sml29623 #else
3343859Sml29623 	uint32_t		param_id:16;	/* [15:0] Param ID */
3353859Sml29623 	uint32_t		map_to:8;	/* [23:16] map to resource */
3363859Sml29623 	uint32_t		rsrv:4;		/* [27:24] preference */
3373859Sml29623 	uint32_t		pref:1;		/* [28] preference */
3383859Sml29623 	uint32_t		remove:1;	/* [29] Remove */
3393859Sml29623 	uint32_t		rsrvd2:2;	/* [30:31] rsrvd */
3403859Sml29623 #endif
3413859Sml29623 } nxge_param_map_t, *p_nxge_param_map_t;
3423859Sml29623 
3433859Sml29623 typedef struct nxge_rcr_param {
3443859Sml29623 #if defined(_BIG_ENDIAN)
3453859Sml29623 	uint32_t		rsrvd2:2;	/* [30:31] rsrvd */
3463859Sml29623 	uint32_t		remove:1;	/* [29] Remove */
3473859Sml29623 	uint32_t		rsrv:5;		/* [28:24] preference */
3483859Sml29623 	uint32_t		rdc:8;		/* [23:16] rdc # */
3493859Sml29623 	uint32_t		cfg_val:16;	/* [15:0] interrupt parameter */
3503859Sml29623 #else
3513859Sml29623 	uint32_t		cfg_val:16;	/* [15:0] interrupt parameter */
3523859Sml29623 	uint32_t		rdc:8;		/* [23:16] rdc # */
3533859Sml29623 	uint32_t		rsrv:5;		/* [28:24] preference */
3543859Sml29623 	uint32_t		remove:1;	/* [29] Remove */
3553859Sml29623 	uint32_t		rsrvd2:2;	/* [30:31] rsrvd */
3563859Sml29623 #endif
3573859Sml29623 } nxge_rcr_param_t, *p_nxge_rcr_param_t;
3583859Sml29623 
3596495Sspeer /*
3606495Sspeer  * These are the properties of the TxDMA channels for this
3616495Sspeer  * port (instance).
3626495Sspeer  * <start> is the index of the first TDC that is being managed
3636495Sspeer  *		by this port.
3646495Sspeer  * <count> is the number of TDCs being managed by this port.
3656495Sspeer  * <owned> is the number of TDCs currently being utilized by this port.
3666495Sspeer  *
3676495Sspeer  * <owned> may be less than <count> in hybrid I/O systems.
3686495Sspeer  */
3696495Sspeer typedef struct {
3706495Sspeer 	int		start;	/* start TDC (0 - 31) */
3716495Sspeer 	int		count;	/* 8 - 32 */
3726495Sspeer 	int		owned;	/* 1 - count */
3736495Sspeer } tdc_cfg_t;
3746495Sspeer 
3753859Sml29623 /* Needs to have entries in the ndd table */
3763859Sml29623 /*
3773859Sml29623  * Hardware properties created by fcode.
3783859Sml29623  * In order for those properties visible to the user
3793859Sml29623  * command ndd, we need to add the following properties
3803859Sml29623  * to the ndd defined parameter array and data structures.
3813859Sml29623  *
3823859Sml29623  * Use default static configuration for x86.
3833859Sml29623  */
3843859Sml29623 typedef struct nxge_hw_pt_cfg {
3853859Sml29623 	uint32_t	function_number; /* function number		*/
3866495Sspeer 	tdc_cfg_t	tdc;
3873859Sml29623 	uint32_t	start_rdc;	 /* start RDC (0 - 31)		*/
3883859Sml29623 	uint32_t	max_rdcs;	 /* max rdc in sequence		*/
3893859Sml29623 	uint32_t	ninterrupts;	/* obp interrupts(mac/mif/syserr) */
3903859Sml29623 	uint32_t	mac_ldvid;
3913859Sml29623 	uint32_t	mif_ldvid;
3923859Sml29623 	uint32_t	ser_ldvid;
3933859Sml29623 	uint32_t	def_rdc;	 /* default RDC			*/
3943859Sml29623 	uint32_t	drr_wt;		 /* port DRR weight		*/
3953859Sml29623 	uint32_t	max_grpids;	 /* max group ID		*/
3966495Sspeer 	uint32_t	grpids[NXGE_MAX_RDCS]; /* RDC group IDs		*/
3973859Sml29623 	uint32_t	max_rdc_grpids;	 /* max RDC group ID		*/
3983859Sml29623 	uint32_t	start_ldg;	 /* starting logical group # 	*/
3993859Sml29623 	uint32_t	max_ldgs;	 /* max logical device group	*/
4003859Sml29623 	uint32_t	max_ldvs;	 /* max logical devices		*/
4013859Sml29623 	uint32_t	start_mac_entry; /* where to put the first mac	*/
4023859Sml29623 	uint32_t	max_macs;	 /* the max mac entry allowed	*/
4033859Sml29623 	uint32_t	mac_pref;	 /* preference over VLAN	*/
4048275SEric Cheng 	uint32_t	def_mac_txdma_grpid; /* default TDC group ID	*/
4053859Sml29623 	uint32_t	def_mac_rxdma_grpid; /* default RDC group ID	*/
4063859Sml29623 	uint32_t	vlan_pref;	 /* preference over MAC		*/
4073859Sml29623 
4083859Sml29623 	/* Expand if we have more hardware or default configurations    */
4093859Sml29623 	uint16_t	ldg[NXGE_INT_MAX_LDG];
4103859Sml29623 	uint16_t	ldg_chn_start;
4113859Sml29623 } nxge_hw_pt_cfg_t, *p_nxge_hw_pt_cfg_t;
4123859Sml29623 
4133859Sml29623 
4143859Sml29623 /* per port configuration */
4153859Sml29623 typedef struct nxge_dma_pt_cfg {
4163859Sml29623 	uint8_t		mac_port;	/* MAC port (function)		*/
4173859Sml29623 	nxge_hw_pt_cfg_t hw_config;	/* hardware configuration 	*/
4183859Sml29623 
4193859Sml29623 	uint32_t alloc_buf_size;
4203859Sml29623 	uint32_t rbr_size;
4213859Sml29623 	uint32_t rcr_size;
4223859Sml29623 
4233859Sml29623 	/*
4243859Sml29623 	 * Configuration for hardware initialization based on the
4253859Sml29623 	 * hardware properties or the default properties.
4263859Sml29623 	 */
4273859Sml29623 	uint32_t	tx_dma_map;	/* Transmit DMA channel bit map */
4283859Sml29623 
4298275SEric Cheng 	/* Transmit DMA channel: device wise */
4308275SEric Cheng 	nxge_tdc_grp_t  tdc_grps[NXGE_MAX_TDC_GROUPS];
4318275SEric Cheng 
4323859Sml29623 	/* Receive DMA channel */
4333859Sml29623 	nxge_rdc_grp_t	rdc_grps[NXGE_MAX_RDC_GROUPS];
4343859Sml29623 
4353859Sml29623 	uint16_t	rcr_timeout[NXGE_MAX_RDCS];
4363859Sml29623 	uint16_t	rcr_threshold[NXGE_MAX_RDCS];
4373859Sml29623 	uint8_t	rcr_full_header;
4383859Sml29623 	uint16_t	rx_drr_weight;
4393859Sml29623 
4403859Sml29623 	/* Add more stuff later */
4413859Sml29623 } nxge_dma_pt_cfg_t, *p_nxge_dma_pt_cfg_t;
4423859Sml29623 
4433859Sml29623 /* classification configuration */
4443859Sml29623 typedef struct nxge_class_pt_cfg {
4453859Sml29623 
4463859Sml29623 	/* MAC table */
4473859Sml29623 	nxge_mv_cfg_t	mac_host_info[NXGE_MAX_MACS];
4483859Sml29623 
4493859Sml29623 	/* VLAN table */
4503859Sml29623 	nxge_mv_cfg_t	vlan_tbl[NXGE_MAX_VLANS];
4513859Sml29623 	/* class config value */
4523859Sml29623 	uint32_t	init_h1;
4533859Sml29623 	uint16_t	init_h2;
4543859Sml29623 	uint8_t mcast_rdcgrp;
4553859Sml29623 	uint8_t mac_rdcgrp;
4563859Sml29623 	uint32_t	class_cfg[TCAM_CLASS_MAX];
4573859Sml29623 } nxge_class_pt_cfg_t, *p_nxge_class_pt_cfg_t;
4583859Sml29623 
4593859Sml29623 /* per Neptune sharable resources among ports */
4603859Sml29623 typedef struct nxge_common {
4613859Sml29623 	uint32_t		partition_id;
4623859Sml29623 	boolean_t		mode32;
4633859Sml29623 	/* DMA Channels: RDC and TDC */
4643859Sml29623 	nxge_rdc_cfg_t		rdc_config[NXGE_MAX_RDCS];
4653859Sml29623 	nxge_tdc_cfg_t		tdc_config[NXGE_MAX_TDCS];
4663859Sml29623 	nxge_dma_common_cfg_t	dma_common_config;
4673859Sml29623 
4683859Sml29623 	uint32_t		timer_res;
4693859Sml29623 	boolean_t		ld_sys_error_set;
4703859Sml29623 	uint8_t			sys_error_owner;
4713859Sml29623 
4723859Sml29623 	/* Layer 2/3/4 */
4733859Sml29623 	uint16_t		class2_etype;
4743859Sml29623 	uint16_t		class3_etype;
4753859Sml29623 
4763859Sml29623 	/* FCRAM (hashing) */
4773859Sml29623 	uint32_t		hash1_initval;
4783859Sml29623 	uint32_t		hash2_initval;
4793859Sml29623 } nxge_common_t, *p_nxge_common_t;
4803859Sml29623 
4813859Sml29623 /*
4823859Sml29623  * Partition (logical domain) configuration per Neptune/NIU.
4833859Sml29623  */
4843859Sml29623 typedef struct nxge_part_cfg {
4853859Sml29623 	uint32_t	rdc_grpbits;	/* RDC group bit masks */
4863859Sml29623 	uint32_t	tdc_bitmap;	/* bounded TDC */
4873859Sml29623 	nxge_dma_pt_cfg_t pt_config[NXGE_MAX_PORTS];
4883859Sml29623 
4893859Sml29623 	/* Flow Classification Partition (flow partition select register) */
4903859Sml29623 	uint8_t		hash_lookup;	/* external lookup is available */
4913859Sml29623 	uint8_t		base_mask;	/* select bits in base_h1 to replace */
4923859Sml29623 					/* bits [19:15} in Hash 1. */
4933859Sml29623 	uint8_t		base_h1;	/* value to replace Hash 1 [19:15]. */
4943859Sml29623 
4953859Sml29623 	/* Add more here */
4963859Sml29623 	uint32_t	attributes;	/* permission and attribute bits */
4973859Sml29623 #define	FZC_SERVICE_ENTITY		0x01
4983859Sml29623 #define	FZC_READ_WRITE			0x02
4993859Sml29623 #define	FZC_READ_ONLY			0x04
5003859Sml29623 } nxge_part_cfg_t, *p_nxge_part_cfg_t;
5013859Sml29623 
502*11304SJanie.Lu@Sun.COM typedef struct nxge_usr_l3_cls {
503*11304SJanie.Lu@Sun.COM 	uint64_t		cls;
504*11304SJanie.Lu@Sun.COM 	uint16_t		tcam_ref_cnt;
505*11304SJanie.Lu@Sun.COM 	uint8_t			pid;
506*11304SJanie.Lu@Sun.COM 	uint8_t			flow_pkt_type;
507*11304SJanie.Lu@Sun.COM 	uint8_t			valid;
508*11304SJanie.Lu@Sun.COM } nxge_usr_l3_cls_t, *p_nxge_usr_l3_cls_t;
509*11304SJanie.Lu@Sun.COM 
5103859Sml29623 typedef struct nxge_hw_list {
5113859Sml29623 	struct nxge_hw_list 	*next;
5123859Sml29623 	nxge_os_mutex_t 	nxge_cfg_lock;
5133859Sml29623 	nxge_os_mutex_t 	nxge_tcam_lock;
5143859Sml29623 	nxge_os_mutex_t 	nxge_vlan_lock;
5153859Sml29623 	nxge_os_mutex_t 	nxge_mdio_lock;
5163859Sml29623 
5173859Sml29623 	nxge_dev_info_t		*parent_devp;
5188272SMichael.Speer@Sun.COM #if defined(sun4v)
5198272SMichael.Speer@Sun.COM 	/*
5208272SMichael.Speer@Sun.COM 	 * With Hybrid I/O, a VR (virtualization region) is the moral
5218272SMichael.Speer@Sun.COM 	 * equivalent of a device function as seen in the service domain.
5228272SMichael.Speer@Sun.COM 	 * And, a guest domain can map up to 8 VRs for a single NIU for both
5238272SMichael.Speer@Sun.COM 	 * of the physical ports.  Hence, need space for up to the maximum
5248272SMichael.Speer@Sun.COM 	 * number of VRs (functions) for the guest domain driver.
5258272SMichael.Speer@Sun.COM 	 *
5268272SMichael.Speer@Sun.COM 	 * For non-sun4v platforms, NXGE_MAX_PORTS provides the correct
5278272SMichael.Speer@Sun.COM 	 * number of functions for the device. For sun4v platforms,
5288272SMichael.Speer@Sun.COM 	 * NXGE_MAX_FUNCTIONS will be defined by the number of
5298272SMichael.Speer@Sun.COM 	 * VRs that the guest domain can map.
5308272SMichael.Speer@Sun.COM 	 *
5318272SMichael.Speer@Sun.COM 	 * NOTE: This solution only works for one NIU and will need to
5328272SMichael.Speer@Sun.COM 	 * revisit this for KT-NIU.
5338272SMichael.Speer@Sun.COM 	 */
5348272SMichael.Speer@Sun.COM #define	NXGE_MAX_GUEST_FUNCTIONS	8
5358272SMichael.Speer@Sun.COM #define	NXGE_MAX_FUNCTIONS		NXGE_MAX_GUEST_FUNCTIONS
5368272SMichael.Speer@Sun.COM #else
5378272SMichael.Speer@Sun.COM #define	NXGE_MAX_FUNCTIONS		NXGE_MAX_PORTS
5388272SMichael.Speer@Sun.COM #endif
5398272SMichael.Speer@Sun.COM 	struct _nxge_t		*nxge_p[NXGE_MAX_FUNCTIONS];
5403859Sml29623 	uint32_t		ndevs;
5413859Sml29623 	uint32_t 		flags;
5423859Sml29623 	uint32_t 		magic;
5434732Sdavemq 	uint32_t		niu_type;
5444732Sdavemq 	uint32_t		platform_type;
5455572Ssbehera 	uint8_t			xcvr_addr[NXGE_MAX_PORTS];
5466495Sspeer 	uintptr_t		hio;
547*11304SJanie.Lu@Sun.COM 	void			*tcam;
548*11304SJanie.Lu@Sun.COM 	uint32_t 		tcam_size;
549*11304SJanie.Lu@Sun.COM 	uint64_t		tcam_l2_prog_cls[NXGE_L2_PROG_CLS];
550*11304SJanie.Lu@Sun.COM 	nxge_usr_l3_cls_t	tcam_l3_prog_cls[NXGE_L3_PROG_CLS];
5513859Sml29623 } nxge_hw_list_t, *p_nxge_hw_list_t;
5523859Sml29623 
5533859Sml29623 #ifdef	__cplusplus
5543859Sml29623 }
5553859Sml29623 #endif
5563859Sml29623 
5573859Sml29623 #endif	/* _SYS_NXGE_NXGE_COMMON_H */
558