2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 AMD8111 based 10/100 Ethernet Controller driver definitions.
36 /* Hardware definitions */
38 #define B31_MASK 0x80000000
39 #define B30_MASK 0X40000000
40 #define B29_MASK 0x20000000
41 #define B28_MASK 0x10000000
42 #define B27_MASK 0x08000000
43 #define B26_MASK 0x04000000
44 #define B25_MASK 0x02000000
45 #define B24_MASK 0x01000000
46 #define B23_MASK 0x00800000
47 #define B22_MASK 0x00400000
48 #define B21_MASK 0x00200000
49 #define B20_MASK 0x00100000
50 #define B19_MASK 0x00080000
51 #define B18_MASK 0x00040000
52 #define B17_MASK 0x00020000
53 #define B16_MASK 0x00010000
55 #define B15_MASK 0x8000
56 #define B14_MASK 0x4000
57 #define B13_MASK 0x2000
58 #define B12_MASK 0x1000
59 #define B11_MASK 0x0800
60 #define B10_MASK 0x0400
61 #define B9_MASK 0x0200
62 #define B8_MASK 0x0100
63 #define B7_MASK 0x0080
64 #define B6_MASK 0x0040
65 #define B5_MASK 0x0020
66 #define B4_MASK 0x0010
67 #define B3_MASK 0x0008
68 #define B2_MASK 0x0004
69 #define B1_MASK 0x0002
70 #define B0_MASK 0x0001
72 /* PCI register offset */
73 #define PCI_ID_REG 0x00
74 #define PCI_COMMAND_REG 0x04
75 /* #define MEMEN_BIT B1_MASK */
76 /* #define IOEN_BIT B0_MASK */
77 #define PCI_REV_ID_REG 0x08
78 #define PCI_MEM_BASE_REG 0x10
79 /* #define MEMBASE_MASK 0xFFFFF000 */
80 /* #define MEMBASE_SIZE 4096 */
81 #define PCI_INTR_REG 0x3C
82 #define PCI_STATUS_REG 0x06
83 #define PCI_CAP_ID_REG_OFFSET 0x34
84 #define PCI_PMC_REG_OFFSET 0x36
85 #define PCI_PMCSR_REG_OFFSET 0x38
87 /* #define NEW_CAP 0x0010 */
90 #define PARTID_MASK 0xFFFFF000
91 #define PARTID_START_BIT 12
93 /* #define LANCE_DWIO_RESET_PORT 0x18
94 #define LANCE_WIO_RESET_PORT 0x14 */
95 #define MIB_OFFSET 0x28
97 /* Command style register access
99 Registers CMD0, CMD2, CMD3,CMD7 and INTEN0 uses a write access technique called command style access. It allows the write to selected bits of this register without altering the bits that are not selected. Command style registers are divided into 4 bytes that can be written independently. Higher order bit of each byte is the value bit that specifies the value that will be written into the selected bits of register.
101 eg., if the value 10011010b is written into the least significant byte of a command style register, bits 1,3 and 4 of the register will be set to 1, and the other bits will not be altered. If the value 00011010b is written into the same byte, bits 1,3 and 4 will be cleared to 0 and the other bits will not be altered.
105 /* Offset for Memory Mapped Registers. */
106 /* 32 bit registers */
108 #define ASF_STAT 0x00 /* ASF status register */
109 #define CHIPID 0x04 /* Chip ID regsiter */
110 #define MIB_DATA 0x10 /* MIB data register */
111 #define MIB_ADDR 0x14 /* MIB address register */
112 #define STAT0 0x30 /* Status0 register */
113 #define INT0 0x38 /* Interrupt0 register */
114 #define INTEN0 0x40 /* Interrupt0 enable register*/
115 #define CMD0 0x48 /* Command0 register */
116 #define CMD2 0x50 /* Command2 register */
117 #define CMD3 0x54 /* Command3 resiter */
118 #define CMD7 0x64 /* Command7 register */
120 #define CTRL1 0x6C /* Control1 register */
121 #define CTRL2 0x70 /* Control2 register */
123 #define XMT_RING_LIMIT 0x7C /* Transmit ring limit register */
125 #define AUTOPOLL0 0x88 /* Auto-poll0 register */
126 #define AUTOPOLL1 0x8A /* Auto-poll1 register */
127 #define AUTOPOLL2 0x8C /* Auto-poll2 register */
128 #define AUTOPOLL3 0x8E /* Auto-poll3 register */
129 #define AUTOPOLL4 0x90 /* Auto-poll4 register */
130 #define AUTOPOLL5 0x92 /* Auto-poll5 register */
132 #define AP_VALUE 0x98 /* Auto-poll value register */
133 #define DLY_INT_A 0xA8 /* Group A delayed interrupt register */
134 #define DLY_INT_B 0xAC /* Group B delayed interrupt register */
136 #define FLOW_CONTROL 0xC8 /* Flow control register */
137 #define PHY_ACCESS 0xD0 /* PHY access register */
139 #define STVAL 0xD8 /* Software timer value register */
141 #define XMT_RING_BASE_ADDR0 0x100 /* Transmit ring0 base addr register */
142 #define XMT_RING_BASE_ADDR1 0x108 /* Transmit ring1 base addr register */
143 #define XMT_RING_BASE_ADDR2 0x110 /* Transmit ring2 base addr register */
144 #define XMT_RING_BASE_ADDR3 0x118 /* Transmit ring2 base addr register */
146 #define RCV_RING_BASE_ADDR0 0x120 /* Transmit ring0 base addr register */
148 #define PMAT0 0x190 /* OnNow pattern register0 */
149 #define PMAT1 0x194 /* OnNow pattern register1 */
151 /* 16bit registers */
153 #define XMT_RING_LEN0 0x140 /* Transmit Ring0 length register */
154 #define XMT_RING_LEN1 0x144 /* Transmit Ring1 length register */
155 #define XMT_RING_LEN2 0x148 /* Transmit Ring2 length register */
156 #define XMT_RING_LEN3 0x14C /* Transmit Ring3 length register */
158 #define RCV_RING_LEN0 0x150 /* Transmit Ring0 length register */
160 #define SRAM_SIZE 0x178 /* SRAM size register */
161 #define SRAM_BOUNDARY 0x17A /* SRAM boundary register */
165 #define PADR 0x160 /* Physical address register */
169 #define LADRF 0x168 /* Logical address filter register */
171 /* 8bit regsisters */
173 #define IFS1 0x18C /* Inter-frame spacing Part1 register */
174 #define IFS 0x18D /* Inter-frame spacing register */
176 /* Register Bit Definitions */
178 /* STAT_ASF 0x00, 32bit register */
179 #define ASF_INIT_DONE B1_MASK
180 #define ASF_INIT_PRESENT B0_MASK
182 /* MIB_ADDR 0x14, 16bit register */
183 #define MIB_CMD_ACTIVE B15_MASK
184 #define MIB_RD_CMD B13_MASK
185 #define MIB_CLEAR B12_MASK
186 #define MIB_ADDRESS 0x0000003F /* 5:0 */
188 /* QOS_ADDR 0x1C, 16bit register */
189 #define QOS_CMD_ACTIVE B15_MASK
190 #define QOS_WR_CMD B14_MASK
191 #define QOS_RD_CMD B13_MASK
192 #define QOS_ADDRESS 0x0000001F /* 4:0 */
194 /* STAT0 0x30, 32bit register */
195 #define PAUSE_PEND B14_MASK
196 #define PAUSING B13_MASK
197 #define PMAT_DET B12_MASK
198 #define MP_DET B11_MASK
199 #define LC_DET B10_MASK
200 #define SPEED_MASK 0x0380 /* 9:7 */
201 #define FULL_DPLX B6_MASK
202 #define LINK_STATS B5_MASK
203 #define AUTONEG_COMPLETE B4_MASK
204 #define MIIPD B3_MASK
205 #define RX_SUSPENDED B2_MASK
206 #define TX_SUSPENDED B1_MASK
207 #define RUNNING B0_MASK
208 #define PHY_SPEED_10 0x2
209 #define PHY_SPEED_100 0x3
211 /* INT0 0x38, 32bit register */
212 #define INTR B31_MASK
213 #define PCSINT B28_MASK
214 #define LCINT B27_MASK
215 #define APINT5 B26_MASK
216 #define APINT4 B25_MASK
217 #define APINT3 B24_MASK
218 #define TINT_SUM B23_MASK
219 #define APINT2 B22_MASK
220 #define APINT1 B21_MASK
221 #define APINT0 B20_MASK
222 #define MIIPDTINT B19_MASK
223 #define MCCIINT B18_MASK
224 #define MCCINT B17_MASK
225 #define MREINT B16_MASK
226 #define RINT_SUM B15_MASK
227 #define SPNDINT B14_MASK
228 #define MPINT B13_MASK
229 #define SINT B12_MASK
230 #define TINT3 B11_MASK
231 #define TINT2 B10_MASK
232 #define TINT1 B9_MASK
233 #define TINT0 B8_MASK
235 #define STINT B4_MASK
236 #define RINT3 B3_MASK
237 #define RINT2 B2_MASK
238 #define RINT1 B1_MASK
239 #define RINT0 B0_MASK
241 /* INTEN0 0x40, 32bit register */
242 #define VAL3 B31_MASK /* VAL bit for byte 3 */
243 #define VAL2 B23_MASK /* VAL bit for byte 2 */
244 #define VAL1 B15_MASK /* VAL bit for byte 1 */
245 #define VAL0 B7_MASK /* VAL bit for byte 0 */
247 #define PSCINTEN B28_MASK
248 #define LCINTEN B27_MASK
249 #define APINT5EN B26_MASK
250 #define APINT4EN B25_MASK
251 #define APINT3EN B24_MASK
253 #define APINT2EN B22_MASK
254 #define APINT1EN B21_MASK
255 #define APINT0EN B20_MASK
256 #define MIIPDTINTEN B19_MASK
257 #define MCCIINTEN B18_MASK
258 #define MCCINTEN B17_MASK
259 #define MREINTEN B16_MASK
261 #define SPNDINTEN B14_MASK
262 #define MPINTEN B13_MASK
263 #define SINTEN B12_MASK
264 #define TINTEN3 B11_MASK
265 #define TINTEN2 B10_MASK
266 #define TINTEN1 B9_MASK
267 #define TINTEN0 B8_MASK
269 #define STINTEN B4_MASK
270 #define RINTEN3 B3_MASK
271 #define RINTEN2 B2_MASK
272 #define RINTEN1 B1_MASK
273 #define RINTEN0 B0_MASK
275 #define INTEN0_CLEAR 0x1F7F7F1F /* Command style register */
277 /* CMD0 0x48, 32bit register */
279 #define RDMD3 B19_MASK
280 #define RDMD2 B18_MASK
281 #define RDMD1 B17_MASK
282 #define RDMD0 B16_MASK
284 #define TDMD3 B11_MASK
285 #define TDMD2 B10_MASK
286 #define TDMD1 B9_MASK
287 #define TDMD0 B8_MASK
289 #define UINTCMD B6_MASK
290 #define RX_FAST_SPND B5_MASK
291 #define TX_FAST_SPND B4_MASK
292 #define RX_SPND B3_MASK
293 #define TX_SPND B2_MASK
294 #define INTREN B1_MASK
297 #define CMD0_CLEAR 0x000F0F7F /* Command style register */
299 /* CMD2 0x50, 32bit register */
301 #define CONDUIT_MODE B29_MASK
304 #define DRCVPA B18_MASK
305 #define DRCVBC B17_MASK
306 #define PROM B16_MASK
308 #define ASTRP_RCV B13_MASK
309 #define FCOLL B12_MASK
310 #define EMBA B11_MASK
311 #define DXMT2PD B10_MASK
312 #define LTINTEN B9_MASK
313 #define DXMTFCS B8_MASK
315 #define APAD_XMT B6_MASK
317 #define INLOOP B4_MASK
318 #define EXLOOP B3_MASK
319 #define REX_RTRY B2_MASK
320 #define REX_UFLO B1_MASK
321 #define REX_LCOL B0_MASK
323 #define CMD2_CLEAR 0x3F7F3F7F /* Command style register */
325 /* CMD3 0x54, 32bit register */
327 #define ASF_INIT_DONE_ALIAS B29_MASK
329 #define JUMBO B21_MASK
330 #define VSIZE B20_MASK
331 #define VLONLY B19_MASK
332 #define VL_TAG_DEL B18_MASK
334 #define EN_PMGR B14_MASK
335 #define INTLEVEL B13_MASK
336 #define FORCE_FULL_DUPLEX B12_MASK
337 #define FORCE_LINK_STATUS B11_MASK
338 #define APEP B10_MASK
339 #define MPPLBA B9_MASK
341 #define RESET_PHY_PULSE B2_MASK
342 #define RESET_PHY B1_MASK
343 #define PHY_RST_POL B0_MASK
344 /* CMD7 0x64, 32bit register */
346 #define PMAT_SAVE_MATCH B4_MASK
347 #define PMAT_MODE B3_MASK
348 #define MPEN_SW B1_MASK
349 #define LCMODE_SW B0_MASK
351 #define CMD7_CLEAR 0x0000001B /* Command style register */
352 /* CTRL0 0x68, 32bit register */
353 #define PHY_SEL 0x03000000 /* 25:24 */
354 #define RESET_PHY_WIDTH 0x00FF0000 /* 23:16 */
355 #define BSWP_REGS B10_MASK
356 #define BSWP_DESC B9_MASK
357 #define BSWP_DATA B8_MASK
358 #define CACHE_ALIGN B4_MASK
359 #define BURST_LIMIT 0x0000000F /* 3:0 */
361 /* CTRL1 0x6C, 32bit register */
362 #define SLOTMOD_MASK 0x03000000 /* 25:24 */
363 #define XMTSP_MASK 0x300 /* 17:16 */
364 #define XMTSP_128 0x200
365 #define XMTSP_64 0x100
366 #define CRTL1_DEFAULT 0x00000017
368 /* CTRL2 0x70, 32bit register */
369 #define FS_MASK 0x00070000 /* 18:16 */
370 #define FMDC_MASK 0x00000300 /* 9:8 */
371 #define XPHYRST B7_MASK
372 #define XPHYANE B6_MASK
373 #define XPHYFD B5_MASK
374 #define XPHYSP B3_MASK /* 4:3 */
375 #define APDW_MASK 0x00000007 /* 2:0 */
377 /* RCV_RING_CFG 0x78, 16bit register */
378 #define RCV_DROP3 B11_MASK
379 #define RCV_DROP2 B10_MASK
380 #define RCV_DROP1 B9_MASK
381 #define RCV_DROP0 B8_MASK
382 #define RCV_RING_DEFAULT 0x0030 /* 5:4 */
383 #define RCV_RING3_EN B3_MASK
384 #define RCV_RING2_EN B2_MASK
385 #define RCV_RING1_EN B1_MASK
386 #define RCV_RING0_EN B0_MASK
388 /* XMT_RING_LIMIT 0x7C, 32bit register */
389 #define XMT_RING2_LIMIT 0x00FF0000 /* 23:16 */
390 #define XMT_RING1_LIMIT 0x0000FF00 /* 15:8 */
391 #define XMT_RING0_LIMIT 0x000000FF /* 7:0 */
393 /* AUTOPOLL0 0x88, 16bit register */
394 #define AP_REG0_EN B15_MASK
395 #define AP_REG0_ADDR_MASK 0x1F00 /* 12:8 */
396 #define AP_PHY0_ADDR_MASK 0x001F /* 4:0 */
398 /* AUTOPOLL1 0x8A, 16bit register */
399 #define AP_REG1_EN B15_MASK
400 #define AP_REG1_ADDR_MASK 0x1F00 /* 12:8 */
401 #define AP_PRE_SUP1 B6_MASK
402 #define AP_PHY1_DFLT B5_MASK
403 #define AP_PHY1_ADDR_MASK 0x001F /* 4:0 */
405 /* AUTOPOLL2 0x8C, 16bit register */
406 #define AP_REG2_EN B15_MASK
407 #define AP_REG2_ADDR_MASK 0x1F00 /* 12:8 */
408 #define AP_PRE_SUP2 B6_MASK
409 #define AP_PHY2_DFLT B5_MASK
410 #define AP_PHY2_ADDR_MASK 0x001F /* 4:0 */
412 /* AUTOPOLL3 0x8E, 16bit register */
413 #define AP_REG3_EN B15_MASK
414 #define AP_REG3_ADDR_MASK 0x1F00 /* 12:8 */
415 #define AP_PRE_SUP3 B6_MASK
416 #define AP_PHY3_DFLT B5_MASK
417 #define AP_PHY3_ADDR_MASK 0x001F /* 4:0 */
419 /* AUTOPOLL4 0x90, 16bit register */
420 #define AP_REG4_EN B15_MASK
421 #define AP_REG4_ADDR_MASK 0x1F00 /* 12:8 */
422 #define AP_PRE_SUP4 B6_MASK
423 #define AP_PHY4_DFLT B5_MASK
424 #define AP_PHY4_ADDR_MASK 0x001F /* 4:0 */
426 /* AUTOPOLL5 0x92, 16bit register */
427 #define AP_REG5_EN B15_MASK
428 #define AP_REG5_ADDR_MASK 0x1F00 /* 12:8 */
429 #define AP_PRE_SUP5 B6_MASK
430 #define AP_PHY5_DFLT B5_MASK
431 #define AP_PHY5_ADDR_MASK 0x001F /* 4:0 */
433 /* AP_VALUE 0x98, 32bit ragister */
434 #define AP_VAL_ACTIVE B31_MASK
435 #define AP_VAL_RD_CMD B29_MASK
436 #define AP_ADDR 0x00070000 /* 18:16 */
437 #define AP_VAL 0x0000FFFF /* 15:0 */
439 /* PCS_ANEG 0x9C, 32bit register */
440 #define SYNC_LOST B10_MASK
441 #define IMATCH B9_MASK
442 #define CMATCH B8_MASK
443 #define PCS_AN_IDLE B1_MASK
444 #define PCS_AN_CFG B0_MASK
446 /* DLY_INT_A 0xA8, 32bit register */
447 #define DLY_INT_A_R3 B31_MASK
448 #define DLY_INT_A_R2 B30_MASK
449 #define DLY_INT_A_R1 B29_MASK
450 #define DLY_INT_A_R0 B28_MASK
451 #define DLY_INT_A_T3 B27_MASK
452 #define DLY_INT_A_T2 B26_MASK
453 #define DLY_INT_A_T1 B25_MASK
454 #define DLY_INT_A_T0 B24_MASK
455 #define EVENT_COUNT_A 0x00FF0000 /* 20:16 */
456 #define MAX_DELAY_TIME_A 0x000007FF /* 10:0 */
458 /* DLY_INT_B 0xAC, 32bit register */
459 #define DLY_INT_B_R3 B31_MASK
460 #define DLY_INT_B_R2 B30_MASK
461 #define DLY_INT_B_R1 B29_MASK
462 #define DLY_INT_B_R0 B28_MASK
463 #define DLY_INT_B_T3 B27_MASK
464 #define DLY_INT_B_T2 B26_MASK
465 #define DLY_INT_B_T1 B25_MASK
466 #define DLY_INT_B_T0 B24_MASK
467 #define EVENT_COUNT_B 0x00FF0000 /* 20:16 */
468 #define MAX_DELAY_TIME_B 0x000007FF /* 10:0 */
470 /* DFC_THRESH2 0xC0, 16bit register */
471 #define DFC_THRESH2_HIGH 0xFF00 /* 15:8 */
472 #define DFC_THRESH2_LOW 0x00FF /* 7:0 */
474 /* DFC_THRESH3 0xC2, 16bit register */
475 #define DFC_THRESH3_HIGH 0xFF00 /* 15:8 */
476 #define DFC_THRESH3_LOW 0x00FF /* 7:0 */
478 /* DFC_THRESH0 0xC4, 16bit register */
479 #define DFC_THRESH0_HIGH 0xFF00 /* 15:8 */
480 #define DFC_THRESH0_LOW 0x00FF /* 7:0 */
482 /* DFC_THRESH1 0xC6, 16bit register */
483 #define DFC_THRESH1_HIGH 0xFF00 /* 15:8 */
484 #define DFC_THRESH1_LOW 0x00FF /* 7:0 */
486 /* FLOW_CONTROL 0xC8, 32bit register */
487 #define PAUSE_LEN_CHG B30_MASK
488 #define FFC_EN B28_MASK
489 #define DFC_RING3_EN B27_MASK
490 #define DFC_RING2_EN B26_MASK
491 #define DFC_RING1_EN B25_MASK
492 #define DFC_RING0_EN B24_MASK
493 #define FIXP_CONGEST B21_MASK
496 #define FIXP B18_MASK
497 #define FCPEN B17_MASK
498 #define FCCMD B16_MASK
499 #define PAUSE_LEN 0x0000FFFF /* 15:0 */
501 /* FFC THRESH 0xCC, 32bit register */
502 #define FFC_HIGH 0xFFFF0000 /* 31:16 */
503 #define FFC_LOW 0x0000FFFF /* 15:0 */
505 /* PHY_ ACCESS 0xD0, 32bit register */
506 #define PHY_CMD_ACTIVE B31_MASK
507 #define PHY_WR_CMD B30_MASK
508 #define PHY_RD_CMD B29_MASK
509 #define PHY_RD_ERR B28_MASK
510 #define PHY_PRE_SUP B27_MASK
511 #define PHY_ADDR 0x03E00000 /* 25:21 */
512 #define PHY_REG_ADDR 0x001F0000 /* 20:16 */
513 #define PHY_DATA 0x0000FFFF /* 15:0 */
515 /* LED0..3 0xE0..0xE6, 16bit register */
516 #define LEDOUT B15_MASK
517 #define LEDPOL B14_MASK
518 #define LEDDIS B13_MASK
519 #define LEDSTRETCH B12_MASK
520 #define LED1000 B8_MASK
521 #define LED100 B7_MASK
522 #define LEDMP B6_MASK
523 #define LEDFD B5_MASK
524 #define LEDLINK B4_MASK
525 #define LEDRCVMAT B3_MASK
526 #define LEDXMT B2_MASK
527 #define LEDRCV B1_MASK
528 #define LEDCOLOUT B0_MASK
530 /* EEPROM_ACC 0x17C, 16bit register */
531 #define PVALID B15_MASK
532 #define PREAD B14_MASK
533 #define EEDET B13_MASK
537 #define edi_edo b0_MASK
539 /* PMAT0 0x190, 32bit register */
540 #define PMR_ACTIVE B31_MASK
541 #define PMR_WR_CMD B30_MASK
542 #define PMR_RD_CMD B29_MASK
543 #define PMR_BANK B28_MASK
544 #define PMR_ADDR 0x007F0000 /* 22:16 */
545 #define PMR_B4 0x000000FF /* 15:0 */
547 /* PMAT1 0x194, 32bit register */
548 #define PMR_B3 0xFF000000 /* 31:24 */
549 #define PMR_B2 0x00FF0000 /* 23:16 */
550 #define PMR_B1 0x0000FF00 /* 15:8 */
551 #define PMR_B0 0x000000FF /* 7:0 */
553 /************************************************************************/
555 /* MIB counter definitions */
557 /************************************************************************/
559 #define rcv_miss_pkts 0x00
560 #define rcv_octets 0x01
561 #define rcv_broadcast_pkts 0x02
562 #define rcv_multicast_pkts 0x03
563 #define rcv_undersize_pkts 0x04
564 #define rcv_oversize_pkts 0x05
565 #define rcv_fragments 0x06
566 #define rcv_jabbers 0x07
567 #define rcv_unicast_pkts 0x08
568 #define rcv_alignment_errors 0x09
569 #define rcv_fcs_errors 0x0A
570 #define rcv_good_octets 0x0B
571 #define rcv_mac_ctrl 0x0C
572 #define rcv_flow_ctrl 0x0D
573 #define rcv_pkts_64_octets 0x0E
574 #define rcv_pkts_65to127_octets 0x0F
575 #define rcv_pkts_128to255_octets 0x10
576 #define rcv_pkts_256to511_octets 0x11
577 #define rcv_pkts_512to1023_octets 0x12
578 #define rcv_pkts_1024to1518_octets 0x13
579 #define rcv_unsupported_opcode 0x14
580 #define rcv_symbol_errors 0x15
581 #define rcv_drop_pkts_ring1 0x16
582 #define rcv_drop_pkts_ring2 0x17
583 #define rcv_drop_pkts_ring3 0x18
584 #define rcv_drop_pkts_ring4 0x19
585 #define rcv_jumbo_pkts 0x1A
587 #define xmt_underrun_pkts 0x20
588 #define xmt_octets 0x21
589 #define xmt_packets 0x22
590 #define xmt_broadcast_pkts 0x23
591 #define xmt_multicast_pkts 0x24
592 #define xmt_collisions 0x25
593 #define xmt_unicast_pkts 0x26
594 #define xmt_one_collision 0x27
595 #define xmt_multiple_collision 0x28
596 #define xmt_deferred_transmit 0x29
597 #define xmt_late_collision 0x2A
598 #define xmt_excessive_defer 0x2B
599 #define xmt_loss_carrier 0x2C
600 #define xmt_excessive_collision 0x2D
601 #define xmt_back_pressure 0x2E
602 #define xmt_flow_ctrl 0x2F
603 #define xmt_pkts_64_octets 0x30
604 #define xmt_pkts_65to127_octets 0x31
605 #define xmt_pkts_128to255_octets 0x32
606 #define xmt_pkts_256to511_octets 0x33
607 #define xmt_pkts_512to1023_octets 0x34
608 #define xmt_pkts_1024to1518_octet 0x35
609 #define xmt_oversize_pkts 0x36
610 #define xmt_jumbo_pkts 0x37
613 /* Driver definitions */
615 #define PCI_VENDOR_ID_AMD 0x1022
616 #define PCI_DEVICE_ID_AMD8111E_7462 0x7462
618 #define MAX_UNITS 16 /* Maximum number of devices possible */
620 #define NUM_TX_BUFFERS 32 /* Number of transmit buffers */
621 #define NUM_RX_BUFFERS 32 /* Number of receive buffers */
623 #define TX_BUFF_MOD_MASK 31 /* (NUM_TX_BUFFERS -1) */
624 #define RX_BUFF_MOD_MASK 31 /* (NUM_RX_BUFFERS -1) */
626 #define NUM_TX_RING_DR 32
627 #define NUM_RX_RING_DR 32
629 #define TX_RING_DR_MOD_MASK 31 /* (NUM_TX_RING_DR -1) */
630 #define RX_RING_DR_MOD_MASK 31 /* (NUM_RX_RING_DR -1) */
632 #define MAX_FILTER_SIZE 64 /* Maximum multicast address */
633 #define AMD8111E_MIN_MTU 60
634 #define AMD8111E_MAX_MTU 9000
636 #define PKT_BUFF_SZ 1536
637 #define MIN_PKT_LEN 60
638 #define ETH_ADDR_LEN 6
640 #define OPTION_VLAN_ENABLE 0x0001
641 #define OPTION_JUMBO_ENABLE 0x0002
642 #define OPTION_MULTICAST_ENABLE 0x0004
643 #define OPTION_WOL_ENABLE 0x0008
644 #define OPTION_WAKE_MAGIC_ENABLE 0x0010
645 #define OPTION_WAKE_PHY_ENABLE 0x0020
647 #define PHY_REG_ADDR_MASK 0x1f
649 /* Assume contoller gets data 10 times the maximum processing time */
650 #define REPEAT_CNT 10;
652 /* amd8111e decriptor flag definitions */
654 #define OWN_BIT B15_MASK
655 #define ADD_FCS_BIT B13_MASK
656 #define LTINT_BIT B12_MASK
657 #define STP_BIT B9_MASK
658 #define ENP_BIT B8_MASK
659 #define KILL_BIT B6_MASK
660 #define TCC_MASK 0x0003
661 #define TCC_VLAN_INSERT B1_MASK
662 #define TCC_VLAN_REPLACE 0x0003
663 #define RESET_RX_FLAGS 0x0000
665 #define ERR_BIT B14_MASK
666 #define FRAM_BIT B13_MASK
667 #define OFLO_BIT B12_MASK
668 #define CRC_BIT B11_MASK
669 #define PAM_BIT B6_MASK
670 #define LAFM_BIT B5_MASK
671 #define BAM_BIT B4_MASK
672 #define TT_MASK 0x000c
673 #define TT_VLAN_TAGGED 0x000c
674 #define TT_PRTY_TAGGED 0x0008
676 /* driver ioctl parameters */
677 #define PHY_ID 0x01 /* currently it is fixed */
678 #define AMD8111E_REG_DUMP_LEN 4096 /* Memory mapped register length */
680 /* amd8111e desriptor format */
682 struct amd8111e_tx_dr{
684 u16 buff_count; /* Size of the buffer pointed by this descriptor */
697 struct amd8111e_rx_dr{
701 u16 msg_count; /* Received message len */
705 u16 buff_count; /* Len of the buffer pointed by descriptor. */
712 struct amd8111e_link_config{
714 #define SPEED_INVALID 0xffff
715 #define DUPLEX_INVALID 0xff
716 #define AUTONEG_INVALID 0xff
718 unsigned long orig_phy_option;
724 u8 reserved; /* 32bit alignment */
726 struct amd8111e_priv{
728 struct amd8111e_tx_dr* tx_ring;
729 struct amd8111e_rx_dr* rx_ring;
730 dma_addr_t tx_ring_dma_addr; /* tx descriptor ring base address */
731 dma_addr_t rx_ring_dma_addr; /* rx descriptor ring base address */
733 struct pci_dev *pci_dev; /* Ptr to the associated pci_dev */
734 struct net_device* amd8111e_net_dev; /* ptr to associated net_device */
735 /* Transmit and recive skbs */
736 struct sk_buff *tx_skbuff[NUM_TX_BUFFERS];
737 struct sk_buff *rx_skbuff[NUM_RX_BUFFERS];
738 /* Transmit and receive dma mapped addr */
739 dma_addr_t tx_dma_addr[NUM_TX_BUFFERS];
740 dma_addr_t rx_dma_addr[NUM_RX_BUFFERS];
741 /* Reg memory mapped address */
744 spinlock_t lock; /* Guard lock */
745 unsigned long rx_idx, tx_idx; /* The next free ring entry */
746 unsigned long tx_complete_idx;
747 unsigned long tx_ring_complete_idx;
748 unsigned long tx_ring_idx;
749 int rx_buff_len; /* Buffer length of rx buffers */
750 int options; /* Options enabled/disabled for the device */
751 unsigned long ext_phy_option;
752 struct amd8111e_link_config link_config;
755 struct net_device *next;
756 #if AMD8111E_VLAN_TAG_USED
757 struct vlan_group *vlgrp;
760 struct net_device_stats stats;
761 struct net_device_stats prev_stats;
762 struct dev_mc_list* mc_list;
765 #define AMD8111E_READ_REG64(_memMapBase, _offset, _pUlData) \
766 *(u32*)(_pUlData) = readl(_memMapBase + (_offset)); \
767 *((u32*)(_pUlData))+1) = readl(_memMapBase + ((_offset)+4))
769 #define AMD8111E_WRITE_REG64(_memMapBase, _offset, _pUlData) \
770 writel(*(u32*)(_pUlData), _memMapBase + (_offset)); \
771 writel(*(u32*)((u8*)(_pUlData)+4), _memMapBase + ((_offset)+4)) \
773 /* maps the external speed options to internal value */
774 static unsigned char speed_duplex_mapping[] = {
776 XPHYANE, /* Auto-negotiation, speed_duplex option 0 */
777 0, /* 10M Half, speed_duplex option 1 */
778 XPHYFD, /* 10M Full, speed_duplex option 2 */
779 XPHYSP, /* 100M Half, speed_duplex option 3 */
780 XPHYFD | XPHYSP /* 100M Full, speed_duplex option 4 */
783 static int speed_duplex[MAX_UNITS] = { 0, };
785 #endif /* _AMD8111E_H */