xref: /titanic_50/usr/src/uts/common/io/e1000g/e1000g_sw.h (revision 2449e17f82f6097fd2c665b64723e31ceecbeca6)
1 /*
2  * This file is provided under a CDDLv1 license.  When using or
3  * redistributing this file, you may do so under this license.
4  * In redistributing this file this license must be included
5  * and no other modification of this header file is permitted.
6  *
7  * CDDL LICENSE SUMMARY
8  *
9  * Copyright(c) 1999 - 2007 Intel Corporation. All rights reserved.
10  *
11  * The contents of this file are subject to the terms of Version
12  * 1.0 of the Common Development and Distribution License (the "License").
13  *
14  * You should have received a copy of the License with this software.
15  * You can obtain a copy of the License at
16  *	http://www.opensolaris.org/os/licensing.
17  * See the License for the specific language governing permissions
18  * and limitations under the License.
19  */
20 
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms of the CDDLv1.
24  */
25 
26 #ifndef _E1000G_SW_H
27 #define	_E1000G_SW_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /*
36  * **********************************************************************
37  * Module Name:								*
38  *   e1000g_sw.h							*
39  *									*
40  * Abstract:								*
41  *   This header file contains Software-related data structures		*
42  *   definitions.							*
43  *									*
44  *   This driver runs on the following hardware:			*
45  *   - Wisemane based PCI gigabit ethernet adapters			*
46  *									*
47  * Environment:								*
48  *   Kernel Mode -							*
49  *									*
50  * **********************************************************************
51  */
52 
53 #ifdef DEBUG
54 #define	e1000g_DEBUG
55 #endif
56 
57 /*
58  *  Solaris Multithreaded GLD wiseman PCI Ethernet Driver
59  */
60 
61 #include <sys/types.h>
62 #include <sys/conf.h>
63 #include <sys/debug.h>
64 #include <sys/stropts.h>
65 #include <sys/stream.h>
66 #include <sys/strsun.h>
67 #include <sys/strlog.h>
68 #include <sys/kmem.h>
69 #include <sys/stat.h>
70 #include <sys/kstat.h>
71 #include <sys/modctl.h>
72 #include <sys/errno.h>
73 #include <sys/mac.h>
74 #include <sys/mac_ether.h>
75 #include <sys/vlan.h>
76 #include <sys/ddi.h>
77 #include <sys/sunddi.h>
78 #include <sys/pci.h>
79 #include <sys/sdt.h>
80 #include <sys/ethernet.h>
81 #include <sys/pattr.h>
82 #include <sys/strsubr.h>
83 #include <sys/netlb.h>
84 #include <inet/common.h>
85 #include <inet/ip.h>
86 #include <inet/mi.h>
87 #include <inet/nd.h>
88 #include "e1000_hw.h"
89 
90 /*
91  * PCI Command Register Bit Definitions
92  * Configuration Space Header
93  */
94 #define	CMD_IO_SPACE			0x0001	/* BIT_0 */
95 #define	CMD_MEMORY_SPACE		0x0002	/* BIT_1 */
96 #define	CMD_BUS_MASTER			0x0004	/* BIT_2 */
97 #define	CMD_SPECIAL_CYCLES		0x0008	/* BIT_3 */
98 
99 #define	CMD_VGA_PALLETTE_SNOOP		0x0020	/* BIT_5 */
100 #define	CMD_PARITY_RESPONSE		0x0040	/* BIT_6 */
101 #define	CMD_WAIT_CYCLE_CONTROL		0x0080	/* BIT_7 */
102 #define	CMD_SERR_ENABLE			0x0100	/* BIT_8 */
103 #define	CMD_BACK_TO_BACK		0x0200	/* BIT_9 */
104 
105 #define	WSDRAINTIME		(200)	/* # milliseconds xmit drain */
106 
107 #ifdef __sparc
108 #ifdef _LP64
109 #define	DWORD_SWAP(value)	(value)
110 #else
111 #define	DWORD_SWAP(value)	\
112 	(uint64_t)((((uint64_t)value & 0x00000000FFFFFFFF) << 32) | \
113 	(((uint64_t)value & 0xFFFFFFFF00000000) >> 32))
114 #endif
115 #else
116 #define	DWORD_SWAP(value)	(value)
117 #endif
118 
119 #define	JUMBO_FRAG_LENGTH		4096
120 
121 #define	LAST_RAR_ENTRY			(E1000_RAR_ENTRIES - 1)
122 #define	MAX_NUM_UNICAST_ADDRESSES	E1000_RAR_ENTRIES
123 #define	MAX_NUM_MULTICAST_ADDRESSES	256
124 
125 #define	MAX_TX_DESC_PER_PACKET		16
126 
127 /*
128  * constants used in setting flow control thresholds
129  */
130 #define	E1000_PBA_MASK		0xffff
131 #define	E1000_PBA_SHIFT		10
132 #define	E1000_FC_HIGH_DIFF	0x1638 /* High: 5688 bytes below Rx FIFO size */
133 #define	E1000_FC_LOW_DIFF	0x1640 /* Low: 5696 bytes below Rx FIFO size */
134 #define	E1000_FC_PAUSE_TIME	0x0680 /* 858 usec */
135 
136 #define	MAXNUMTXDESCRIPTOR		4096
137 #define	MAXNUMRXDESCRIPTOR		4096
138 #define	MAXNUMRXFREELIST		4096
139 #define	MAXNUMTXSWPACKET		4096
140 #define	MAXNUMRCVPKTONINTR		4096
141 #define	MAXTXFRAGSLIMIT			1024
142 #define	MAXTXINTERRUPTDELAYVAL		65535
143 #define	MAXINTERRUPTTHROTTLINGVAL	65535
144 #define	MAXRXBCOPYTHRESHOLD		E1000_RX_BUFFER_SIZE_2K
145 #define	MAXTXBCOPYTHRESHOLD		E1000_TX_BUFFER_SIZE_2K
146 #define	MAXTXRECYCLELOWWATER		\
147 	(DEFAULTNUMTXDESCRIPTOR - MAX_TX_DESC_PER_PACKET)
148 #define	MAXTXRECYCLENUM			DEFAULTNUMTXDESCRIPTOR
149 
150 #define	MINNUMTXDESCRIPTOR		80
151 #define	MINNUMRXDESCRIPTOR		80
152 #define	MINNUMRXFREELIST		64
153 #define	MINNUMTXSWPACKET		80
154 #define	MINNUMRCVPKTONINTR		16
155 #define	MINTXFRAGSLIMIT			2
156 #define	MINTXINTERRUPTDELAYVAL		0
157 #define	MININTERRUPTTHROTTLINGVAL	0
158 #define	MINRXBCOPYTHRESHOLD		0
159 #define	MINTXBCOPYTHRESHOLD		MINIMUM_ETHERNET_PACKET_SIZE
160 #define	MINTXRECYCLELOWWATER		MAX_TX_DESC_PER_PACKET
161 #define	MINTXRECYCLENUM			MAX_TX_DESC_PER_PACKET
162 
163 #define	DEFAULTNUMTXDESCRIPTOR		2048
164 #define	DEFAULTNUMRXDESCRIPTOR		2048
165 #define	DEFAULTNUMRXFREELIST		4096
166 #define	DEFAULTNUMTXSWPACKET		2048
167 #define	DEFAULTMAXNUMRCVPKTONINTR	256
168 #define	DEFAULTTXFRAGSLIMIT		4
169 #define	DEFAULTFLOWCONTROLVAL		3
170 #define	DEFAULTTXINTERRUPTDELAYVAL	300
171 #define	DEFAULTINTERRUPTTHROTTLINGVAL	0x225
172 #define	DEFAULTMWIENABLEVAL		1	/* Only PCI 450NX chipset */
173 						/* needs this value to be 0 */
174 #define	DEFAULTMASTERLATENCYTIMERVAL	0	/* BIOS should decide */
175 						/* which is normally 0x040 */
176 #define	DEFAULTRXPCIPRIORITYVAL		1	/* Boolean value */
177 #define	DEFAULTPROFILEJUMBOTRAFFIC	1	/* Profile Jumbo Traffic */
178 #define	DEFAULTTBICOMPATIBILITYENABLE	1	/* Enable SBP workaround */
179 #define	DEFAULTMSIENABLE		1	/* MSI Enable */
180 
181 #define	DEFAULTRXBCOPYTHRESHOLD		0
182 #define	DEFAULTTXBCOPYTHRESHOLD		512
183 #define	DEFAULTTXRECYCLELOWWATER	64
184 #define	DEFAULTTXRECYCLENUM		128
185 
186 /*
187  * The size of the receive/transmite buffers
188  */
189 #define	E1000_RX_BUFFER_SIZE_2K		(2048)
190 #define	E1000_RX_BUFFER_SIZE_4K		(4096)
191 #define	E1000_RX_BUFFER_SIZE_8K		(8192)
192 #define	E1000_RX_BUFFER_SIZE_16K	(16384)
193 
194 #define	E1000_TX_BUFFER_SIZE_2K		(2048)
195 #define	E1000_TX_BUFFER_SIZE_4K		(4096)
196 #define	E1000_TX_BUFFER_SIZE_8K		(8192)
197 #define	E1000_TX_BUFFER_SIZE_16K	(16384)
198 
199 #define	FORCE_BCOPY_EXCEED_FRAGS	0x1
200 #define	FORCE_BCOPY_UNDER_SIZE		0x2
201 
202 #define	E1000G_RX_SW_FREE		0x0
203 #define	E1000G_RX_SW_SENDUP		0x1
204 #define	E1000G_RX_SW_DETACHED		0x2
205 
206 /*
207  * By default it will print only to log
208  */
209 #define	DEFAULTDEBUGLEVEL		0x004
210 #define	DEFAULTDISPLAYONLY		0
211 #define	DEFAULTPRINTONLY		1
212 
213 /*
214  * definitions for smartspeed workaround
215  */
216 #define	  E1000_SMARTSPEED_MAX		30	/* 30 watchdog iterations */
217 						/* or 30 seconds */
218 #define	  E1000_SMARTSPEED_DOWNSHIFT	6	/* 6 watchdog iterations */
219 						/* or 6 seconds */
220 
221 /*
222  * Definitions for module_info.
223  */
224 #define	 WSNAME			"e1000g"	/* module name */
225 
226 /*
227  * Defined for IP header alignment. We also need to preserve space for
228  * VLAN tag (4 bytes)
229  */
230 #define	E1000G_IPALIGNROOM		6
231 #define	E1000G_IPALIGNPRESERVEROOM	64
232 
233 #define	E1000G_IMS_TX_INTR	(E1000_IMS_TXDW | E1000_IMS_TXQE)
234 #define	E1000G_IMC_TX_INTR	(E1000_IMC_TXDW | E1000_IMC_TXQE)
235 #define	E1000G_ICR_TX_INTR	(E1000_ICR_TXDW | E1000_ICR_TXQE)
236 
237 /*
238  * bit flags for 'attach_progress' which is a member variable in struct e1000g
239  */
240 #define	ATTACH_PROGRESS_SOFTINTR	0x0001	/* Soft interrupt added */
241 #define	ATTACH_PROGRESS_REGSMAPPED	0x0002	/* registers mapped */
242 #define	ATTACH_PROGRESS_LOCKS		0x0004	/* locks initialized */
243 #define	ATTACH_PROGRESS_PCICONFIG	0x0008	/* PCI config set up */
244 #define	ATTACH_PROGRESS_KSTATS		0x0010	/* kstats created */
245 #define	ATTACH_PROGRESS_INIT		0x0020	/* reset */
246 #define	ATTACH_PROGRESS_INTRADDED	0x0040	/* interrupts added */
247 #define	ATTACH_PROGRESS_MACREGISTERED	0x0080	/* MAC registered */
248 #define	ATTACH_PROGRESS_PROP		0x0100	/* properties initialized */
249 #define	ATTACH_PROGRESS_NDD		0x0200	/* NDD initialized */
250 #define	ATTACH_PROGRESS_INTRENABLED	0x0400	/* DDI interrupts enabled */
251 #define	ATTACH_PROGRESS_ALLOC		0x0800	/* DMA resources allocated */
252 
253 /*
254  * Speed and Duplex Settings
255  */
256 #define	GDIAG_10_HALF		1
257 #define	GDIAG_10_FULL		2
258 #define	GDIAG_100_HALF		3
259 #define	GDIAG_100_FULL		4
260 #define	GDIAG_1000_FULL		6
261 #define	GDIAG_ANY		7
262 #define	MAX_DEVICES		256
263 
264 /*
265  * Coexist Workaround RP: 07/04/03
266  * 82544 Workaround : Co-existence
267  */
268 #define	MAX_TX_BUF_SIZE		(8 * 1024)
269 
270 #define	ROUNDOFF		0x1000
271 
272 /*
273  * Defines for Jumbo Frame
274  */
275 #define	FRAME_SIZE_UPTO_2K	2048
276 #define	FRAME_SIZE_UPTO_4K	4096
277 #define	FRAME_SIZE_UPTO_8K	8192
278 #define	FRAME_SIZE_UPTO_16K	16384
279 #define	FRAME_SIZE_UPTO_10K	10500
280 
281 /*
282  * Max microsecond for ITR (Interrupt Throttling Register)
283  */
284 #define	E1000_ITR_MAX_MICROSECOND	0x3fff
285 
286 /* Defines for Tx stall check */
287 #define	E1000G_STALL_WATCHDOG_COUNT	8
288 
289 #define	MAX_TX_LINK_DOWN_TIMEOUT	8
290 
291 /* Defines for DVMA */
292 #ifdef __sparc
293 #define	E1000G_DEFAULT_DVMA_PAGE_NUM	2
294 #endif
295 
296 /*
297  * Loopback definitions
298  */
299 #define	E1000G_LB_NONE			0
300 #define	E1000G_LB_EXTERNAL_1000		1
301 #define	E1000G_LB_EXTERNAL_100		2
302 #define	E1000G_LB_EXTERNAL_10		3
303 #define	E1000G_LB_INTERNAL_PHY		4
304 
305 
306 #define	GET_ETHER_TYPE(ptr)	(\
307 	(((uint8_t *)&((struct ether_header *)ptr)->ether_type)[0] << 8) | \
308 	(((uint8_t *)&((struct ether_header *)ptr)->ether_type)[1]))
309 
310 /*
311  * QUEUE_INIT_LIST -- Macro which will init ialize a queue to NULL.
312  */
313 #define	QUEUE_INIT_LIST(_LH)	\
314 	(_LH)->Flink = (_LH)->Blink = (PSINGLE_LIST_LINK)0
315 
316 /*
317  * IS_QUEUE_EMPTY -- Macro which checks to see if a queue is empty.
318  */
319 #define	IS_QUEUE_EMPTY(_LH)	\
320 	((_LH)->Flink == (PSINGLE_LIST_LINK)0)
321 
322 /*
323  * QUEUE_GET_HEAD -- Macro which returns the head of the queue, but does
324  * not remove the head from the queue.
325  */
326 #define	QUEUE_GET_HEAD(_LH)	((PSINGLE_LIST_LINK)((_LH)->Flink))
327 
328 /*
329  * QUEUE_REMOVE_HEAD -- Macro which removes the head of the head of a queue.
330  */
331 #define	QUEUE_REMOVE_HEAD(_LH)	\
332 { \
333 	PSINGLE_LIST_LINK ListElem; \
334 	if (ListElem = (_LH)->Flink) \
335 	{ \
336 		if (!((_LH)->Flink = ListElem->Flink)) \
337 			(_LH)->Blink = (PSINGLE_LIST_LINK) 0; \
338 	} \
339 }
340 
341 /*
342  * QUEUE_POP_HEAD -- Macro which  will pop the head off of a queue (list),
343  *	and return it (this differs from QUEUE_REMOVE_HEAD only in
344  *	the 1st line).
345  */
346 #define	QUEUE_POP_HEAD(_LH)	\
347 	(PSINGLE_LIST_LINK)(_LH)->Flink; \
348 	{ \
349 		PSINGLE_LIST_LINK ListElem; \
350 		ListElem = (_LH)->Flink; \
351 		if (ListElem) \
352 		{ \
353 			(_LH)->Flink = ListElem->Flink; \
354 			if (!(_LH)->Flink) \
355 				(_LH)->Blink = (PSINGLE_LIST_LINK)0; \
356 		} \
357 	}
358 
359 /*
360  * QUEUE_GET_TAIL -- Macro which returns the tail of the queue, but does not
361  *	remove the tail from the queue.
362  */
363 #define	QUEUE_GET_TAIL(_LH)	((PSINGLE_LIST_LINK)((_LH)->Blink))
364 
365 /*
366  * QUEUE_PUSH_TAIL -- Macro which puts an element at the tail (end) of the queue
367  */
368 #define	QUEUE_PUSH_TAIL(_LH, _E)	\
369 	if ((_LH)->Blink) \
370 	{ \
371 		((PSINGLE_LIST_LINK)(_LH)->Blink)->Flink = \
372 			(PSINGLE_LIST_LINK)(_E); \
373 		(_LH)->Blink = (PSINGLE_LIST_LINK)(_E); \
374 	} else { \
375 		(_LH)->Flink = \
376 			(_LH)->Blink = (PSINGLE_LIST_LINK)(_E); \
377 	} \
378 	(_E)->Flink = (PSINGLE_LIST_LINK)0;
379 
380 /*
381  * QUEUE_PUSH_HEAD -- Macro which puts an element at the head of the queue.
382  */
383 #define	QUEUE_PUSH_HEAD(_LH, _E)	\
384 	if (!((_E)->Flink = (_LH)->Flink)) \
385 	{ \
386 		(_LH)->Blink = (PSINGLE_LIST_LINK)(_E); \
387 	} \
388 	(_LH)->Flink = (PSINGLE_LIST_LINK)(_E);
389 
390 /*
391  * QUEUE_GET_NEXT -- Macro which returns the next element linked to the
392  *	current element.
393  */
394 #define	QUEUE_GET_NEXT(_LH, _E)		\
395 	(PSINGLE_LIST_LINK)((((_LH)->Blink) == (_E)) ? \
396 	(0) : ((_E)->Flink))
397 
398 /*
399  * QUEUE_APPEND -- Macro which appends a queue to the tail of another queue
400  */
401 #define	QUEUE_APPEND(_LH1, _LH2)	\
402 	if ((_LH2)->Flink) { \
403 		if ((_LH1)->Flink) { \
404 			((PSINGLE_LIST_LINK)(_LH1)->Blink)->Flink = \
405 				((PSINGLE_LIST_LINK)(_LH2)->Flink); \
406 		} else { \
407 			(_LH1)->Flink = \
408 				((PSINGLE_LIST_LINK)(_LH2)->Flink); \
409 		} \
410 		(_LH1)->Blink = ((PSINGLE_LIST_LINK)(_LH2)->Blink); \
411 	}
412 
413 /*
414  * Property lookups
415  */
416 #define	E1000G_PROP_EXISTS(d, n)	ddi_prop_exists(DDI_DEV_T_ANY, (d), \
417 						DDI_PROP_DONTPASS, (n))
418 #define	E1000G_PROP_GET_INT(d, n)	ddi_prop_get_int(DDI_DEV_T_ANY, (d), \
419 						DDI_PROP_DONTPASS, (n), -1)
420 
421 /*
422  * Shorthand for the NDD parameters
423  */
424 #define	param_adv_autoneg	nd_params[PARAM_ADV_AUTONEG_CAP].ndp_val
425 #define	param_adv_pause		nd_params[PARAM_ADV_PAUSE_CAP].ndp_val
426 #define	param_adv_asym_pause	nd_params[PARAM_ADV_ASYM_PAUSE_CAP].ndp_val
427 #define	param_adv_1000fdx	nd_params[PARAM_ADV_1000FDX_CAP].ndp_val
428 #define	param_adv_1000hdx	nd_params[PARAM_ADV_1000HDX_CAP].ndp_val
429 #define	param_adv_100fdx	nd_params[PARAM_ADV_100FDX_CAP].ndp_val
430 #define	param_adv_100hdx	nd_params[PARAM_ADV_100HDX_CAP].ndp_val
431 #define	param_adv_10fdx		nd_params[PARAM_ADV_10FDX_CAP].ndp_val
432 #define	param_adv_10hdx		nd_params[PARAM_ADV_10HDX_CAP].ndp_val
433 
434 #define	param_force_speed_duplex nd_params[PARAM_FORCE_SPEED_DUPLEX].ndp_val
435 
436 #define	param_link_up		nd_params[PARAM_LINK_STATUS].ndp_val
437 #define	param_link_speed	nd_params[PARAM_LINK_SPEED].ndp_val
438 #define	param_link_duplex	nd_params[PARAM_LINK_DUPLEX].ndp_val
439 #define	param_link_autoneg	nd_params[PARAM_LINK_AUTONEG].ndp_val
440 
441 /*
442  * E1000G-specific ioctls ...
443  */
444 #define	E1000G_IOC		((((((('E' << 4) + '1') << 4) \
445 				+ 'K') << 4) + 'G') << 4)
446 
447 /*
448  * These diagnostic IOCTLS are enabled only in DEBUG drivers
449  */
450 #define	E1000G_IOC_REG_PEEK	(E1000G_IOC | 1)
451 #define	E1000G_IOC_REG_POKE	(E1000G_IOC | 2)
452 #define	E1000G_IOC_CHIP_RESET	(E1000G_IOC | 3)
453 
454 #define	E1000G_PP_SPACE_REG	0	/* PCI memory space	*/
455 #define	E1000G_PP_SPACE_E1000G	1	/* driver's soft state	*/
456 
457 typedef struct {
458 	uint64_t pp_acc_size;	/* It's 1, 2, 4 or 8	*/
459 	uint64_t pp_acc_space;	/* See #defines below	*/
460 	uint64_t pp_acc_offset;	/* See regs definition	*/
461 	uint64_t pp_acc_data;	/* output for peek	*/
462 				/* input for poke	*/
463 } e1000g_peekpoke_t;
464 
465 /*
466  * (Internal) return values from ioctl subroutines
467  */
468 enum ioc_reply {
469 	IOC_INVAL = -1,		/* bad, NAK with EINVAL	*/
470 	IOC_DONE,		/* OK, reply sent	*/
471 	IOC_ACK,		/* OK, just send ACK	*/
472 	IOC_REPLY		/* OK, just send reply	*/
473 };
474 
475 /*
476  * Named Data (ND) Parameter Management Structure
477  */
478 typedef struct {
479 	uint32_t ndp_info;
480 	uint32_t ndp_min;
481 	uint32_t ndp_max;
482 	uint32_t ndp_val;
483 	struct e1000g *ndp_instance;
484 	char *ndp_name;
485 } nd_param_t;
486 
487 /*
488  * NDD parameter indexes, divided into:
489  *
490  *	read-only parameters describing the hardware's capabilities
491  *	read-write parameters controlling the advertised capabilities
492  *	read-only parameters describing the partner's capabilities
493  *	read-write parameters controlling the force speed and duplex
494  *	read-only parameters describing the link state
495  *	read-only parameters describing the driver properties
496  *	read-write parameters controlling the driver properties
497  */
498 enum {
499 	PARAM_AUTONEG_CAP,
500 	PARAM_PAUSE_CAP,
501 	PARAM_ASYM_PAUSE_CAP,
502 	PARAM_1000FDX_CAP,
503 	PARAM_1000HDX_CAP,
504 	PARAM_100T4_CAP,
505 	PARAM_100FDX_CAP,
506 	PARAM_100HDX_CAP,
507 	PARAM_10FDX_CAP,
508 	PARAM_10HDX_CAP,
509 
510 	PARAM_ADV_AUTONEG_CAP,
511 	PARAM_ADV_PAUSE_CAP,
512 	PARAM_ADV_ASYM_PAUSE_CAP,
513 	PARAM_ADV_1000FDX_CAP,
514 	PARAM_ADV_1000HDX_CAP,
515 	PARAM_ADV_100T4_CAP,
516 	PARAM_ADV_100FDX_CAP,
517 	PARAM_ADV_100HDX_CAP,
518 	PARAM_ADV_10FDX_CAP,
519 	PARAM_ADV_10HDX_CAP,
520 
521 	PARAM_LP_AUTONEG_CAP,
522 	PARAM_LP_PAUSE_CAP,
523 	PARAM_LP_ASYM_PAUSE_CAP,
524 	PARAM_LP_1000FDX_CAP,
525 	PARAM_LP_1000HDX_CAP,
526 	PARAM_LP_100T4_CAP,
527 	PARAM_LP_100FDX_CAP,
528 	PARAM_LP_100HDX_CAP,
529 	PARAM_LP_10FDX_CAP,
530 	PARAM_LP_10HDX_CAP,
531 
532 	PARAM_FORCE_SPEED_DUPLEX,
533 
534 	PARAM_LINK_STATUS,
535 	PARAM_LINK_SPEED,
536 	PARAM_LINK_DUPLEX,
537 	PARAM_LINK_AUTONEG,
538 
539 	PARAM_MAX_FRAME_SIZE,
540 	PARAM_LOOP_MODE,
541 	PARAM_INTR_TYPE,
542 
543 	PARAM_TX_BCOPY_THRESHOLD,
544 	PARAM_TX_FRAGS_LIMIT,
545 	PARAM_TX_RECYCLE_LOW_WATER,
546 	PARAM_TX_RECYCLE_NUM,
547 	PARAM_TX_INTR_ENABLE,
548 	PARAM_TX_INTR_DELAY,
549 	PARAM_RX_BCOPY_THRESHOLD,
550 	PARAM_RX_PKT_ON_INTR,
551 	PARAM_RX_RDTR,
552 	PARAM_RX_RADV,
553 
554 	PARAM_COUNT
555 };
556 
557 static struct ether_addr etherbroadcastaddr = {
558 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff
559 };
560 
561 /*
562  * DMA access attributes <Little Endian Card>
563  */
564 static ddi_device_acc_attr_t accattr = {
565 	DDI_DEVICE_ATTR_V0,
566 	DDI_STRUCTURE_LE_ACC,
567 	DDI_STRICTORDER_ACC,
568 };
569 
570 /*
571  * DMA access attributes for receive buffer <Big Endian> for Sparc
572  */
573 #ifdef __sparc
574 static ddi_device_acc_attr_t accattr2 = {
575 	DDI_DEVICE_ATTR_V0,
576 	DDI_STRUCTURE_BE_ACC,
577 	DDI_STRICTORDER_ACC,
578 };
579 #else
580 static ddi_device_acc_attr_t accattr2 = {
581 	DDI_DEVICE_ATTR_V0,
582 	DDI_STRUCTURE_LE_ACC,
583 	DDI_STRICTORDER_ACC,
584 };
585 #endif
586 
587 typedef struct _private_devi_list {
588 	dev_info_t *dip;
589 	dev_info_t *priv_dip;
590 	struct _private_devi_list *next;
591 } private_devi_list_t;
592 
593 /*
594  * A structure that points to the next entry in the queue.
595  */
596 typedef struct _SINGLE_LIST_LINK {
597 	struct _SINGLE_LIST_LINK *Flink;
598 } SINGLE_LIST_LINK, *PSINGLE_LIST_LINK;
599 
600 /*
601  * A "ListHead" structure that points to the head and tail of a queue
602  */
603 typedef struct _LIST_DESCRIBER {
604 	struct _SINGLE_LIST_LINK *volatile Flink;
605 	struct _SINGLE_LIST_LINK *volatile Blink;
606 } LIST_DESCRIBER, *PLIST_DESCRIBER;
607 
608 /*
609  * Address-Length pair structure that stores descriptor info
610  */
611 typedef struct _ADDRESS_LENGTH_PAIR {
612 	uint64_t Address;
613 	uint32_t Length;
614 } ADDRESS_LENGTH_PAIR, *PADDRESS_LENGTH_PAIR;
615 
616 typedef struct _DESCRIPTOR_PAIR {
617 	ADDRESS_LENGTH_PAIR Descriptor[4];
618 	uint32_t Elements;
619 } DESC_ARRAY, *PDESC_ARRAY;
620 
621 typedef enum {
622 	USE_NONE,
623 	USE_BCOPY,
624 	USE_DVMA,
625 	USE_DMA
626 } dma_type_t;
627 
628 typedef struct _dma_buffer {
629 	caddr_t address;
630 	uint64_t dma_address;
631 	ddi_acc_handle_t acc_handle;
632 	ddi_dma_handle_t dma_handle;
633 	size_t size;
634 	size_t len;
635 } dma_buffer_t, *pdma_buffer_t;
636 
637 /*
638  * Transmit Control Block (TCB), Ndis equiv of SWPacket This
639  * structure stores the additional information that is
640  * associated with every packet to be transmitted. It stores the
641  * message block pointer and the TBD addresses associated with
642  * the m_blk and also the link to the next tcb in the chain
643  */
644 typedef struct _TX_SW_PACKET_ {
645 	/* Link to the next TX_SW_PACKET in the list */
646 	SINGLE_LIST_LINK Link;
647 	mblk_t *mp;
648 	UINT num_desc;
649 	UINT num_mblk_frag;
650 	dma_type_t dma_type;
651 	dma_type_t data_transfer_type;
652 	ddi_dma_handle_t tx_dma_handle;
653 	dma_buffer_t tx_buf[1];
654 	ADDRESS_LENGTH_PAIR desc[MAX_TX_DESC_PER_PACKET + 1];
655 } TX_SW_PACKET, *PTX_SW_PACKET;
656 
657 /*
658  * This structure is similar to the RX_SW_PACKET structure used
659  * for Ndis. This structure stores information about the 2k
660  * aligned receive buffer into which the FX1000 DMA's frames.
661  * This structure is maintained as a linked list of many
662  * receiver buffer pointers.
663  */
664 typedef struct _RX_SW_PACKET {
665 	/* Link to the next RX_SW_PACKET in the list */
666 	SINGLE_LIST_LINK Link;
667 	struct _RX_SW_PACKET *next;
668 	uint16_t flag;
669 	mblk_t *mp;
670 	caddr_t rx_ring;
671 	dma_type_t dma_type;
672 	frtn_t free_rtn;
673 	dma_buffer_t rx_buf[1];
674 } RX_SW_PACKET, *PRX_SW_PACKET;
675 
676 typedef struct _e1000g_msg_chain {
677 	mblk_t *head;
678 	mblk_t *tail;
679 	kmutex_t lock;
680 } e1000g_msg_chain_t;
681 
682 typedef struct _cksum_data {
683 	uint32_t ether_header_size;
684 	uint32_t cksum_flags;
685 	uint32_t cksum_start;
686 	uint32_t cksum_stuff;
687 } cksum_data_t;
688 
689 /*
690  * MultiCast Command Block (MULTICAST_CB) The multicast
691  * structure contains an array of multicast addresses and
692  * also a count of the total number of addresses.
693  */
694 typedef struct _multicast_cb_t {
695 	ushort_t mc_count;	/* Number of multicast addresses */
696 	uchar_t MulticastBuffer[(ETH_LENGTH_OF_ADDRESS *
697 		MAX_NUM_MULTICAST_ADDRESSES)];
698 } mltcst_cb_t, *pmltcst_cb_t;
699 
700 typedef union _e1000g_ether_addr {
701 	struct {
702 		uint32_t high;
703 		uint32_t low;
704 	} reg;
705 	struct {
706 		uint8_t set;
707 		uint8_t redundant;
708 		uint8_t addr[NODE_ADDRESS_SIZE];
709 	} mac;
710 } e1000g_ether_addr_t;
711 
712 typedef struct _e1000gstat {
713 
714 	kstat_named_t link_speed;	/* Link Speed */
715 	kstat_named_t rx_none;		/* Rx No Incoming Data */
716 	kstat_named_t rx_error;		/* Rx Error in Packet */
717 	kstat_named_t rx_exceed_pkt;	/* Rx Exceed Max Pkt Count */
718 	kstat_named_t rx_multi_desc;	/* Rx Multi Spanned Pkt */
719 	kstat_named_t rx_no_freepkt;	/* Rx No Free Pkt */
720 	kstat_named_t rx_avail_freepkt;	/* Rx Freelist Avail Buffers */
721 	kstat_named_t rx_esballoc_fail;	/* Rx Desballoc Failure */
722 	kstat_named_t rx_allocb_fail;	/* Rx Allocb Failure */
723 	kstat_named_t rx_seq_intr;	/* Rx Sequencing Errors Intr */
724 	kstat_named_t tx_lack_desc;	/* Tx Lack of Desc */
725 	kstat_named_t tx_no_desc;	/* Tx No Desc */
726 	kstat_named_t tx_no_swpkt;	/* Tx No Pkt Buffer */
727 	kstat_named_t tx_send_fail;	/* Tx SendPkt Failure */
728 	kstat_named_t tx_multi_cookie;	/* Tx Pkt Span Multi Cookies */
729 	kstat_named_t tx_over_size;	/* Tx Pkt Too Long */
730 	kstat_named_t tx_under_size;	/* Tx Allocb Failure */
731 	kstat_named_t tx_reschedule;	/* Tx Reschedule */
732 	kstat_named_t tx_empty_frags;	/* Tx Empty Frags */
733 	kstat_named_t tx_exceed_frags;	/* Tx Exceed Max Frags */
734 	kstat_named_t tx_recycle;	/* Tx Recycle */
735 	kstat_named_t tx_recycle_retry;	/* Tx Recycle Retry */
736 	kstat_named_t tx_recycle_intr;	/* Tx Recycle in Intr */
737 	kstat_named_t tx_recycle_none;	/* Tx No Desc Recycled */
738 	kstat_named_t tx_copy;		/* Tx Send Copy */
739 	kstat_named_t tx_bind;		/* Tx Send Bind */
740 	kstat_named_t tx_multi_copy;	/* Tx Copy Multi Fragments */
741 	kstat_named_t StallWatchdog;	/* Tx Stall Watchdog */
742 	kstat_named_t reset_count;	/* Reset Count */
743 	kstat_named_t intr_type;	/* Interrupt Type */
744 	kstat_named_t Crcerrs;	/* CRC Error Count */
745 	kstat_named_t Symerrs;	/* Symbol Error Count */
746 	kstat_named_t Mpc;	/* Missed Packet Count */
747 	kstat_named_t Scc;	/* Single Collision Count */
748 	kstat_named_t Ecol;	/* Excessive Collision Count */
749 	kstat_named_t Mcc;	/* Multiple Collision Count */
750 	kstat_named_t Latecol;	/* Late Collision Count */
751 	kstat_named_t Colc;	/* Collision Count */
752 	kstat_named_t Dc;	/* Defer Count */
753 	kstat_named_t Sec;	/* Sequence Error Count */
754 	kstat_named_t Rlec;	/* Receive Length Error Count */
755 	kstat_named_t Xonrxc;	/* XON Received Count */
756 	kstat_named_t Xontxc;	/* XON Xmitted Count */
757 	kstat_named_t Xoffrxc;	/* XOFF Received Count */
758 	kstat_named_t Xofftxc;	/* Xoff Xmitted Count */
759 	kstat_named_t Fcruc;	/* Unknown Flow Conrol Packet Rcvd Count */
760 	kstat_named_t Prc64;	/* Packets Received - 64b */
761 	kstat_named_t Prc127;	/* Packets Received - 65-127b */
762 	kstat_named_t Prc255;	/* Packets Received - 127-255b */
763 	kstat_named_t Prc511;	/* Packets Received - 256-511b */
764 	kstat_named_t Prc1023;	/* Packets Received - 511-1023b */
765 	kstat_named_t Prc1522;	/* Packets Received - 1024-1522b */
766 	kstat_named_t Gprc;	/* Good Packets Received Count */
767 	kstat_named_t Bprc;	/* Broadcasts Pkts Received Count */
768 	kstat_named_t Mprc;	/* Multicast Pkts Received Count */
769 	kstat_named_t Gptc;	/* Good Packets Xmitted Count */
770 	kstat_named_t Gorl;	/* Good Octets Recvd Lo Count */
771 	kstat_named_t Gorh;	/* Good Octets Recvd Hi Count */
772 	kstat_named_t Gotl;	/* Good Octets Xmitd Lo Count */
773 	kstat_named_t Goth;	/* Good Octets Xmitd Hi Count */
774 	kstat_named_t Rnbc;	/* Receive No Buffers Count */
775 	kstat_named_t Ruc;	/* Receive Undersize Count */
776 	kstat_named_t Rfc;	/* Receive Frag Count */
777 	kstat_named_t Roc;	/* Receive Oversize Count */
778 	kstat_named_t Rjc;	/* Receive Jabber Count */
779 	kstat_named_t Torl;	/* Total Octets Recvd Lo Count */
780 	kstat_named_t Torh;	/* Total Octets Recvd Hi Count */
781 	kstat_named_t Totl;	/* Total Octets Xmted Lo Count */
782 	kstat_named_t Toth;	/* Total Octets Xmted Hi Count */
783 	kstat_named_t Tpr;	/* Total Packets Received */
784 	kstat_named_t Tpt;	/* Total Packets Xmitted */
785 	kstat_named_t Ptc64;	/* Packets Xmitted (64b) */
786 	kstat_named_t Ptc127;	/* Packets Xmitted (64-127b) */
787 	kstat_named_t Ptc255;	/* Packets Xmitted (128-255b) */
788 	kstat_named_t Ptc511;	/* Packets Xmitted (255-511b) */
789 	kstat_named_t Ptc1023;	/* Packets Xmitted (512-1023b) */
790 	kstat_named_t Ptc1522;	/* Packets Xmitted (1024-1522b */
791 	kstat_named_t Mptc;	/* Multicast Packets Xmited Count */
792 	kstat_named_t Bptc;	/* Broadcast Packets Xmited Count */
793 	/*
794 	 * New Livengood Stat Counters
795 	 */
796 	kstat_named_t Algnerrc;	/* Alignment Error count */
797 	kstat_named_t Tuc;	/* Transmit Underrun count */
798 	kstat_named_t Rxerrc;	/* Rx Error Count */
799 	kstat_named_t Tncrs;	/* Transmit with no CRS */
800 	kstat_named_t Cexterr;	/* Carrier Extension Error count */
801 	kstat_named_t Rutec;	/* Receive DMA too Early count */
802 	kstat_named_t Tsctc;	/* TCP seg contexts xmit count */
803 	kstat_named_t Tsctfc;	/* TCP seg contexts xmit fail count */
804 	/*
805 	 * Jumbo Frame Counters
806 	 */
807 	kstat_named_t JumboTx_4K;	/* 4k Jumbo Frames Transmitted */
808 	kstat_named_t JumboRx_4K;	/* 4k Jumbo Frames Received */
809 	kstat_named_t JumboTx_8K;	/* 8k Jumbo Frames Transmitted */
810 	kstat_named_t JumboRx_8K;	/* 8k Jumbo Frames Received */
811 	kstat_named_t JumboTx_16K;	/* 16k Jumbo Frames Transmitted */
812 	kstat_named_t JumboRx_16K;	/* 16k Jumbo Frames Received */
813 
814 } e1000gstat, *e1000gstatp;
815 
816 typedef struct _e1000g_tx_ring {
817 	kmutex_t tx_lock;
818 	kmutex_t freelist_lock;
819 	kmutex_t usedlist_lock;
820 	/*
821 	 * Descriptor queue definitions
822 	 */
823 	ddi_dma_handle_t tbd_dma_handle;
824 	ddi_acc_handle_t tbd_acc_handle;
825 	struct e1000_tx_desc *tbd_area;
826 	uint64_t tbd_dma_addr;
827 	struct e1000_tx_desc *tbd_first;
828 	struct e1000_tx_desc *tbd_last;
829 	struct e1000_tx_desc *tbd_oldest;
830 	struct e1000_tx_desc *tbd_next;
831 	/*
832 	 * Software packet structures definitions
833 	 */
834 	PTX_SW_PACKET packet_area;
835 	LIST_DESCRIBER used_list;
836 	LIST_DESCRIBER free_list;
837 	/*
838 	 * TCP/UDP checksum offload
839 	 */
840 	cksum_data_t cksum_data;
841 	/*
842 	 * Timer definitions for 82547
843 	 */
844 	timeout_id_t timer_id_82547;
845 	boolean_t timer_enable_82547;
846 	/*
847 	 * Pointer to the adapter
848 	 */
849 	struct e1000g *adapter;
850 } e1000g_tx_ring_t, *pe1000g_tx_ring_t;
851 
852 typedef struct _e1000g_rx_ring {
853 	kmutex_t rx_lock;
854 	kmutex_t freelist_lock;
855 	/*
856 	 * Descriptor queue definitions
857 	 */
858 	ddi_dma_handle_t rbd_dma_handle;
859 	ddi_acc_handle_t rbd_acc_handle;
860 	struct e1000_rx_desc *rbd_area;
861 	uint64_t rbd_dma_addr;
862 	struct e1000_rx_desc *rbd_first;
863 	struct e1000_rx_desc *rbd_last;
864 	struct e1000_rx_desc *rbd_next;
865 	/*
866 	 * Software packet structures definitions
867 	 */
868 	PRX_SW_PACKET packet_area;
869 	LIST_DESCRIBER recv_list;
870 	LIST_DESCRIBER free_list;
871 	/*
872 	 * Pointer to the adapter
873 	 */
874 	struct e1000g *adapter;
875 } e1000g_rx_ring_t, *pe1000g_rx_ring_t;
876 
877 typedef struct e1000g {
878 	mac_handle_t mh;
879 	dev_info_t *dip;
880 	dev_info_t *priv_dip;
881 	ddi_acc_handle_t handle;
882 	ddi_acc_handle_t E1000_handle;		/* Ws-PCI handle to regs */
883 	int AdapterInstance;
884 	struct e1000_hw Shared;
885 	struct e1000g_osdep osdep;
886 
887 	link_state_t link_state;
888 	UINT link_speed;
889 	UINT link_duplex;
890 	UINT NumRxDescriptors;
891 	UINT NumRxFreeList;
892 	UINT NumTxDescriptors;
893 	UINT NumTxSwPacket;
894 	UINT MaxNumReceivePackets;
895 	UINT bar64;
896 	USHORT TxInterruptDelay;
897 	USHORT MWIEnable;
898 	UINT MasterLatencyTimer;
899 #ifdef e1000g_DEBUG
900 	UINT DebugLevel;
901 	UINT DisplayOnly;
902 	UINT PrintOnly;
903 #endif
904 	UINT smartspeed;	/* smartspeed w/a counter */
905 	uint32_t init_count;
906 	size_t TxBufferSize;
907 	size_t RxBufferSize;
908 	boolean_t intr_adaptive;
909 	uint32_t intr_throttling_rate;
910 	timeout_id_t WatchDogTimer_id;
911 	timeout_id_t link_tid;
912 	boolean_t link_complete;
913 
914 	/*
915 	 * The e1000g_timeout_lock must be held when updateing the
916 	 * timeout fields in struct e1000g, that is,
917 	 * WatchDogTimer_id, timeout_enabled, timeout_started.
918 	 */
919 	kmutex_t e1000g_timeout_lock;
920 	/*
921 	 * The e1000g_linklock protects the link fields in struct e1000g,
922 	 * such as link_state, link_speed, link_duplex, link_complete, and
923 	 * link_tid.
924 	 */
925 	kmutex_t e1000g_linklock;
926 	kmutex_t TbiCntrMutex;
927 	/*
928 	 * The chip_lock assures that the Rx/Tx process must be
929 	 * stopped while other functions change the hardware
930 	 * configuration of e1000g card, such as e1000g_reset(),
931 	 * e1000g_reset_hw() etc are executed.
932 	 */
933 	krwlock_t chip_lock;
934 
935 	e1000g_rx_ring_t rx_ring[1];
936 	e1000g_tx_ring_t tx_ring[1];
937 
938 	uint32_t rx_bcopy_thresh;
939 	uint32_t tx_bcopy_thresh;
940 	uint32_t tx_recycle_low_water;
941 	uint32_t tx_recycle_num;
942 	uint32_t tx_frags_limit;
943 	uint32_t tx_link_down_timeout;
944 
945 	boolean_t tx_intr_enable;
946 	ddi_softint_handle_t tx_softint_handle;
947 	int tx_softint_pri;
948 	/*
949 	 * Message chain that needs to be freed
950 	 */
951 	e1000g_msg_chain_t tx_msg_chain[1];
952 
953 	mblk_t *rx_mblk;
954 	mblk_t *rx_mblk_tail;
955 	USHORT rx_packet_len;
956 
957 	kstat_t *e1000g_ksp;
958 
959 	uint32_t rx_none;
960 	uint32_t rx_error;
961 	uint32_t rx_exceed_pkt;
962 	uint32_t rx_multi_desc;
963 	uint32_t rx_no_freepkt;
964 	uint32_t rx_esballoc_fail;
965 	uint32_t rx_avail_freepkt;
966 	uint32_t rx_allocb_fail;
967 	uint32_t rx_seq_intr;
968 	uint32_t tx_lack_desc;
969 	uint32_t tx_no_desc;
970 	uint32_t tx_no_swpkt;
971 	uint32_t tx_send_fail;
972 	uint32_t tx_multi_cookie;
973 	uint32_t tx_over_size;
974 	uint32_t tx_under_size;
975 	uint32_t tx_reschedule;
976 	uint32_t tx_empty_frags;
977 	uint32_t tx_exceed_frags;
978 	uint32_t tx_recycle;
979 	uint32_t tx_recycle_retry;
980 	uint32_t tx_recycle_intr;
981 	uint32_t tx_recycle_none;
982 	uint32_t tx_copy;
983 	uint32_t tx_bind;
984 	uint32_t tx_multi_copy;
985 
986 	uint32_t JumboTx_4K;
987 	uint32_t JumboRx_4K;
988 	uint32_t JumboTx_8K;
989 	uint32_t JumboRx_8K;
990 	uint32_t JumboTx_16K;
991 	uint32_t JumboRx_16K;
992 
993 	uint32_t StallWatchdog;
994 	uint32_t tx_recycle_fail;
995 	uint32_t reset_count;
996 
997 	uint32_t unicst_avail;
998 	uint32_t unicst_total;
999 	e1000g_ether_addr_t unicst_addr[MAX_NUM_UNICAST_ADDRESSES];
1000 
1001 	uint32_t mcast_count;
1002 	struct ether_addr mcast_table[MAX_NUM_MULTICAST_ADDRESSES];
1003 
1004 	uint32_t loopback_mode;
1005 
1006 	UINT ProfileJumboTraffic;
1007 	UINT RcvBufferAlignment;
1008 
1009 	boolean_t timeout_enabled;
1010 	boolean_t timeout_started;
1011 
1012 	boolean_t e1000g_promisc;
1013 	boolean_t started;
1014 	mac_resource_handle_t mrh;
1015 
1016 	uint32_t attach_progress;	/* attach tracking */
1017 	/*
1018 	 * reschedule when tx resource is available
1019 	 */
1020 	boolean_t resched_needed;
1021 
1022 #ifdef __sparc
1023 	ulong_t sys_page_sz;
1024 	uint_t dvma_page_num;
1025 #endif
1026 
1027 	boolean_t msi_enabled;
1028 	int intr_type;
1029 	int intr_cnt;
1030 	int intr_cap;
1031 	size_t intr_size;
1032 	uint_t intr_pri;
1033 	ddi_intr_handle_t *htable;
1034 
1035 	/*
1036 	 * NDD parameters
1037 	 */
1038 	caddr_t nd_data;
1039 	nd_param_t nd_params[PARAM_COUNT];
1040 
1041 } e1000g, *Pe1000g, ADAPTER_STRUCT, *PADAPTER_STRUCT;
1042 
1043 
1044 static ddi_dma_attr_t tx_dma_attr = {
1045 	DMA_ATTR_V0,		/* version of this structure */
1046 	0,			/* lowest usable address */
1047 	0xffffffffffffffffULL,	/* highest usable address */
1048 	0x7fffffff,		/* maximum DMAable byte count */
1049 	1,			/* alignment in bytes */
1050 	0x7ff,			/* burst sizes (any?) */
1051 	1,			/* minimum transfer */
1052 	0xffffffffU,		/* maximum transfer */
1053 	0xffffffffffffffffULL,	/* maximum segment length */
1054 	16,			/* maximum number of segments */
1055 	1,			/* granularity */
1056 	0,			/* flags (reserved) */
1057 };
1058 
1059 static ddi_dma_attr_t buf_dma_attr = {
1060 	DMA_ATTR_V0,		/* version of this structure */
1061 	0,			/* lowest usable address */
1062 	0xffffffffffffffffULL,	/* highest usable address */
1063 	0x7fffffff,		/* maximum DMAable byte count */
1064 	1,			/* alignment in bytes */
1065 	0x7ff,			/* burst sizes (any?) */
1066 	1,			/* minimum transfer */
1067 	0xffffffffU,		/* maximum transfer */
1068 	0xffffffffffffffffULL,	/* maximum segment length */
1069 	1,			/* maximum number of segments */
1070 	1,			/* granularity */
1071 	0,			/* flags (reserved) */
1072 };
1073 
1074 static ddi_dma_attr_t tbd_dma_attr = {
1075 	DMA_ATTR_V0,		/* version of this structure */
1076 	0,			/* lowest usable address */
1077 	0xffffffffffffffffULL,	/* highest usable address */
1078 	0x7fffffff,		/* maximum DMAable byte count */
1079 	E1000_MDALIGN,		/* alignment in bytes 4K! */
1080 	0x7ff,			/* burst sizes (any?) */
1081 	1,			/* minimum transfer */
1082 	0xffffffffU,		/* maximum transfer */
1083 	0xffffffffffffffffULL,	/* maximum segment length */
1084 	1,			/* maximum number of segments */
1085 	1,			/* granularity */
1086 	0,			/* flags (reserved) */
1087 };
1088 
1089 /*
1090  * Function prototypes
1091  */
1092 int e1000g_alloc_dma_resources(struct e1000g *Adapter);
1093 void e1000g_release_dma_resources(struct e1000g *Adapter);
1094 void e1000g_free_rx_sw_packet(PRX_SW_PACKET packet);
1095 void SetupTransmitStructures(struct e1000g *Adapter);
1096 void SetupReceiveStructures(struct e1000g *Adapter);
1097 void SetupMulticastTable(struct e1000g *Adapter);
1098 boolean_t e1000g_reset(struct e1000g *Adapter);
1099 
1100 int e1000g_recycle(e1000g_tx_ring_t *tx_ring);
1101 void FreeTxSwPacket(PTX_SW_PACKET packet);
1102 uint_t e1000g_tx_freemsg(caddr_t arg1, caddr_t arg2);
1103 mblk_t *e1000g_m_tx(void *arg, mblk_t *mp);
1104 mblk_t *e1000g_receive(struct e1000g *Adapter);
1105 void e1000g_rxfree_func(PRX_SW_PACKET packet);
1106 
1107 int e1000g_m_stat(void *arg, uint_t stat, uint64_t *val);
1108 int InitStatsCounters(struct e1000g *Adapter);
1109 void AdjustTbiAcceptedStats(struct e1000g *Adapter, UINT32 FrameLength,
1110     PUCHAR MacAddress);
1111 enum ioc_reply e1000g_nd_ioctl(struct e1000g *Adapter,
1112     queue_t *wq, mblk_t *mp, struct iocblk *iocp);
1113 void e1000g_nd_cleanup(struct e1000g *Adapter);
1114 int e1000g_nd_init(struct e1000g *Adapter);
1115 
1116 void e1000g_DisableInterrupt(struct e1000g *Adapter);
1117 void e1000g_EnableInterrupt(struct e1000g *Adapter);
1118 void e1000g_DisableAllInterrupts(struct e1000g *Adapter);
1119 void e1000g_DisableTxInterrupt(struct e1000g *Adapter);
1120 void e1000g_EnableTxInterrupt(struct e1000g *Adapter);
1121 void phy_spd_state(struct e1000_hw *hw, boolean_t enable);
1122 void e1000_enable_pciex_master(struct e1000_hw *hw);
1123 
1124 /*
1125  * Global variables
1126  */
1127 extern boolean_t e1000g_force_detach;
1128 extern uint32_t e1000g_mblks_pending;
1129 extern krwlock_t e1000g_rx_detach_lock;
1130 
1131 
1132 #ifdef __cplusplus
1133 }
1134 #endif
1135 
1136 #endif	/* _E1000G_SW_H */
1137