Print this page
212 Atheros AR8132 / L1c Gigabit Ethernet Adapter
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/io/atge/atge_l1e_reg.h
+++ new/usr/src/uts/common/io/atge/atge_l1e_reg.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
↓ open down ↓ |
11 lines elided |
↑ open up ↑ |
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 + * Copyright (c) 2012 Gary Mills
23 + *
22 24 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 25 * Use is subject to license terms.
24 26 */
25 27
26 28 #ifndef _ATGE_L1E_REG_H
27 29 #define _ATGE_L1E_REG_H
28 30
29 31 #ifdef __cplusplus
30 32 extern "C" {
31 33 #endif
32 34
33 35 /*
34 36 * Number of RX Rings (or pages) we use.
35 37 */
36 38 #define L1E_RX_PAGES 2
37 39
38 40 #pragma pack(1)
39 41 typedef struct rx_rs {
40 42 uint32_t seqno;
↓ open down ↓ |
9 lines elided |
↑ open up ↑ |
41 43 uint32_t length;
42 44 uint32_t flags;
43 45 uint32_t vtags;
44 46 } rx_rs_t;
45 47
46 48 typedef struct rx_cmb {
47 49 uint32_t cmb[L1E_RX_PAGES];
48 50 } rx_cmb_t;
49 51 #pragma pack()
50 52
53 +/* Master configuration */
54 +#define L1E_MASTER_CFG 0x1400
55 +#define L1E_MASTER_RESET 0x00000001
56 +#define L1E_MASTER_MTIMER_ENB 0x00000002
57 +#define L1E_MASTER_IM_TX_TIMER_ENB 0x00000004
58 +#define L1E_MASTER_MANUAL_INT_ENB 0x00000008
59 +#define L1E_MASTER_IM_RX_TIMER_ENB 0x00000020
60 +#define L1E_MASTER_CHIP_REV_MASK 0x00FF0000
61 +#define L1E_MASTER_CHIP_ID_MASK 0xFF000000
62 +#define L1E_MASTER_CHIP_REV_SHIFT 16
63 +#define L1E_MASTER_CHIP_ID_SHIFT 24
64 +
65 +
51 66 /*
52 67 * DMA CFG registers (L1E specific).
53 68 */
54 69 #define DMA_CFG_RD_REQ_PRI 0x00000400
55 -#define DMA_CFG_RD_DELAY_CNT_MASK 0x0000F800
56 -#define DMA_CFG_WR_DELAY_CNT_MASK 0x000F0000
57 70 #define DMA_CFG_TXCMB_ENB 0x00100000
58 -#define DMA_CFG_RXCMB_ENB 0x00200000
59 71 #define DMA_CFG_RD_BURST_MASK 0x07
60 72 #define DMA_CFG_RD_BURST_SHIFT 4
61 73 #define DMA_CFG_WR_BURST_MASK 0x07
62 74 #define DMA_CFG_WR_BURST_SHIFT 7
63 -#define DMA_CFG_RD_DELAY_CNT_SHIFT 11
64 -#define DMA_CFG_WR_DELAY_CNT_SHIFT 16
65 -#define DMA_CFG_RD_DELAY_CNT_DEFAULT 15
66 -#define DMA_CFG_WR_DELAY_CNT_DEFAULT 4
67 75
68 76 #define L1E_TX_RING_CNT_MIN 32
69 77 #define L1E_TX_RING_CNT_MAX 1020
70 78 #define L1E_TX_RING_ALIGN 8
71 79 #define L1E_RX_PAGE_ALIGN 32
72 80 #define L1E_CMB_ALIGN 32
73 81 #define L1E_MAX_FRAMELEN ETHERMAX
74 82
75 83 #define L1E_RX_PAGE_SZ_MIN (8 * 1024)
76 84 #define L1E_RX_PAGE_SZ_MAX (1024 * 1024)
77 85 #define L1E_RX_FRAMES_PAGE 128
78 86 #define L1E_RX_PAGE_SZ \
79 87 (ROUNDUP(L1E_MAX_FRAMELEN, L1E_RX_PAGE_ALIGN) * L1E_RX_FRAMES_PAGE)
80 88 #define L1E_TX_CMB_SZ (sizeof (uint32_t))
81 89 #define L1E_RX_CMB_SZ (sizeof (uint32_t))
82 90
83 91 #define L1E_PROC_MAX \
84 92 ((L1E_RX_PAGE_SZ * L1E_RX_PAGES) / ETHERMAX)
85 93 #define L1E_PROC_DEFAULT (L1E_PROC_MAX / 4)
86 94
87 95 #define L1E_INTRS \
88 96 (INTR_DMA_RD_TO_RST | INTR_DMA_WR_TO_RST | \
89 97 INTR_RX_PKT | INTR_TX_PKT | INTR_RX_FIFO_OFLOW | \
90 98 INTR_TX_FIFO_UNDERRUN | INTR_SMB)
91 99
92 100 #define L1E_RSS_IDT_TABLE0 0x1560
93 101 #define L1E_RSS_CPU 0x157C
94 102
95 103 #define L1E_SRAM_RX_FIFO_LEN 0x1524
96 104
97 105 #define L1E_PHY_STATUS 0x1418
98 106 #define PHY_STATUS_100M 0x00020000
99 107
100 108 #define L1E_SMB_STAT_TIMER 0x15C4
101 109
102 110 #define GPHY_CTRL_EXT_RESET 0x0001
103 111 #define GPHY_CTRL_PIPE_MOD 0x0002
104 112 #define GPHY_CTRL_BERT_START 0x0010
105 113 #define GPHY_CTRL_GL1E_25M_ENB 0x0020
106 114 #define GPHY_CTRL_LPW_EXIT 0x0040
107 115 #define GPHY_CTRL_PHY_IDDQ 0x0080
108 116 #define GPHY_CTRL_PHY_IDDQ_DIS 0x0100
109 117 #define GPHY_CTRL_PCLK_SEL_DIS 0x0200
110 118 #define GPHY_CTRL_HIB_EN 0x0400
111 119 #define GPHY_CTRL_HIB_PULSE 0x0800
112 120 #define GPHY_CTRL_SEL_ANA_RESET 0x1000
113 121 #define GPHY_CTRL_PHY_PLL_ON 0x2000
114 122 #define GPHY_CTRL_PWDOWN_HW 0x4000
115 123
116 124 #define RXF_VALID 0x01
117 125
118 126 #define L1E_RXF0_PAGE0 0x15F4
119 127 #define L1E_RXF0_PAGE1 0x15F5
120 128
121 129 #define L1E_RXF0_PAGE0_ADDR_LO 0x1544
122 130 #define L1E_RXF0_PAGE1_ADDR_LO 0x1548
123 131
124 132 #define L1E_RXF_PAGE_SIZE 0x1558
125 133
126 134 #define L1E_INT_TRIG_THRESH 0x15C8
127 135 #define INT_TRIG_TX_THRESH_MASK 0x0000FFFF
128 136 #define INT_TRIG_RX_THRESH_MASK 0xFFFF0000
129 137 #define INT_TRIG_TX_THRESH_SHIFT 0
130 138 #define INT_TRIG_RX_THRESH_SHIFT 16
131 139
132 140 #define L1E_INT_TRIG_TIMER 0x15CC
133 141 #define INT_TRIG_TX_TIMER_MASK 0x0000FFFF
134 142 #define INT_TRIG_RX_TIMER_MASK 0x0000FFFF
135 143 #define INT_TRIG_TX_TIMER_SHIFT 0
136 144 #define INT_TRIG_RX_TIMER_SHIFT 16
137 145
138 146 #define TX_COALSC_PKT_1e 0x15C8 /* W: L1E */
139 147 #define RX_COALSC_PKT_1e 0x15CA /* W: L1E */
140 148 #define TX_COALSC_TO_1e 0x15CC /* W: L1E */
141 149 #define RX_COALSC_TO_1e 0x15CE /* W: L1E */
142 150
143 151 #define L1E_HOST_RXF0_PAGEOFF 0x1800
144 152 #define L1E_TPD_CONS_IDX 0x1804
145 153 #define L1E_HOST_RXF1_PAGEOFF 0x1808
146 154 #define L1E_HOST_RXF2_PAGEOFF 0x180C
147 155 #define L1E_HOST_RXF3_PAGEOFF 0x1810
148 156 #define L1E_RXF0_CMB0_ADDR_LO 0x1820
149 157 #define L1E_RXF0_CMB1_ADDR_LO 0x1824
150 158 #define L1E_RXF1_CMB0_ADDR_LO 0x1828
151 159 #define L1E_RXF1_CMB1_ADDR_LO 0x182C
152 160 #define L1E_RXF2_CMB0_ADDR_LO 0x1830
153 161 #define L1E_RXF2_CMB1_ADDR_LO 0x1834
154 162 #define L1E_RXF3_CMB0_ADDR_LO 0x1838
155 163 #define L1E_RXF3_CMB1_ADDR_LO 0x183C
156 164 #define L1E_TX_CMB_ADDR_LO 0x1840
157 165 #define L1E_SMB_ADDR_LO 0x1844
158 166
159 167 #define L1E_RD_SEQNO_MASK 0x0000FFFF
160 168 #define L1E_RD_HASH_MASK 0xFFFF0000
161 169 #define L1E_RD_SEQNO_SHIFT 0
162 170 #define L1E_RD_HASH_SHIFT 16
163 171 #define L1E_RX_SEQNO(x) \
164 172 (((x) & L1E_RD_SEQNO_MASK) >> L1E_RD_SEQNO_SHIFT)
165 173 #define L1E_RD_CSUM_MASK 0x0000FFFF
166 174 #define L1E_RD_LEN_MASK 0x3FFF0000
167 175 #define L1E_RD_CPU_MASK 0xC0000000
168 176 #define L1E_RD_CSUM_SHIFT 0
169 177 #define L1E_RD_LEN_SHIFT 16
170 178 #define L1E_RD_CPU_SHIFT 30
171 179 #define L1E_RX_CSUM(x) \
172 180 (((x) & L1E_RD_CSUM_MASK) >> L1E_RD_CSUM_SHIFT)
173 181 #define L1E_RX_BYTES(x) \
174 182 (((x) & L1E_RD_LEN_MASK) >> L1E_RD_LEN_SHIFT)
175 183 #define L1E_RX_CPU(x) \
176 184 (((x) & L1E_RD_CPU_MASK) >> L1E_RD_CPU_SHIFT)
177 185
178 186 #define L1E_RD_RSS_IPV4 0x00000001
179 187 #define L1E_RD_RSS_IPV4_TCP 0x00000002
180 188 #define L1E_RD_RSS_IPV6 0x00000004
181 189 #define L1E_RD_RSS_IPV6_TCP 0x00000008
182 190 #define L1E_RD_IPV6 0x00000010
183 191 #define L1E_RD_IPV4_FRAG 0x00000020
184 192 #define L1E_RD_IPV4_DF 0x00000040
185 193 #define L1E_RD_802_3 0x00000080
186 194 #define L1E_RD_VLAN 0x00000100
187 195 #define L1E_RD_ERROR 0x00000200
188 196 #define L1E_RD_IPV4 0x00000400
189 197 #define L1E_RD_UDP 0x00000800
190 198 #define L1E_RD_TCP 0x00001000
191 199 #define L1E_RD_BCAST 0x00002000
192 200 #define L1E_RD_MCAST 0x00004000
193 201 #define L1E_RD_PAUSE 0x00008000
194 202 #define L1E_RD_CRC 0x00010000
195 203 #define L1E_RD_CODE 0x00020000
196 204 #define L1E_RD_DRIBBLE 0x00040000
197 205 #define L1E_RD_RUNT 0x00080000
198 206 #define L1E_RD_OFLOW 0x00100000
199 207 #define L1E_RD_TRUNC 0x00200000
200 208 #define L1E_RD_IPCSUM_NOK 0x00400000
201 209 #define L1E_RD_TCP_UDPCSUM_NOK 0x00800000
202 210 #define L1E_RD_LENGTH_NOK 0x01000000
203 211 #define L1E_RD_DES_ADDR_FILTERED 0x02000000
204 212
205 213 /* TX descriptor fields */
206 214 #define L1E_TD_VLAN_MASK 0xFFFF0000
207 215 #define L1E_TD_PKT_INT 0x00008000
208 216 #define L1E_TD_DMA_INT 0x00004000
209 217 #define L1E_TD_VLAN_SHIFT 16
210 218 #define L1E_TX_VLAN_TAG(x) \
211 219 (((x) << 4) | ((x) >> 13) | (((x) >> 9) & 8))
212 220 #define L1E_TD_BUFLEN_SHIFT 0
213 221 #define L1E_TD_MSS 0xFFF80000
214 222 #define L1E_TD_TSO_HDR 0x00040000
215 223 #define L1E_TD_TCPHDR_LEN 0x0003C000
216 224 #define L1E_TD_IPHDR_LEN 0x00003C00
217 225 #define L1E_TD_IPV6HDR_LEN2 0x00003C00
218 226 #define L1E_TD_LLC_SNAP 0x00000200
219 227 #define L1E_TD_VLAN_TAGGED 0x00000100
220 228 #define L1E_TD_UDPCSUM 0x00000080
221 229 #define L1E_TD_TCPCSUM 0x00000040
222 230 #define L1E_TD_IPCSUM 0x00000020
223 231 #define L1E_TD_IPV6HDR_LEN1 0x000000E0
224 232 #define L1E_TD_TSO 0x00000010
225 233 #define L1E_TD_CXSUM 0x00000008
226 234 #define L1E_TD_INSERT_VLAN_TAG 0x00000004
227 235 #define L1E_TD_IPV6 0x00000002
228 236
229 237 #define L1E_TD_CSUM_PLOADOFFSET 0x00FF0000
230 238 #define L1E_TD_CSUM_XSUMOFFSET 0xFF000000
231 239 #define L1E_TD_CSUM_XSUMOFFSET_SHIFT 24
232 240 #define L1E_TD_CSUM_PLOADOFFSET_SHIFT 16
233 241 #define L1E_TD_MSS_SHIFT 19
234 242 #define L1E_TD_TCPHDR_LEN_SHIFT 14
235 243 #define L1E_TD_IPHDR_LEN_SHIFT 10
236 244
237 245 #define L1E_JUMBO_FRAMELEN 8132
238 246
239 247 #define L1E_TX_JUMBO_THRESH 0x1584
240 248 #define TX_JUMBO_THRESH_MASK 0x000007FF
241 249 #define TX_JUMBO_THRESH_SHIFT 0
242 250 #define TX_JUMBO_THRESH_UNIT 8
243 251 #define TX_JUMBO_THRESH_UNIT_SHIFT 3
244 252
245 253 /*
246 254 * Statistics counters collected by the MAC.
247 255 * AR81xx requires register access to get MAC statistics
248 256 * and the format of statistics seems to be the same of L1
249 257 * except for tx_abort field in TX stats. So keep it separate for simplicity.
250 258 */
251 259 #define L1E_RX_MIB_BASE 0x1700
252 260 #define L1E_TX_MIB_BASE 0x1760
253 261
254 262 #pragma pack(1)
255 263 typedef struct smb {
256 264 /* Rx stats. */
257 265 uint32_t rx_frames;
258 266 uint32_t rx_bcast_frames;
259 267 uint32_t rx_mcast_frames;
260 268 uint32_t rx_pause_frames;
261 269 uint32_t rx_control_frames;
262 270 uint32_t rx_crcerrs;
263 271 uint32_t rx_lenerrs;
264 272 uint32_t rx_bytes;
265 273 uint32_t rx_runts;
266 274 uint32_t rx_fragments;
267 275 uint32_t rx_pkts_64;
268 276 uint32_t rx_pkts_65_127;
269 277 uint32_t rx_pkts_128_255;
270 278 uint32_t rx_pkts_256_511;
271 279 uint32_t rx_pkts_512_1023;
272 280 uint32_t rx_pkts_1024_1518;
273 281 uint32_t rx_pkts_1519_max;
274 282 uint32_t rx_pkts_truncated;
275 283 uint32_t rx_fifo_oflows;
276 284 uint32_t rx_rrs_errs;
277 285 uint32_t rx_alignerrs;
278 286 uint32_t rx_bcast_bytes;
279 287 uint32_t rx_mcast_bytes;
280 288 uint32_t rx_pkts_filtered;
281 289 /* Tx stats. */
282 290 uint32_t tx_frames;
283 291 uint32_t tx_bcast_frames;
284 292 uint32_t tx_mcast_frames;
285 293 uint32_t tx_pause_frames;
286 294 uint32_t tx_excess_defer;
287 295 uint32_t tx_control_frames;
288 296 uint32_t tx_deferred;
289 297 uint32_t tx_bytes;
290 298 uint32_t tx_pkts_64;
291 299 uint32_t tx_pkts_65_127;
292 300 uint32_t tx_pkts_128_255;
293 301 uint32_t tx_pkts_256_511;
294 302 uint32_t tx_pkts_512_1023;
295 303 uint32_t tx_pkts_1024_1518;
296 304 uint32_t tx_pkts_1519_max;
297 305 uint32_t tx_single_colls;
298 306 uint32_t tx_multi_colls;
299 307 uint32_t tx_late_colls;
300 308 uint32_t tx_excess_colls;
301 309 uint32_t tx_abort;
302 310 uint32_t tx_underrun;
303 311 uint32_t tx_desc_underrun;
304 312 uint32_t tx_lenerrs;
305 313 uint32_t tx_pkts_truncated;
306 314 uint32_t tx_bcast_bytes;
307 315 uint32_t tx_mcast_bytes;
308 316 } atge_l1e_smb_t;
309 317 #pragma pack()
310 318
311 319 #ifdef __cplusplus
312 320 }
313 321 #endif
314 322
315 323 #endif /* _ATGE_L1E_REG_H */
↓ open down ↓ |
239 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX