xref: /freebsd/sys/dev/ae/if_aereg.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1ba26d470SStanislav Sedov /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3718cf2ccSPedro F. Giffuni  *
4ba26d470SStanislav Sedov  * Copyright (c) 2008 Stanislav Sedov <stas@FreeBSD.org>.
5ba26d470SStanislav Sedov  * All rights reserved.
6ba26d470SStanislav Sedov  *
7ba26d470SStanislav Sedov  * Redistribution and use in source and binary forms, with or without
8ba26d470SStanislav Sedov  * modification, are permitted provided that the following conditions
9ba26d470SStanislav Sedov  * are met:
10ba26d470SStanislav Sedov  * 1. Redistributions of source code must retain the above copyright
11ba26d470SStanislav Sedov  *    notice, this list of conditions and the following disclaimer.
12ba26d470SStanislav Sedov  * 2. Redistributions in binary form must reproduce the above copyright
13ba26d470SStanislav Sedov  *    notice, this list of conditions and the following disclaimer in the
14ba26d470SStanislav Sedov  *    documentation and/or other materials provided with the distribution.
15ba26d470SStanislav Sedov  *
16ba26d470SStanislav Sedov  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17ba26d470SStanislav Sedov  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18ba26d470SStanislav Sedov  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19ba26d470SStanislav Sedov  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20ba26d470SStanislav Sedov  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21ba26d470SStanislav Sedov  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22ba26d470SStanislav Sedov  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23ba26d470SStanislav Sedov  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24ba26d470SStanislav Sedov  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25ba26d470SStanislav Sedov  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26ba26d470SStanislav Sedov  */
27ba26d470SStanislav Sedov 
28ba26d470SStanislav Sedov /*
29ba26d470SStanislav Sedov  * Master configuration register
30ba26d470SStanislav Sedov  */
31ba26d470SStanislav Sedov #define	AE_MASTER_REG		0x1400
32ba26d470SStanislav Sedov 
33ba26d470SStanislav Sedov #define	AE_MASTER_SOFT_RESET	0x1	/* Reset adapter. */
34ba26d470SStanislav Sedov #define	AE_MASTER_MTIMER_EN	0x2	/* Unknown. */
35ba26d470SStanislav Sedov #define	AE_MASTER_IMT_EN	0x4	/* Interrupt moderation timer enable. */
36ba26d470SStanislav Sedov #define	AE_MASTER_MANUAL_INT	0x8	/* Software manual interrupt. */
37ba26d470SStanislav Sedov #define	AE_MASTER_REVNUM_SHIFT	16	/* Chip revision number. */
38ba26d470SStanislav Sedov #define	AE_MASTER_REVNUM_MASK	0xff
39ba26d470SStanislav Sedov #define	AE_MASTER_DEVID_SHIFT	24	/* PCI device id. */
40ba26d470SStanislav Sedov #define	AE_MASTER_DEVID_MASK	0xff
41ba26d470SStanislav Sedov 
42ba26d470SStanislav Sedov /*
43ba26d470SStanislav Sedov  * Interrupt status register
44ba26d470SStanislav Sedov  */
45ba26d470SStanislav Sedov #define	AE_ISR_REG		0x1600
46ba26d470SStanislav Sedov #define	AE_ISR_TIMER		0x00000001	/* Counter expired. */
47ba26d470SStanislav Sedov #define	AE_ISR_MANUAL		0x00000002	/* Manual interrupt occuried. */
48ba26d470SStanislav Sedov #define	AE_ISR_RXF_OVERFLOW	0x00000004	/* RxF overflow occuried. */
49ba26d470SStanislav Sedov #define	AE_ISR_TXF_UNDERRUN	0x00000008	/* TxF underrun occuried. */
50ba26d470SStanislav Sedov #define	AE_ISR_TXS_OVERFLOW	0x00000010	/* TxS overflow occuried. */
51ba26d470SStanislav Sedov #define	AE_ISR_RXS_OVERFLOW	0x00000020	/* Internal RxS ring overflow. */
52ba26d470SStanislav Sedov #define	AE_ISR_LINK_CHG		0x00000040	/* Link state changed. */
53ba26d470SStanislav Sedov #define	AE_ISR_TXD_UNDERRUN	0x00000080	/* TxD underrun occuried. */
54ba26d470SStanislav Sedov #define	AE_ISR_RXD_OVERFLOW	0x00000100	/* RxD overflow occuried. */
55ba26d470SStanislav Sedov #define	AE_ISR_DMAR_TIMEOUT	0x00000200	/* DMA read timeout. */
56ba26d470SStanislav Sedov #define	AE_ISR_DMAW_TIMEOUT	0x00000400	/* DMA write timeout. */
57ba26d470SStanislav Sedov #define	AE_ISR_PHY		0x00000800	/* PHY interrupt. */
58ba26d470SStanislav Sedov #define	AE_ISR_TXS_UPDATED	0x00010000	/* Tx status updated. */
59ba26d470SStanislav Sedov #define	AE_ISR_RXD_UPDATED	0x00020000	/* Rx status updated. */
60ba26d470SStanislav Sedov #define	AE_ISR_TX_EARLY		0x00040000	/* TxMAC started transmit. */
61ba26d470SStanislav Sedov #define	AE_ISR_FIFO_UNDERRUN	0x01000000	/* FIFO underrun. */
62ba26d470SStanislav Sedov #define	AE_ISR_FRAME_ERROR	0x02000000	/* Frame receive error. */
63ba26d470SStanislav Sedov #define	AE_ISR_FRAME_SUCCESS	0x04000000	/* Frame receive success. */
64ba26d470SStanislav Sedov #define	AE_ISR_CRC_ERROR	0x08000000	/* CRC error occuried. */
65ba26d470SStanislav Sedov #define	AE_ISR_PHY_LINKDOWN	0x10000000	/* PHY link down. */
66ba26d470SStanislav Sedov #define	AE_ISR_DISABLE		0x80000000	/* Disable interrupts. */
67ba26d470SStanislav Sedov 
68ba26d470SStanislav Sedov #define	AE_ISR_TX_EVENT		(AE_ISR_TXF_UNDERRUN | AE_ISR_TXS_OVERFLOW | \
69ba26d470SStanislav Sedov 				 AE_ISR_TXD_UNDERRUN | AE_ISR_TXS_UPDATED | \
70ba26d470SStanislav Sedov 				 AE_ISR_TX_EARLY)
71ba26d470SStanislav Sedov #define	AE_ISR_RX_EVENT		(AE_ISR_RXF_OVERFLOW | AE_ISR_RXS_OVERFLOW | \
72ba26d470SStanislav Sedov 				 AE_ISR_RXD_OVERFLOW | AE_ISR_RXD_UPDATED)
73ba26d470SStanislav Sedov 
74ba26d470SStanislav Sedov /* Interrupt mask register. */
75ba26d470SStanislav Sedov #define	AE_IMR_REG		0x1604
76ba26d470SStanislav Sedov 
77ba26d470SStanislav Sedov #define	AE_IMR_DEFAULT		(AE_ISR_DMAR_TIMEOUT | AE_ISR_DMAW_TIMEOUT | \
78ba26d470SStanislav Sedov 				 AE_ISR_PHY_LINKDOWN | \
79ba26d470SStanislav Sedov 				 AE_ISR_TXS_UPDATED | AE_ISR_RXD_UPDATED )
80ba26d470SStanislav Sedov 
81ba26d470SStanislav Sedov /*
82ba26d470SStanislav Sedov  * Ethernet address register.
83ba26d470SStanislav Sedov  */
84ba26d470SStanislav Sedov #define	AE_EADDR0_REG		0x1488	/* 5 - 2 bytes */
85ba26d470SStanislav Sedov #define	AE_EADDR1_REG		0x148c	/* 1 - 0 bytes */
86ba26d470SStanislav Sedov 
87ba26d470SStanislav Sedov /*
88ba26d470SStanislav Sedov  * Desriptor rings registers.
89ba26d470SStanislav Sedov  * L2 supports 64-bit addressing but all rings base addresses
90ba26d470SStanislav Sedov  * should have the same high 32 bits of address.
91ba26d470SStanislav Sedov  */
92ba26d470SStanislav Sedov #define	AE_DESC_ADDR_HI_REG	0x1540	/* High 32 bits of ring base address. */
93ba26d470SStanislav Sedov #define	AE_RXD_ADDR_LO_REG	0x1554	/* Low 32 bits of RxD ring address. */
94ba26d470SStanislav Sedov #define	AE_TXD_ADDR_LO_REG	0x1544	/* Low 32 bits of TxD ring address. */
95ba26d470SStanislav Sedov #define	AE_TXS_ADDR_LO_REG	0x154c	/* Low 32 bits of TxS ring address. */
96ba26d470SStanislav Sedov #define	AE_RXD_COUNT_REG	0x1558	/* Number of RxD descriptors in ring.
97ba26d470SStanislav Sedov 					   Should be 120-byte aligned (i.e.
98ba26d470SStanislav Sedov 					   the 'data' field of RxD should
99ba26d470SStanislav Sedov 					   have 128-byte alignment). */
100ba26d470SStanislav Sedov #define	AE_TXD_BUFSIZE_REG	0x1548	/* Size of TxD ring in 4-byte units.
101ba26d470SStanislav Sedov 					   Should be 4-byte aligned. */
102ba26d470SStanislav Sedov #define	AE_TXS_COUNT_REG	0x1550	/* Number of TxS descriptors in ring.
103ba26d470SStanislav Sedov 					   4 byte alignment. */
104ba26d470SStanislav Sedov #define	AE_RXD_COUNT_MIN	16
105ba26d470SStanislav Sedov #define	AE_RXD_COUNT_MAX	512
106ba26d470SStanislav Sedov #define	AE_RXD_COUNT_DEFAULT	64
107fcb1bf41SPyun YongHyeon /* Padding to align frames on a 128-byte boundary. */
108fcb1bf41SPyun YongHyeon #define	AE_RXD_PADDING		120
109ba26d470SStanislav Sedov 
110ba26d470SStanislav Sedov #define	AE_TXD_BUFSIZE_MIN	4096
111ba26d470SStanislav Sedov #define	AE_TXD_BUFSIZE_MAX	65536
112ba26d470SStanislav Sedov #define	AE_TXD_BUFSIZE_DEFAULT	8192
113ba26d470SStanislav Sedov 
114ba26d470SStanislav Sedov #define	AE_TXS_COUNT_MIN	8	/* Not sure. */
115ba26d470SStanislav Sedov #define	AE_TXS_COUNT_MAX	160
116ba26d470SStanislav Sedov #define	AE_TXS_COUNT_DEFAULT	64	/* AE_TXD_BUFSIZE_DEFAULT / 128 */
117ba26d470SStanislav Sedov 
118ba26d470SStanislav Sedov /*
119ba26d470SStanislav Sedov  * Inter-frame gap configuration register.
120ba26d470SStanislav Sedov  */
121ba26d470SStanislav Sedov #define	AE_IFG_REG		0x1484
122ba26d470SStanislav Sedov 
123ba26d470SStanislav Sedov #define	AE_IFG_TXIPG_DEFAULT	0x60	/* 96-bit IFG time. */
124ba26d470SStanislav Sedov #define	AE_IFG_TXIPG_SHIFT	0
125ba26d470SStanislav Sedov #define	AE_IFG_TXIPG_MASK	0x7f
126ba26d470SStanislav Sedov 
127ba26d470SStanislav Sedov #define	AE_IFG_RXIPG_DEFAULT	0x50	/* 80-bit IFG time. */
128ba26d470SStanislav Sedov #define	AE_IFG_RXIPG_SHIFT	8
129ba26d470SStanislav Sedov #define	AE_IFG_RXIPG_MASK	0xff00
130ba26d470SStanislav Sedov 
131ba26d470SStanislav Sedov #define	AE_IFG_IPGR1_DEFAULT	0x40	/* Carrier-sense window. */
132ba26d470SStanislav Sedov #define	AE_IFG_IPGR1_SHIFT	16
133ba26d470SStanislav Sedov #define	AE_IFG_IPGR1_MASK	0x7f0000
134ba26d470SStanislav Sedov 
135ba26d470SStanislav Sedov #define	AE_IFG_IPGR2_DEFAULT	0x60	/* IFG window. */
136ba26d470SStanislav Sedov #define	AE_IFG_IPGR2_SHIFT	24
137ba26d470SStanislav Sedov #define	AE_IFG_IPGR2_MASK	0x7f000000
138ba26d470SStanislav Sedov 
139ba26d470SStanislav Sedov /*
140ba26d470SStanislav Sedov  * Half-duplex mode configuration register.
141ba26d470SStanislav Sedov  */
142ba26d470SStanislav Sedov #define	AE_HDPX_REG		0x1498
143ba26d470SStanislav Sedov 
144ba26d470SStanislav Sedov /* Collision window. */
145ba26d470SStanislav Sedov #define	AE_HDPX_LCOL_SHIFT	0
146ba26d470SStanislav Sedov #define	AE_HDPX_LCOL_MASK	0x000003ff
147ba26d470SStanislav Sedov #define	AE_HDPX_LCOL_DEFAULT	0x37
148ba26d470SStanislav Sedov 
149ba26d470SStanislav Sedov /* Max retransmission time, after that the packet will be discarded. */
150ba26d470SStanislav Sedov #define	AE_HDPX_RETRY_SHIFT	12
151ba26d470SStanislav Sedov #define	AE_HDPX_RETRY_MASK	0x0000f000
152ba26d470SStanislav Sedov #define	AE_HDPX_RETRY_DEFAULT	0x0f
153ba26d470SStanislav Sedov 
154ba26d470SStanislav Sedov /* Alternative binary exponential back-off time. */
155ba26d470SStanislav Sedov #define	AE_HDPX_ABEBT_SHIFT	20
156ba26d470SStanislav Sedov #define	AE_HDPX_ABEBT_MASK	0x00f00000
157ba26d470SStanislav Sedov #define	AE_HDPX_ABEBT_DEFAULT	0x0a
158ba26d470SStanislav Sedov 
159ba26d470SStanislav Sedov /* IFG to start JAM for collision based flow control (8-bit time units).*/
160ba26d470SStanislav Sedov #define	AE_HDPX_JAMIPG_SHIFT	24
161ba26d470SStanislav Sedov #define	AE_HDPX_JAMIPG_MASK	0x0f000000
162ba26d470SStanislav Sedov #define	AE_HDPX_JAMIPG_DEFAULT	0x07
163ba26d470SStanislav Sedov 
164ba26d470SStanislav Sedov /* Allow the transmission of a packet which has been excessively deferred. */
165ba26d470SStanislav Sedov #define	AE_HDPX_EXC_EN		0x00010000
166ba26d470SStanislav Sedov /* No back-off on collision, immediately start the retransmission. */
167ba26d470SStanislav Sedov #define	AE_HDPX_NO_BACK_C	0x00020000
168ba26d470SStanislav Sedov /* No back-off on backpressure, immediately start the transmission. */
169ba26d470SStanislav Sedov #define	AE_HDPX_NO_BACK_P	0x00040000
170ba26d470SStanislav Sedov /* Alternative binary exponential back-off enable. */
171ba26d470SStanislav Sedov #define	AE_HDPX_ABEBE		0x00080000
172ba26d470SStanislav Sedov 
173ba26d470SStanislav Sedov /*
174ba26d470SStanislav Sedov  * Interrupt moderation timer configuration register.
175ba26d470SStanislav Sedov  */
176ba26d470SStanislav Sedov #define	AE_IMT_REG		0x1408	/* Timer value in 2 us units. */
177ba26d470SStanislav Sedov #define	AE_IMT_MAX		65000
178ba26d470SStanislav Sedov #define	AE_IMT_MIN		50
179ba26d470SStanislav Sedov #define	AE_IMT_DEFAULT		100	/* 200 microseconds. */
180ba26d470SStanislav Sedov 
181ba26d470SStanislav Sedov /*
182ba26d470SStanislav Sedov  * Interrupt clearing timer configuration register.
183ba26d470SStanislav Sedov  */
184ba26d470SStanislav Sedov #define	AE_ICT_REG		0x140e	/* Maximum time allowed to clear
185ba26d470SStanislav Sedov 					   interrupt. In 2 us units.  */
186ba26d470SStanislav Sedov #define	AE_ICT_DEFAULT		50000	/* 100ms */
187ba26d470SStanislav Sedov 
188ba26d470SStanislav Sedov /*
189ba26d470SStanislav Sedov  * MTU configuration register.
190ba26d470SStanislav Sedov  */
191ba26d470SStanislav Sedov #define	AE_MTU_REG		0x149c	/* MTU size in bytes. */
192ba26d470SStanislav Sedov 
193ba26d470SStanislav Sedov /*
194ba26d470SStanislav Sedov  * Cut-through configuration register.
195ba26d470SStanislav Sedov  */
196ba26d470SStanislav Sedov #define	AE_CUT_THRESH_REG	0x1590	/* Cut-through threshold in unknown units. */
197ba26d470SStanislav Sedov #define	AE_CUT_THRESH_DEFAULT   0x177
198ba26d470SStanislav Sedov 
199ba26d470SStanislav Sedov /*
200ba26d470SStanislav Sedov  * Flow-control configuration registers.
201ba26d470SStanislav Sedov  */
202ba26d470SStanislav Sedov #define	AE_FLOW_THRESH_HI_REG	0x15a8	/* High watermark of RxD
203ba26d470SStanislav Sedov 					   overflow threshold. */
204ba26d470SStanislav Sedov #define	AE_FLOW_THRESH_LO_REG	0x15aa	/* Lower watermark of RxD
205ba26d470SStanislav Sedov 					   overflow threshold */
206ba26d470SStanislav Sedov 
207ba26d470SStanislav Sedov /*
208ba26d470SStanislav Sedov  * Mailbox configuration registers.
209ba26d470SStanislav Sedov */
210ba26d470SStanislav Sedov #define	AE_MB_TXD_IDX_REG	0x15f0	/* TxD read index. */
211ba26d470SStanislav Sedov #define	AE_MB_RXD_IDX_REG	0x15f4	/* RxD write index. */
212ba26d470SStanislav Sedov 
213ba26d470SStanislav Sedov /*
214ba26d470SStanislav Sedov  * DMA configuration registers.
215ba26d470SStanislav Sedov  */
216ba26d470SStanislav Sedov #define	AE_DMAREAD_REG		0x1580	/* Read DMA configuration register. */
217ba26d470SStanislav Sedov #define	AE_DMAREAD_EN		1
218ba26d470SStanislav Sedov #define	AE_DMAWRITE_REG		0x15a0	/* Write DMA configuration register. */
219ba26d470SStanislav Sedov #define	AE_DMAWRITE_EN		1
220ba26d470SStanislav Sedov 
221ba26d470SStanislav Sedov /*
222ba26d470SStanislav Sedov  * MAC configuration register.
223ba26d470SStanislav Sedov  */
224ba26d470SStanislav Sedov #define	AE_MAC_REG		0x1480
225ba26d470SStanislav Sedov 
226ba26d470SStanislav Sedov #define	AE_MAC_TX_EN		0x00000001	/* Enable transmit. */
227ba26d470SStanislav Sedov #define	AE_MAC_RX_EN		0x00000002	/* Enable receive. */
228ba26d470SStanislav Sedov #define	AE_MAC_TX_FLOW_EN	0x00000004	/* Enable Tx flow control. */
229ba26d470SStanislav Sedov #define	AE_MAC_RX_FLOW_EN	0x00000008	/* Enable Rx flow control. */
230ba26d470SStanislav Sedov #define	AE_MAC_LOOPBACK		0x00000010	/* Loopback at MII. */
231ba26d470SStanislav Sedov #define	AE_MAC_FULL_DUPLEX	0x00000020	/* Enable full-duplex. */
232ba26d470SStanislav Sedov #define	AE_MAC_TX_CRC_EN	0x00000040	/* Enable CRC generation. */
233ba26d470SStanislav Sedov #define	AE_MAC_TX_AUTOPAD	0x00000080	/* Pad short frames. */
234ba26d470SStanislav Sedov #define	AE_MAC_PREAMBLE_MASK	0x00003c00	/* Preamble length. */
235ba26d470SStanislav Sedov #define	AE_MAC_PREAMBLE_SHIFT	10
236ba26d470SStanislav Sedov #define	AE_MAC_PREAMBLE_DEFAULT	0x07		/* By standard. */
237ba26d470SStanislav Sedov #define	AE_MAC_RMVLAN_EN	0x00004000	/* Remove VLAN tags in
238ba26d470SStanislav Sedov 						   incoming packets. */
239ba26d470SStanislav Sedov #define	AE_MAC_PROMISC_EN	0x00008000	/* Enable promiscue mode. */
240ba26d470SStanislav Sedov #define	AE_MAC_TX_MAXBACKOFF	0x00100000	/* Unknown. */
241ba26d470SStanislav Sedov #define	AE_MAC_MCAST_EN		0x02000000	/* Pass all multicast frames. */
242ba26d470SStanislav Sedov #define	AE_MAC_BCAST_EN		0x04000000	/* Pass all broadcast frames. */
243ba26d470SStanislav Sedov #define	AE_MAC_CLK_PHY		0x08000000	/* If 1 uses loopback clock
244ba26d470SStanislav Sedov 						   PHY, if 0 - system clock. */
245ba26d470SStanislav Sedov #define	AE_HALFBUF_MASK		0xf0000000	/* Half-duplex retry buffer. */
246ba26d470SStanislav Sedov #define	AE_HALFBUF_SHIFT	28
247ba26d470SStanislav Sedov #define	AE_HALFBUF_DEFAULT	2		/* XXX: From Linux. */
248ba26d470SStanislav Sedov 
249ba26d470SStanislav Sedov /*
250ba26d470SStanislav Sedov  * MDIO control register.
251ba26d470SStanislav Sedov  */
252ba26d470SStanislav Sedov #define	AE_MDIO_REG		0x1414
253ba26d470SStanislav Sedov #define	AE_MDIO_DATA_MASK	0xffff
254ba26d470SStanislav Sedov #define	AE_MDIO_DATA_SHIFT	0
255ba26d470SStanislav Sedov #define	AE_MDIO_REGADDR_MASK	0x1f0000
256ba26d470SStanislav Sedov #define	AE_MDIO_REGADDR_SHIFT	16
257ba26d470SStanislav Sedov #define	AE_MDIO_READ		0x00200000	/* Read operation. */
258ba26d470SStanislav Sedov #define	AE_MDIO_SUP_PREAMBLE	0x00400000	/* Suppress preamble. */
259ba26d470SStanislav Sedov #define	AE_MDIO_START		0x00800000	/* Initiate MDIO transfer. */
260ba26d470SStanislav Sedov #define	AE_MDIO_CLK_SHIFT	24		/* Clock selection. */
261ba26d470SStanislav Sedov #define	AE_MDIO_CLK_MASK	0x07000000	/* Clock selection. */
262ba26d470SStanislav Sedov #define	AE_MDIO_CLK_25_4	0		/* Dividers? */
263ba26d470SStanislav Sedov #define	AE_MDIO_CLK_25_6	2
264ba26d470SStanislav Sedov #define	AE_MDIO_CLK_25_8	3
265ba26d470SStanislav Sedov #define	AE_MDIO_CLK_25_10	4
266ba26d470SStanislav Sedov #define	AE_MDIO_CLK_25_14	5
267ba26d470SStanislav Sedov #define	AE_MDIO_CLK_25_20	6
268ba26d470SStanislav Sedov #define	AE_MDIO_CLK_25_28	7
269ba26d470SStanislav Sedov #define	AE_MDIO_BUSY		0x08000000	/* MDIO is busy. */
270ba26d470SStanislav Sedov 
271ba26d470SStanislav Sedov /*
272ba26d470SStanislav Sedov  * Idle status register.
273ba26d470SStanislav Sedov  */
274ba26d470SStanislav Sedov #define	AE_IDLE_REG		0x1410
275ba26d470SStanislav Sedov 
276ba26d470SStanislav Sedov /*
277ba26d470SStanislav Sedov  * Idle status bits.
278ba26d470SStanislav Sedov  * If bit is set then the corresponding module is in non-idle state.
279ba26d470SStanislav Sedov  */
280ba26d470SStanislav Sedov #define	AE_IDLE_RXMAC		1
281ba26d470SStanislav Sedov #define	AE_IDLE_TXMAC		2
282ba26d470SStanislav Sedov #define	AE_IDLE_DMAREAD		8
283ba26d470SStanislav Sedov #define	AE_IDLE_DMAWRITE	4
284ba26d470SStanislav Sedov 
285ba26d470SStanislav Sedov /*
286ba26d470SStanislav Sedov  * Multicast hash tables registers.
287ba26d470SStanislav Sedov  */
288ba26d470SStanislav Sedov #define	AE_REG_MHT0		0x1490
289ba26d470SStanislav Sedov #define	AE_REG_MHT1		0x1494
290ba26d470SStanislav Sedov 
291ba26d470SStanislav Sedov /*
292ba26d470SStanislav Sedov  * Wake on lan (WOL).
293ba26d470SStanislav Sedov  */
294ba26d470SStanislav Sedov #define	AE_WOL_REG		0x14a0
295ba26d470SStanislav Sedov #define	AE_WOL_MAGIC		0x00000004
296ba26d470SStanislav Sedov #define	AE_WOL_MAGIC_PME	0x00000008
297ba26d470SStanislav Sedov #define	AE_WOL_LNKCHG		0x00000010
298ba26d470SStanislav Sedov #define	AE_WOL_LNKCHG_PME	0x00000020
299ba26d470SStanislav Sedov 
300ba26d470SStanislav Sedov /*
301ba26d470SStanislav Sedov  * PCIE configuration registers. Descriptions unknown.
302ba26d470SStanislav Sedov  */
303ba26d470SStanislav Sedov #define	AE_PCIE_LTSSM_TESTMODE_REG	0x12fc
304ba26d470SStanislav Sedov #define	AE_PCIE_LTSSM_TESTMODE_DEFAULT	0x6500
305ba26d470SStanislav Sedov #define	AE_PCIE_DLL_TX_CTRL_REG		0x1104
306ba26d470SStanislav Sedov #define	AE_PCIE_DLL_TX_CTRL_SEL_NOR_CLK	0x0400
307ba26d470SStanislav Sedov #define	AE_PCIE_DLL_TX_CTRL_DEFAULT	0x0568
308ba26d470SStanislav Sedov #define	AE_PCIE_PHYMISC_REG		0x1000
309ba26d470SStanislav Sedov #define	AE_PCIE_PHYMISC_FORCE_RCV_DET	0x4
310ba26d470SStanislav Sedov 
311ba26d470SStanislav Sedov /*
312ba26d470SStanislav Sedov  * PHY enable register.
313ba26d470SStanislav Sedov  */
314ba26d470SStanislav Sedov #define	AE_PHY_ENABLE_REG	0x140c
315ba26d470SStanislav Sedov #define	AE_PHY_ENABLE		1
316ba26d470SStanislav Sedov 
317ba26d470SStanislav Sedov /*
318ba26d470SStanislav Sedov  * VPD registers.
319ba26d470SStanislav Sedov  */
320ba26d470SStanislav Sedov #define	AE_VPD_CAP_REG		0x6c	/* Command register. */
321ba26d470SStanislav Sedov #define	AE_VPD_CAP_ID_MASK	0xff
322ba26d470SStanislav Sedov #define	AE_VPD_CAP_ID_SHIFT	0
323ba26d470SStanislav Sedov #define	AE_VPD_CAP_NEXT_MASK	0xff00
324ba26d470SStanislav Sedov #define	AE_VPD_CAP_NEXT_SHIFT	8
325ba26d470SStanislav Sedov #define	AE_VPD_CAP_ADDR_MASK	0x7fff0000
326ba26d470SStanislav Sedov #define	AE_VPD_CAP_ADDR_SHIFT	16
327ba26d470SStanislav Sedov #define	AE_VPD_CAP_DONE		0x80000000
328ba26d470SStanislav Sedov 
329ba26d470SStanislav Sedov #define	AE_VPD_DATA_REG		0x70	/* Data register. */
330ba26d470SStanislav Sedov 
331ba26d470SStanislav Sedov #define	AE_VPD_NREGS		64	/* Maximum number of VPD regs. */
332ba26d470SStanislav Sedov #define	AE_VPD_SIG_MASK		0xff
333ba26d470SStanislav Sedov #define	AE_VPD_SIG		0x5a	/* VPD block signature. */
334ba26d470SStanislav Sedov #define	AE_VPD_REG_SHIFT	16	/* Register id offset. */
335ba26d470SStanislav Sedov 
336ba26d470SStanislav Sedov /*
337ba26d470SStanislav Sedov  * SPI registers.
338ba26d470SStanislav Sedov  */
339ba26d470SStanislav Sedov #define	AE_SPICTL_REG		0x200
340ba26d470SStanislav Sedov #define	AE_SPICTL_VPD_EN	0x2000	/* Enable VPD. */
341ba26d470SStanislav Sedov 
342ba26d470SStanislav Sedov /*
343ba26d470SStanislav Sedov  * PHY-specific registers constants.
344ba26d470SStanislav Sedov  */
345ba26d470SStanislav Sedov #define	AE_PHY_DBG_ADDR		0x1d
346ba26d470SStanislav Sedov #define	AE_PHY_DBG_DATA		0x1e
347ba26d470SStanislav Sedov #define	AE_PHY_DBG_POWERSAVE	0x1000
348ba26d470SStanislav Sedov 
349ba26d470SStanislav Sedov /*
350ba26d470SStanislav Sedov  * TxD flags.
351ba26d470SStanislav Sedov  */
352ba26d470SStanislav Sedov #define	AE_TXD_INSERT_VTAG	0x8000	/* Insert VLAN tag on transfer. */
353ba26d470SStanislav Sedov 
354ba26d470SStanislav Sedov /*
355ba26d470SStanislav Sedov  * TxS flags.
356ba26d470SStanislav Sedov  */
357ba26d470SStanislav Sedov #define	AE_TXS_SUCCESS		0x0001	/* Packed transmitted successfully. */
358ba26d470SStanislav Sedov #define	AE_TXS_BCAST		0x0002	/* Transmitted broadcast frame. */
359ba26d470SStanislav Sedov #define	AE_TXS_MCAST		0x0004	/* Transmitted multicast frame. */
360ba26d470SStanislav Sedov #define	AE_TXS_PAUSE		0x0008	/* Transmitted pause frame. */
361ba26d470SStanislav Sedov #define	AE_TXS_CTRL		0x0010	/* Transmitted control frame. */
362ba26d470SStanislav Sedov #define	AE_TXS_DEFER		0x0020	/* Frame transmitted with defer. */
363ba26d470SStanislav Sedov #define	AE_TXS_EXCDEFER		0x0040	/* Excessive collision. */
364ba26d470SStanislav Sedov #define	AE_TXS_SINGLECOL	0x0080	/* Single collision occuried. */
365ba26d470SStanislav Sedov #define	AE_TXS_MULTICOL		0x0100	/* Multiple collisions occuried. */
366ba26d470SStanislav Sedov #define	AE_TXS_LATECOL		0x0200	/* Late collision occuried. */
367ba26d470SStanislav Sedov #define	AE_TXS_ABORTCOL		0x0400	/* Frame abort due to collisions. */
368ba26d470SStanislav Sedov #define	AE_TXS_UNDERRUN		0x0800	/* Tx SRAM underrun occuried. */
369ba26d470SStanislav Sedov #define	AE_TXS_UPDATE		0x8000
370ba26d470SStanislav Sedov 
371ba26d470SStanislav Sedov /*
372ba26d470SStanislav Sedov  * RxD flags.
373ba26d470SStanislav Sedov  */
374ba26d470SStanislav Sedov #define	AE_RXD_SUCCESS		0x0001
375ba26d470SStanislav Sedov #define	AE_RXD_BCAST		0x0002	/* Broadcast frame received. */
376ba26d470SStanislav Sedov #define	AE_RXD_MCAST		0x0004	/* Multicast frame received. */
377ba26d470SStanislav Sedov #define	AE_RXD_PAUSE		0x0008	/* Pause frame received. */
378ba26d470SStanislav Sedov #define	AE_RXD_CTRL		0x0010	/* Control frame received. */
379ba26d470SStanislav Sedov #define	AE_RXD_CRCERR		0x0020	/* Invalid frame CRC. */
380ba26d470SStanislav Sedov #define	AE_RXD_CODEERR		0x0040	/* Invalid frame opcode. */
381ba26d470SStanislav Sedov #define	AE_RXD_RUNT		0x0080	/* Runt frame received. */
382ba26d470SStanislav Sedov #define	AE_RXD_FRAG		0x0100	/* Collision fragment received. */
383ba26d470SStanislav Sedov #define	AE_RXD_TRUNC		0x0200	/* The frame was truncated due
384ba26d470SStanislav Sedov 					   to Rx SRAM underrun. */
385ba26d470SStanislav Sedov #define	AE_RXD_ALIGN		0x0400	/* Frame alignment error. */
386ba26d470SStanislav Sedov #define	AE_RXD_HAS_VLAN		0x0800	/* VLAN tag present. */
387ba26d470SStanislav Sedov #define	AE_RXD_UPDATE		0x8000
388