xref: /minix3/minix/drivers/net/e1000/e1000_reg.h (revision f7df02e7476731c31f12548e38bcadbaf0233f6a)
1433d6423SLionel Sambuc /**
2433d6423SLionel Sambuc  * @file e1000_reg.h
3433d6423SLionel Sambuc  *
4433d6423SLionel Sambuc  * @brief Hardware specific registers and flags of the Intel
5433d6423SLionel Sambuc  *        Pro/1000 Gigabit Ethernet card(s).
6433d6423SLionel Sambuc  *
7433d6423SLionel Sambuc  * Parts of this code is based on the DragonflyBSD (FreeBSD)
8433d6423SLionel Sambuc  * implementation, and the fxp driver for Minix 3.
9433d6423SLionel Sambuc  *
10433d6423SLionel Sambuc  * @see http://svn.freebsd.org/viewvc/base/head/sys/dev/e1000/
11433d6423SLionel Sambuc  * @see fxp.c
12433d6423SLionel Sambuc  *
13433d6423SLionel Sambuc  * @author Niek Linnenbank <nieklinnenbank@gmail.com>
14433d6423SLionel Sambuc  * @date September 2009
15433d6423SLionel Sambuc  *
16433d6423SLionel Sambuc  */
17433d6423SLionel Sambuc 
18433d6423SLionel Sambuc #ifndef __E1000_REG_H
19433d6423SLionel Sambuc #define __E1000_REG_H
20433d6423SLionel Sambuc 
21433d6423SLionel Sambuc /**
22433d6423SLionel Sambuc  * @name Controller Registers.
23433d6423SLionel Sambuc  * @{
24433d6423SLionel Sambuc  */
25433d6423SLionel Sambuc 
26433d6423SLionel Sambuc /** Device Control. */
27433d6423SLionel Sambuc #define E1000_REG_CTRL		0x00000
28433d6423SLionel Sambuc 
29433d6423SLionel Sambuc /** Device Status. */
30433d6423SLionel Sambuc #define E1000_REG_STATUS	0x00008
31433d6423SLionel Sambuc 
32433d6423SLionel Sambuc /** EEPROM Read. */
33433d6423SLionel Sambuc #define E1000_REG_EERD		0x00014
34433d6423SLionel Sambuc 
35433d6423SLionel Sambuc /** Flow Control Address Low. */
36433d6423SLionel Sambuc #define E1000_REG_FCAL		0x00028
37433d6423SLionel Sambuc 
38433d6423SLionel Sambuc /** Flow Control Address High. */
39433d6423SLionel Sambuc #define E1000_REG_FCAH		0x0002c
40433d6423SLionel Sambuc 
41433d6423SLionel Sambuc /** Flow Control Type. */
42433d6423SLionel Sambuc #define E1000_REG_FCT		0x00030
43433d6423SLionel Sambuc 
44433d6423SLionel Sambuc /** Interrupt Cause Read. */
45433d6423SLionel Sambuc #define E1000_REG_ICR		0x000c0
46433d6423SLionel Sambuc 
47433d6423SLionel Sambuc /** Interrupt Mask Set/Read Register. */
48433d6423SLionel Sambuc #define E1000_REG_IMS		0x000d0
49433d6423SLionel Sambuc 
50433d6423SLionel Sambuc /** Receive Control Register. */
51433d6423SLionel Sambuc #define E1000_REG_RCTL		0x00100
52433d6423SLionel Sambuc 
53433d6423SLionel Sambuc /** Transmit Control Register. */
54433d6423SLionel Sambuc #define E1000_REG_TCTL		0x00400
55433d6423SLionel Sambuc 
56433d6423SLionel Sambuc /** Flow Control Transmit Timer Value. */
57433d6423SLionel Sambuc #define E1000_REG_FCTTV		0x00170
58433d6423SLionel Sambuc 
59433d6423SLionel Sambuc /** Receive Descriptor Base Address Low. */
60433d6423SLionel Sambuc #define E1000_REG_RDBAL		0x02800
61433d6423SLionel Sambuc 
62433d6423SLionel Sambuc /** Receive Descriptor Base Address High. */
63433d6423SLionel Sambuc #define E1000_REG_RDBAH		0x02804
64433d6423SLionel Sambuc 
65433d6423SLionel Sambuc /** Receive Descriptor Length. */
66433d6423SLionel Sambuc #define E1000_REG_RDLEN		0x02808
67433d6423SLionel Sambuc 
68433d6423SLionel Sambuc /** Receive Descriptor Head. */
69433d6423SLionel Sambuc #define E1000_REG_RDH		0x02810
70433d6423SLionel Sambuc 
71433d6423SLionel Sambuc /** Receive Descriptor Tail. */
72433d6423SLionel Sambuc #define E1000_REG_RDT		0x02818
73433d6423SLionel Sambuc 
74433d6423SLionel Sambuc /** Transmit Descriptor Base Address Low. */
75433d6423SLionel Sambuc #define E1000_REG_TDBAL		0x03800
76433d6423SLionel Sambuc 
77433d6423SLionel Sambuc /** Transmit Descriptor Base Address High. */
78433d6423SLionel Sambuc #define E1000_REG_TDBAH		0x03804
79433d6423SLionel Sambuc 
80433d6423SLionel Sambuc /** Transmit Descriptor Length. */
81433d6423SLionel Sambuc #define E1000_REG_TDLEN		0x03808
82433d6423SLionel Sambuc 
83433d6423SLionel Sambuc /** Transmit Descriptor Head. */
84433d6423SLionel Sambuc #define E1000_REG_TDH		0x03810
85433d6423SLionel Sambuc 
86433d6423SLionel Sambuc /** Transmit Descriptor Tail. */
87433d6423SLionel Sambuc #define E1000_REG_TDT		0x03818
88433d6423SLionel Sambuc 
89433d6423SLionel Sambuc /** CRC Error Count. */
90433d6423SLionel Sambuc #define E1000_REG_CRCERRS	0x04000
91433d6423SLionel Sambuc 
92433d6423SLionel Sambuc /** RX Error Count. */
93433d6423SLionel Sambuc #define E1000_REG_RXERRC	0x0400c
94433d6423SLionel Sambuc 
95433d6423SLionel Sambuc /** Missed Packets Count. */
96433d6423SLionel Sambuc #define E1000_REG_MPC		0x04010
97433d6423SLionel Sambuc 
98433d6423SLionel Sambuc /** Collision Count. */
99433d6423SLionel Sambuc #define E1000_REG_COLC		0x04028
100433d6423SLionel Sambuc 
101433d6423SLionel Sambuc /** Total Packets Received. */
102433d6423SLionel Sambuc #define E1000_REG_TPR		0x040D0
103433d6423SLionel Sambuc 
104433d6423SLionel Sambuc /** Total Packets Transmitted. */
105433d6423SLionel Sambuc #define E1000_REG_TPT		0x040D4
106433d6423SLionel Sambuc 
107433d6423SLionel Sambuc /** Receive Address Low. */
108433d6423SLionel Sambuc #define E1000_REG_RAL		0x05400
109433d6423SLionel Sambuc 
110433d6423SLionel Sambuc /** Receive Address High. */
111433d6423SLionel Sambuc #define E1000_REG_RAH		0x05404
112433d6423SLionel Sambuc 
113433d6423SLionel Sambuc /** Multicast Table Array. */
114433d6423SLionel Sambuc #define E1000_REG_MTA		0x05200
115433d6423SLionel Sambuc 
116433d6423SLionel Sambuc /**
117433d6423SLionel Sambuc  * @}
118433d6423SLionel Sambuc  */
119433d6423SLionel Sambuc 
120433d6423SLionel Sambuc /**
121433d6423SLionel Sambuc  * @name Control Register Bits.
122433d6423SLionel Sambuc  * @{
123433d6423SLionel Sambuc  */
124433d6423SLionel Sambuc 
125433d6423SLionel Sambuc /** Auto-Speed Detection Enable. */
126433d6423SLionel Sambuc #define E1000_REG_CTRL_ASDE	(1 << 5)
127433d6423SLionel Sambuc 
128433d6423SLionel Sambuc /** Link Reset. */
129433d6423SLionel Sambuc #define E1000_REG_CTRL_LRST	(1 << 3)
130433d6423SLionel Sambuc 
131433d6423SLionel Sambuc /** Set Link Up. */
132433d6423SLionel Sambuc #define E1000_REG_CTRL_SLU	(1 << 6)
133433d6423SLionel Sambuc 
134433d6423SLionel Sambuc /** Invert Los Of Signal. */
135433d6423SLionel Sambuc #define E1000_REG_CTRL_ILOS	(1 << 7)
136433d6423SLionel Sambuc 
137433d6423SLionel Sambuc /** Device Reset. */
138433d6423SLionel Sambuc #define E1000_REG_CTRL_RST	(1 << 26)
139433d6423SLionel Sambuc 
140433d6423SLionel Sambuc /** VLAN Mode Enable. */
141433d6423SLionel Sambuc #define E1000_REG_CTRL_VME	(1 << 30)
142433d6423SLionel Sambuc 
143433d6423SLionel Sambuc /** PHY Reset. */
144433d6423SLionel Sambuc #define E1000_REG_CTRL_PHY_RST	(1 << 31)
145433d6423SLionel Sambuc 
146433d6423SLionel Sambuc /**
147433d6423SLionel Sambuc  * @}
148433d6423SLionel Sambuc  */
149433d6423SLionel Sambuc 
150433d6423SLionel Sambuc /**
151433d6423SLionel Sambuc  * @name Status Register Bits.
152433d6423SLionel Sambuc  * @{
153433d6423SLionel Sambuc  */
154433d6423SLionel Sambuc 
155433d6423SLionel Sambuc /** Link Full Duplex Configuration Indication. */
156433d6423SLionel Sambuc #define E1000_REG_STATUS_FD	 (1 << 0)
157433d6423SLionel Sambuc 
158433d6423SLionel Sambuc /** Link Up Indication. */
159433d6423SLionel Sambuc #define E1000_REG_STATUS_LU	 (1 << 1)
160433d6423SLionel Sambuc 
161433d6423SLionel Sambuc /** Transmission Paused. */
162433d6423SLionel Sambuc #define E1000_REG_STATUS_TXOFF	 (1 << 4)
163433d6423SLionel Sambuc 
164433d6423SLionel Sambuc /** Link Speed Setting. */
165433d6423SLionel Sambuc #define E1000_REG_STATUS_SPEED	((1 << 6) | (1 << 7))
166433d6423SLionel Sambuc 
167*f7df02e7SDavid van Moolenbroek #define E1000_REG_STATUS_SPEED_10	(0 << 6)	/* 10 Mb/s */
168*f7df02e7SDavid van Moolenbroek #define E1000_REG_STATUS_SPEED_100	(1 << 6)	/* 100 Mb/s */
169*f7df02e7SDavid van Moolenbroek #define E1000_REG_STATUS_SPEED_1000_A	(2 << 6)	/* 1000 Mb/s */
170*f7df02e7SDavid van Moolenbroek #define E1000_REG_STATUS_SPEED_1000_B	(3 << 6)	/* 1000 Mb/s */
171*f7df02e7SDavid van Moolenbroek 
172433d6423SLionel Sambuc /**
173433d6423SLionel Sambuc  * @}
174433d6423SLionel Sambuc  */
175433d6423SLionel Sambuc 
176433d6423SLionel Sambuc /**
177433d6423SLionel Sambuc  * @name EEPROM Read Register Bits.
178433d6423SLionel Sambuc  * @{
179433d6423SLionel Sambuc  */
180433d6423SLionel Sambuc 
181433d6423SLionel Sambuc /** Start Read. */
182433d6423SLionel Sambuc #define E1000_REG_EERD_START	(1 << 0)
183433d6423SLionel Sambuc 
184433d6423SLionel Sambuc /** Read Done. */
185433d6423SLionel Sambuc #define E1000_REG_EERD_DONE	(1 << 4)
186433d6423SLionel Sambuc 
187433d6423SLionel Sambuc /** Read Address Bit Mask. */
188433d6423SLionel Sambuc #define E1000_REG_EERD_ADDR	(0xff   << 8)
189433d6423SLionel Sambuc 
190433d6423SLionel Sambuc /** Read Data Bit Mask. */
191433d6423SLionel Sambuc #define E1000_REG_EERD_DATA	(0xffff << 16)
192433d6423SLionel Sambuc 
193433d6423SLionel Sambuc /**
194433d6423SLionel Sambuc  * @}
195433d6423SLionel Sambuc  */
196433d6423SLionel Sambuc 
197433d6423SLionel Sambuc /**
198433d6423SLionel Sambuc  * @name Interrupt Cause Read.
199433d6423SLionel Sambuc  * @{
200433d6423SLionel Sambuc  */
201433d6423SLionel Sambuc 
202433d6423SLionel Sambuc /** Transmit Descripts Written Back. */
203433d6423SLionel Sambuc #define E1000_REG_ICR_TXDW	(1 << 0)
204433d6423SLionel Sambuc 
205433d6423SLionel Sambuc /** Transmit Queue Empty. */
206433d6423SLionel Sambuc #define E1000_REG_ICR_TXQE	(1 << 1)
207433d6423SLionel Sambuc 
208433d6423SLionel Sambuc /** Link Status Change. */
209433d6423SLionel Sambuc #define E1000_REG_ICR_LSC	(1 << 2)
210433d6423SLionel Sambuc 
211433d6423SLionel Sambuc /** Receiver Overrun. */
212433d6423SLionel Sambuc #define E1000_REG_ICR_RXO	(1 << 6)
213433d6423SLionel Sambuc 
214433d6423SLionel Sambuc /** Receiver Timer Interrupt. */
215433d6423SLionel Sambuc #define E1000_REG_ICR_RXT	(1 << 7)
216433d6423SLionel Sambuc 
217433d6423SLionel Sambuc /**
218433d6423SLionel Sambuc  * @}
219433d6423SLionel Sambuc  */
220433d6423SLionel Sambuc 
221433d6423SLionel Sambuc /**
222433d6423SLionel Sambuc  * @name Interrupt Mask Set/Read Register Bits.
223433d6423SLionel Sambuc  * @{
224433d6423SLionel Sambuc  */
225433d6423SLionel Sambuc 
226433d6423SLionel Sambuc /** Transmit Descripts Written Back. */
227433d6423SLionel Sambuc #define E1000_REG_IMS_TXDW	(1 << 0)
228433d6423SLionel Sambuc 
229433d6423SLionel Sambuc /** Transmit Queue Empty. */
230433d6423SLionel Sambuc #define E1000_REG_IMS_TXQE	(1 << 1)
231433d6423SLionel Sambuc 
232433d6423SLionel Sambuc /** Link Status Change. */
233433d6423SLionel Sambuc #define E1000_REG_IMS_LSC	(1 << 2)
234433d6423SLionel Sambuc 
235433d6423SLionel Sambuc /** Receiver FIFO Overrun. */
236433d6423SLionel Sambuc #define E1000_REG_IMS_RXO	(1 << 6)
237433d6423SLionel Sambuc 
238433d6423SLionel Sambuc /** Receiver Timer Interrupt. */
239433d6423SLionel Sambuc #define E1000_REG_IMS_RXT	(1 << 7)
240433d6423SLionel Sambuc 
241433d6423SLionel Sambuc /**
242433d6423SLionel Sambuc  * @}
243433d6423SLionel Sambuc  */
244433d6423SLionel Sambuc 
245433d6423SLionel Sambuc /**
246433d6423SLionel Sambuc  * @name Receive Control Register Bits.
247433d6423SLionel Sambuc  * @{
248433d6423SLionel Sambuc  */
249433d6423SLionel Sambuc 
250433d6423SLionel Sambuc /** Receive Enable. */
251433d6423SLionel Sambuc #define E1000_REG_RCTL_EN	(1 << 1)
252433d6423SLionel Sambuc 
253*f7df02e7SDavid van Moolenbroek /** Unicast Promiscuous Enable. */
254*f7df02e7SDavid van Moolenbroek #define E1000_REG_RCTL_UPE	(1 << 3)
255*f7df02e7SDavid van Moolenbroek 
256*f7df02e7SDavid van Moolenbroek /** Multicast Promiscuous Enable. */
257433d6423SLionel Sambuc #define E1000_REG_RCTL_MPE	(1 << 4)
258433d6423SLionel Sambuc 
259433d6423SLionel Sambuc /** Broadcast Accept Mode. */
260433d6423SLionel Sambuc #define E1000_REG_RCTL_BAM	(1 << 15)
261433d6423SLionel Sambuc 
262433d6423SLionel Sambuc /** Receive Buffer Size. */
263433d6423SLionel Sambuc #define E1000_REG_RCTL_BSIZE	((1 << 16) | (1 << 17))
264433d6423SLionel Sambuc 
265433d6423SLionel Sambuc /**
266433d6423SLionel Sambuc  * @}
267433d6423SLionel Sambuc  */
268433d6423SLionel Sambuc 
269433d6423SLionel Sambuc /**
270433d6423SLionel Sambuc  * @name Transmit Control Register Bits.
271433d6423SLionel Sambuc  * @{
272433d6423SLionel Sambuc  */
273433d6423SLionel Sambuc 
274433d6423SLionel Sambuc /** Transmit Enable. */
275433d6423SLionel Sambuc #define E1000_REG_TCTL_EN	(1 << 1)
276433d6423SLionel Sambuc 
277433d6423SLionel Sambuc /** Pad Short Packets. */
278433d6423SLionel Sambuc #define E1000_REG_TCTL_PSP	(1 << 3)
279433d6423SLionel Sambuc 
280433d6423SLionel Sambuc /**
281433d6423SLionel Sambuc  * @}
282433d6423SLionel Sambuc  */
283433d6423SLionel Sambuc 
284433d6423SLionel Sambuc /**
285433d6423SLionel Sambuc  * @name Receive Address High Register Bits.
286433d6423SLionel Sambuc  * @{
287433d6423SLionel Sambuc  */
288433d6423SLionel Sambuc 
289433d6423SLionel Sambuc /** Receive Address Valid. */
290433d6423SLionel Sambuc #define E1000_REG_RAH_AV	(1 << 31)
291433d6423SLionel Sambuc 
292433d6423SLionel Sambuc /**
293433d6423SLionel Sambuc  * @}
294433d6423SLionel Sambuc  */
295433d6423SLionel Sambuc 
296433d6423SLionel Sambuc /**
297433d6423SLionel Sambuc  * @name ICH Flash Registers.
298433d6423SLionel Sambuc  * @see http://gitweb.dragonflybsd.org
299433d6423SLionel Sambuc  * @{
300433d6423SLionel Sambuc  */
301433d6423SLionel Sambuc 
302433d6423SLionel Sambuc #define ICH_FLASH_GFPREG                 0x0000
303433d6423SLionel Sambuc #define ICH_FLASH_HSFSTS                 0x0004
304433d6423SLionel Sambuc #define ICH_FLASH_HSFCTL                 0x0006
305433d6423SLionel Sambuc #define ICH_FLASH_FADDR                  0x0008
306433d6423SLionel Sambuc #define ICH_FLASH_FDATA0                 0x0010
307433d6423SLionel Sambuc #define FLASH_GFPREG_BASE_MASK           0x1FFF
308433d6423SLionel Sambuc #define FLASH_SECTOR_ADDR_SHIFT          12
309433d6423SLionel Sambuc #define ICH_FLASH_READ_COMMAND_TIMEOUT   500
310433d6423SLionel Sambuc #define ICH_FLASH_LINEAR_ADDR_MASK       0x00FFFFFF
311433d6423SLionel Sambuc #define ICH_CYCLE_READ                   0
312433d6423SLionel Sambuc #define ICH_FLASH_CYCLE_REPEAT_COUNT     10
313433d6423SLionel Sambuc 
314433d6423SLionel Sambuc /**
315433d6423SLionel Sambuc  * @}
316433d6423SLionel Sambuc  */
317433d6423SLionel Sambuc 
318433d6423SLionel Sambuc #endif /* __E1000_REG_H */
319