xref: /onnv-gate/usr/src/uts/common/io/chxge/com/ch_compat.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 (C) 2003-2005 Chelsio Communications.  All rights reserved.
24*3833Sxw161283  */
25*3833Sxw161283 
26*3833Sxw161283 #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* ch_compat.h */
27*3833Sxw161283 
28*3833Sxw161283 #ifndef CHELSIO_T1_COMPAT_H
29*3833Sxw161283 #define	CHELSIO_T1_COMPAT_H
30*3833Sxw161283 
31*3833Sxw161283 #ifndef ETH_ALEN
32*3833Sxw161283 #define	ETH_ALEN 6
33*3833Sxw161283 #endif
34*3833Sxw161283 
35*3833Sxw161283 /* MAC and PHY link speeds */
36*3833Sxw161283 enum { SPEED_10, SPEED_100, SPEED_1000, SPEED_10000 };
37*3833Sxw161283 
38*3833Sxw161283 /* MAC and PHY link duplex */
39*3833Sxw161283 enum { DUPLEX_HALF, DUPLEX_FULL };
40*3833Sxw161283 
41*3833Sxw161283 /* Autonegotiation settings */
42*3833Sxw161283 enum { AUTONEG_DISABLE, AUTONEG_ENABLE };
43*3833Sxw161283 
44*3833Sxw161283 #ifndef MII_BMCR
45*3833Sxw161283 
46*3833Sxw161283 /* Generic MII registers and register fields. */
47*3833Sxw161283 #define	MII_BMCR	0x00	/* Basic mode control register	*/
48*3833Sxw161283 #define	MII_BMSR	0x01	/* Basic mode status register	*/
49*3833Sxw161283 #define	MII_PHYSID1	0x02	/* PHYS ID 1			*/
50*3833Sxw161283 #define	MII_PHYSID2	0x03	/* PHYS ID 2			*/
51*3833Sxw161283 #define	MII_ADVERTISE	0x04	/* Advertisement control reg	*/
52*3833Sxw161283 #define	MII_LPA		0x05	/* Link partner ability reg	*/
53*3833Sxw161283 
54*3833Sxw161283 /* Basic mode control register. */
55*3833Sxw161283 #define	BMCR_RESV	0x007f	/* Unused...			*/
56*3833Sxw161283 #define	BMCR_CTST	0x0080	/* Collision test		*/
57*3833Sxw161283 #define	BMCR_FULLDPLX	0x0100	/* Full duplex			*/
58*3833Sxw161283 #define	BMCR_ANRESTART	0x0200	/* Auto negotiation restart	*/
59*3833Sxw161283 #define	BMCR_ISOLATE	0x0400	/* Disconnect DP83840 from MII	*/
60*3833Sxw161283 #define	BMCR_PDOWN	0x0800	/* Powerdown the DP83840	*/
61*3833Sxw161283 #define	BMCR_ANENABLE	0x1000	/* Enable auto negotiation	*/
62*3833Sxw161283 #define	BMCR_SPEED100	0x2000	/* Select 100Mbps		*/
63*3833Sxw161283 #define	BMCR_LOOPBACK	0x4000	/* TXD loopback bits		*/
64*3833Sxw161283 #define	BMCR_RESET	0x8000	/* Reset the DP83840		*/
65*3833Sxw161283 
66*3833Sxw161283 /* Basic mode status register. */
67*3833Sxw161283 #define	BMSR_ERCAP		0x0001	/* Ext-reg capability		*/
68*3833Sxw161283 #define	BMSR_JCD		0x0002	/* Jabber detected		*/
69*3833Sxw161283 #define	BMSR_LSTATUS		0x0004	/* Link status			*/
70*3833Sxw161283 #define	BMSR_ANEGCAPABLE	0x0008	/* Able to do auto-negotiation	*/
71*3833Sxw161283 #define	BMSR_RFAULT		0x0010	/* Remote fault detected	*/
72*3833Sxw161283 #define	BMSR_ANEGCOMPLETE	0x0020	/* Auto-negotiation complete	*/
73*3833Sxw161283 #define	BMSR_RESV		0x07c0	/* Unused...			*/
74*3833Sxw161283 #define	BMSR_10HALF		0x0800	/* Can do 10mbps, half-duplex	*/
75*3833Sxw161283 #define	BMSR_10FULL		0x1000	/* Can do 10mbps, full-duplex	*/
76*3833Sxw161283 #define	BMSR_100HALF		0x2000	/* Can do 100mbps, half-duplex	*/
77*3833Sxw161283 #define	BMSR_100FULL		0x4000	/* Can do 100mbps, full-duplex	*/
78*3833Sxw161283 #define	BMSR_100BASE4		0x8000	/* Can do 100mbps, 4k packets	*/
79*3833Sxw161283 
80*3833Sxw161283 /* Advertisement control register. */
81*3833Sxw161283 #define	ADVERTISE_SLCT		0x001f	/* Selector bits		*/
82*3833Sxw161283 #define	ADVERTISE_CSMA		0x0001	/* Only selector supported	*/
83*3833Sxw161283 #define	ADVERTISE_10HALF	0x0020	/* Try for 10mbps half-duplex	*/
84*3833Sxw161283 #define	ADVERTISE_10FULL	0x0040	/* Try for 10mbps full-duplex	*/
85*3833Sxw161283 #define	ADVERTISE_100HALF	0x0080	/* Try for 100mbps half-duplex	*/
86*3833Sxw161283 #define	ADVERTISE_100FULL	0x0100	/* Try for 100mbps full-duplex	*/
87*3833Sxw161283 #define	ADVERTISE_100BASE4	0x0200	/* Try for 100mbps 4k packets	*/
88*3833Sxw161283 #define	ADVERTISE_RESV		0x1c00	/* Unused...			*/
89*3833Sxw161283 #define	ADVERTISE_RFAULT	0x2000	/* Say we can detect faults	*/
90*3833Sxw161283 #define	ADVERTISE_LPACK		0x4000	/* Ack link partners response	*/
91*3833Sxw161283 #define	ADVERTISE_NPAGE		0x8000	/* Next page bit		*/
92*3833Sxw161283 #endif
93*3833Sxw161283 
94*3833Sxw161283 /* MAC and PHY supported features */
95*3833Sxw161283 #define	SUPPORTED_10baseT_Half		(1 << 0)
96*3833Sxw161283 #define	SUPPORTED_10baseT_Full		(1 << 1)
97*3833Sxw161283 #define	SUPPORTED_100baseT_Half		(1 << 2)
98*3833Sxw161283 #define	SUPPORTED_100baseT_Full		(1 << 3)
99*3833Sxw161283 #define	SUPPORTED_1000baseT_Half	(1 << 4)
100*3833Sxw161283 #define	SUPPORTED_1000baseT_Full	(1 << 5)
101*3833Sxw161283 #define	SUPPORTED_10000baseT_Full	(1 << 6)
102*3833Sxw161283 #define	SUPPORTED_Autoneg		(1 << 7)
103*3833Sxw161283 #define	SUPPORTED_TP			(1 << 8)
104*3833Sxw161283 #define	SUPPORTED_FIBRE			(1 << 9)
105*3833Sxw161283 #define	SUPPORTED_PAUSE			(1 << 10)
106*3833Sxw161283 #define	SUPPORTED_LOOPBACK		(1 << 11)
107*3833Sxw161283 
108*3833Sxw161283 /* Features advertised by PHY */
109*3833Sxw161283 #define	ADVERTISED_10baseT_Half		(1 << 0)
110*3833Sxw161283 #define	ADVERTISED_10baseT_Full		(1 << 1)
111*3833Sxw161283 #define	ADVERTISED_100baseT_Half	(1 << 2)
112*3833Sxw161283 #define	ADVERTISED_100baseT_Full	(1 << 3)
113*3833Sxw161283 #define	ADVERTISED_1000baseT_Half	(1 << 4)
114*3833Sxw161283 #define	ADVERTISED_1000baseT_Full	(1 << 5)
115*3833Sxw161283 #define	ADVERTISED_10000baseT_Full	(1 << 6)
116*3833Sxw161283 #define	ADVERTISED_Autoneg		(1 << 7)
117*3833Sxw161283 #define	ADVERTISED_PAUSE		(1 << 10)
118*3833Sxw161283 #define	ADVERTISED_ASYM_PAUSE		(1 << 12)
119*3833Sxw161283 
120*3833Sxw161283 /* diagnostic message categories */
121*3833Sxw161283 enum { LINK = 1, INTR = 2, HW = 4 };
122*3833Sxw161283 
123*3833Sxw161283 /* diagnostic message levels */
124*3833Sxw161283 /* enum { INFO, DEBUG }; */
125*3833Sxw161283 
126*3833Sxw161283 #ifndef __devinit
127*3833Sxw161283 #define	__devinit
128*3833Sxw161283 #endif
129*3833Sxw161283 
130*3833Sxw161283 #ifndef CH_DEVICE
131*3833Sxw161283 struct pci_device_id {
132*3833Sxw161283 	unsigned short devid;
133*3833Sxw161283 	unsigned short ssid;
134*3833Sxw161283 	unsigned short board_info_index;
135*3833Sxw161283 };
136*3833Sxw161283 
137*3833Sxw161283 #define	CH_DEVICE_COMMON(devid, ssid, idx) { devid, ssid, idx }
138*3833Sxw161283 #define	CH_DEVICE(devid, ssid, idx) CH_DEVICE_COMMON(devid, ssid, idx)
139*3833Sxw161283 #endif
140*3833Sxw161283 
141*3833Sxw161283 #endif
142