iPXE
tg3.c
Go to the documentation of this file.
1
2FILE_LICENCE ( GPL2_ONLY );
3
4#include <mii.h>
5#include <stdio.h>
6#include <string.h>
7#include <errno.h>
8#include <unistd.h>
9#include <byteswap.h>
10#include <ipxe/pci.h>
11#include <ipxe/iobuf.h>
12#include <ipxe/timer.h>
13#include <ipxe/malloc.h>
14#include <ipxe/if_ether.h>
15#include <ipxe/ethernet.h>
16#include <ipxe/netdevice.h>
17
18#include "tg3.h"
19
20#define TG3_DEF_RX_MODE 0
21#define TG3_DEF_TX_MODE 0
22
23static void tg3_refill_prod_ring(struct tg3 *tp);
24
25/* Do not place this n-ring entries value into the tp struct itself,
26 * we really want to expose these constants to GCC so that modulo et
27 * al. operations are done with shifts and masks instead of with
28 * hw multiply/modulo instructions. Another solution would be to
29 * replace things like '% foo' with '& (foo - 1)'.
30 */
31
32#define TG3_TX_RING_BYTES (sizeof(struct tg3_tx_buffer_desc) * \
33 TG3_TX_RING_SIZE)
34
35/* FIXME: does TG3_RX_RET_MAX_SIZE_5705 work for all cards? */
36#define TG3_RX_RCB_RING_BYTES(tp) \
37 (sizeof(struct tg3_rx_buffer_desc) * (TG3_RX_RET_MAX_SIZE_5705))
38
39#define TG3_RX_STD_RING_BYTES(tp) \
40 (sizeof(struct tg3_rx_buffer_desc) * TG3_RX_STD_MAX_SIZE_5700)
41
43{ DBGP("%s\n", __func__);
44
45 if (tpr->rx_std) {
47 tpr->rx_std = NULL;
48 }
49}
50
51/*
52 * Must not be invoked with interrupt sources disabled and
53 * the hardware shutdown down.
54 */
55static void tg3_free_consistent(struct tg3 *tp)
56{ DBGP("%s\n", __func__);
57
58 if (tp->tx_ring) {
60 tp->tx_ring = NULL;
61 }
62
63 free(tp->tx_buffers);
64 tp->tx_buffers = NULL;
65
66 if (tp->rx_rcb) {
68 tp->rx_rcb_mapping = 0;
69 tp->rx_rcb = NULL;
70 }
71
72 tg3_rx_prodring_fini(&tp->prodring);
73
74 if (tp->hw_status) {
75 free_phys(tp->hw_status, TG3_HW_STATUS_SIZE);
76 tp->status_mapping = 0;
77 tp->hw_status = NULL;
78 }
79}
80
81/*
82 * Must not be invoked with interrupt sources disabled and
83 * the hardware shutdown down. Can sleep.
84 */
86{ DBGP("%s\n", __func__);
87
88 struct tg3_hw_status *sblk;
89 struct tg3_rx_prodring_set *tpr = &tp->prodring;
90
92 if (!tp->hw_status) {
93 DBGC(tp->dev, "hw_status alloc failed\n");
94 goto err_out;
95 }
96 tp->status_mapping = virt_to_bus(tp->hw_status);
97
98 memset(tp->hw_status, 0, TG3_HW_STATUS_SIZE);
99 sblk = tp->hw_status;
100
102 if (!tpr->rx_std) {
103 DBGC(tp->dev, "rx prodring alloc failed\n");
104 goto err_out;
105 }
106 tpr->rx_std_mapping = virt_to_bus(tpr->rx_std);
108
109 tp->tx_buffers = zalloc(sizeof(struct ring_info) * TG3_TX_RING_SIZE);
110 if (!tp->tx_buffers)
111 goto err_out;
112
114 if (!tp->tx_ring)
115 goto err_out;
116 tp->tx_desc_mapping = virt_to_bus(tp->tx_ring);
117
118 /*
119 * When RSS is enabled, the status block format changes
120 * slightly. The "rx_jumbo_consumer", "reserved",
121 * and "rx_mini_consumer" members get mapped to the
122 * other three rx return ring producer indexes.
123 */
124
125 tp->rx_rcb_prod_idx = &sblk->idx[0].rx_producer;
126
128 if (!tp->rx_rcb)
129 goto err_out;
130 tp->rx_rcb_mapping = virt_to_bus(tp->rx_rcb);
131
132 memset(tp->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp));
133
134 return 0;
135
136err_out:
138 return -ENOMEM;
139}
140
141#define TG3_RX_STD_BUFF_RING_BYTES(tp) \
142 (sizeof(struct ring_info) * TG3_RX_STD_MAX_SIZE_5700)
143#define TG3_RX_STD_RING_BYTES(tp) \
144 (sizeof(struct tg3_rx_buffer_desc) * TG3_RX_STD_MAX_SIZE_5700)
145
146/* Initialize rx rings for packet processing.
147 *
148 * The chip has been shut down and the driver detached from
149 * the networking, so no interrupts or new tx packets will
150 * end up in the driver.
151 */
153 struct tg3_rx_prodring_set *tpr)
154{ DBGP("%s\n", __func__);
155
156 u32 i;
157
158 tpr->rx_std_cons_idx = 0;
159 tpr->rx_std_prod_idx = 0;
160
161 /* Initialize invariants of the rings, we only set this
162 * stuff once. This works because the card does not
163 * write into the rx buffer posting rings.
164 */
165 /* FIXME: does TG3_RX_STD_MAX_SIZE_5700 work on all cards? */
166 for (i = 0; i < TG3_RX_STD_MAX_SIZE_5700; i++) {
167 struct tg3_rx_buffer_desc *rxd;
168
169 rxd = &tpr->rx_std[i];
170 rxd->idx_len = (TG3_RX_STD_DMA_SZ - 64 - 2) << RXD_LEN_SHIFT;
171 rxd->type_flags = (RXD_FLAG_END << RXD_FLAGS_SHIFT);
172 rxd->opaque = (RXD_OPAQUE_RING_STD |
174 }
175
176 return 0;
177}
178
179static void tg3_rx_iob_free(struct io_buffer *iobs[], int i)
180{ DBGP("%s\n", __func__);
181
182 if (iobs[i] == NULL)
183 return;
184
185 free_iob(iobs[i]);
186 iobs[i] = NULL;
187}
188
190{ DBGP("%s\n", __func__);
191
192 unsigned int i;
193
194 for (i = 0; i < TG3_DEF_RX_RING_PENDING; i++)
195 tg3_rx_iob_free(tpr->rx_iobufs, i);
196}
197
198/* Initialize tx/rx rings for packet processing.
199 *
200 * The chip has been shut down and the driver detached from
201 * the networking, so no interrupts or new tx packets will
202 * end up in the driver.
203 */
205{ DBGP("%s\n", __func__);
206
207 /* Free up all the SKBs. */
208/// tg3_free_rings(tp);
209
210 tp->last_tag = 0;
211 tp->last_irq_tag = 0;
212 tp->hw_status->status = 0;
213 tp->hw_status->status_tag = 0;
214 memset(tp->hw_status, 0, TG3_HW_STATUS_SIZE);
215
216 tp->tx_prod = 0;
217 tp->tx_cons = 0;
218 if (tp->tx_ring)
219 memset(tp->tx_ring, 0, TG3_TX_RING_BYTES);
220
221 tp->rx_rcb_ptr = 0;
222 if (tp->rx_rcb)
223 memset(tp->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp));
224
225 if (tg3_rx_prodring_alloc(tp, &tp->prodring)) {
226 DBGC(tp->dev, "tg3_rx_prodring_alloc() failed\n");
227 tg3_rx_prodring_free(&tp->prodring);
228 return -ENOMEM;
229 }
230
231 return 0;
232}
233
234static int tg3_open(struct net_device *dev)
235{ DBGP("%s\n", __func__);
236
237 struct tg3 *tp = dev->priv;
238 struct tg3_rx_prodring_set *tpr = &tp->prodring;
239 int err = 0;
240
242
243 /* Initialize MAC address and backoff seed. */
245
247 if (err)
248 return err;
249
250 tpr->rx_std_iob_cnt = 0;
251
252 err = tg3_init_hw(tp, 1);
253 if (err != 0)
254 DBGC(tp->dev, "tg3_init_hw failed: %s\n", strerror(err));
255 else
257
258 return err;
259}
260
261static inline u32 tg3_tx_avail(struct tg3 *tp)
262{ DBGP("%s\n", __func__);
263
264 /* Tell compiler to fetch tx indices from memory. */
265 barrier();
267 ((tp->tx_prod - tp->tx_cons) & (TG3_TX_RING_SIZE - 1));
268}
269
270#if 0
271/**
272 *
273 * Prints all registers that could cause a set ERR bit in hw_status->status
274 */
275static void tg3_dump_err_reg(struct tg3 *tp)
276{ DBGP("%s\n", __func__);
277
278 printf("FLOW_ATTN: %#08x\n", tr32(HOSTCC_FLOW_ATTN));
279 printf("MAC ATTN: %#08x\n", tr32(MAC_STATUS));
280 printf("MSI STATUS: %#08x\n", tr32(MSGINT_STATUS));
281 printf("DMA RD: %#08x\n", tr32(RDMAC_STATUS));
282 printf("DMA WR: %#08x\n", tr32(WDMAC_STATUS));
283 printf("TX CPU STATE: %#08x\n", tr32(TX_CPU_STATE));
284 printf("RX CPU STATE: %#08x\n", tr32(RX_CPU_STATE));
285}
286
287static void __unused tw32_mailbox2(struct tg3 *tp, uint32_t reg, uint32_t val)
288{ DBGP("%s\n", __func__);
289
291 tr32(reg);
292}
293#endif
294
295#define NEXT_TX(N) (((N) + 1) & (TG3_TX_RING_SIZE - 1))
296
297/* hard_start_xmit for devices that have the 4G bug and/or 40-bit bug and
298 * support TG3_FLAG_HW_TSO_1 or firmware TSO only.
299 */
300static int tg3_transmit(struct net_device *dev, struct io_buffer *iob)
301{ DBGP("%s\n", __func__);
302
303 struct tg3 *tp = dev->priv;
304 u32 len, entry;
305 dma_addr_t mapping;
306
307 if (tg3_tx_avail(tp) < 1) {
308 DBGC(dev, "Transmit ring full\n");
309 return -ENOBUFS;
310 }
311
312 entry = tp->tx_prod;
313
314 iob_pad(iob, ETH_ZLEN);
315 mapping = virt_to_bus(iob->data);
316 len = iob_len(iob);
317
318 tp->tx_buffers[entry].iob = iob;
319
320 tg3_set_txd(tp, entry, mapping, len, TXD_FLAG_END);
321
322 entry = NEXT_TX(entry);
323
324 /* Packets are ready, update Tx producer idx local and on card. */
325 tw32_tx_mbox(tp->prodmbox, entry);
326
327 tp->tx_prod = entry;
328
329 mb();
330
331 return 0;
332}
333
334static void tg3_tx_complete(struct net_device *dev)
335{ DBGP("%s\n", __func__);
336
337 struct tg3 *tp = dev->priv;
338 u32 hw_idx = tp->hw_status->idx[0].tx_consumer;
339 u32 sw_idx = tp->tx_cons;
340
341 while (sw_idx != hw_idx) {
342 struct io_buffer *iob = tp->tx_buffers[sw_idx].iob;
343
344 DBGC2(dev, "Transmitted packet: %zd bytes\n", iob_len(iob));
345
346 netdev_tx_complete(dev, iob);
347 sw_idx = NEXT_TX(sw_idx);
348 }
349
350 tp->tx_cons = sw_idx;
351}
352
353#define TG3_RX_STD_BUFF_RING_BYTES(tp) \
354 (sizeof(struct ring_info) * TG3_RX_STD_MAX_SIZE_5700)
355#define TG3_RX_STD_RING_BYTES(tp) \
356 (sizeof(struct tg3_rx_buffer_desc) * TG3_RX_STD_MAX_SIZE_5700)
357
358/* Returns 0 or < 0 on error.
359 *
360 * We only need to fill in the address because the other members
361 * of the RX descriptor are invariant, see tg3_init_rings.
362 *
363 * Note the purposeful assymetry of cpu vs. chip accesses. For
364 * posting buffers we only dirty the first cache line of the RX
365 * descriptor (containing the address). Whereas for the RX status
366 * buffers the cpu only reads the last cacheline of the RX descriptor
367 * (to fetch the error flags, vlan tag, checksum, and opaque cookie).
368 */
369static int tg3_alloc_rx_iob(struct tg3_rx_prodring_set *tpr, u32 dest_idx_unmasked)
370{ DBGP("%s\n", __func__);
371
372 struct tg3_rx_buffer_desc *desc;
373 struct io_buffer *iob;
374 dma_addr_t mapping;
375 int dest_idx, iob_idx;
376
377 dest_idx = dest_idx_unmasked & (TG3_RX_STD_MAX_SIZE_5700 - 1);
378 desc = &tpr->rx_std[dest_idx];
379
380 /* Do not overwrite any of the map or rp information
381 * until we are sure we can commit to a new buffer.
382 *
383 * Callers depend upon this behavior and assume that
384 * we leave everything unchanged if we fail.
385 */
387 if (iob == NULL)
388 return -ENOMEM;
389
390 iob_idx = dest_idx % TG3_DEF_RX_RING_PENDING;
391 tpr->rx_iobufs[iob_idx] = iob;
392
393 mapping = virt_to_bus(iob->data);
394
395 desc->addr_hi = ((u64)mapping >> 32);
396 desc->addr_lo = ((u64)mapping & 0xffffffff);
397
398 return 0;
399}
400
401static void tg3_refill_prod_ring(struct tg3 *tp)
402{ DBGP("%s\n", __func__);
403
404 struct tg3_rx_prodring_set *tpr = &tp->prodring;
405 int idx = tpr->rx_std_prod_idx;
406
407 DBGCP(tp->dev, "%s\n", __func__);
408
410 if (tpr->rx_iobufs[idx % TG3_DEF_RX_RING_PENDING] == NULL) {
411 if (tg3_alloc_rx_iob(tpr, idx) < 0) {
412 DBGC(tp->dev, "alloc_iob() failed for descriptor %d\n", idx);
413 break;
414 }
415 DBGC2(tp->dev, "allocated iob_buffer for descriptor %d\n", idx);
416 }
417
418 idx = (idx + 1) % TG3_RX_STD_MAX_SIZE_5700;
419 tpr->rx_std_iob_cnt++;
420 }
421
422 if ((u32)idx != tpr->rx_std_prod_idx) {
423 tpr->rx_std_prod_idx = idx;
425 }
426}
427
428static void tg3_rx_complete(struct net_device *dev)
429{ DBGP("%s\n", __func__);
430
431 struct tg3 *tp = dev->priv;
432
433 u32 sw_idx = tp->rx_rcb_ptr;
434 u16 hw_idx;
435 struct tg3_rx_prodring_set *tpr = &tp->prodring;
436
437 hw_idx = *(tp->rx_rcb_prod_idx);
438
439 while (sw_idx != hw_idx) {
440 struct tg3_rx_buffer_desc *desc = &tp->rx_rcb[sw_idx];
441 u32 desc_idx = desc->opaque & RXD_OPAQUE_INDEX_MASK;
442 int iob_idx = desc_idx % TG3_DEF_RX_RING_PENDING;
443 struct io_buffer *iob = tpr->rx_iobufs[iob_idx];
444 unsigned int len;
445
446 DBGC2(dev, "RX - desc_idx: %d sw_idx: %d hw_idx: %d\n", desc_idx, sw_idx, hw_idx);
447
448 assert(iob != NULL);
449
450 if ((desc->err_vlan & RXD_ERR_MASK) != 0 &&
451 (desc->err_vlan != RXD_ERR_ODD_NIBBLE_RCVD_MII)) {
452 /* drop packet */
453 DBGC(dev, "Corrupted packet received\n");
454 netdev_rx_err(dev, iob, -EINVAL);
455 } else {
456 len = ((desc->idx_len & RXD_LEN_MASK) >> RXD_LEN_SHIFT) -
458 iob_put(iob, len);
459 netdev_rx(dev, iob);
460
461 DBGC2(dev, "Received packet: %d bytes %d %d\n", len, sw_idx, hw_idx);
462 }
463
464 sw_idx++;
465 sw_idx &= TG3_RX_RET_MAX_SIZE_5705 - 1;
466
467 tpr->rx_iobufs[iob_idx] = NULL;
468 tpr->rx_std_iob_cnt--;
469 }
470
471 if (tp->rx_rcb_ptr != sw_idx) {
472 tw32_rx_mbox(tp->consmbox, sw_idx);
473 tp->rx_rcb_ptr = sw_idx;
474 }
475
477}
478
479static void tg3_poll(struct net_device *dev)
480{ DBGP("%s\n", __func__);
481
482 struct tg3 *tp = dev->priv;
483
484 /* ACK interrupts */
485 /*
486 *tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00);
487 */
488 tp->hw_status->status &= ~SD_STATUS_UPDATED;
489
490 mb();
491
495}
496
497static void tg3_close(struct net_device *dev)
498{ DBGP("%s\n", __func__);
499
500 struct tg3 *tp = dev->priv;
501
502 DBGP("%s\n", __func__);
503
504 tg3_halt(tp);
505 tg3_rx_prodring_free(&tp->prodring);
506 tg3_flag_clear(tp, INIT_COMPLETE);
507
509
510}
511
512static void tg3_irq(struct net_device *dev, int enable)
513{ DBGP("%s\n", __func__);
514
515 struct tg3 *tp = dev->priv;
516
517 DBGP("%s: %d\n", __func__, enable);
518
519 if (enable)
521 else
523}
524
526 .open = tg3_open,
527 .close = tg3_close,
528 .poll = tg3_poll,
529 .transmit = tg3_transmit,
530 .irq = tg3_irq,
531};
532
533#define TEST_BUFFER_SIZE 0x2000
534
535int tg3_do_test_dma(struct tg3 *tp, u32 __unused *buf, dma_addr_t buf_dma, int size, int to_device);
536void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val);
537
538static int tg3_test_dma(struct tg3 *tp)
539{ DBGP("%s\n", __func__);
540
541 dma_addr_t buf_dma;
542 u32 *buf;
543 int ret = 0;
544
546 if (!buf) {
547 ret = -ENOMEM;
548 goto out_nofree;
549 }
550 buf_dma = virt_to_bus(buf);
551 DBGC2(tp->dev, "dma test buffer, virt: %p phys: %#016lx\n", buf, buf_dma);
552
553 if (tg3_flag(tp, 57765_PLUS)) {
555 goto out;
556 }
557
558 tp->dma_rwctrl = ((0x7 << DMA_RWCTRL_PCI_WRITE_CMD_SHIFT) |
560
561 if (tg3_flag(tp, PCI_EXPRESS)) {
562 /* DMA read watermark not used on PCIE */
563 tp->dma_rwctrl |= 0x00180000;
564 } else if (!tg3_flag(tp, PCIX_MODE)) {
565 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 ||
566 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750)
567 tp->dma_rwctrl |= 0x003f0000;
568 else
569 tp->dma_rwctrl |= 0x003f000f;
570 } else {
571 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 ||
572 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) {
573 u32 ccval = (tr32(TG3PCI_CLOCK_CTRL) & 0x1f);
574 u32 read_water = 0x7;
575
576 if (ccval == 0x6 || ccval == 0x7)
577 tp->dma_rwctrl |= DMA_RWCTRL_ONE_DMA;
578
579 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703)
580 read_water = 4;
581 /* Set bit 23 to enable PCIX hw bug fix */
582 tp->dma_rwctrl |=
583 (read_water << DMA_RWCTRL_READ_WATER_SHIFT) |
585 (1 << 23);
586 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) {
587 /* 5780 always in PCIX mode */
588 tp->dma_rwctrl |= 0x00144000;
589 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714) {
590 /* 5714 always in PCIX mode */
591 tp->dma_rwctrl |= 0x00148000;
592 } else {
593 tp->dma_rwctrl |= 0x001b000f;
594 }
595 }
596
597 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 ||
598 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704)
599 tp->dma_rwctrl &= 0xfffffff0;
600
601 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
602 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701) {
603 /* Remove this if it causes problems for some boards. */
604 tp->dma_rwctrl |= DMA_RWCTRL_USE_MEM_READ_MULT;
605
606 /* On 5700/5701 chips, we need to set this bit.
607 * Otherwise the chip will issue cacheline transactions
608 * to streamable DMA memory with not all the byte
609 * enables turned on. This is an error on several
610 * RISC PCI controllers, in particular sparc64.
611 *
612 * On 5703/5704 chips, this bit has been reassigned
613 * a different meaning. In particular, it is used
614 * on those chips to enable a PCI-X workaround.
615 */
616 tp->dma_rwctrl |= DMA_RWCTRL_ASSERT_ALL_BE;
617 }
618
619 tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl);
620
621#if 0
622 /* Unneeded, already done by tg3_get_invariants. */
624#endif
625
626 if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700 &&
627 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701)
628 goto out;
629
630 /* It is best to perform DMA test with maximum write burst size
631 * to expose the 5700/5701 write DMA bug.
632 */
633 tp->dma_rwctrl &= ~DMA_RWCTRL_WRITE_BNDRY_MASK;
634 tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl);
635
636 while (1) {
637 u32 *p = buf, i;
638
639 for (i = 0; i < TEST_BUFFER_SIZE / sizeof(u32); i++)
640 p[i] = i;
641
642 /* Send the buffer to the chip. */
643 ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, 1);
644 if (ret) {
645 DBGC(&tp->pdev->dev,
646 "%s: Buffer write failed. err = %d\n",
647 __func__, ret);
648 break;
649 }
650
651 /* validate data reached card RAM correctly. */
652 for (i = 0; i < TEST_BUFFER_SIZE / sizeof(u32); i++) {
653 u32 val;
654 tg3_read_mem(tp, 0x2100 + (i*4), &val);
655 if (le32_to_cpu(val) != p[i]) {
656 DBGC(&tp->pdev->dev,
657 "%s: Buffer corrupted on device! "
658 "(%d != %d)\n", __func__, val, i);
659 /* ret = -ENODEV here? */
660 }
661 p[i] = 0;
662 }
663
664 /* Now read it back. */
665 ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, 0);
666 if (ret) {
667 DBGC(&tp->pdev->dev, "%s: Buffer read failed. "
668 "err = %d\n", __func__, ret);
669 break;
670 }
671
672 /* Verify it. */
673 for (i = 0; i < TEST_BUFFER_SIZE / sizeof(u32); i++) {
674 if (p[i] == i)
675 continue;
676
677 if ((tp->dma_rwctrl & DMA_RWCTRL_WRITE_BNDRY_MASK) !=
679 tp->dma_rwctrl &= ~DMA_RWCTRL_WRITE_BNDRY_MASK;
680 tp->dma_rwctrl |= DMA_RWCTRL_WRITE_BNDRY_16;
681 tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl);
682 break;
683 } else {
684 DBGC(&tp->pdev->dev,
685 "%s: Buffer corrupted on read back! "
686 "(%d != %d)\n", __func__, p[i], i);
687 ret = -ENODEV;
688 goto out;
689 }
690 }
691
692 if (i == (TEST_BUFFER_SIZE / sizeof(u32))) {
693 /* Success. */
694 ret = 0;
695 break;
696 }
697 }
698
699 if ((tp->dma_rwctrl & DMA_RWCTRL_WRITE_BNDRY_MASK) !=
701 /* DMA test passed without adjusting DMA boundary,
702 * now look for chipsets that are known to expose the
703 * DMA bug without failing the test.
704 */
705 tp->dma_rwctrl &= ~DMA_RWCTRL_WRITE_BNDRY_MASK;
706 tp->dma_rwctrl |= DMA_RWCTRL_WRITE_BNDRY_16;
707
708 tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl);
709 }
710
711out:
713out_nofree:
714 return ret;
715}
716
717static int tg3_init_one(struct pci_device *pdev)
718{ DBGP("%s\n", __func__);
719
720 struct net_device *dev;
721 struct tg3 *tp;
722 int err = 0;
723 unsigned long reg_base, reg_size;
724
726
727 dev = alloc_etherdev(sizeof(*tp));
728 if (!dev) {
729 DBGC(&pdev->dev, "Failed to allocate etherdev\n");
730 err = -ENOMEM;
731 goto err_out_disable_pdev;
732 }
733
736
737 dev->dev = &pdev->dev;
738
739 tp = dev->priv;
740 tp->pdev = pdev;
741 tp->dev = dev;
742 tp->rx_mode = TG3_DEF_RX_MODE;
743 tp->tx_mode = TG3_DEF_TX_MODE;
744
745 /* Subsystem IDs are required later */
746 pci_read_config_word(tp->pdev, PCI_SUBSYSTEM_VENDOR_ID, &tp->subsystem_vendor);
747 pci_read_config_word(tp->pdev, PCI_SUBSYSTEM_ID, &tp->subsystem_device);
748
749 /* The word/byte swap controls here control register access byte
750 * swapping. DMA data byte swapping is controlled in the GRC_MODE
751 * setting below.
752 */
753 tp->misc_host_ctrl =
758
759 /* The NONFRM (non-frame) byte/word swap controls take effect
760 * on descriptor entries, anything which isn't packet data.
761 *
762 * The StrongARM chips on the board (one for tx, one for rx)
763 * are running in big-endian mode.
764 */
767#if __BYTE_ORDER == __BIG_ENDIAN
768 tp->grc_mode |= GRC_MODE_BSWAP_NONFRM_DATA;
769#endif
770
771 /* FIXME: how can we detect errors here? */
774
775 tp->regs = pci_ioremap(pdev, reg_base, reg_size);
776 if (!tp->regs) {
777 DBGC(&pdev->dev, "Failed to remap device registers\n");
778 errno = -ENOENT;
779 goto err_out_disable_pdev;
780 }
781
782 err = tg3_get_invariants(tp);
783 if (err) {
784 DBGC(&pdev->dev, "Problem fetching invariants of chip, aborting\n");
785 goto err_out_iounmap;
786 }
787
789
791 if (err) {
792 DBGC(&pdev->dev, "Could not obtain valid ethernet address, aborting\n");
793 goto err_out_iounmap;
794 }
795
796 /*
797 * Reset chip in case UNDI or EFI driver did not shutdown
798 * DMA self test will enable WDMAC and we'll see (spurious)
799 * pending DMA on the PCI bus at that point.
800 */
804 tg3_halt(tp);
805 }
806
807 err = tg3_test_dma(tp);
808 if (err) {
809 DBGC(&pdev->dev, "DMA engine test failed, aborting\n");
810 goto err_out_iounmap;
811 }
812
816
817 tp->coal_now = HOSTCC_MODE_NOW;
818
819 err = register_netdev(dev);
820 if (err) {
821 DBGC(&pdev->dev, "Cannot register net device, aborting\n");
822 goto err_out_iounmap;
823 }
824
825 /* Call tg3_setup_phy() to start autoneg process, which saves time
826 * over starting autoneg in tg3_open();
827 */
828 err = tg3_setup_phy(tp, 0);
829 if (err) {
830 DBGC(tp->dev, "tg3_setup_phy() call failed in %s\n", __func__);
831 goto err_out_iounmap;
832 }
833
834 return 0;
835
836err_out_iounmap:
837 if (tp->regs) {
838 iounmap(tp->regs);
839 tp->regs = NULL;
840 }
841
843
844err_out_disable_pdev:
846 return err;
847}
848
849static void tg3_remove_one(struct pci_device *pci)
850{ DBGP("%s\n", __func__);
851
852 struct net_device *netdev = pci_get_drvdata(pci);
853
857}
858
859static struct pci_device_id tg3_nics[] = {
860 PCI_ROM(0x106b, 0x1645, "106b-1645", "106b-1645", 0),
861 PCI_ROM(0x1148, 0x4400, "1148-4400", "1148-4400", 0),
862 PCI_ROM(0x1148, 0x4500, "1148-4500", "1148-4500", 0),
863 PCI_ROM(0x14e4, 0x1600, "14e4-1600", "14e4-1600", 0),
864 PCI_ROM(0x14e4, 0x1601, "14e4-1601", "14e4-1601", 0),
865 PCI_ROM(0x14e4, 0x1644, "14e4-1644", "14e4-1644", 0),
866 PCI_ROM(0x14e4, 0x1645, "14e4-1645", "14e4-1645", 0),
867 PCI_ROM(0x14e4, 0x1646, "14e4-1646", "14e4-1646", 0),
868 PCI_ROM(0x14e4, 0x1647, "14e4-1647", "14e4-1647", 0),
869 PCI_ROM(0x14e4, 0x1648, "14e4-1648", "14e4-1648", 0),
870 PCI_ROM(0x14e4, 0x1649, "14e4-1649", "14e4-1649", 0),
871 PCI_ROM(0x14e4, 0x164d, "14e4-164d", "14e4-164d", 0),
872 PCI_ROM(0x14e4, 0x1653, "14e4-1653", "14e4-1653", 0),
873 PCI_ROM(0x14e4, 0x1654, "14e4-1654", "14e4-1654", 0),
874 PCI_ROM(0x14e4, 0x1655, "14e4-1655", "14e4-1655", 0),
875 PCI_ROM(0x14e4, 0x1656, "14e4-1656", "14e4-1656", 0),
876 PCI_ROM(0x14e4, 0x1657, "14e4-1657", "14e4-1657", 0),
877 PCI_ROM(0x14e4, 0x1659, "14e4-1659", "14e4-1659", 0),
878 PCI_ROM(0x14e4, 0x165a, "14e4-165a", "14e4-165a", 0),
879 PCI_ROM(0x14e4, 0x165b, "14e4-165b", "14e4-165b", 0),
880 PCI_ROM(0x14e4, 0x165d, "14e4-165d", "14e4-165d", 0),
881 PCI_ROM(0x14e4, 0x165e, "14e4-165e", "14e4-165e", 0),
882 PCI_ROM(0x14e4, 0x165f, "14e4-165f", "14e4-165f", 0),
883 PCI_ROM(0x14e4, 0x1668, "14e4-1668", "14e4-1668", 0),
884 PCI_ROM(0x14e4, 0x1669, "14e4-1669", "14e4-1669", 0),
885 PCI_ROM(0x14e4, 0x166a, "14e4-166a", "14e4-166a", 0),
886 PCI_ROM(0x14e4, 0x166b, "14e4-166b", "14e4-166b", 0),
887 PCI_ROM(0x14e4, 0x166e, "14e4-166e", "14e4-166e", 0),
888 PCI_ROM(0x14e4, 0x1672, "14e4-1672", "14e4-1672", 0),
889 PCI_ROM(0x14e4, 0x1673, "14e4-1673", "14e4-1673", 0),
890 PCI_ROM(0x14e4, 0x1674, "14e4-1674", "14e4-1674", 0),
891 PCI_ROM(0x14e4, 0x1677, "14e4-1677", "14e4-1677", 0),
892 PCI_ROM(0x14e4, 0x1678, "14e4-1678", "14e4-1678", 0),
893 PCI_ROM(0x14e4, 0x1679, "14e4-1679", "14e4-1679", 0),
894 PCI_ROM(0x14e4, 0x167a, "14e4-167a", "14e4-167a", 0),
895 PCI_ROM(0x14e4, 0x167b, "14e4-167b", "14e4-167b", 0),
896 PCI_ROM(0x14e4, 0x167d, "14e4-167d", "14e4-167d", 0),
897 PCI_ROM(0x14e4, 0x167e, "14e4-167e", "14e4-167e", 0),
898 PCI_ROM(0x14e4, 0x167f, "14e4-167f", "14e4-167f", 0),
899 PCI_ROM(0x14e4, 0x1680, "14e4-1680", "14e4-1680", 0),
900 PCI_ROM(0x14e4, 0x1681, "14e4-1681", "14e4-1681", 0),
901 PCI_ROM(0x14e4, 0x1682, "14e4-1682", "14e4-1682", 0),
902 PCI_ROM(0x14e4, 0x1684, "14e4-1684", "14e4-1684", 0),
903 PCI_ROM(0x14e4, 0x1686, "14e4-1686", "14e4-1686", 0),
904 PCI_ROM(0x14e4, 0x1688, "14e4-1688", "14e4-1688", 0),
905 PCI_ROM(0x14e4, 0x1689, "14e4-1689", "14e4-1689", 0),
906 PCI_ROM(0x14e4, 0x1690, "14e4-1690", "14e4-1690", 0),
907 PCI_ROM(0x14e4, 0x1691, "14e4-1691", "14e4-1691", 0),
908 PCI_ROM(0x14e4, 0x1692, "14e4-1692", "14e4-1692", 0),
909 PCI_ROM(0x14e4, 0x1693, "14e4-1693", "14e4-1693", 0),
910 PCI_ROM(0x14e4, 0x1694, "14e4-1694", "14e4-1694", 0),
911 PCI_ROM(0x14e4, 0x1696, "14e4-1696", "14e4-1696", 0),
912 PCI_ROM(0x14e4, 0x1698, "14e4-1698", "14e4-1698", 0),
913 PCI_ROM(0x14e4, 0x1699, "14e4-1699", "14e4-1699", 0),
914 PCI_ROM(0x14e4, 0x169a, "14e4-169a", "14e4-169a", 0),
915 PCI_ROM(0x14e4, 0x169b, "14e4-169b", "14e4-169b", 0),
916 PCI_ROM(0x14e4, 0x169c, "14e4-169c", "14e4-169c", 0),
917 PCI_ROM(0x14e4, 0x169d, "14e4-169d", "14e4-169d", 0),
918 PCI_ROM(0x14e4, 0x16a0, "14e4-16a0", "14e4-16a0", 0),
919 PCI_ROM(0x14e4, 0x16a6, "14e4-16a6", "14e4-16a6", 0),
920 PCI_ROM(0x14e4, 0x16a7, "14e4-16a7", "14e4-16a7", 0),
921 PCI_ROM(0x14e4, 0x16a8, "14e4-16a8", "14e4-16a8", 0),
922 PCI_ROM(0x14e4, 0x16b0, "14e4-16b0", "14e4-16b0", 0),
923 PCI_ROM(0x14e4, 0x16b1, "14e4-16b1", "14e4-16b1", 0),
924 PCI_ROM(0x14e4, 0x16b2, "14e4-16b2", "14e4-16b2", 0),
925 PCI_ROM(0x14e4, 0x16b4, "14e4-16b4", "14e4-16b4", 0),
926 PCI_ROM(0x14e4, 0x16b5, "14e4-16b5", "14e4-16b5", 0),
927 PCI_ROM(0x14e4, 0x16b6, "14e4-16b6", "14e4-16b6", 0),
928 PCI_ROM(0x14e4, 0x16c6, "14e4-16c6", "14e4-16c6", 0),
929 PCI_ROM(0x14e4, 0x16c7, "14e4-16c7", "14e4-16c7", 0),
930 PCI_ROM(0x14e4, 0x16dd, "14e4-16dd", "14e4-16dd", 0),
931 PCI_ROM(0x14e4, 0x16f7, "14e4-16f7", "14e4-16f7", 0),
932 PCI_ROM(0x14e4, 0x16fd, "14e4-16fd", "14e4-16fd", 0),
933 PCI_ROM(0x14e4, 0x16fe, "14e4-16fe", "14e4-16fe", 0),
934 PCI_ROM(0x14e4, 0x170d, "14e4-170d", "14e4-170d", 0),
935 PCI_ROM(0x14e4, 0x170e, "14e4-170e", "14e4-170e", 0),
936 PCI_ROM(0x14e4, 0x1712, "14e4-1712", "14e4-1712", 0),
937 PCI_ROM(0x14e4, 0x1713, "14e4-1713", "14e4-1713", 0),
938 PCI_ROM(0x173b, 0x03e8, "173b-03e8", "173b-03e8", 0),
939 PCI_ROM(0x173b, 0x03e9, "173b-03e9", "173b-03e9", 0),
940 PCI_ROM(0x173b, 0x03ea, "173b-03ea", "173b-03ea", 0),
941 PCI_ROM(0x173b, 0x03eb, "173b-03eb", "173b-03eb", 0),
942};
943
944struct pci_driver tg3_pci_driver __pci_driver = {
945 .ids = tg3_nics,
946 .id_count = ARRAY_SIZE(tg3_nics),
947 .probe = tg3_init_one,
948 .remove = tg3_remove_one,
949};
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
__be32 out[4]
Definition CIB_PRM.h:8
unsigned int uint32_t
Definition stdint.h:12
#define assert(condition)
Assert a condition at run-time.
Definition assert.h:50
#define ETH_FCS_LEN
Definition atl1e.h:45
#define rxd
Definition davicom.c:146
ring len
Length.
Definition dwmac.h:226
#define ARRAY_SIZE(x)
Definition efx_common.h:43
struct ena_llq_option desc
Descriptor counts.
Definition ena.h:9
int errno
Global "last error" number.
Definition errno.c:21
Error codes.
#define dma_addr_t
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
Definition ethernet.c:265
Ethernet protocol.
static struct net_device * netdev
Definition gdbudp.c:53
#define __unused
Declare a variable or data structure as unused.
Definition compiler.h:573
#define DBGP(...)
Definition compiler.h:532
#define DBGC2(...)
Definition compiler.h:522
#define DBGCP(...)
Definition compiler.h:539
#define DBGC(...)
Definition compiler.h:505
uint16_t size
Buffer size.
Definition dwmac.h:3
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define ENOENT
No such file or directory.
Definition errno.h:515
#define EINVAL
Invalid argument.
Definition errno.h:429
#define ENOMEM
Not enough space.
Definition errno.h:535
#define ENOBUFS
No buffer space available.
Definition errno.h:499
#define ENODEV
No such device.
Definition errno.h:510
#define ETH_ZLEN
Definition if_ether.h:11
#define le32_to_cpu(value)
Definition byteswap.h:114
#define barrier()
Optimisation barrier.
Definition compiler.h:633
void mb(void)
Memory barrier.
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
Definition io.h:184
void iounmap(volatile const void *io_addr)
Unmap I/O address.
int pci_read_config_word(struct pci_device *pci, unsigned int where, uint16_t *value)
Read 16-bit word from PCI configuration space.
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
iPXE timers
void __asmcall int val
Definition setjmp.h:12
uint64_t u64
Definition stdint.h:26
String functions.
void * memset(void *dest, int character, size_t len) __nonnull
void iob_pad(struct io_buffer *iobuf, size_t min_len)
Pad I/O buffer.
Definition iobpad.c:50
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition iobuf.c:153
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
Definition iobuf.c:131
I/O buffers.
#define iob_put(iobuf, len)
Definition iobuf.h:125
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition iobuf.h:160
void * zalloc(size_t size)
Allocate cleared memory.
Definition malloc.c:662
void * malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
Definition malloc.c:707
void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
Definition malloc.c:723
Dynamic memory allocation.
Media Independent Interface constants.
static unsigned int unsigned int reg
Definition myson.h:162
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
Definition netdevice.c:549
void unregister_netdev(struct net_device *netdev)
Unregister network device.
Definition netdevice.c:942
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
Definition netdevice.c:587
int register_netdev(struct net_device *netdev)
Register network device.
Definition netdevice.c:760
Network device management.
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
Definition netdevice.h:519
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
Definition netdevice.h:532
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
Definition netdevice.h:576
static void netdev_tx_complete(struct net_device *netdev, struct io_buffer *iobuf)
Complete network transmission.
Definition netdevice.h:767
unsigned long pci_bar_size(struct pci_device *pci, unsigned int reg)
Get the size of a PCI BAR.
Definition pci.c:164
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
Definition pci.c:241
unsigned long pci_bar_start(struct pci_device *pci, unsigned int reg)
Find the start of a PCI BAR.
Definition pci.c:97
PCI bus.
#define __pci_driver
Declare a PCI driver.
Definition pci.h:278
#define PCI_SUBSYSTEM_ID
PCI subsystem ID.
Definition pci.h:79
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
Definition pci.h:366
#define PCI_ROM(_vendor, _device, _name, _description, _data)
Definition pci.h:308
#define PCI_BASE_ADDRESS_0
Definition pci.h:63
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
Definition pci.h:376
#define PCI_SUBSYSTEM_VENDOR_ID
PCI subsystem vendor ID.
Definition pci.h:76
static void(* free)(struct refcnt *refcnt))
Definition refcnt.h:55
char * strerror(int errno)
Retrieve string representation of error number.
Definition strerror.c:79
A persistent I/O buffer.
Definition iobuf.h:38
void * data
Start of data.
Definition iobuf.h:53
Network device operations.
Definition netdevice.h:214
A network device.
Definition netdevice.h:353
void * priv
Driver private data.
Definition netdevice.h:432
struct device * dev
Underlying hardware device.
Definition netdevice.h:365
A PCI device ID list entry.
Definition pci.h:175
A PCI device.
Definition pci.h:211
struct device dev
Generic device.
Definition pci.h:213
A PCI driver.
Definition pci.h:252
struct tg3_hw_status::@346154016361251030104324040037321237160035164370 idx[16]
u16 rx_producer
Definition tg3.h:2696
struct tg3_rx_buffer_desc * rx_std
Definition tg3.h:2955
struct io_buffer * rx_iobufs[TG3_DEF_RX_RING_PENDING]
Definition tg3.h:2956
dma_addr_t rx_std_mapping
Definition tg3.h:2957
Definition tg3.h:3047
struct pci_device * pdev
Definition tg3.h:3092
struct net_device * dev
Definition tg3.h:3091
void tg3_rx_prodring_fini(struct tg3_rx_prodring_set *tpr)
Definition tg3.c:42
#define TEST_BUFFER_SIZE
Definition tg3.c:533
static int tg3_transmit(struct net_device *dev, struct io_buffer *iob)
Definition tg3.c:300
static int tg3_open(struct net_device *dev)
Definition tg3.c:234
int tg3_do_test_dma(struct tg3 *tp, u32 __unused *buf, dma_addr_t buf_dma, int size, int to_device)
Definition tg3_hw.c:2595
#define TG3_TX_RING_BYTES
Definition tg3.c:32
static int tg3_test_dma(struct tg3 *tp)
Definition tg3.c:538
static void tg3_irq(struct net_device *dev, int enable)
Definition tg3.c:512
static int tg3_alloc_rx_iob(struct tg3_rx_prodring_set *tpr, u32 dest_idx_unmasked)
Definition tg3.c:369
static u32 tg3_tx_avail(struct tg3 *tp)
Definition tg3.c:261
#define TG3_DEF_TX_MODE
Definition tg3.c:21
static struct pci_device_id tg3_nics[]
Definition tg3.c:859
static void tg3_refill_prod_ring(struct tg3 *tp)
Definition tg3.c:401
#define TG3_RX_RCB_RING_BYTES(tp)
Definition tg3.c:36
static void tg3_rx_iob_free(struct io_buffer *iobs[], int i)
Definition tg3.c:179
static void tg3_remove_one(struct pci_device *pci)
Definition tg3.c:849
static int tg3_rx_prodring_alloc(struct tg3 __unused *tp, struct tg3_rx_prodring_set *tpr)
Definition tg3.c:152
static void tg3_free_consistent(struct tg3 *tp)
Definition tg3.c:55
void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val)
Definition tg3_hw.c:153
static void tg3_rx_complete(struct net_device *dev)
Definition tg3.c:428
static int tg3_init_one(struct pci_device *pdev)
Definition tg3.c:717
static void tg3_rx_prodring_free(struct tg3_rx_prodring_set *tpr)
Definition tg3.c:189
#define NEXT_TX(N)
Definition tg3.c:295
int tg3_alloc_consistent(struct tg3 *tp)
Definition tg3.c:85
#define TG3_RX_STD_RING_BYTES(tp)
Definition tg3.c:39
#define TG3_DEF_RX_MODE
Definition tg3.c:20
int tg3_init_rings(struct tg3 *tp)
Definition tg3.c:204
static struct net_device_operations tg3_netdev_ops
Definition tg3.c:525
static void tg3_tx_complete(struct net_device *dev)
Definition tg3.c:334
static void tg3_poll(struct net_device *dev)
Definition tg3.c:479
static void tg3_close(struct net_device *dev)
Definition tg3.c:497
#define MISC_HOST_CTRL_INDIR_ACCESS
Definition tg3.h:252
void tg3_set_power_state_0(struct tg3 *tp)
Definition tg3_hw.c:130
#define TG3_DMA_ALIGNMENT
Definition tg3.h:3313
#define RDMAC_STATUS
Definition tg3.h:1495
#define ASIC_REV_5780
Definition tg3.h:306
int tg3_init_hw(struct tg3 *tp, int reset_phy)
Definition tg3_hw.c:2573
#define TG3_RX_STD_DMA_SZ
Definition tg3.h:3315
#define ASIC_REV_5701
Definition tg3.h:300
#define tw32_tx_mbox(reg, val)
Definition tg3.h:3336
#define DMA_RWCTRL_PCI_WRITE_CMD_SHIFT
Definition tg3.h:378
#define MAILBOX_INTERRUPT_0
Definition tg3.h:431
#define TG3PCI_DMA_RW_CTRL
Definition tg3.h:340
#define RXD_ERR_MASK
Definition tg3.h:2625
#define tr32(reg)
Definition tg3.h:3339
#define ASIC_REV_5705
Definition tg3.h:303
#define RXD_FLAG_END
Definition tg3.h:2597
#define MAILBOX_SNDHOST_PROD_IDX_0
Definition tg3.h:467
#define TG3_HW_STATUS_SIZE
Definition tg3.h:2669
#define DMA_RWCTRL_WRITE_BNDRY_MASK
Definition tg3.h:356
#define TG3_DEF_TX_RING_PENDING
Definition tg3.h:3311
#define RXD_ERR_ODD_NIBBLE_RCVD_MII
Definition tg3.h:2620
#define GRC_MODE_WSWAP_DATA
Definition tg3.h:1787
#define GET_ASIC_REV(CHIP_REV_ID)
Definition tg3.h:298
#define tg3_flag(tp, flag)
Definition tg3.h:3365
#define TX_CPU_STATE
Definition tg3.h:1607
#define RXD_LEN_MASK
Definition tg3.h:2590
#define HOSTCC_MODE_NOW
Definition tg3.h:1303
#define MISC_HOST_CTRL_PCISTATE_RW
Definition tg3.h:249
#define DMA_RWCTRL_PCI_READ_CMD_SHIFT
Definition tg3.h:376
#define WDMAC_STATUS
Definition tg3.h:1536
void tg3_enable_ints(struct tg3 *tp)
Definition tg3_hw.c:968
#define MISC_HOST_CTRL_MASK_PCI_INT
Definition tg3.h:246
#define MSGINT_STATUS
Definition tg3.h:1770
#define tw32(reg, val)
Definition tg3.h:3329
#define TG3_RX_STD_PROD_IDX_REG
Definition tg3.h:445
#define HOSTCC_MODE
Definition tg3.h:1299
#define ASIC_REV_5750
Definition tg3.h:304
#define TG3_DEF_RX_RING_PENDING
Definition tg3.h:2949
#define ASIC_REV_5703
Definition tg3.h:301
#define TG3PCI_CLOCK_CTRL
Definition tg3.h:395
void tg3_set_txd(struct tg3 *tp, int entry, dma_addr_t mapping, int len, u32 flags)
Definition tg3_hw.c:2583
#define RXD_FLAGS_SHIFT
Definition tg3.h:2595
#define HOSTCC_FLOW_ATTN
Definition tg3.h:1359
#define GRC_MODE_WSWAP_NONFRM_DATA
Definition tg3.h:1785
#define SD_STATUS_UPDATED
Definition tg3.h:2672
#define MAILBOX_RCVRET_CON_IDX_0
Definition tg3.h:451
#define tg3_flag_clear(tp, flag)
Definition tg3.h:3369
#define WDMAC_MODE_ENABLE
Definition tg3.h:1524
void tg3_init_bufmgr_config(struct tg3 *tp)
Definition tg3_hw.c:850
#define DMA_RWCTRL_USE_MEM_READ_MULT
Definition tg3.h:373
#define RX_CPU_STATE
Definition tg3.h:1602
int tg3_get_invariants(struct tg3 *tp)
Definition tg3_hw.c:394
#define TG3_RX_STD_MAX_SIZE_5700
Definition tg3.h:173
#define RXD_LEN_SHIFT
Definition tg3.h:2591
int tg3_halt(struct tg3 *tp)
Definition tg3_hw.c:1481
#define MEMARB_MODE
Definition tg3.h:1410
#define ASIC_REV_5700
Definition tg3.h:299
#define MISC_HOST_CTRL_WORD_SWAP
Definition tg3.h:248
#define RXD_OPAQUE_RING_STD
Definition tg3.h:2631
#define DMA_RWCTRL_ONE_DMA
Definition tg3.h:368
#define GRC_MODE_BSWAP_DATA
Definition tg3.h:1786
#define ASIC_REV_5704
Definition tg3.h:302
int tg3_setup_phy(struct tg3 *tp, int force_reset)
Definition tg3_phy.c:2521
void tg3_poll_link(struct tg3 *tp)
Definition tg3_phy.c:1009
#define TG3_RX_RET_MAX_SIZE_5705
Definition tg3.h:178
void __tg3_set_mac_addr(struct tg3 *tp, int skip_mac_1)
Definition tg3_hw.c:1094
#define tw32_rx_mbox(reg, val)
Definition tg3.h:3337
#define RXD_OPAQUE_INDEX_SHIFT
Definition tg3.h:2630
#define MAC_STATUS
Definition tg3.h:530
#define DMA_RWCTRL_DIS_CACHE_ALIGNMENT
Definition tg3.h:341
#define HOSTCC_MODE_ENABLE
Definition tg3.h:1301
#define tw32_mailbox(reg, val)
define tw32_mailbox(reg, val) tg3_write_indirect_mbox(((val) & 0xffffffff), tp->regs + (reg))
Definition tg3.h:3331
#define MEMARB_MODE_ENABLE
Definition tg3.h:1412
#define DMA_RWCTRL_READ_WATER_SHIFT
Definition tg3.h:370
#define RXD_OPAQUE_INDEX_MASK
Definition tg3.h:2629
void tg3_disable_ints(struct tg3 *tp)
Definition tg3_hw.c:959
#define TG3_64BIT_REG_LOW
Definition tg3.h:160
int tg3_get_device_address(struct tg3 *tp)
Definition tg3_hw.c:1650
#define DMA_RWCTRL_WRITE_WATER_SHIFT
Definition tg3.h:372
#define DMA_RWCTRL_ASSERT_ALL_BE
Definition tg3.h:374
#define ASIC_REV_5714
Definition tg3.h:307
#define DMA_RWCTRL_WRITE_BNDRY_16
Definition tg3.h:358
#define TG3_TX_RING_SIZE
Definition tg3.h:3310
#define TXD_FLAG_END
Definition tg3.h:2560
#define GRC_MODE_BSWAP_NONFRM_DATA
Definition tg3.h:1784
#define WDMAC_MODE
Definition tg3.h:1522
static void tg3_switch_clocks(struct tg3 *tp)
Definition tg3_hw.c:360
static struct tulip_private * tp
Definition tulip.c:442
#define u16
Definition vga.h:20
#define u32
Definition vga.h:21
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition vsprintf.c:465