xref: /netbsd-src/sys/dev/marvell/gtethreg.h (revision fead0fdcafb49f628dcdf77c808146f59721036b)
1*fead0fdcSmsaitoh /*	$NetBSD: gtethreg.h,v 1.6 2021/11/10 17:19:30 msaitoh Exp $	*/
2ff2281b4Smatt 
3ff2281b4Smatt /*
4ff2281b4Smatt  * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc.
5ff2281b4Smatt  * All rights reserved.
6ff2281b4Smatt  *
7ff2281b4Smatt  * Redistribution and use in source and binary forms, with or without
8ff2281b4Smatt  * modification, are permitted provided that the following conditions
9ff2281b4Smatt  * are met:
10ff2281b4Smatt  * 1. Redistributions of source code must retain the above copyright
11ff2281b4Smatt  *    notice, this list of conditions and the following disclaimer.
12ff2281b4Smatt  * 2. Redistributions in binary form must reproduce the above copyright
13ff2281b4Smatt  *    notice, this list of conditions and the following disclaimer in the
14ff2281b4Smatt  *    documentation and/or other materials provided with the distribution.
15ff2281b4Smatt  * 3. All advertising materials mentioning features or use of this software
16ff2281b4Smatt  *    must display the following acknowledgement:
17ff2281b4Smatt  *      This product includes software developed for the NetBSD Project by
18ff2281b4Smatt  *      Allegro Networks, Inc., and Wasabi Systems, Inc.
19ff2281b4Smatt  * 4. The name of Allegro Networks, Inc. may not be used to endorse
20ff2281b4Smatt  *    or promote products derived from this software without specific prior
21ff2281b4Smatt  *    written permission.
22ff2281b4Smatt  * 5. The name of Wasabi Systems, Inc. may not be used to endorse
23ff2281b4Smatt  *    or promote products derived from this software without specific prior
24ff2281b4Smatt  *    written permission.
25ff2281b4Smatt  *
26ff2281b4Smatt  * THIS SOFTWARE IS PROVIDED BY ALLEGRO NETWORKS, INC. AND
27ff2281b4Smatt  * WASABI SYSTEMS, INC. ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
28ff2281b4Smatt  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
29ff2281b4Smatt  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
30ff2281b4Smatt  * IN NO EVENT SHALL EITHER ALLEGRO NETWORKS, INC. OR WASABI SYSTEMS, INC.
31ff2281b4Smatt  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32ff2281b4Smatt  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33ff2281b4Smatt  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34ff2281b4Smatt  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35ff2281b4Smatt  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36ff2281b4Smatt  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37ff2281b4Smatt  * POSSIBILITY OF SUCH DAMAGE.
38ff2281b4Smatt  */
39ff2281b4Smatt 
40ff2281b4Smatt #ifndef _DEV_GTETHREG_H_
41ff2281b4Smatt #define	_DEV_GTETHREG_H_
42ff2281b4Smatt 
43ff2281b4Smatt #define ETH__BIT(bit)			(1U << (bit))
44ff2281b4Smatt #define ETH__LLBIT(bit)			(1LLU << (bit))
45ff2281b4Smatt #define ETH__MASK(bit)			(ETH__BIT(bit) - 1)
46ff2281b4Smatt #define ETH__LLMASK(bit)		(ETH__LLBIT(bit) - 1)
47ff2281b4Smatt #define	ETH__EXT(data, bit, len)	(((data) >> (bit)) & ETH__MASK(len))
48ff2281b4Smatt #define	ETH__LLEXT(data, bit, len)	(((data) >> (bit)) & ETH__LLMASK(len))
49ff2281b4Smatt #define	ETH__CLR(data, bit, len)	((data) &= ~(ETH__MASK(len) << (bit)))
50ff2281b4Smatt #define	ETH__INS(new, bit)		((new) << (bit))
51ff2281b4Smatt #define	ETH__LLINS(new, bit)		((uint64_t)(new) << (bit))
52ff2281b4Smatt 
53ff2281b4Smatt /*
54ff2281b4Smatt  * Descriptors used for both receive & transmit data.  Note that the descriptor
55ff2281b4Smatt  * must start on a 4LW boundary.  Since the GT accesses the descriptor as
56ff2281b4Smatt  * two 64-bit quantities, we must present them 32bit quantities in the right
57*fead0fdcSmsaitoh  * order based on endianness.
58ff2281b4Smatt  */
59ff2281b4Smatt 
60ff2281b4Smatt struct gt_eth_desc {
61ff2281b4Smatt #if defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN
62ff2281b4Smatt 	u_int32_t ed_lencnt;	/* length is hi 16 bits; count (rx) is lo 16 */
63ff2281b4Smatt 	u_int32_t ed_cmdsts;	/* command (hi16)/status (lo16) bits */
64ff2281b4Smatt 	u_int32_t ed_nxtptr;	/* next descriptor (must be 4LW aligned) */
65ff2281b4Smatt 	u_int32_t ed_bufptr;	/* pointer to packet buffer */
66ff2281b4Smatt #endif
67ff2281b4Smatt #if defined(BYTE_ORDER) && BYTE_ORDER == LITTLE_ENDIAN
68ff2281b4Smatt 	u_int32_t ed_cmdsts;	/* command (hi16)/status (lo16) bits */
69ff2281b4Smatt 	u_int32_t ed_lencnt;	/* length is hi 16 bits; count (rx) is lo 16 */
70ff2281b4Smatt 	u_int32_t ed_bufptr;	/* pointer to packet buffer */
71ff2281b4Smatt 	u_int32_t ed_nxtptr;	/* next descriptor (must be 4LW aligned) */
72ff2281b4Smatt #endif
73ff2281b4Smatt };
74ff2281b4Smatt 
75ff2281b4Smatt /* Table 578: Ethernet TX Descriptor - Command/Status word
76ff2281b4Smatt  * All bits except F, EI, AM, O are only valid if TX_CMD_L is also set,
77ff2281b4Smatt  * otherwise should be 0 (tx).
78ff2281b4Smatt  */
79ff2281b4Smatt #define	TX_STS_LC	ETH__BIT(5)	/* Late Collision */
80ff2281b4Smatt #define	TX_STS_UR	ETH__BIT(6)	/* Underrun error */
81ff2281b4Smatt #define	TX_STS_RL	ETH__BIT(8)	/* Retransmit Limit (excession coll) */
82ff2281b4Smatt #define	TX_STS_COL	ETH__BIT(9)	/* Collision Occurred */
83ff2281b4Smatt #define	TX_STS_RC(v)	ETH__GETBITS(v, 10, 4)	/* Retransmit Count */
84ff2281b4Smatt #define	TX_STS_ES	ETH__BIT(15)	/* Error Summary (LC|UR|RL) */
85ff2281b4Smatt #define	TX_CMD_L	ETH__BIT(16)	/* Last - End Of Packet */
86ff2281b4Smatt #define	TX_CMD_F	ETH__BIT(17)	/* First - Start Of Packet */
87ff2281b4Smatt #define	TX_CMD_P	ETH__BIT(18)	/* Pad Packet */
88ff2281b4Smatt #define	TX_CMD_GC	ETH__BIT(22)	/* Generate CRC */
89ff2281b4Smatt #define	TX_CMD_EI	ETH__BIT(23)	/* Enable Interrupt */
90ff2281b4Smatt #define	TX_CMD_AM	ETH__BIT(30)	/* Auto Mode */
91ff2281b4Smatt #define	TX_CMD_O	ETH__BIT(31)	/* Ownership (1=GT 0=CPU) */
92ff2281b4Smatt 
93ff2281b4Smatt #define	TX_CMD_FIRST	(TX_CMD_F|TX_CMD_O)
94ff2281b4Smatt #define	TX_CMD_LAST	(TX_CMD_L|TX_CMD_GC|TX_CMD_P|TX_CMD_O)
95ff2281b4Smatt 
96ff2281b4Smatt /* Table 582: Ethernet RX Descriptor - Command/Status Word
97ff2281b4Smatt  * All bits except F, EI, AM, O are only valid if RX_CMD_L is also set,
98ff2281b4Smatt  * otherwise should be ignored (rx).
99ff2281b4Smatt  */
100ff2281b4Smatt #define	RX_STS_CE	ETH__BIT(0)	/* CRC Error */
101ff2281b4Smatt #define	RX_STS_COL	ETH__BIT(1)	/* Collision sensed during reception */
102ff2281b4Smatt #define	RX_STS_LC	ETH__BIT(5)	/* Late Collision (Reserved) */
103ff2281b4Smatt #define	RX_STS_OR	ETH__BIT(6)	/* Overrun Error */
104ff2281b4Smatt #define	RX_STS_MFL	ETH__BIT(7)	/* Max Frame Len Error */
105ff2281b4Smatt #define	RX_STS_SF	ETH__BIT(8)	/* Short Frame Error (< 64 bytes) */
106ff2281b4Smatt #define	RX_STS_FT	ETH__BIT(11)	/* Frame Type (1 = 802.3) */
107ff2281b4Smatt #define	RX_STS_M	ETH__BIT(12)	/* Missed Frame */
108ff2281b4Smatt #define	RX_STS_HE	ETH__BIT(13)	/* Hash Expired (manual match) */
109ff2281b4Smatt #define	RX_STS_IGMP	ETH__BIT(14)	/* IGMP Packet */
110ff2281b4Smatt #define	RX_STS_ES	ETH__BIT(15)	/* Error Summary (CE|COL|LC|OR|MFL|SF) */
111ff2281b4Smatt #define	RX_CMD_L	ETH__BIT(16)	/* Last - End Of Packet */
112ff2281b4Smatt #define	RX_CMD_F	ETH__BIT(17)	/* First - Start Of Packet */
113ff2281b4Smatt #define	RX_CMD_EI	ETH__BIT(23)	/* Enable Interrupt */
114ff2281b4Smatt #define	RX_CMD_AM	ETH__BIT(30)	/* Auto Mode */
115ff2281b4Smatt #define	RX_CMD_O	ETH__BIT(31)	/* Ownership (1=GT 0=CPU) */
116ff2281b4Smatt 
117ff2281b4Smatt /* Table 586: Hash Table Entry Fields
118ff2281b4Smatt  */
119ff2281b4Smatt #define HSH_V		ETH__LLBIT(0)	/* Entry is valid */
120ff2281b4Smatt #define HSH_S		ETH__LLBIT(1)	/* Skip this entry */
121ff2281b4Smatt #define HSH_RD		ETH__LLBIT(2)	/* Receive(1) / Discard (0) */
122ff2281b4Smatt #define HSH_R		ETH__LLBIT(2)	/* Receive(1) */
123ff2281b4Smatt #define	HSH_PRIO_GET(v)	ETH__LLEXT(v, 51, 2)
124ff2281b4Smatt #define	HSH_PRIO_INS(v)	ETH__LLINS(v, 51)
125ff2281b4Smatt #define	HSH_ADDR_MASK	0x7fffff8LLU
126ff2281b4Smatt #define	HSH_LIMIT	12
127ff2281b4Smatt 
128ff2281b4Smatt 
129a748aedcSkiyohara #define	ETHC_SIZE	0x4000		/* Register Space */
130a748aedcSkiyohara 
131ff2281b4Smatt #define	ETH_EPAR	0x2000		/* PHY Address Register */
132ff2281b4Smatt #define	ETH_ESMIR	0x2010		/* SMI Register */
133ff2281b4Smatt 
134a748aedcSkiyohara #define	ETH_BASE(u)	(ETH0_BASE + ((u) << 10)) /* Ethernet Register Base */
135a748aedcSkiyohara #define	ETH_NUM		3
136f2703325Smatt #define	ETH_SIZE	0x0400			  /* Register Space */
137ff2281b4Smatt 
138a748aedcSkiyohara #define	ETH_EBASE	0x0000		/* Base of Registers */
139a748aedcSkiyohara #define	ETH_EPCR	0x0000		/* Port Config. Register */
140a748aedcSkiyohara #define	ETH_EPCXR	0x0008		/* Port Config. Extend Reg */
141a748aedcSkiyohara #define	ETH_EPCMR	0x0010		/* Port Command Register */
142a748aedcSkiyohara #define	ETH_EPSR	0x0018		/* Port Status Register */
143a748aedcSkiyohara #define	ETH_ESPR	0x0020		/* Port Serial Parameters Reg */
144a748aedcSkiyohara #define	ETH_EHTPR	0x0028		/* Port Hash Table Pointer Reg*/
145a748aedcSkiyohara #define	ETH_EFCSAL	0x0030		/* Flow Control Src Addr Low */
146a748aedcSkiyohara #define	ETH_EFCSAH	0x0038		/* Flow Control Src Addr High */
147a748aedcSkiyohara #define	ETH_ESDCR	0x0040		/* SDMA Configuration Reg */
148a748aedcSkiyohara #define	ETH_ESDCMR	0x0048		/* SDMA Command Register */
149a748aedcSkiyohara #define	ETH_EICR	0x0050		/* Interrupt Cause Register */
150a748aedcSkiyohara #define	ETH_EIMR	0x0058		/* Interrupt Mask Register */
151a748aedcSkiyohara #define	ETH_EFRDP0	0x0080		/* First Rx Desc Pointer 0 */
152a748aedcSkiyohara #define	ETH_EFRDP1	0x0084		/* First Rx Desc Pointer 1 */
153a748aedcSkiyohara #define	ETH_EFRDP2	0x0088		/* First Rx Desc Pointer 2 */
154a748aedcSkiyohara #define	ETH_EFRDP3	0x008c		/* First Rx Desc Pointer 3 */
155a748aedcSkiyohara #define	ETH_ECRDP0	0x00a0		/* Current Rx Desc Pointer 0 */
156a748aedcSkiyohara #define	ETH_ECRDP1	0x00a4		/* Current Rx Desc Pointer 1 */
157a748aedcSkiyohara #define	ETH_ECRDP2	0x00a8		/* Current Rx Desc Pointer 2 */
158a748aedcSkiyohara #define	ETH_ECRDP3	0x00ac		/* Current Rx Desc Pointer 3 */
159a748aedcSkiyohara #define	ETH_ECTDP0	0x00e0		/* Current Tx Desc Pointer 0 */
160a748aedcSkiyohara #define	ETH_ECTDP1	0x00e4		/* Current Tx Desc Pointer 1 */
161a748aedcSkiyohara #define	ETH_EDSCP2P0L	0x0060		/* IP Differentiated Services
162ff2281b4Smatt 					   CodePoint to Priority0 low */
163a748aedcSkiyohara #define	ETH_EDSCP2P0H	0x0064		/* IP Differentiated Services
164ff2281b4Smatt 					   CodePoint to Priority0 high*/
165a748aedcSkiyohara #define	ETH_EDSCP2P1L	0x0068		/* IP Differentiated Services
166ff2281b4Smatt 					   CodePoint to Priority1 low */
167a748aedcSkiyohara #define	ETH_EDSCP2P1H	0x006c		/* IP Differentiated Services
168ff2281b4Smatt 					   CodePoint to Priority1 high*/
169a748aedcSkiyohara #define	ETH_EVPT2P	0x0068		/* VLAN Prio. Tag to Priority */
170a748aedcSkiyohara #define	ETH_EMIBCTRS	0x0100		/* MIB Counters */
171f2703325Smatt 
172ff2281b4Smatt 
173ff2281b4Smatt #define	ETH_EPAR_PhyAD_GET(v, n)	(((v) >> ((n) * 5)) & 0x1f)
174ff2281b4Smatt 
175ff2281b4Smatt #define ETH_ESMIR_READ(phy, reg)	(ETH__INS(phy, 16)|\
176ff2281b4Smatt 					 ETH__INS(reg, 21)|\
177ff2281b4Smatt 					 ETH_ESMIR_ReadOpcode)
178ff2281b4Smatt #define ETH_ESMIR_WRITE(phy, reg, val)	(ETH__INS(phy, 16)|\
179ff2281b4Smatt 					 ETH__INS(reg, 21)|\
180ff2281b4Smatt 					 ETH__INS(val,  0)|\
181ff2281b4Smatt 					 ETH_ESMIR_WriteOpcode)
182ff2281b4Smatt #define ETH_ESMIR_Value_GET(v)		ETH__EXT(v, 0, 16)
183ff2281b4Smatt #define	ETH_ESMIR_WriteOpcode		0
184ff2281b4Smatt #define	ETH_ESMIR_ReadOpcode		ETH__BIT(26)
185ff2281b4Smatt #define	ETH_ESMIR_ReadValid		ETH__BIT(27)
186ff2281b4Smatt #define	ETH_ESMIR_Busy			ETH__BIT(28)
187ff2281b4Smatt 
188ff2281b4Smatt /*
189ff2281b4Smatt  * Table 597: Port Configuration Register (PCR)
190ff2281b4Smatt  * 00:00 PM			Promiscuous mode
191ff2281b4Smatt  *				0: Normal mode (Frames are only received if the
192ff2281b4Smatt  *				   destination address is found in the hash
193ff2281b4Smatt  *				   table)
194ff2281b4Smatt  *				1: Promiscuous mode (Frames are received
195ff2281b4Smatt  *				   regardless of their destination address.
196ff2281b4Smatt  *				   Errored frames are discarded unless the Port
197ff2281b4Smatt  *				   Configuration register's PBF bit is set)
198ff2281b4Smatt  * 01:01 RBM			Reject Broadcast Mode
199ff2281b4Smatt  *				0: Receive broadcast address
200ff2281b4Smatt  *				1: Reject frames with broadcast address
201ff2281b4Smatt  *				Overridden by the promiscuous mode.
202ff2281b4Smatt  * 02:02 PBF			Pass Bad Frames
203ff2281b4Smatt  *				(0: Normal mode, 1: Pass bad Frames)
204ff2281b4Smatt  *				The Ethernet receiver passes to the CPU errored
205ff2281b4Smatt  *				frames (like fragments and collided packets)
206ff2281b4Smatt  *				that are normally rejected.
207ff2281b4Smatt  *				NOTE: Frames are only passed if they
208ff2281b4Smatt  *				      successfully pass address filtering.
209ff2281b4Smatt  * 06:03 Reserved
210ff2281b4Smatt  * 07:07 EN			Enable (0: Disabled, 1: Enable)
211ff2281b4Smatt  *				When enabled, the ethernet port is ready to
212ff2281b4Smatt  *				transmit/receive.
213ff2281b4Smatt  * 09:08 LPBK			Loop Back Mode
214ff2281b4Smatt  *				00: Normal mode
215ff2281b4Smatt  *				01: Internal loop back mode (TX data is looped
216ff2281b4Smatt  *				    back to the RX lines. No transition is seen
217ff2281b4Smatt  *				    on the interface pins)
218ff2281b4Smatt  *				10: External loop back mode (TX data is looped
219ff2281b4Smatt  *				    back to the RX lines and also transmitted
220ff2281b4Smatt  *				    out to the MII interface pins)
221ff2281b4Smatt  *				11: Reserved
222ff2281b4Smatt  * 10:10 FC			Force Collision
223ff2281b4Smatt  *				0: Normal mode.
224ff2281b4Smatt  *				1: Force Collision on any TX frame.
225ff2281b4Smatt  *				   For RXM test (in Loopback mode).
226ff2281b4Smatt  * 11:11 Reserved.
227ff2281b4Smatt  * 12:12 HS			Hash Size
228ff2281b4Smatt  *				0: 8K address filtering
229ff2281b4Smatt  *				   (256KB of memory space required).
230ff2281b4Smatt  *				1: 512 address filtering
231ff2281b4Smatt  *				   ( 16KB of memory space required).
232ff2281b4Smatt  * 13:13 HM			Hash Mode (0: Hash Func. 0; 1: Hash Func. 1)
233ff2281b4Smatt  * 14:14 HDM			Hash Default Mode
234ff2281b4Smatt  *				0: Discard addresses not found in address table
235ff2281b4Smatt  *				1: Pass addresses not found in address table
236ff2281b4Smatt  * 15:15 HD			Duplex Mode (0: Half Duplex, 1: Full Duplex)
237ff2281b4Smatt  *				NOTE: Valid only when auto-negotiation for
238ff2281b4Smatt  *				      duplex mode is disabled.
239ff2281b4Smatt  * 30:16 Reserved
240ff2281b4Smatt  * 31:31 ACCS			Accelerate Slot Time
241ff2281b4Smatt  *				(0: Normal mode, 1: Reserved)
242ff2281b4Smatt  */
243ff2281b4Smatt #define	ETH_EPCR_PM		ETH__BIT(0)
244ff2281b4Smatt #define	ETH_EPCR_RBM		ETH__BIT(1)
245ff2281b4Smatt #define	ETH_EPCR_PBF		ETH__BIT(2)
246ff2281b4Smatt #define	ETH_EPCR_EN		ETH__BIT(7)
247ff2281b4Smatt #define	ETH_EPCR_LPBK_GET(v)	ETH__BIT(v, 8, 2)
248ff2281b4Smatt #define	ETH_EPCR_LPBK_Normal	0
249ff2281b4Smatt #define	ETH_EPCR_LPBK_Internal	1
250ff2281b4Smatt #define	ETH_EPCR_LPBK_External	2
251ff2281b4Smatt #define	ETH_EPCR_FC		ETH__BIT(10)
252ff2281b4Smatt 
253ff2281b4Smatt #define	ETH_EPCR_HS		ETH__BIT(12)
254ff2281b4Smatt #define	ETH_EPCR_HS_8K		0
255ff2281b4Smatt #define	ETH_EPCR_HS_512		ETH_EPCR_HS
256ff2281b4Smatt 
257ff2281b4Smatt #define	ETH_EPCR_HM		ETH__BIT(13)
258ff2281b4Smatt #define	ETH_EPCR_HM_0		0
259ff2281b4Smatt #define	ETH_EPCR_HM_1		ETH_EPCR_HM
260ff2281b4Smatt 
261ff2281b4Smatt #define	ETH_EPCR_HDM		ETH__BIT(14)
262ff2281b4Smatt #define	ETH_EPCR_HDM_Discard	0
263ff2281b4Smatt #define	ETH_EPCR_HDM_Pass	ETH_EPCR_HDM
264ff2281b4Smatt 
265ff2281b4Smatt #define	ETH_EPCR_HD_Half	0
266ff2281b4Smatt #define	ETH_EPCR_HD_Full	ETH_EPCR_HD_Full
267ff2281b4Smatt 
268ff2281b4Smatt #define	ETH_EPCR_ACCS		ETH__BIT(31)
269ff2281b4Smatt 
270ff2281b4Smatt 
271ff2281b4Smatt 
272ff2281b4Smatt /*
273ff2281b4Smatt  * Table 598: Port Configuration Extend Register (PCXR)
274ff2281b4Smatt  * 00:00 IGMP			IGMP Packets Capture Enable
275ff2281b4Smatt  *				0: IGMP packets are treated as normal Multicast
276ff2281b4Smatt  *				   packets.
277ff2281b4Smatt  *				1: IGMP packets on IPv4/Ipv6 over Ethernet/802.3
278ff2281b4Smatt  *				   are trapped and sent to high priority RX
279ff2281b4Smatt  *				   queue.
280ff2281b4Smatt  * 01:01 SPAN			Spanning Tree Packets Capture Enable
281ff2281b4Smatt  *				0: BPDU (Bridge Protocol Data Unit) packets are
282ff2281b4Smatt  *				   treated as normal Multicast packets.
283ff2281b4Smatt  *				1: BPDU packets are trapped and sent to high
284ff2281b4Smatt  *				   priority RX queue.
285ff2281b4Smatt  * 02:02 PAR			Partition Enable (0: Normal, 1: Partition)
286ff2281b4Smatt  *				When more than 61 collisions occur while
287ff2281b4Smatt  *				transmitting, the port enters Partition mode.
288ff2281b4Smatt  *				It waits for the first good packet from the
289ff2281b4Smatt  *				wire and then goes back to Normal mode.  Under
290ff2281b4Smatt  *				Partition mode it continues transmitting, but
291ff2281b4Smatt  *				it does not receive.
292ff2281b4Smatt  * 05:03 PRIOtx			Priority weight in the round-robin between high
293ff2281b4Smatt  *				and low priority TX queues.
294ff2281b4Smatt  *				000: 1 pkt from HIGH, 1 pkt from LOW.
295ff2281b4Smatt  *				001: 2 pkt from HIGH, 1 pkt from LOW.
296ff2281b4Smatt  *				010: 4 pkt from HIGH, 1 pkt from LOW.
297ff2281b4Smatt  *				011: 6 pkt from HIGH, 1 pkt from LOW.
298ff2281b4Smatt  *				100: 8 pkt from HIGH, 1 pkt from LOW.
299ff2281b4Smatt  *				101: 10 pkt from HIGH, 1 pkt from LOW.
300ff2281b4Smatt  *				110: 12 pkt from HIGH, 1 pkt from LOW.
301ff2281b4Smatt  *				111: All pkt from HIGH, 0 pkt from LOW. LOW is
302ff2281b4Smatt  *				     served only if HIGH is empty.
303ff2281b4Smatt  *				NOTE: If the HIGH queue is emptied before
304ff2281b4Smatt  *				      finishing the count, the count is reset
305ff2281b4Smatt  *				      until the next first HIGH comes in.
306ff2281b4Smatt  * 07:06 PRIOrx			Default Priority for Packets Received on this
307ff2281b4Smatt  *				Port (00: Lowest priority, 11: Highest priority)
308ff2281b4Smatt  * 08:08 PRIOrx_Override	Override Priority for Packets Received on this
309ff2281b4Smatt  *				Port (0: Do not override, 1: Override with
310ff2281b4Smatt  *				<PRIOrx> field)
311ff2281b4Smatt  * 09:09 DPLXen			Enable Auto-negotiation for Duplex Mode
312ff2281b4Smatt  *				(0: Enable, 1: Disable)
313ff2281b4Smatt  * 11:10 FCTLen			Enable Auto-negotiation for 802.3x Flow-control
314ff2281b4Smatt  *				0: Enable; When enabled, 1 is written (through
315ff2281b4Smatt  *				   SMI access) to the PHY's register 4 bit 10
316ff2281b4Smatt  *				   to advertise flow-control capability.
317ff2281b4Smatt  *				1: Disable; Only enables flow control after the
318ff2281b4Smatt  *				   PHY address is set by the CPU. When changing
319ff2281b4Smatt  *				   the PHY address the flow control
320ff2281b4Smatt  *				   auto-negotiation must be disabled.
321ff2281b4Smatt  * 11:11 FLP			Force Link Pass
322ff2281b4Smatt  *				(0: Force Link Pass, 1: Do NOT Force Link pass)
323ff2281b4Smatt  * 12:12 FCTL			802.3x Flow-Control Mode (0: Enable, 1: Disable)
324ff2281b4Smatt  *				NOTE: Only valid when auto negotiation for flow
325ff2281b4Smatt  *				      control is disabled.
326ff2281b4Smatt  * 13:13 Reserved
327ff2281b4Smatt  * 15:14 MFL			Max Frame Length
328ff2281b4Smatt  *				Maximum packet allowed for reception (including
329ff2281b4Smatt  *				CRC):   00: 1518 bytes,   01: 1536 bytes,
330ff2281b4Smatt  *					10: 2048 bytes,   11:  64K bytes
331ff2281b4Smatt  * 16:16 MIBclrMode		MIB Counters Clear Mode (0: Clear, 1: No effect)
332ff2281b4Smatt  * 17:17 MIBctrMode		Reserved. (MBZ)
333ff2281b4Smatt  * 18:18 Speed			Port Speed (0: 10Mbit/Sec, 1: 100Mbit/Sec)
334ff2281b4Smatt  *				NOTE: Only valid if SpeedEn bit is set.
335ff2281b4Smatt  * 19:19 SpeedEn		Enable Auto-negotiation for Speed
336ff2281b4Smatt  *				(0: Enable, 1: Disable)
337ff2281b4Smatt  * 20:20 RMIIen			RMII enable
338ff2281b4Smatt  *				0: Port functions as MII port
339ff2281b4Smatt  *				1: Port functions as RMII port
340ff2281b4Smatt  * 21:21 DSCPen			DSCP enable
341ff2281b4Smatt  *				0: IP DSCP field decoding is disabled.
342ff2281b4Smatt  *				1: IP DSCP field decoding is enabled.
343ff2281b4Smatt  * 31:22 Reserved
344ff2281b4Smatt  */
345ff2281b4Smatt #define	ETH_EPCXR_IGMP			ETH__BIT(0)
346ff2281b4Smatt #define	ETH_EPCXR_SPAN			ETH__BIT(1)
347ff2281b4Smatt #define	ETH_EPCXR_PAR			ETH__BIT(2)
348ff2281b4Smatt #define	ETH_EPCXR_PRIOtx_GET(v)		ETH__EXT(v, 3, 3)
349ff2281b4Smatt #define	ETH_EPCXR_PRIOrx_GET(v)		ETH__EXT(v, 3, 3)
350ff2281b4Smatt #define	ETH_EPCXR_PRIOrx_Override	ETH__BIT(8)
351ff2281b4Smatt #define	ETH_EPCXR_DLPXen		ETH__BIT(9)
352ff2281b4Smatt #define	ETH_EPCXR_FCTLen		ETH__BIT(10)
353ff2281b4Smatt #define	ETH_EPCXR_FLP			ETH__BIT(11)
354ff2281b4Smatt #define	ETH_EPCXR_FCTL			ETH__BIT(12)
355ff2281b4Smatt #define	ETH_EPCXR_MFL_GET(v)		ETH__EXT(v, 14, 2)
356a748aedcSkiyohara #define	ETH_EPCXR_MFL_SET(v)		((v) << 14)
357a748aedcSkiyohara #define	ETH_EPCXR_MFL_MASK		0x3
358ff2281b4Smatt #define	ETH_EPCXR_MFL_1518		0
359ff2281b4Smatt #define	ETH_EPCXR_MFL_1536		1
360ff2281b4Smatt #define	ETH_EPCXR_MFL_2084		2
361ff2281b4Smatt #define	ETH_EPCXR_MFL_64K		3
362ff2281b4Smatt #define	ETH_EPCXR_MIBclrMode		ETH__BIT(16)
363ff2281b4Smatt #define	ETH_EPCXR_MIBctrMode		ETH__BIT(17)
364ff2281b4Smatt #define	ETH_EPCXR_Speed			ETH__BIT(18)
365ff2281b4Smatt #define	ETH_EPCXR_SpeedEn		ETH__BIT(19)
366ff2281b4Smatt #define	ETH_EPCXR_RMIIEn		ETH__BIT(20)
367ff2281b4Smatt #define	ETH_EPCXR_DSCPEn		ETH__BIT(21)
368ff2281b4Smatt 
369ff2281b4Smatt 
370ff2281b4Smatt 
371ff2281b4Smatt /*
372ff2281b4Smatt  * Table 599: Port Command Register (PCMR)
373ff2281b4Smatt  * 14:00 Reserved
374ff2281b4Smatt  * 15:15 FJ			Force Jam / Flow Control
375ff2281b4Smatt  *				When in half-duplex mode, the CPU uses this bit
376ff2281b4Smatt  *				to force collisions on the Ethernet segment.
377ff2281b4Smatt  *				When the CPU recognizes that it is going to run
378ff2281b4Smatt  *				out of receive buffers, it can force the
379ff2281b4Smatt  *				transmitter to send jam frames, forcing
380ff2281b4Smatt  *				collisions on the wire.  To allow transmission
381ff2281b4Smatt  *				on the Ethernet segment, the CPU must clear the
382ff2281b4Smatt  *				FJ bit when more resources are available.  When
383ff2281b4Smatt  *				in full-duplex and flow-control is enabled, this
384ff2281b4Smatt  *				bit causes the port's transmitter to send
385ff2281b4Smatt  *				flow-control PAUSE packets. The CPU must reset
386ff2281b4Smatt  *				this bit when more resources are available.
387ff2281b4Smatt  * 31:16 Reserved
388ff2281b4Smatt  */
389ff2281b4Smatt 
390ff2281b4Smatt #define	ETH_EPCMR_FJ		ETH__BIT(15)
391ff2281b4Smatt 
392ff2281b4Smatt 
393ff2281b4Smatt /*
394ff2281b4Smatt  * Table 600: Port Status Register (PSR) -- Read Only
395ff2281b4Smatt  * 00:00 Speed			Indicates Port Speed (0: 10Mbs, 1: 100Mbs)
396ff2281b4Smatt  * 01:01 Duplex			Indicates Port Duplex Mode (0: Half, 1: Full)
397ff2281b4Smatt  * 02:02 Fctl			Indicates Flow-control Mode
398ff2281b4Smatt  *				(0: enabled, 1: disabled)
399ff2281b4Smatt  * 03:03 Link			Indicates Link Status (0: down, 1: up)
400ff2281b4Smatt  * 04:04 Pause			Indicates that the port is in flow-control
401ff2281b4Smatt  *				disabled state.  This bit is set when an IEEE
402ff2281b4Smatt  *				802.3x flow-control PAUSE (XOFF) packet is
403ff2281b4Smatt  *				received (assuming that flow-control is
404ff2281b4Smatt  *				enabled and the port is in full-duplex mode).
405ff2281b4Smatt  *				Reset when XON is received, or when the XOFF
406ff2281b4Smatt  *				timer has expired.
407ff2281b4Smatt  * 05:05 TxLow			Tx Low Priority Status
408ff2281b4Smatt  *				Indicates the status of the low priority
409ff2281b4Smatt  *				transmit queue: (0: Stopped, 1: Running)
410ff2281b4Smatt  * 06:06 TxHigh			Tx High Priority Status
411ff2281b4Smatt  *				Indicates the status of the high priority
412ff2281b4Smatt  *				transmit queue: (0: Stopped, 1: Running)
413ff2281b4Smatt  * 07:07 TXinProg		TX in Progress
414ff2281b4Smatt  *				Indicates that the port's transmitter is in an
415ff2281b4Smatt  *				active transmission state.
416ff2281b4Smatt  * 31:08 Reserved
417ff2281b4Smatt  */
418ff2281b4Smatt #define	ETH_EPSR_Speed		ETH__BIT(0)
419ff2281b4Smatt #define	ETH_EPSR_Duplex		ETH__BIT(1)
420ff2281b4Smatt #define	ETH_EPSR_Fctl		ETH__BIT(2)
421ff2281b4Smatt #define	ETH_EPSR_Link		ETH__BIT(3)
422ff2281b4Smatt #define	ETH_EPSR_Pause		ETH__BIT(4)
423ff2281b4Smatt #define	ETH_EPSR_TxLow		ETH__BIT(5)
424ff2281b4Smatt #define	ETH_EPSR_TxHigh		ETH__BIT(6)
425ff2281b4Smatt #define	ETH_EPSR_TXinProg	ETH__BIT(7)
426ff2281b4Smatt 
427ff2281b4Smatt 
428ff2281b4Smatt /*
429ff2281b4Smatt  * Table 601: Serial Parameters Register (SPR)
430ff2281b4Smatt  * 01:00 JAM_LENGTH		Two bits to determine the JAM Length
431ff2281b4Smatt  *				(in Backpressure) as follows:
432ff2281b4Smatt  *					00 = 12K bit-times
433ff2281b4Smatt  *					01 = 24K bit-times
434ff2281b4Smatt  *					10 = 32K bit-times
435ff2281b4Smatt  *					11 = 48K bit-times
436ff2281b4Smatt  * 06:02 JAM_IPG		Five bits to determine the JAM IPG.
437ff2281b4Smatt  *				The step is four bit-times. The value may vary
438ff2281b4Smatt  *				between 4 bit time to 124.
439ff2281b4Smatt  * 11:07 IPG_JAM_TO_DATA	Five bits to determine the IPG JAM to DATA.
440ff2281b4Smatt  *				The step is four bit-times. The value may vary
441ff2281b4Smatt  *				between 4 bit time to 124.
442ff2281b4Smatt  * 16:12 IPG_DATA		Inter-Packet Gap (IPG)
443ff2281b4Smatt  *				The step is four bit-times. The value may vary
444ff2281b4Smatt  *				between 12 bit time to 124.
445ff2281b4Smatt  *				NOTE: These bits may be changed only when the
446ff2281b4Smatt  *				      Ethernet ports is disabled.
447ff2281b4Smatt  * 21:17 Data_Blind		Data Blinder
448ff2281b4Smatt  *				The number of nibbles from the beginning of the
449ff2281b4Smatt  *				IPG, in which the IPG counter is restarted when
450ff2281b4Smatt  *				detecting a carrier activity.  Following this
451ff2281b4Smatt  *				value, the port enters the Data Blinder zone and
452ff2281b4Smatt  *				does not reset the IPG counter. This ensures
453ff2281b4Smatt  *				fair access to the medium.
454ff2281b4Smatt  *				The default is 10 hex (64 bit times - 2/3 of the
455ff2281b4Smatt  *				default IPG).  The step is 4 bit-times. Valid
456ff2281b4Smatt  *				range is 3 to 1F hex nibbles.
457ff2281b4Smatt  *				NOTE: These bits may be only changed when the
458ff2281b4Smatt  *				      Ethernet port is disabled.
459ff2281b4Smatt  * 22:22 Limit4			The number of consecutive packet collisions that
460ff2281b4Smatt  *				occur before the collision counter is reset.
461ff2281b4Smatt  *				  0: The port resets its collision counter after
462ff2281b4Smatt  *				     16 consecutive retransmit trials and
463ff2281b4Smatt  *				     restarts the Backoff algorithm.
464ff2281b4Smatt  *				  1: The port resets its collision counter and
465ff2281b4Smatt  *				     restarts the Backoff algorithm after 4
466ff2281b4Smatt  *				     consecutive transmit trials.
467ff2281b4Smatt  * 31:23 Reserved
468ff2281b4Smatt  */
469ff2281b4Smatt #define	ETH_ESPR_JAM_LENGTH_GET(v)	ETH__EXT(v, 0, 2)
470ff2281b4Smatt #define	ETH_ESPR_JAM_IPG_GET(v)		ETH__EXT(v, 2, 5)
471ff2281b4Smatt #define	ETH_ESPR_IPG_JAM_TO_DATA_GET(v)	ETH__EXT(v, 7, 5)
472ff2281b4Smatt #define	ETH_ESPR_IPG_DATA_GET(v)	ETH__EXT(v, 12, 5)
473ff2281b4Smatt #define	ETH_ESPR_Data_Bilnd_GET(v)	ETH__EXT(v, 17, 5)
474ff2281b4Smatt #define	ETH_ESPR_Limit4(v)		ETH__BIT(22)
475ff2281b4Smatt 
476ff2281b4Smatt /*
477ff2281b4Smatt  * Table 602: Hash Table Pointer Register (HTPR)
478ff2281b4Smatt  * 31:00 HTP			32-bit pointer to the address table.
479ff2281b4Smatt  *				Bits [2:0] must be set to zero.
480ff2281b4Smatt  */
481ff2281b4Smatt 
482ff2281b4Smatt /*
483ff2281b4Smatt  * Table 603: Flow Control Source Address Low (FCSAL)
484ff2281b4Smatt  * 15:0 SA[15:0]		Source Address
485ff2281b4Smatt  *				The least significant bits of the source
486ff2281b4Smatt  *				address for the port.  This address is used for
487ff2281b4Smatt  *				Flow Control.
488ff2281b4Smatt  * 31:16 Reserved
489ff2281b4Smatt  */
490ff2281b4Smatt 
491ff2281b4Smatt /*
492ff2281b4Smatt  * Table 604: Flow Control Source Address High (FCSAH)
493ff2281b4Smatt  * 31:0 SA[47:16]		Source Address
494ff2281b4Smatt  *				The most significant bits of the source address
495ff2281b4Smatt  *				for the port.  This address is used for Flow
496ff2281b4Smatt  *				Control.
497ff2281b4Smatt  */
498ff2281b4Smatt 
499ff2281b4Smatt 
500ff2281b4Smatt /*
501ff2281b4Smatt  * Table 605: SDMA Configuration Register (SDCR)
502ff2281b4Smatt  * 01:00 Reserved
503ff2281b4Smatt  * 05:02 RC			Retransmit Count
504ff2281b4Smatt  *				Sets the maximum number of retransmits per
505ff2281b4Smatt  *				packet.  After executing retransmit for RC
506ff2281b4Smatt  *				times, the TX SDMA closes the descriptor with a
507ff2281b4Smatt  *				Retransmit Limit error indication and processes
508ff2281b4Smatt  *				the next packet.  When RC is set to 0, the
509ff2281b4Smatt  *				number of retransmits is unlimited. In this
510ff2281b4Smatt  *				case, the retransmit process is only terminated
511ff2281b4Smatt  *				if CPU issues an Abort command.
512ff2281b4Smatt  * 06:06 BLMR			Big/Little Endian Receive Mode
513ff2281b4Smatt  *				The DMA supports Big or Little Endian
514ff2281b4Smatt  *				configurations on a per channel basis. The BLMR
515ff2281b4Smatt  *				bit only affects data transfer to memory.
516ff2281b4Smatt  *					0: Big Endian
517ff2281b4Smatt  *					1: Little Endian
518ff2281b4Smatt  * 07:07 BLMT			Big/Little Endian Transmit Mode
519ff2281b4Smatt  *				The DMA supports Big or Little Endian
520ff2281b4Smatt  *				configurations on a per channel basis. The BLMT
521ff2281b4Smatt  *				bit only affects data transfer from memory.
522ff2281b4Smatt  *					0: Big Endian
523ff2281b4Smatt  *					1: Little Endian
524ff2281b4Smatt  * 08:08 POVR			PCI Override
525ff2281b4Smatt  *				When set, causes the SDMA to direct all its
526ff2281b4Smatt  *				accesses in PCI_0 direction and overrides
527ff2281b4Smatt  *				normal address decoding process.
528ff2281b4Smatt  * 09:09 RIFB			Receive Interrupt on Frame Boundaries
529ff2281b4Smatt  *				When set, the SDMA Rx generates interrupts only
530ff2281b4Smatt  *				on frame boundaries (i.e. after writing the
531ff2281b4Smatt  *				frame status to the descriptor).
532ff2281b4Smatt  * 11:10 Reserved
533ff2281b4Smatt  * 13:12 BSZ			Burst Size
534ff2281b4Smatt  *				Sets the maximum burst size for SDMA
535ff2281b4Smatt  *				transactions:
536ff2281b4Smatt  *					00: Burst is limited to 1 64bit words.
537ff2281b4Smatt  *					01: Burst is limited to 2 64bit words.
538ff2281b4Smatt  *					10: Burst is limited to 4 64bit words.
539ff2281b4Smatt  *					11: Burst is limited to 8 64bit words.
540ff2281b4Smatt  * 31:14 Reserved
541ff2281b4Smatt  */
542ff2281b4Smatt #define	ETH_ESDCR_RC_GET(v)		ETH__EXT(v, 2, 4)
543ff2281b4Smatt #define	ETH_ESDCR_BLMR			ETH__BIT(6)
544ff2281b4Smatt #define	ETH_ESDCR_BLMT			ETH__BIT(7)
545ff2281b4Smatt #define	ETH_ESDCR_POVR			ETH__BIT(8)
546ff2281b4Smatt #define	ETH_ESDCR_RIFB			ETH__BIT(9)
547ff2281b4Smatt #define	ETH_ESDCR_BSZ_GET(v)		ETH__EXT(v, 12, 2)
548ff2281b4Smatt #define	ETH_ESDCR_BSZ_SET(v, n)		(ETH__CLR(v, 12, 2),\
549ff2281b4Smatt 					 (v) |= ETH__INS(n, 12))
550ff2281b4Smatt #define	ETH_ESDCR_BSZ_1			0
551ff2281b4Smatt #define	ETH_ESDCR_BSZ_2			1
552ff2281b4Smatt #define	ETH_ESDCR_BSZ_4			2
553ff2281b4Smatt #define	ETH_ESDCR_BSZ_8			3
554ff2281b4Smatt 
555ff2281b4Smatt #define	ETH_ESDCR_BSZ_Strings		{ "1 64-bit word", "2 64-bit words", \
556ff2281b4Smatt 					  "4 64-bit words", "8 64-bit words" }
557ff2281b4Smatt 
558ff2281b4Smatt /*
559ff2281b4Smatt  * Table 606: SDMA Command Register (SDCMR)
560ff2281b4Smatt  * 06:00 Reserved
561ff2281b4Smatt  * 07:07 ERD			Enable RX DMA.
562ff2281b4Smatt  *				Set to 1 by the CPU to cause the SDMA to start
563ff2281b4Smatt  *				a receive process.  Cleared when the CPU issues
564ff2281b4Smatt  *				an Abort Receive command.
565ff2281b4Smatt  * 14:08 Reserved
566ff2281b4Smatt  * 15:15 AR			Abort Receive
567ff2281b4Smatt  *				Set to 1 by the CPU to abort a receive SDMA
568ff2281b4Smatt  *				operation.  When the AR bit is set, the SDMA
569ff2281b4Smatt  *				aborts its current operation and moves to IDLE.
570ff2281b4Smatt  *				No descriptor is closed.  The AR bit is cleared
571ff2281b4Smatt  *				upon entering IDLE.  After setting the AR bit,
572ff2281b4Smatt  *				the CPU must poll the bit to verify that the
573ff2281b4Smatt  *				abort sequence is completed.
574ff2281b4Smatt  * 16:16 STDH			Stop TX High
575ff2281b4Smatt  *				Set to 1 by the CPU to stop the transmission
576ff2281b4Smatt  *				process from the high priority queue at the end
577ff2281b4Smatt  *				of the current frame. An interrupt is generated
578ff2281b4Smatt  *				when the stop command has been executed.
579ff2281b4Smatt  *				  Writing 1 to STDH resets TXDH bit.
580ff2281b4Smatt  *				  Writing 0 to this bit has no effect.
581ff2281b4Smatt  * 17:17 STDL			Stop TX Low
582ff2281b4Smatt  *				Set to 1 by the CPU to stop the transmission
583ff2281b4Smatt  *				process from the low priority queue at the end
584ff2281b4Smatt  *				of the current frame. An interrupt is generated
585ff2281b4Smatt  *				when the stop command has been executed.
586ff2281b4Smatt  *				  Writing 1 to STDL resets TXDL bit.
587ff2281b4Smatt  *				  Writing 0 to this bit has no effect.
588ff2281b4Smatt  * 22:18 Reserved
589ff2281b4Smatt  * 23:23 TXDH			Start Tx High
590ff2281b4Smatt  *				Set to 1 by the CPU to cause the SDMA to fetch
591ff2281b4Smatt  *				the first descriptor and start a transmit
592ff2281b4Smatt  *				process from the high priority Tx queue.
593ff2281b4Smatt  *				  Writing 1 to TXDH resets STDH bit.
594ff2281b4Smatt  *				  Writing 0 to this bit has no effect.
595ff2281b4Smatt  * 24:24 TXDL			Start Tx Low
596ff2281b4Smatt  *				Set to 1 by the CPU to cause the SDMA to fetch
597ff2281b4Smatt  *				the first descriptor and start a transmit
598ff2281b4Smatt  *				process from the low priority Tx queue.
599ff2281b4Smatt  *				  Writing 1 to TXDL resets STDL bit.
600ff2281b4Smatt  *				  Writing 0 to this bit has no effect.
601ff2281b4Smatt  * 30:25 Reserved
602ff2281b4Smatt  * 31:31 AT			Abort Transmit
603ff2281b4Smatt  *				Set to 1 by the CPU to abort a transmit DMA
604ff2281b4Smatt  *				operation.  When the AT bit is set, the SDMA
605ff2281b4Smatt  *				aborts its current operation and moves to IDLE.
606ff2281b4Smatt  *				No descriptor is closed.  Cleared upon entering
607ff2281b4Smatt  *				IDLE.  After setting AT bit, the CPU must poll
608ff2281b4Smatt  *				it in order to verify that the abort sequence
609ff2281b4Smatt  *				is completed.
610ff2281b4Smatt  */
611ff2281b4Smatt #define	ETH_ESDCMR_ERD			ETH__BIT(7)
612ff2281b4Smatt #define	ETH_ESDCMR_AR			ETH__BIT(15)
613ff2281b4Smatt #define	ETH_ESDCMR_STDH			ETH__BIT(16)
614ff2281b4Smatt #define	ETH_ESDCMR_STDL			ETH__BIT(17)
615ff2281b4Smatt #define	ETH_ESDCMR_TXDH			ETH__BIT(23)
616ff2281b4Smatt #define	ETH_ESDCMR_TXDL			ETH__BIT(24)
617ff2281b4Smatt #define	ETH_ESDCMR_AT			ETH__BIT(31)
618ff2281b4Smatt 
619ff2281b4Smatt /*
620ff2281b4Smatt  * Table 607: Interrupt Cause Register (ICR)
621ff2281b4Smatt  * 00:00 RxBuffer		Rx Buffer Return
622ff2281b4Smatt  *				Indicates an Rx buffer returned to CPU ownership
623ff2281b4Smatt  *				or that the port finished reception of a Rx
624ff2281b4Smatt  *				frame in either priority queues.
625ff2281b4Smatt  *				NOTE: In order to get a Rx Buffer return per
626ff2281b4Smatt  *				      priority queue, use bit 19:16. This bit is
627ff2281b4Smatt  *				      set upon closing any Rx descriptor which
628ff2281b4Smatt  *				      has its EI bit set. To limit the
629ff2281b4Smatt  *				      interrupts to frame (rather than buffer)
630ff2281b4Smatt  *				      boundaries, the user must set SDMA
631ff2281b4Smatt  *				      Configuration register's RIFB bit. When
632ff2281b4Smatt  *				      the RIFB bit is set, an interrupt
633ff2281b4Smatt  *				      generates only upon closing the first
634ff2281b4Smatt  *				      descriptor of a received packet, if this
635ff2281b4Smatt  *				      descriptor has it EI bit set.
636ff2281b4Smatt  * 01:01 Reserved
637ff2281b4Smatt  * 02:02 TxBufferHigh		Tx Buffer for High priority Queue
638ff2281b4Smatt  *				Indicates a Tx buffer returned to CPU ownership
639ff2281b4Smatt  *				or that the port finished transmission of a Tx
640ff2281b4Smatt  *				frame.
641ff2281b4Smatt  *				NOTE: This bit is set upon closing any Tx
642ff2281b4Smatt  *				      descriptor which has its EI bit set. To
643ff2281b4Smatt  *				      limit the interrupts to frame (rather than
644ff2281b4Smatt  *				      buffer) boundaries, the user must set EI
645ff2281b4Smatt  *				      only in the last descriptor.
646ff2281b4Smatt  * 03:03 TxBufferLow		Tx Buffer for Low Priority Queue
647ff2281b4Smatt  *				Indicates a Tx buffer returned to CPU ownership
648ff2281b4Smatt  *				or that the port finished transmission of a Tx
649ff2281b4Smatt  *				frame.
650ff2281b4Smatt  *				NOTE: This bit is set upon closing any Tx
651ff2281b4Smatt  *				      descriptor which has its EI bit set. To
652ff2281b4Smatt  *				      limit the interrupts to frame (rather than
653ff2281b4Smatt  *				      buffer) boundaries, the user must set EI
654ff2281b4Smatt  *				      only in the last descriptor.
655ff2281b4Smatt  * 05:04 Reserved
656ff2281b4Smatt  * 06:06 TxEndHigh		Tx End for High Priority Queue
657ff2281b4Smatt  *				Indicates that the Tx DMA stopped processing the
658ff2281b4Smatt  *				high priority queue after stop command, or that
659ff2281b4Smatt  *				it reached the end of the high priority
660ff2281b4Smatt  *				descriptor chain.
661ff2281b4Smatt  * 07:07 TxEndLow		Tx End for Low Priority Queue
662ff2281b4Smatt  *				Indicates that the Tx DMA stopped processing the
663ff2281b4Smatt  *				low priority queue after stop command, or that
664ff2281b4Smatt  *				it reached the end of the low priority
665ff2281b4Smatt  *				descriptor chain.
666ff2281b4Smatt  * 08:08 RxError		Rx Resource Error
667ff2281b4Smatt  *				Indicates a Rx resource error event in one of
668ff2281b4Smatt  *				the priority queues.
669ff2281b4Smatt  *				NOTE: To get a Rx Resource Error Indication per
670ff2281b4Smatt  *				      priority queue, use bit 23:20.
671ff2281b4Smatt  * 09:09 Reserved
672ff2281b4Smatt  * 10:10 TxErrorHigh		Tx Resource Error for High Priority Queue
673ff2281b4Smatt  *				Indicates a Tx resource error event during
674ff2281b4Smatt  *				packet transmission from the high priority queue
675ff2281b4Smatt  * 11:11 TxErrorLow		Tx Resource Error for Low Priority Queue
676ff2281b4Smatt  *				Indicates a Tx resource error event during
677ff2281b4Smatt  *				packet transmission from the low priority queue
678ff2281b4Smatt  * 12:12 RxOVR			Rx Overrun
679ff2281b4Smatt  *				Indicates an overrun event that occurred during
680ff2281b4Smatt  *				reception of a packet.
681ff2281b4Smatt  * 13:13 TxUdr			Tx Underrun
682ff2281b4Smatt  *				Indicates an underrun event that occurred during
683ff2281b4Smatt  *				transmission of packet from either queue.
684ff2281b4Smatt  * 15:14 Reserved
685ff2281b4Smatt  * 16:16 RxBuffer-Queue[0]	Rx Buffer Return in Priority Queue[0]
686ff2281b4Smatt  *				Indicates a Rx buffer returned to CPU ownership
687ff2281b4Smatt  *				or that the port completed reception of a Rx
688ff2281b4Smatt  *				frame in a receive priority queue[0]
689ff2281b4Smatt  * 17:17 RxBuffer-Queue[1]	Rx Buffer Return in Priority Queue[1]
690ff2281b4Smatt  *				Indicates a Rx buffer returned to CPU ownership
691ff2281b4Smatt  *				or that the port completed reception of a Rx
692ff2281b4Smatt  *				frame in a receive priority queue[1].
693ff2281b4Smatt  * 18:18 RxBuffer-Queue[2]	Rx Buffer Return in Priority Queue[2]
694ff2281b4Smatt  *				Indicates a Rx buffer returned to CPU ownership
695ff2281b4Smatt  *				or that the port completed reception of a Rx
696ff2281b4Smatt  *				frame in a receive priority queue[2].
697ff2281b4Smatt  * 19:19 RxBuffer-Queue[3]	Rx Buffer Return in Priority Queue[3]
698ff2281b4Smatt  *				Indicates a Rx buffer returned to CPU ownership
699ff2281b4Smatt  *				or that the port completed reception of a Rx
700ff2281b4Smatt  *				frame in a receive priority queue[3].
701ff2281b4Smatt  * 20:20 RxError-Queue[0]	Rx Resource Error in Priority Queue[0]
702ff2281b4Smatt  *				Indicates a Rx resource error event in receive
703ff2281b4Smatt  *				priority queue[0].
704ff2281b4Smatt  * 21:21 RxError-Queue[1]	Rx Resource Error in Priority Queue[1]
705ff2281b4Smatt  *				Indicates a Rx resource error event in receive
706ff2281b4Smatt  *				priority queue[1].
707ff2281b4Smatt  * 22:22 RxError-Queue[2]	Rx Resource Error in Priority Queue[2]
708ff2281b4Smatt  *				Indicates a Rx resource error event in receive
709ff2281b4Smatt  *				priority queue[2].
710ff2281b4Smatt  * 23:23 RxError-Queue[3]	Rx Resource Error in Priority Queue[3]
711ff2281b4Smatt  *				Indicates a Rx resource error event in receive
712ff2281b4Smatt  *				priority queue[3].
713ff2281b4Smatt  * 27:24 Reserved
714ff2281b4Smatt  * 28:29 MIIPhySTC		MII PHY Status Change
715ff2281b4Smatt  *				Indicates a status change reported by the PHY
716ff2281b4Smatt  *				connected to this port.  Set when the MII
717ff2281b4Smatt  *				management interface block identifies a change
718ff2281b4Smatt  *				in PHY's register 1.
719ff2281b4Smatt  * 29:29 SMIdone		SMI Command Done
720ff2281b4Smatt  *				Indicates that the SMI completed a MII
721ff2281b4Smatt  *				management command (either read or write) that
722ff2281b4Smatt  *				was initiated by the CPU writing to the SMI
723ff2281b4Smatt  *				register.
724ff2281b4Smatt  * 30:30 Reserved
725ff2281b4Smatt  * 31:31 EtherIntSum		Ethernet Interrupt Summary
726ff2281b4Smatt  *				This bit is a logical OR of the (unmasked) bits
727ff2281b4Smatt  *				[30:04] in the Interrupt Cause register.
728ff2281b4Smatt  */
729ff2281b4Smatt 
730ff2281b4Smatt #define	ETH_IR_RxBuffer		ETH__BIT(0)
731ff2281b4Smatt #define	ETH_IR_TxBufferHigh	ETH__BIT(2)
732ff2281b4Smatt #define	ETH_IR_TxBufferLow	ETH__BIT(3)
733ff2281b4Smatt #define	ETH_IR_TxEndHigh	ETH__BIT(6)
734ff2281b4Smatt #define	ETH_IR_TxEndLow		ETH__BIT(7)
735ff2281b4Smatt #define	ETH_IR_RxError		ETH__BIT(8)
736ff2281b4Smatt #define	ETH_IR_TxErrorHigh	ETH__BIT(10)
737ff2281b4Smatt #define	ETH_IR_TxErrorLow	ETH__BIT(11)
738ff2281b4Smatt #define	ETH_IR_RxOVR		ETH__BIT(12)
739ff2281b4Smatt #define	ETH_IR_TxUdr		ETH__BIT(13)
740ff2281b4Smatt #define	ETH_IR_RxBuffer_0	ETH__BIT(16)
741ff2281b4Smatt #define	ETH_IR_RxBuffer_1	ETH__BIT(17)
742ff2281b4Smatt #define	ETH_IR_RxBuffer_2	ETH__BIT(18)
743ff2281b4Smatt #define	ETH_IR_RxBuffer_3	ETH__BIT(19)
744ff2281b4Smatt #define	ETH_IR_RxBuffer_GET(v)	ETH__EXT(v, 16, 4)
745ff2281b4Smatt #define	ETH_IR_RxError_0	ETH__BIT(20)
746ff2281b4Smatt #define	ETH_IR_RxError_1	ETH__BIT(21)
747ff2281b4Smatt #define	ETH_IR_RxError_2	ETH__BIT(22)
748ff2281b4Smatt #define	ETH_IR_RxError_3	ETH__BIT(23)
749ff2281b4Smatt #define	ETH_IR_RxError_GET(v)	ETH__EXT(v, 20, 4)
750ff2281b4Smatt #define	ETH_IR_RxBits		(ETH_IR_RxBuffer_0|\
751ff2281b4Smatt 				 ETH_IR_RxBuffer_1|\
752ff2281b4Smatt 				 ETH_IR_RxBuffer_2|\
753ff2281b4Smatt 				 ETH_IR_RxBuffer_3|\
754ff2281b4Smatt 				 ETH_IR_RxError_0|\
755ff2281b4Smatt 				 ETH_IR_RxError_1|\
756ff2281b4Smatt 				 ETH_IR_RxError_2|\
757ff2281b4Smatt 				 ETH_IR_RxError_3)
758ff2281b4Smatt #define	ETH_IR_MIIPhySTC	ETH__BIT(28)
759ff2281b4Smatt #define	ETH_IR_SMIdone		ETH__BIT(29)
760ff2281b4Smatt #define	ETH_IR_EtherIntSum	ETH__BIT(31)
761ff2281b4Smatt #define	ETH_IR_Summary		ETH__BIT(31)
762ff2281b4Smatt 
763ff2281b4Smatt /*
764ff2281b4Smatt  * Table 608: Interrupt Mask Register (IMR)
765ff2281b4Smatt  * 31:00 Various		Mask bits for the Interrupt Cause register.
766ff2281b4Smatt  */
767ff2281b4Smatt 
768ff2281b4Smatt /*
769ff2281b4Smatt  * Table 609: IP Differentiated Services CodePoint to Priority0 low (DSCP2P0L),
770ff2281b4Smatt  * 31:00 Priority0_low		The LSB priority bits for DSCP[31:0] entries.
771ff2281b4Smatt  */
772ff2281b4Smatt 
773ff2281b4Smatt /*
774ff2281b4Smatt  * Table 610: IP Differentiated Services CodePoint to Priority0 high (DSCP2P0H)
775ff2281b4Smatt  * 31:00 Priority0_high		The LSB priority bits for DSCP[63:32] entries.
776ff2281b4Smatt  */
777ff2281b4Smatt 
778ff2281b4Smatt /*
779ff2281b4Smatt  * Table 611: IP Differentiated Services CodePoint to Priority1 low (DSCP2P1L)
780ff2281b4Smatt  * 31:00 Priority1_low		The MSB priority bits for DSCP[31:0] entries.
781ff2281b4Smatt  */
782ff2281b4Smatt 
783ff2281b4Smatt /*
784ff2281b4Smatt  * Table 612: IP Differentiated Services CodePoint to Priority1 high (DSCP2P1H)
785ff2281b4Smatt  * 31:00 Priority1_high		The MSB priority bit for DSCP[63:32] entries.
786ff2281b4Smatt  */
787ff2281b4Smatt 
788ff2281b4Smatt /*
789ff2281b4Smatt  * Table 613: VLAN Priority Tag to Priority (VPT2P)
790ff2281b4Smatt  * 07:00 Priority0		The LSB priority bits for VLAN Priority[7:0]
791ff2281b4Smatt  *				entries.
792ff2281b4Smatt  * 15:08 Priority1		The MSB priority bits for VLAN Priority[7:0]
793ff2281b4Smatt  *				entries.
794ff2281b4Smatt  * 31:16 Reserved
795ff2281b4Smatt  */
796ff2281b4Smatt #endif /* _DEV_GTETHREG_H_ */
797