1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 #define TXP_PCI_LOMEM 0x14
30 #define TXP_PCI_LOIO 0x10
31
32
33
34
35 #define TXP_SRR 0x00
36 #define TXP_ISR 0x04
37 #define TXP_IER 0x08
38 #define TXP_IMR 0x0c
39 #define TXP_SIR 0x10
40 #define TXP_H2A_7 0x14
41 #define TXP_H2A_6 0x18
42 #define TXP_H2A_5 0x1c
43 #define TXP_H2A_4 0x20
44 #define TXP_H2A_3 0x24
45 #define TXP_H2A_2 0x28
46 #define TXP_H2A_1 0x2c
47 #define TXP_H2A_0 0x30
48 #define TXP_A2H_3 0x34
49 #define TXP_A2H_2 0x38
50 #define TXP_A2H_1 0x3c
51 #define TXP_A2H_0 0x40
52
53
54
55
56 #define TXP_INT_RESERVED 0xffff0000
57 #define TXP_INT_A2H_7 0x00008000
58 #define TXP_INT_A2H_6 0x00004000
59 #define TXP_INT_A2H_5 0x00002000
60 #define TXP_INT_A2H_4 0x00001000
61 #define TXP_INT_SELF 0x00000800
62 #define TXP_INT_PCI_TABORT 0x00000400
63 #define TXP_INT_PCI_MABORT 0x00000200
64 #define TXP_INT_DMA3 0x00000100
65 #define TXP_INT_DMA2 0x00000080
66 #define TXP_INT_DMA1 0x00000040
67 #define TXP_INT_DMA0 0x00000020
68 #define TXP_INT_A2H_3 0x00000010
69 #define TXP_INT_A2H_2 0x00000008
70 #define TXP_INT_A2H_1 0x00000004
71 #define TXP_INT_A2H_0 0x00000002
72 #define TXP_INT_LATCH 0x00000001
73
74
75
76
77 #define TXP_SRR_ALL 0x0000007f
78
79
80
81
82 #define TXP_BOOTCMD_NULL 0x00
83 #define TXP_BOOTCMD_DOWNLOAD_COMPLETE 0xfb
84 #define TXP_BOOTCMD_SEGMENT_AVAILABLE 0xfc
85 #define TXP_BOOTCMD_RUNTIME_IMAGE 0xfd
86 #define TXP_BOOTCMD_REGISTER_BOOT_RECORD 0xff
87
88
89
90
91 #define TXP_CMD_GLOBAL_RESET 0x00
92 #define TXP_CMD_TX_ENABLE 0x01
93 #define TXP_CMD_TX_DISABLE 0x02
94 #define TXP_CMD_RX_ENABLE 0x03
95 #define TXP_CMD_RX_DISABLE 0x04
96 #define TXP_CMD_RX_FILTER_WRITE 0x05
97 #define TXP_CMD_RX_FILTER_READ 0x06
98 #define TXP_CMD_READ_STATISTICS 0x07
99 #define TXP_CMD_CYCLE_STATISTICS 0x08
100 #define TXP_CMD_CLEAR_STATISTICS 0x09
101 #define TXP_CMD_MEMORY_READ 0x0a
102 #define TXP_CMD_MEMORY_WRITE_SINGLE 0x0b
103 #define TXP_CMD_VARIABLE_SECTION_READ 0x0c
104 #define TXP_CMD_VARIABLE_SECTION_WRITE 0x0d
105 #define TXP_CMD_STATIC_SECTION_READ 0x0e
106 #define TXP_CMD_STATIC_SECTION_WRITE 0x0f
107 #define TXP_CMD_IMAGE_SECTION_PROGRAM 0x10
108 #define TXP_CMD_NVRAM_PAGE_READ 0x11
109 #define TXP_CMD_NVRAM_PAGE_WRITE 0x12
110 #define TXP_CMD_XCVR_SELECT 0x13
111 #define TXP_CMD_TEST_MUX 0x14
112 #define TXP_CMD_PHYLOOPBACK_ENABLE 0x15
113 #define TXP_CMD_PHYLOOPBACK_DISABLE 0x16
114 #define TXP_CMD_MAC_CONTROL_READ 0x17
115 #define TXP_CMD_MAC_CONTROL_WRITE 0x18
116 #define TXP_CMD_MAX_PKT_SIZE_READ 0x19
117 #define TXP_CMD_MAX_PKT_SIZE_WRITE 0x1a
118 #define TXP_CMD_MEDIA_STATUS_READ 0x1b
119 #define TXP_CMD_MEDIA_STATUS_WRITE 0x1c
120 #define TXP_CMD_NETWORK_DIAGS_READ 0x1d
121 #define TXP_CMD_NETWORK_DIAGS_WRITE 0x1e
122 #define TXP_CMD_PHY_MGMT_READ 0x1f
123 #define TXP_CMD_PHY_MGMT_WRITE 0x20
124 #define TXP_CMD_VARIABLE_PARAMETER_READ 0x21
125 #define TXP_CMD_VARIABLE_PARAMETER_WRITE 0x22
126 #define TXP_CMD_GOTO_SLEEP 0x23
127 #define TXP_CMD_FIREWALL_CONTROL 0x24
128 #define TXP_CMD_MCAST_HASH_MASK_WRITE 0x25
129 #define TXP_CMD_STATION_ADDRESS_WRITE 0x26
130 #define TXP_CMD_STATION_ADDRESS_READ 0x27
131 #define TXP_CMD_STATION_MASK_WRITE 0x28
132 #define TXP_CMD_STATION_MASK_READ 0x29
133 #define TXP_CMD_VLAN_ETHER_TYPE_READ 0x2a
134 #define TXP_CMD_VLAN_ETHER_TYPE_WRITE 0x2b
135 #define TXP_CMD_VLAN_MASK_READ 0x2c
136 #define TXP_CMD_VLAN_MASK_WRITE 0x2d
137 #define TXP_CMD_BCAST_THROTTLE_WRITE 0x2e
138 #define TXP_CMD_BCAST_THROTTLE_READ 0x2f
139 #define TXP_CMD_DHCP_PREVENT_WRITE 0x30
140 #define TXP_CMD_DHCP_PREVENT_READ 0x31
141 #define TXP_CMD_RECV_BUFFER_CONTROL 0x32
142 #define TXP_CMD_SOFTWARE_RESET 0x33
143 #define TXP_CMD_CREATE_SA 0x34
144 #define TXP_CMD_DELETE_SA 0x35
145 #define TXP_CMD_ENABLE_RX_IP_OPTION 0x36
146 #define TXP_CMD_RANDOM_NUMBER_CONTROL 0x37
147 #define TXP_CMD_RANDOM_NUMBER_READ 0x38
148 #define TXP_CMD_MATRIX_TABLE_MODE_WRITE 0x39
149 #define TXP_CMD_MATRIX_DETAIL_READ 0x3a
150 #define TXP_CMD_FILTER_ARRAY_READ 0x3b
151 #define TXP_CMD_FILTER_DETAIL_READ 0x3c
152 #define TXP_CMD_FILTER_TABLE_MODE_WRITE 0x3d
153 #define TXP_CMD_FILTER_TCL_WRITE 0x3e
154 #define TXP_CMD_FILTER_TBL_READ 0x3f
155 #define TXP_CMD_VERSIONS_READ 0x43
156 #define TXP_CMD_FILTER_DEFINE 0x45
157 #define TXP_CMD_ADD_WAKEUP_PKT 0x46
158 #define TXP_CMD_ADD_SLEEP_PKT 0x47
159 #define TXP_CMD_ENABLE_SLEEP_EVENTS 0x48
160 #define TXP_CMD_ENABLE_WAKEUP_EVENTS 0x49
161 #define TXP_CMD_GET_IP_ADDRESS 0x4a
162 #define TXP_CMD_READ_PCI_REG 0x4c
163 #define TXP_CMD_WRITE_PCI_REG 0x4d
164 #define TXP_CMD_OFFLOAD_READ 0x4e
165 #define TXP_CMD_OFFLOAD_WRITE 0x4f
166 #define TXP_CMD_HELLO_RESPONSE 0x57
167 #define TXP_CMD_ENABLE_RX_FILTER 0x58
168 #define TXP_CMD_RX_FILTER_CAPABILITY 0x59
169 #define TXP_CMD_HALT 0x5d
170 #define TXP_CMD_READ_IPSEC_INFO 0x54
171 #define TXP_CMD_GET_IPSEC_ENABLE 0x67
172 #define TXP_CMD_INVALID 0xffff
173
174 #define TXP_FRAGMENT 0x0000
175 #define TXP_TXFRAME 0x0001
176 #define TXP_COMMAND 0x0002
177 #define TXP_OPTION 0x0003
178 #define TXP_RECEIVE 0x0004
179 #define TXP_RESPONSE 0x0005
180
181 #define TXP_TYPE_IPSEC 0x0000
182 #define TXP_TYPE_TCPSEGMENT 0x0001
183
184 #define TXP_PFLAG_NOCRC 0x0001
185 #define TXP_PFLAG_IPCKSUM 0x0002
186 #define TXP_PFLAG_TCPCKSUM 0x0004
187 #define TXP_PFLAG_TCPSEGMENT 0x0008
188 #define TXP_PFLAG_INSERTVLAN 0x0010
189 #define TXP_PFLAG_IPSEC 0x0020
190 #define TXP_PFLAG_PRIORITY 0x0040
191 #define TXP_PFLAG_UDPCKSUM 0x0080
192 #define TXP_PFLAG_PADFRAME 0x0100
193
194 #define TXP_MISC_FIRSTDESC 0x0000
195 #define TXP_MISC_LASTDESC 0x0001
196
197 #define TXP_ERR_INTERNAL 0x0000
198 #define TXP_ERR_FIFOUNDERRUN 0x0001
199 #define TXP_ERR_BADSSD 0x0002
200 #define TXP_ERR_RUNT 0x0003
201 #define TXP_ERR_CRC 0x0004
202 #define TXP_ERR_OVERSIZE 0x0005
203 #define TXP_ERR_ALIGNMENT 0x0006
204 #define TXP_ERR_DRIBBLEBIT 0x0007
205
206 #define TXP_PROTO_UNKNOWN 0x0000
207 #define TXP_PROTO_IP 0x0001
208 #define TXP_PROTO_IPX 0x0002
209 #define TXP_PROTO_RESERVED 0x0003
210
211 #define TXP_STAT_PROTO 0x0001
212 #define TXP_STAT_VLAN 0x0002
213 #define TXP_STAT_IPFRAGMENT 0x0004
214 #define TXP_STAT_IPSEC 0x0008
215 #define TXP_STAT_IPCKSUMBAD 0x0010
216 #define TXP_STAT_TCPCKSUMBAD 0x0020
217 #define TXP_STAT_UDPCKSUMBAD 0x0040
218 #define TXP_STAT_IPCKSUMGOOD 0x0080
219 #define TXP_STAT_TCPCKSUMGOOD 0x0100
220 #define TXP_STAT_UDPCKSUMGOOD 0x0200
221
222 struct txp_tx_desc {
223 volatile u_int8_t tx_flags;
224 volatile u_int8_t tx_numdesc;
225 volatile u_int16_t tx_totlen;
226 volatile u_int32_t tx_addrlo;
227 volatile u_int32_t tx_addrhi;
228 volatile u_int32_t tx_pflags;
229 };
230 #define TX_FLAGS_TYPE_M 0x07
231 #define TX_FLAGS_TYPE_FRAG 0x00
232 #define TX_FLAGS_TYPE_DATA 0x01
233 #define TX_FLAGS_TYPE_CMD 0x02
234 #define TX_FLAGS_TYPE_OPT 0x03
235 #define TX_FLAGS_TYPE_RX 0x04
236 #define TX_FLAGS_TYPE_RESP 0x05
237 #define TX_FLAGS_RESP 0x40
238 #define TX_FLAGS_VALID 0x80
239
240 #define TX_PFLAGS_DNAC 0x00000001
241 #define TX_PFLAGS_IPCKSUM 0x00000002
242 #define TX_PFLAGS_TCPCKSUM 0x00000004
243 #define TX_PFLAGS_TCPSEG 0x00000008
244 #define TX_PFLAGS_VLAN 0x00000010
245 #define TX_PFLAGS_IPSEC 0x00000020
246 #define TX_PFLAGS_PRIO 0x00000040
247 #define TX_PFLAGS_UDPCKSUM 0x00000080
248 #define TX_PFLAGS_PADFRAME 0x00000100
249 #define TX_PFLAGS_VLANTAG_M 0x0ffff000
250 #define TX_PFLAGS_VLANPRI_M 0x00700000
251 #define TX_PFLAGS_VLANTAG_S 12
252
253 struct txp_rx_desc {
254 volatile u_int8_t rx_flags;
255 volatile u_int8_t rx_numdesc;
256 volatile u_int16_t rx_len;
257 volatile u_int32_t rx_vaddrlo;
258 volatile u_int32_t rx_vaddrhi;
259 volatile u_int32_t rx_stat;
260 volatile u_int16_t rx_filter;
261 volatile u_int16_t rx_hash;
262 volatile u_int32_t rx_vlan;
263 };
264
265
266 #define RX_FLAGS_TYPE_M 0x07
267 #define RX_FLAGS_TYPE_FRAG 0x00
268 #define RX_FLAGS_TYPE_DATA 0x01
269 #define RX_FLAGS_TYPE_CMD 0x02
270 #define RX_FLAGS_TYPE_OPT 0x03
271 #define RX_FLAGS_TYPE_RX 0x04
272 #define RX_FLAGS_TYPE_RESP 0x05
273 #define RX_FLAGS_RCV_TYPE_M 0x18
274 #define RX_FLAGS_RCV_TYPE_RX 0x00
275 #define RX_FLAGS_RCV_TYPE_RSP 0x08
276 #define RX_FLAGS_ERROR 0x40
277
278
279 #define RX_ERROR_ADAPTER 0x00000000
280 #define RX_ERROR_FIFO 0x00000001
281 #define RX_ERROR_BADSSD 0x00000002
282 #define RX_ERROR_RUNT 0x00000003
283 #define RX_ERROR_CRC 0x00000004
284 #define RX_ERROR_OVERSIZE 0x00000005
285 #define RX_ERROR_ALIGN 0x00000006
286 #define RX_ERROR_DRIBBLE 0x00000007
287
288
289 #define RX_STAT_PROTO_M 0x00000003
290 #define RX_STAT_PROTO_UK 0x00000000
291 #define RX_STAT_PROTO_IPX 0x00000001
292 #define RX_STAT_PROTO_IP 0x00000002
293 #define RX_STAT_PROTO_RSV 0x00000003
294 #define RX_STAT_VLAN 0x00000004
295 #define RX_STAT_IPFRAG 0x00000008
296 #define RX_STAT_IPSEC 0x00000010
297 #define RX_STAT_IPCKSUMBAD 0x00000020
298 #define RX_STAT_UDPCKSUMBAD 0x00000040
299 #define RX_STAT_TCPCKSUMBAD 0x00000080
300 #define RX_STAT_IPCKSUMGOOD 0x00000100
301 #define RX_STAT_UDPCKSUMGOOD 0x00000200
302 #define RX_STAT_TCPCKSUMGOOD 0x00000400
303
304
305 struct txp_rxbuf_desc {
306 volatile u_int32_t rb_paddrlo;
307 volatile u_int32_t rb_paddrhi;
308 volatile u_int32_t rb_vaddrlo;
309 volatile u_int32_t rb_vaddrhi;
310 };
311
312
313 struct txp_ext_desc {
314 volatile u_int32_t ext_1;
315 volatile u_int32_t ext_2;
316 volatile u_int32_t ext_3;
317 volatile u_int32_t ext_4;
318 };
319
320 struct txp_cmd_desc {
321 volatile u_int8_t cmd_flags;
322 volatile u_int8_t cmd_numdesc;
323 volatile u_int16_t cmd_id;
324 volatile u_int16_t cmd_seq;
325 volatile u_int16_t cmd_par1;
326 volatile u_int32_t cmd_par2;
327 volatile u_int32_t cmd_par3;
328 };
329 #define CMD_FLAGS_TYPE_M 0x07
330 #define CMD_FLAGS_TYPE_FRAG 0x00
331 #define CMD_FLAGS_TYPE_DATA 0x01
332 #define CMD_FLAGS_TYPE_CMD 0x02
333 #define CMD_FLAGS_TYPE_OPT 0x03
334 #define CMD_FLAGS_TYPE_RX 0x04
335 #define CMD_FLAGS_TYPE_RESP 0x05
336 #define CMD_FLAGS_RESP 0x40
337 #define CMD_FLAGS_VALID 0x80
338
339 struct txp_rsp_desc {
340 volatile u_int8_t rsp_flags;
341 volatile u_int8_t rsp_numdesc;
342 volatile u_int16_t rsp_id;
343 volatile u_int16_t rsp_seq;
344 volatile u_int16_t rsp_par1;
345 volatile u_int32_t rsp_par2;
346 volatile u_int32_t rsp_par3;
347 };
348 #define RSP_FLAGS_TYPE_M 0x07
349 #define RSP_FLAGS_TYPE_FRAG 0x00
350 #define RSP_FLAGS_TYPE_DATA 0x01
351 #define RSP_FLAGS_TYPE_CMD 0x02
352 #define RSP_FLAGS_TYPE_OPT 0x03
353 #define RSP_FLAGS_TYPE_RX 0x04
354 #define RSP_FLAGS_TYPE_RESP 0x05
355 #define RSP_FLAGS_ERROR 0x40
356
357 struct txp_frag_desc {
358 volatile u_int8_t frag_flags;
359 volatile u_int8_t frag_rsvd1;
360 volatile u_int16_t frag_len;
361 volatile u_int32_t frag_addrlo;
362 volatile u_int32_t frag_addrhi;
363 volatile u_int32_t frag_rsvd2;
364 };
365 #define FRAG_FLAGS_TYPE_M 0x07
366 #define FRAG_FLAGS_TYPE_FRAG 0x00
367 #define FRAG_FLAGS_TYPE_DATA 0x01
368 #define FRAG_FLAGS_TYPE_CMD 0x02
369 #define FRAG_FLAGS_TYPE_OPT 0x03
370 #define FRAG_FLAGS_TYPE_RX 0x04
371 #define FRAG_FLAGS_TYPE_RESP 0x05
372 #define FRAG_FLAGS_VALID 0x80
373
374 struct txp_opt_desc {
375 u_int8_t opt_desctype:3,
376 opt_rsvd:1,
377 opt_type:4;
378
379 u_int8_t opt_num;
380 u_int16_t opt_dep1;
381 u_int32_t opt_dep2;
382 u_int32_t opt_dep3;
383 u_int32_t opt_dep4;
384 };
385
386 struct txp_ipsec_desc {
387 u_int8_t ipsec_desctpe:3,
388 ipsec_rsvd:1,
389 ipsec_type:4;
390
391 u_int8_t ipsec_num;
392 u_int16_t ipsec_flags;
393 u_int16_t ipsec_ah1;
394 u_int16_t ipsec_esp1;
395 u_int16_t ipsec_ah2;
396 u_int16_t ipsec_esp2;
397 u_int32_t ipsec_rsvd1;
398 };
399
400 struct txp_tcpseg_desc {
401 u_int8_t tcpseg_desctype:3,
402 tcpseg_rsvd:1,
403 tcpseg_type:4;
404
405 u_int8_t tcpseg_num;
406
407 u_int16_t tcpseg_mss:12,
408 tcpseg_misc:4;
409
410 u_int32_t tcpseg_respaddr;
411 u_int32_t tcpseg_txbytes;
412 u_int32_t tcpseg_lss;
413 };
414
415
416
417
418 #define TXP_XCVR_10_HDX 0
419 #define TXP_XCVR_10_FDX 1
420 #define TXP_XCVR_100_HDX 2
421 #define TXP_XCVR_100_FDX 3
422 #define TXP_XCVR_AUTO 4
423
424 #define TXP_MEDIA_CRC 0x0004
425 #define TXP_MEDIA_CD 0x0010
426 #define TXP_MEDIA_CS 0x0020
427 #define TXP_MEDIA_POL 0x0400
428 #define TXP_MEDIA_NOLINK 0x0800
429
430
431
432
433 #define TXP_RXFILT_DIRECT 0x0001
434 #define TXP_RXFILT_ALLMULTI 0x0002
435 #define TXP_RXFILT_BROADCAST 0x0004
436 #define TXP_RXFILT_PROMISC 0x0008
437 #define TXP_RXFILT_HASHMULTI 0x0010
438
439
440
441
442 struct txp_boot_record {
443 volatile u_int32_t br_hostvar_lo;
444 volatile u_int32_t br_hostvar_hi;
445 volatile u_int32_t br_txlopri_lo;
446 volatile u_int32_t br_txlopri_hi;
447 volatile u_int32_t br_txlopri_siz;
448 volatile u_int32_t br_txhipri_lo;
449 volatile u_int32_t br_txhipri_hi;
450 volatile u_int32_t br_txhipri_siz;
451 volatile u_int32_t br_rxlopri_lo;
452 volatile u_int32_t br_rxlopri_hi;
453 volatile u_int32_t br_rxlopri_siz;
454 volatile u_int32_t br_rxbuf_lo;
455 volatile u_int32_t br_rxbuf_hi;
456 volatile u_int32_t br_rxbuf_siz;
457 volatile u_int32_t br_cmd_lo;
458 volatile u_int32_t br_cmd_hi;
459 volatile u_int32_t br_cmd_siz;
460 volatile u_int32_t br_resp_lo;
461 volatile u_int32_t br_resp_hi;
462 volatile u_int32_t br_resp_siz;
463 volatile u_int32_t br_zero_lo;
464 volatile u_int32_t br_zero_hi;
465 volatile u_int32_t br_rxhipri_lo;
466 volatile u_int32_t br_rxhipri_hi;
467 volatile u_int32_t br_rxhipri_siz;
468 };
469
470
471
472
473 struct txp_hostvar {
474 volatile u_int32_t hv_rx_hi_read_idx;
475 volatile u_int32_t hv_rx_lo_read_idx;
476 volatile u_int32_t hv_rx_buf_write_idx;
477 volatile u_int32_t hv_resp_read_idx;
478 volatile u_int32_t hv_tx_lo_desc_read_idx;
479 volatile u_int32_t hv_tx_hi_desc_read_idx;
480 volatile u_int32_t hv_rx_lo_write_idx;
481 volatile u_int32_t hv_rx_buf_read_idx;
482 volatile u_int32_t hv_cmd_read_idx;
483 volatile u_int32_t hv_resp_write_idx;
484 volatile u_int32_t hv_rx_hi_write_idx;
485 };
486
487
488
489
490 #define STAT_ROM_CODE 0x00000001
491 #define STAT_ROM_EEPROM_LOAD 0x00000002
492 #define STAT_WAITING_FOR_BOOT 0x00000007
493 #define STAT_RUNNING 0x00000009
494 #define STAT_WAITING_FOR_HOST_REQUEST 0x0000000d
495 #define STAT_WAITING_FOR_SEGMENT 0x00000010
496 #define STAT_SLEEPING 0x00000011
497 #define STAT_HALTED 0x00000014
498
499 #define TX_ENTRIES 256
500 #define RX_ENTRIES 128
501 #define RXBUF_ENTRIES 256
502 #define CMD_ENTRIES 32
503 #define RSP_ENTRIES 32
504
505 #define OFFLOAD_TCPCKSUM 0x00000002
506 #define OFFLOAD_UDPCKSUM 0x00000004
507 #define OFFLOAD_IPCKSUM 0x00000008
508 #define OFFLOAD_IPSEC 0x00000010
509 #define OFFLOAD_BCAST 0x00000020
510 #define OFFLOAD_DHCP 0x00000040
511 #define OFFLOAD_VLAN 0x00000080
512 #define OFFLOAD_FILTER 0x00000100
513 #define OFFLOAD_TCPSEG 0x00000200
514 #define OFFLOAD_MASK 0xfffffffe
515
516
517
518
519
520
521 #define TXP_IDX2OFFSET(idx) ((idx) << 4)
522 #define TXP_OFFSET2IDX(off) ((off) >> 4)
523
524 struct txp_dma_alloc {
525 u_int64_t dma_paddr;
526 caddr_t dma_vaddr;
527 bus_dmamap_t dma_map;
528 bus_dma_segment_t dma_seg;
529 int dma_nseg;
530 };
531
532 struct txp_cmd_ring {
533 struct txp_cmd_desc *base;
534 u_int32_t lastwrite;
535 u_int32_t size;
536 };
537
538 struct txp_rsp_ring {
539 struct txp_rsp_desc *base;
540 u_int32_t lastwrite;
541 u_int32_t size;
542 };
543
544 struct txp_tx_ring {
545 struct txp_tx_desc *r_desc;
546 u_int32_t r_reg;
547 u_int32_t r_prod;
548 u_int32_t r_cons;
549 u_int32_t r_cnt;
550 volatile u_int32_t *r_off;
551 };
552
553 struct txp_swdesc {
554 struct mbuf * sd_mbuf;
555 bus_dmamap_t sd_map;
556 };
557
558 struct txp_rx_ring {
559 struct txp_rx_desc *r_desc;
560 volatile u_int32_t *r_roff;
561 volatile u_int32_t *r_woff;
562 };
563
564 struct txp_softc {
565 struct device sc_dev;
566 struct arpcom sc_arpcom;
567 struct txp_hostvar *sc_hostvar;
568 struct txp_boot_record *sc_boot;
569 bus_space_handle_t sc_bh;
570 bus_space_tag_t sc_bt;
571 bus_dma_tag_t sc_dmat;
572 struct txp_cmd_ring sc_cmdring;
573 struct txp_rsp_ring sc_rspring;
574 struct txp_swdesc sc_txd[TX_ENTRIES];
575 void * sc_ih;
576 struct timeout sc_tick;
577 struct ifmedia sc_ifmedia;
578 struct txp_tx_ring sc_txhir, sc_txlor;
579 struct txp_rxbuf_desc *sc_rxbufs;
580 struct txp_rx_ring sc_rxhir, sc_rxlor;
581 u_int16_t sc_xcvr;
582 u_int16_t sc_seq;
583 struct txp_dma_alloc sc_boot_dma, sc_host_dma, sc_zero_dma;
584 struct txp_dma_alloc sc_rxhiring_dma, sc_rxloring_dma;
585 struct txp_dma_alloc sc_txhiring_dma, sc_txloring_dma;
586 struct txp_dma_alloc sc_cmdring_dma, sc_rspring_dma;
587 struct txp_dma_alloc sc_rxbufring_dma;
588 int sc_cold;
589 u_int32_t sc_rx_capability, sc_tx_capability;
590 };
591
592 #define TXP_DEVNAME(sc) ((sc)->sc_cold ? "" : (sc)->sc_dev.dv_xname)
593
594 struct txp_fw_file_header {
595 u_int8_t magicid[8];
596 u_int32_t version;
597 u_int32_t nsections;
598 u_int32_t addr;
599 };
600
601 struct txp_fw_section_header {
602 u_int32_t nbytes;
603 u_int16_t cksum;
604 u_int16_t reserved;
605 u_int32_t addr;
606 };
607
608 #define TXP_MAX_SEGLEN 0xffff
609 #define TXP_MAX_PKTLEN 0x0800
610
611 #define WRITE_REG(sc,reg,val) \
612 bus_space_write_4((sc)->sc_bt, (sc)->sc_bh, reg, val)
613 #define READ_REG(sc,reg) \
614 bus_space_read_4((sc)->sc_bt, (sc)->sc_bh, reg)
615