2 * Acess2 E1000 Network Driver
3 * - By John Hodge (thePowersGang)
6 * - Hardware Definitions
11 typedef struct sRXDesc tRXDesc;
12 typedef struct sTXDesc tTXDesc;
14 #define RXD_STS_PIF (1<<7) // Passed inexact filter (multicast, probably)
15 #define RXD_STS_IPCS (1<<6) // IP Checksum was calculated
16 #define RXD_STS_TCPCS (1<<5) // TCP Checksum was calculated
17 #define RXD_STS_RSV (1<<4) // reserved
18 #define RXD_STS_VP (1<<3) // Packet was 802.1q tagged
19 #define RXD_STS_IXSM (1<<2) // Ignore IPCS/TCPS
20 #define RXD_STS_EOP (1<<1) // Last descriptor in apcket
21 #define RXD_STS_DD (1<<0) // Descriptor Done, buffer data is now valid
23 #define RXD_ERR_RXE (1<<7) // RX Error
24 #define RXD_ERR_IPE (1<<6) // IP Checksum Error
25 #define RXD_ERR_TCPE (1<<5) // TCP/UDP Checksum Error
26 #define RXD_ERR_CXE (1<<4) // Carrier Extension Error (GMII cards [82544GC/EI] only)
27 #define RXD_ERR_SEQ (1<<2) // Sequence Error (aka Framing Error)
28 #define RXD_ERR_SE (1<<1) // Symbol error (TBI mode)
29 #define RXD_ERR_CE (1<<0) // CRC Error / Alignmnet Error
41 #define TXD_CMD_IDE (1<<7) // Interrupt delay enable
42 #define TXD_CMD_VLE (1<<6) // VLAN Packet enable
43 #define TXD_CMD_DEXT (1<<5) // Use extended descriptor format (TODO)
44 #define TXD_CMD_RPS (1<<4) // GC/EI Report Packet Set
45 #define TXD_CMD_RS (1<<3) // Report Status
46 #define TXD_CMD_IC (1<<2) // Insert checksum at indicated offset
47 #define TXD_CMD_IFCS (1<<1) // Insert frame check sum
48 #define TXD_CMD_EOP (1<<0) // End of packet
50 #define TXD_STS_TU (1<<3) // [GC/EI] Transmit Underrun
51 #define TXD_STS_LC (1<<2) // Late collision
52 #define TXD_STS_EC (1<<1) // Excess collisions
53 #define TXD_STS_DD (1<<0) // Descriptor Done
59 Uint8 CSO; // TCP Checksum offset
62 Uint8 CSS; // TCP Checksum start
66 #define TXCD_CMD_IDE (1<<(24+7)) // Interrupt Delay
67 #define TXCD_CMD_DEXT (1<<(24+5)) // Descriptor Extension (Must be one)
68 #define TXCD_CMD_RS (1<<(24+3)) // Report Status
69 #define TXCD_CMD_TSE (1<<(24+2)) // TCP Segmentation Enable
70 #define TXCD_CMD_IP (1<<(24+1)) // IP version (1=IPv4, 0=IPv6)
71 #define TXCD_CMD_TCP (1<<(24+0)) // Packet Type (1=TCP, 0=Other)
73 #define TXCD_STS_DD (1<<0) // Descriptor Done
77 Uint8 IPCSS; // IP Checksum Start
78 Uint8 IPCSO; // IP Checksum Offset
79 Uint16 IPCSE; // IP Checksum Ending (last byte)
80 Uint8 TUCSS; // TCP/UDP Checksum Start
81 Uint8 TUCSO; // TCP/UDP Checksum Offset
82 Uint16 TUCSE; // TCP/UDP Checksum Ending
83 Uint32 CmdLen; // [0:19] Length, [20:23] DTYP (0), [24:31] TUCMD
85 Uint8 HdrLen; // Header length
86 Uint16 MSS; // Maximum segment size
89 #define TXDD_CMD_IDE (1<<(24+7)) // Interrupt Delay
90 #define TXDD_CMD_VLE (1<<(24+6)) // VLAN Enable
91 #define TXDD_CMD_DEXT (1<<(24+5)) // Descriptor Extension
92 #define TXDD_CMD_RPS (1<<(24+4)) // [GC/EI] Report Packet Sent
93 #define TXDD_CMD_RS (1<<(24+3)) // Report Status
94 #define TXDD_CMD_TSE (1<<(24+2)) // TCP Segmentation Enable
95 #define TXDD_CMD_IFCS (1<<(24+1)) // Insert FCS
96 #define TXDD_CMD_EOP (1<<(24+0)) // End of packet
98 #define TXDD_STS_TU (1<<3) // [GC/EI] Transmit Underrun
99 #define TXDD_STS_LC (1<<2) // Late collision
100 #define TXDD_STS_EC (1<<1) // Excess collisions
101 #define TXDD_STS_DD (1<<0) // Descriptor Done
103 #define TXDD_POPTS_TXSM (1<<1) // Insert TCP/UDP Checksum
104 #define TXDD_POPTS_IXSM (1<<0) // Insert IP Checksum
109 Uint32 CmdLen; // [0:19] Length, [20:23] DTYP (1), [24:31] DCMD
111 Uint8 POpts; // Packet option field
115 #define REG32(card,ofs) (((volatile Uint32*)card->MMIOBase)[ofs/4])
116 #define REG64(card,ofs) (((volatile Uint64*)card->MMIOBase)[ofs/8])
124 REG_CTRL_EXT = 0x018,
127 REG_FCAL = 0x028, // 64-bit value
131 REG_ICR = 0x0C0, // Interrupt cause read
132 REG_ITR = 0x0C4, // Interrupt throttling
133 REG_ICS = 0x0C8, // Interrupt cause set
134 REG_IMS = 0x0D0, // Interrupt mask set/read
135 REG_IMC = 0x0D8, // Interrupt mask clear
137 REG_TXCW = 0x178, // N/A for 82540EP/EM, 82541xx and 82547GI/EI
138 REG_RXCW = 0x180, // ^^
147 REG_RXDCTL = 0x2820, // Receive Descriptor Control
154 REG_TDIV = 0x3820, // Transmit Interrupt Delay Value
155 REG_TXDCTL = 0x3828, // Transmit Descriptor Control
157 REG_MTA0 = 0x5200, // 128 entries
158 REG_RA0 = 0x5400, // 16 entries of ?
159 REG_VFTA0 = 0x6500, // 128 entries
162 #define CTRL_FD (1 << 0) // Full-Duplex
163 #define CTRL_LRST (1 << 3) // Link Reset
164 #define CTRL_ASDE (1 << 5) // Auto-Speed Detection Enable
165 #define CTRL_SLU (1 << 6) // Set link up
167 #define CTRL_SDP0_DATA (1 << 18) // Software Programmable IO #0 (Data)
168 #define CTRL_SDP1_DATA (1 << 19) // Software Programmable IO #1 (Data)
170 #define CTRL_RST (1 << 26) // Software reset (cleared by hw once complete)
171 #define CTRL_RFCE (1 << 27) // Receive Flow Control Enable
172 #define CTRL_TFCE (1 << 28) // Transmit Flow Control Enable
173 #define CTRL_VME (1 << 30) // VLAN Mode Enable
174 #define CTRL_PHY_RST (1 << 31) // PHY Reset (3uS)
176 #define ICR_TXDW (1 << 0) // Transmit Descriptor Written Back
177 #define ICR_TXQE (1 << 1) // Transmit Queue Empty
178 #define ICR_LSC (1 << 2) // Link Status Change
179 #define ICR_RXSEQ (1 << 3) // Receive Sequence Error (Framing Error)
180 #define ICR_RXDMT0 (1 << 4) // Receive Descriptor Minimum Threshold Reached (need more RX descs)
181 #define ICR_RXO (1 << 6) // Receiver overrun
182 #define ICR_RXT0 (1 << 7) // Receiver Timer Interrupt
183 #define ICR_MDAC (1 << 9) // MDI/O Access Complete
184 #define ICR_RXCFG (1 << 10) // Receiving /C/ ordered sets
185 #define ICR_PHYINT (1 << 12) // PHY Interrupt
186 #define ICR_GPI_SDP6 (1 << 13) // GP Interrupt SDP6/SDP2
187 #define ICR_GPI_SDP7 (1 << 14) // GP Interrupt SDP7/SDP3
188 #define ICR_TXD_LOW (1 << 15) // Transmit Descriptor Low Threshold hit
189 #define ICR_SRPD (1 << 16) // Small Receive Packet Detected
191 #define RCTL_EN (1 << 1) // Receiver Enable
192 #define RCTL_SBP (1 << 2) // Store Bad Packets
193 #define RCTL_UPE (1 << 3) // Unicast Promiscuous Enabled
194 #define RCTL_MPE (1 << 4) // Multicast Promiscuous Enabled
195 #define RCTL_LPE (1 << 5) // Long Packet Reception Enable
196 #define RCTL_LBM (3 << 6) // Loopback mode
198 RCTL_LBM_NONE = 0 << 6, // - No Loopback
199 RCTL_LBM_UD1 = 1 << 6, // - Undefined
200 RCTL_LBM_UD2 = 2 << 6, // - Undefined
201 RCTL_LBM_PHY = 3 << 6, // - PHY or external SerDes loopback
203 #define RCTL_RDMTS (3 << 8) // Receive Descriptor Minimum Threshold Size
205 RCTL_RDMTS_1_2 = 0 << 8, // - 1/2 RDLEN free
206 RCTL_RDMTS_1_4 = 1 << 8, // - 1/4 RDLEN free
207 RCTL_RDMTS_1_8 = 2 << 8, // - 1/8 RDLEN free
208 RCTL_RDMTS_RSVD = 3 << 8, // - Reserved
210 #define RCTL_MO (3 << 12) // Multicast Offset
212 RCTL_MO_36 = 0 << 12, // bits [47:36] of multicast address
213 RCTL_MO_35 = 1 << 12, // bits [46:35] of multicast address
214 RCTL_MO_34 = 2 << 12, // bits [45:34] of multicast address
215 RCTL_MO_32 = 3 << 12, // bits [43:32] of multicast address
217 #define RCTL_BAM (1 << 15) // Broadcast Accept Mode
218 #define RCTL_BSIZE (1 << 16) // Receive Buffer Size
220 RCTL_BSIZE_2048 = (0 << 16), // - 2048 bytes
221 RCTL_BSIZE_1024 = (1 << 16), // - 1024 bytes
222 RCTL_BSIZE_512 = (2 << 16), // - 512 bytes
223 RCTL_BSIZE_256 = (3 << 16), // - 256 bytes
225 RCTL_BSIZE_RSVD = (0 << 16)|(1 << 25), // - Reserved
226 RCTL_BSIZE_16K = (1 << 16)|(1 << 25), // - 16384 bytes
227 RCTL_BSIZE_8192 = (2 << 16)|(1 << 25), // - 8192 bytes
228 RCTL_BSIZE_4096 = (3 << 16)|(1 << 25), // - 4096 bytes
230 #define RCTL_VFE (1 << 18) // VLAN Filter Enable
231 #define RCTL_CFIEN (1 << 19) // Canoical Form Indicator Enable
232 #define RCTL_CFI (1 << 20) // Value to check the CFI for [Valid if CFIEN]
233 #define RCTL_DPF (1 << 22) // Discard Pause Frames
234 #define RCTL_PMCF (1 << 23) // Pass MAC Control Frames
235 #define RCTL_BSEX (1 << 25) // Buffer Size Extension (multply BSIZE by 16, used in BSIZE enum)
236 #define RCTL_SECRC (1 << 26) // Strip Ethernet CRC
238 #define TCTL_EN (1 << 1) // Transmit Enable
239 #define TCTL_PSP (1 << 3) // Pad Short Packets
240 #define TCTL_CT (255 << 4) // Collision Threshold
241 #define TCTL_CT_ofs 4
242 #define TCTL_COLD (1023 << 12) // Collision Distance
243 #define TCTL_COLD_ofs 12
244 #define TCTL_SWXOFF (1 << 22) // Software XOFF Transmission
245 #define TCTL_RTLC (1 << 24) // Retransmit on Late Collision
246 #define TCTL_NRTU (1 << 25) // No retransmit on underrun [82544GC/EI]