xref: /onnv-gate/usr/src/uts/common/io/chxge/oschtoe.h (revision 3833:45d8d0ee8613)
1*3833Sxw161283 /*
2*3833Sxw161283  * CDDL HEADER START
3*3833Sxw161283  *
4*3833Sxw161283  * The contents of this file are subject to the terms of the
5*3833Sxw161283  * Common Development and Distribution License (the "License").
6*3833Sxw161283  * You may not use this file except in compliance with the License.
7*3833Sxw161283  *
8*3833Sxw161283  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*3833Sxw161283  * or http://www.opensolaris.org/os/licensing.
10*3833Sxw161283  * See the License for the specific language governing permissions
11*3833Sxw161283  * and limitations under the License.
12*3833Sxw161283  *
13*3833Sxw161283  * When distributing Covered Code, include this CDDL HEADER in each
14*3833Sxw161283  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*3833Sxw161283  * If applicable, add the following below this CDDL HEADER, with the
16*3833Sxw161283  * fields enclosed by brackets "[]" replaced with your own identifying
17*3833Sxw161283  * information: Portions Copyright [yyyy] [name of copyright owner]
18*3833Sxw161283  *
19*3833Sxw161283  * CDDL HEADER END
20*3833Sxw161283  */
21*3833Sxw161283 
22*3833Sxw161283 /*
23*3833Sxw161283  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*3833Sxw161283  * Use is subject to license terms.
25*3833Sxw161283  */
26*3833Sxw161283 
27*3833Sxw161283 /*
28*3833Sxw161283  * This file is part of the Chelsio T1 Ethernet driver.
29*3833Sxw161283  *
30*3833Sxw161283  * Copyright (C) 2003-2005 Chelsio Communications.  All rights reserved.
31*3833Sxw161283  */
32*3833Sxw161283 
33*3833Sxw161283 #ifndef _CHELSIO_OSCHTOE_H
34*3833Sxw161283 #define	_CHELSIO_OSCHTOE_H
35*3833Sxw161283 
36*3833Sxw161283 #pragma ident	"%Z%%M%	%I%	%E% SMI"
37*3833Sxw161283 
38*3833Sxw161283 #ifdef __cplusplus
39*3833Sxw161283 extern "C" {
40*3833Sxw161283 #endif
41*3833Sxw161283 
42*3833Sxw161283 typedef struct _pesge  pesge;
43*3833Sxw161283 
44*3833Sxw161283 /* looks like this should really be with mc5.h */
45*3833Sxw161283 #define	DEFAULT_SERVER_REGION_LEN 256
46*3833Sxw161283 #define	DEFAULT_RT_REGION_LEN 1024
47*3833Sxw161283 
48*3833Sxw161283 /*
49*3833Sxw161283  * Bits used to configure driver behavior.
50*3833Sxw161283  */
51*3833Sxw161283 #define	CFGDMP_RSPQ	0x00000001 /* dump respq info */
52*3833Sxw161283 #define	CFGDMP_CMDQ0	0x00000010 /* dump cmdq0 info */
53*3833Sxw161283 #define	CFGDMP_CMDQ0MB	0x00000020 /* dump cmdq0 mbufs */
54*3833Sxw161283 #define	CFGDMP_CMDQ1	0x00000040 /* dump cmdq1 info */
55*3833Sxw161283 #define	CFGDMP_CMDQ1MB	0x00000080 /* dump cmdq1 mbufs */
56*3833Sxw161283 #define	CFGDMP_FLQ0	0x00000100 /* dump flq0 info */
57*3833Sxw161283 #define	CFGDMP_FLQ0MB	0x00000200 /* dump flq0 mbufs */
58*3833Sxw161283 #define	CFGDMP_FLQ1	0x00000400 /* dump flq1 info */
59*3833Sxw161283 #define	CFGDMP_FLQ1MB	0x00000800 /* dump flq1 mbufs */
60*3833Sxw161283 #define	CFGDMP_ISRC	0x00001000 /* dump ISR 32 bit cause */
61*3833Sxw161283 #define	CFGDMP_ISR	0x00002000 /* dump ISR info */
62*3833Sxw161283 #define	CFGDMP_OUT	0x00004000 /* dump OUT info */
63*3833Sxw161283 #define	CFGDMP_GMACC	0x00010000 /* dump GMAC cause bits */
64*3833Sxw161283 #define	CFGDMP_PCIXC	0x00020000 /* dump PCIX cause bits */
65*3833Sxw161283 #define	CFGDMP_TPC	0x00040000 /* dump TP cause bits */
66*3833Sxw161283 #define	CFGDMP_MC5C	0x00080000 /* dump MC5 cause bits */
67*3833Sxw161283 
68*3833Sxw161283 #define	CFGMD_RINGB	0x00100000 /* Store all packets in ring buffer */
69*3833Sxw161283 #define	CFGMD_PROFILE	0x00200000 /* Enable driver profiling */
70*3833Sxw161283 
71*3833Sxw161283 #define	CFGDMP_ERR	0x01000000 /* dump errors */
72*3833Sxw161283 #define	CFGDMP_WRN	0x02000000 /* dump warnings */
73*3833Sxw161283 #define	CFGDMP_STA	0x04000000 /* dump status info */
74*3833Sxw161283 #define	CFGDMP_PTH	0x08000000 /* dump function paths */
75*3833Sxw161283 
76*3833Sxw161283 #define	CFGMD_TUNNEL	0x10000000 /* Global tunnel mode ( 0-offload mode ) */
77*3833Sxw161283 #define	CFGMD_144BIT	0x20000000 /* Puts MC5 in 144 bit mode */
78*3833Sxw161283 #define	CFGMD_CPLBPF	0x40000000 /* Include CPL header when bpf_map called */
79*3833Sxw161283 
80*3833Sxw161283 /*
81*3833Sxw161283  * Structure used to store drivers configuration information.
82*3833Sxw161283  * Some of this information will be move out later or
83*3833Sxw161283  * stored elsewhere.  For now, it helps with development.
84*3833Sxw161283  */
85*3833Sxw161283 typedef struct pe_config_data {
86*3833Sxw161283 	uint32_t gtm;			/* run in Global Tunnel Mode */
87*3833Sxw161283 	uint32_t global_config;		/* override global debug value */
88*3833Sxw161283 
89*3833Sxw161283 	uint32_t is_asic;
90*3833Sxw161283 
91*3833Sxw161283 	/*
92*3833Sxw161283 	 * 5-auto-neg
93*3833Sxw161283 	 * 2-1000Gbps(force);
94*3833Sxw161283 	 * 1-100Gbps(force);
95*3833Sxw161283 	 * 0-10Gbps(force)
96*3833Sxw161283 	 */
97*3833Sxw161283 	uint32_t link_speed;
98*3833Sxw161283 
99*3833Sxw161283 	uint32_t num_of_ports;		/* Set the number of ports [1-4] */
100*3833Sxw161283 
101*3833Sxw161283 	uint32_t tp_reset_cm;		/* reset CM memory map */
102*3833Sxw161283 
103*3833Sxw161283 	uint32_t phy_tx_fifo;		/* phy's tx fifo depth */
104*3833Sxw161283 	uint32_t phy_rx_fifo;		/* phy's rx fifo depth */
105*3833Sxw161283 	uint32_t phy_force_master;	/* force link always in master mode */
106*3833Sxw161283 
107*3833Sxw161283 	uint32_t mc5_rtbl_size;		/* TCAM routing table size */
108*3833Sxw161283 	uint32_t mc5_dbsvr_size;	/* TCAM server size */
109*3833Sxw161283 	uint32_t mc5_mode;		/* 72 bit or 144 bit mode */
110*3833Sxw161283 	uint32_t mc5_parity;		/* Enable parity error checking */
111*3833Sxw161283 	uint32_t mc5_issue_syn;		/* Allow for transaction overlap */
112*3833Sxw161283 
113*3833Sxw161283 	uint32_t packet_tracing;
114*3833Sxw161283 
115*3833Sxw161283 	uint32_t server_region_len;
116*3833Sxw161283 	uint32_t rt_region_len;
117*3833Sxw161283 
118*3833Sxw161283 	uint32_t offload_ip_cksum;	/* on/off checksum offloading */
119*3833Sxw161283 	uint32_t offload_udp_cksum;
120*3833Sxw161283 	uint32_t offload_tcp_cksum;
121*3833Sxw161283 
122*3833Sxw161283 	uint32_t sge_cmdq_sp;		/* set sw schedule policy */
123*3833Sxw161283 	uint32_t sge_cmdq_threshold;	/* used w/ sw schedule policy */
124*3833Sxw161283 	uint32_t sge_flq_threshold;	/* set SGE's flq threshold register */
125*3833Sxw161283 
126*3833Sxw161283 	uint32_t sge_cmdq0_cnt;		/* set # entries of cmdq0 */
127*3833Sxw161283 	uint32_t sge_cmdq1_cnt;		/* set # entries of cmdq1 */
128*3833Sxw161283 	uint32_t sge_flq0_cnt;		/* set # entries of flq0 */
129*3833Sxw161283 	uint32_t sge_flq1_cnt;		/* set # entries of flq1 */
130*3833Sxw161283 	uint32_t sge_respq_cnt;		/* set # entries of respq */
131*3833Sxw161283 
132*3833Sxw161283 
133*3833Sxw161283 	/*
134*3833Sxw161283 	 * Update MAC stats automatically.
135*3833Sxw161283 	 * Sometimes we don't want this to
136*3833Sxw161283 	 * happen when debugging
137*3833Sxw161283 	 */
138*3833Sxw161283 	uint32_t stats;
139*3833Sxw161283 
140*3833Sxw161283 	/*
141*3833Sxw161283 	 * Add microsecond delay to packets
142*3833Sxw161283 	 * sent in Tx direction. This is useful
143*3833Sxw161283 	 * in testing hardware.
144*3833Sxw161283 	 */
145*3833Sxw161283 	uint32_t tx_delay_us;
146*3833Sxw161283 
147*3833Sxw161283 	/*
148*3833Sxw161283 	 * Can change chip revision support
149*3833Sxw161283 	 * settting -1 default. Uses hardware
150*3833Sxw161283 	 * lookup table.
151*3833Sxw161283 	 * 0 force T1A
152*3833Sxw161283 	 * 1 force T1B
153*3833Sxw161283 	 */
154*3833Sxw161283 	uint32_t chip;
155*3833Sxw161283 
156*3833Sxw161283 	/*
157*3833Sxw161283 	 * Used to only initialize PCI so
158*3833Sxw161283 	 * read/write registers work. The
159*3833Sxw161283 	 * driver does not initialize anything
160*3833Sxw161283 	 * of the HW blocks.
161*3833Sxw161283 	 */
162*3833Sxw161283 	uint32_t exit_early;
163*3833Sxw161283 
164*3833Sxw161283 	/* local ring buffer */
165*3833Sxw161283 	uint32_t rb_num_of_entries;	/* number of entries */
166*3833Sxw161283 	uint32_t rb_size_of_entries;	/* bytes size of an entry */
167*3833Sxw161283 	uint32_t rb_flag;		/* varies flags */
168*3833Sxw161283 
169*3833Sxw161283 	/* Opt values used to store CATP options.  */
170*3833Sxw161283 	uint32_t type;
171*3833Sxw161283 	uint64_t cat_opt0;
172*3833Sxw161283 	uint64_t cat_opt1;
173*3833Sxw161283 
174*3833Sxw161283 } pe_config_data_t;
175*3833Sxw161283 
176*3833Sxw161283 struct pe_port_t {
177*3833Sxw161283 	uint8_t enaddr[6];
178*3833Sxw161283 	struct cmac *mac;
179*3833Sxw161283 	struct cphy *phy;
180*3833Sxw161283 	struct link_config link_config;
181*3833Sxw161283 	u32 line_up;
182*3833Sxw161283 };
183*3833Sxw161283 
184*3833Sxw161283 #define	DBGASSERT(c) ASSERT(c)
185*3833Sxw161283 
186*3833Sxw161283 #define	t1_is_T1A(adap) adapter_matches_type(adap, CHBT_TERM_T1, TERM_T1A)
187*3833Sxw161283 #define	t1_is_T1B(adap) adapter_matches_type(adap, CHBT_TERM_T1, TERM_T1B)
188*3833Sxw161283 #define	t1_is_T1C(adap) adapter_matches_type(adap, CHBT_TERM_T1, TERM_T1C)
189*3833Sxw161283 
190*3833Sxw161283 #ifdef __cplusplus
191*3833Sxw161283 }
192*3833Sxw161283 #endif
193*3833Sxw161283 
194*3833Sxw161283 #endif /* _CHELSIO_OSCHTOE_H */
195