Lines Matching +full:mem +full:- +full:base

76 MODULE_PARM_DESC(lance_debug, "SUN3 Lance debug level (0-3)");
77 MODULE_DESCRIPTION("Sun3/Sun3x on-board LANCE Ethernet driver");
97 #define TX_RING_MOD_MASK (TX_RING_SIZE - 1)
101 #define RX_RING_MOD_MASK (RX_RING_SIZE - 1)
107 #define PKTBUF_ADDR(head) (void *)((unsigned long)(MEM) | (head)->base)
112 unsigned short base; /* Low word of base addr */ member
114 unsigned char base_hi; /* High word of base addr (unused) */
120 unsigned short base; /* Low word of base addr */ member
122 unsigned char base_hi; /* High word of base addr (unused) */
129 unsigned short mode; /* Pre-set mode */
132 /* Receive and transmit ring base, along with length bits. */
153 struct lance_memory *mem; member
163 #define MEM lp->mem macro
164 #define DREG lp->iobase[0]
165 #define AREG lp->iobase[1]
226 #define CSR0_CERR 0x2000 /* carrier error (no heartbeat :-) (RC) */
227 #define CSR0_BABL 0x4000 /* babble: tx-ed too many bits (RC) */
253 int err = -ENODEV; in sun3lance_probe()
256 return ERR_PTR(-ENODEV); in sun3lance_probe()
259 switch(idprom->id_machtype) { in sun3lance_probe()
267 return ERR_PTR(-ENODEV); in sun3lance_probe()
271 return ERR_PTR(-ENODEV); in sun3lance_probe()
275 return ERR_PTR(-ENOMEM); in sun3lance_probe()
288 iounmap((void __iomem *)dev->base_addr); in sun3lance_probe()
343 /* XXX - leak? */ in lance_probe()
344 MEM = dvma_malloc_align(sizeof(struct lance_memory), 0x10000); in lance_probe()
345 if (!MEM) { in lance_probe()
353 lp->iobase = (volatile unsigned short *)ioaddr; in lance_probe()
354 dev->base_addr = (unsigned long)ioaddr; /* informational only */ in lance_probe()
362 dvma_free((void *)MEM); in lance_probe()
366 dev->irq = (unsigned short)LANCE_IRQ; in lance_probe()
369 printk("%s: SUN3 Lance at io %#lx, mem %#lx, irq %d, hwaddr ", in lance_probe()
370 dev->name, in lance_probe()
372 (unsigned long)MEM, in lance_probe()
373 dev->irq); in lance_probe()
376 eth_hw_addr_set(dev, idprom->id_ethaddr); in lance_probe()
379 MEM->init.hwaddr[0] = dev->dev_addr[1]; in lance_probe()
380 MEM->init.hwaddr[1] = dev->dev_addr[0]; in lance_probe()
381 MEM->init.hwaddr[2] = dev->dev_addr[3]; in lance_probe()
382 MEM->init.hwaddr[3] = dev->dev_addr[2]; in lance_probe()
383 MEM->init.hwaddr[4] = dev->dev_addr[5]; in lance_probe()
384 MEM->init.hwaddr[5] = dev->dev_addr[4]; in lance_probe()
386 printk("%pM\n", dev->dev_addr); in lance_probe()
388 MEM->init.mode = 0x0000; in lance_probe()
389 MEM->init.filter[0] = 0x00000000; in lance_probe()
390 MEM->init.filter[1] = 0x00000000; in lance_probe()
391 MEM->init.rdra = dvma_vtob(MEM->rx_head); in lance_probe()
392 MEM->init.rlen = (RX_LOG_RING_SIZE << 13) | in lance_probe()
393 (dvma_vtob(MEM->rx_head) >> 16); in lance_probe()
394 MEM->init.tdra = dvma_vtob(MEM->tx_head); in lance_probe()
395 MEM->init.tlen = (TX_LOG_RING_SIZE << 13) | in lance_probe()
396 (dvma_vtob(MEM->tx_head) >> 16); in lance_probe()
399 dvma_vtob(&(MEM->init)), dvma_vtob(MEM->rx_head), in lance_probe()
400 (dvma_vtob(MEM->tx_head)))); in lance_probe()
405 dev->netdev_ops = &lance_netdev_ops; in lance_probe()
406 // KLUDGE -- REMOVE ME in lance_probe()
407 set_bit(__LINK_STATE_PRESENT, &dev->state); in lance_probe()
418 DPRINTK( 2, ( "%s: lance_open()\n", dev->name )); in lance_open()
428 while (--i > 0) in lance_open()
433 dev->name, i, DREG )); in lance_open()
435 return -EIO; in lance_open()
442 DPRINTK( 2, ( "%s: LANCE is open, csr0 %04x\n", dev->name, DREG )); in lance_open()
455 lp->lock = 0; in lance_init_ring()
456 lp->tx_full = 0; in lance_init_ring()
457 lp->new_rx = lp->new_tx = 0; in lance_init_ring()
458 lp->old_rx = lp->old_tx = 0; in lance_init_ring()
461 MEM->tx_head[i].base = dvma_vtob(MEM->tx_data[i]); in lance_init_ring()
462 MEM->tx_head[i].flag = 0; in lance_init_ring()
463 MEM->tx_head[i].base_hi = in lance_init_ring()
464 (dvma_vtob(MEM->tx_data[i])) >>16; in lance_init_ring()
465 MEM->tx_head[i].length = 0; in lance_init_ring()
466 MEM->tx_head[i].misc = 0; in lance_init_ring()
470 MEM->rx_head[i].base = dvma_vtob(MEM->rx_data[i]); in lance_init_ring()
471 MEM->rx_head[i].flag = RMD1_OWN_CHIP; in lance_init_ring()
472 MEM->rx_head[i].base_hi = in lance_init_ring()
473 (dvma_vtob(MEM->rx_data[i])) >> 16; in lance_init_ring()
474 MEM->rx_head[i].buf_length = -PKT_BUF_SZ | 0xf000; in lance_init_ring()
475 MEM->rx_head[i].msg_length = 0; in lance_init_ring()
479 MEM->init.hwaddr[0] = dev->dev_addr[1]; in lance_init_ring()
480 MEM->init.hwaddr[1] = dev->dev_addr[0]; in lance_init_ring()
481 MEM->init.hwaddr[2] = dev->dev_addr[3]; in lance_init_ring()
482 MEM->init.hwaddr[3] = dev->dev_addr[2]; in lance_init_ring()
483 MEM->init.hwaddr[4] = dev->dev_addr[5]; in lance_init_ring()
484 MEM->init.hwaddr[5] = dev->dev_addr[4]; in lance_init_ring()
486 MEM->init.mode = 0x0000; in lance_init_ring()
487 MEM->init.filter[0] = 0x00000000; in lance_init_ring()
488 MEM->init.filter[1] = 0x00000000; in lance_init_ring()
489 MEM->init.rdra = dvma_vtob(MEM->rx_head); in lance_init_ring()
490 MEM->init.rlen = (RX_LOG_RING_SIZE << 13) | in lance_init_ring()
491 (dvma_vtob(MEM->rx_head) >> 16); in lance_init_ring()
492 MEM->init.tdra = dvma_vtob(MEM->tx_head); in lance_init_ring()
493 MEM->init.tlen = (TX_LOG_RING_SIZE << 13) | in lance_init_ring()
494 (dvma_vtob(MEM->tx_head) >> 16); in lance_init_ring()
498 REGA(CSR1) = dvma_vtob(&(MEM->init)); in lance_init_ring()
499 REGA(CSR2) = dvma_vtob(&(MEM->init)) >> 16; in lance_init_ring()
519 dev->name)); in lance_start_xmit()
523 int tickssofar = jiffies - dev_trans_start(dev); in lance_start_xmit()
528 dev->name, DREG )); in lance_start_xmit()
535 dev->stats.tx_errors++; in lance_start_xmit()
540 lp->old_tx, lp->new_tx, in lance_start_xmit()
541 lp->tx_full ? " (full)" : "", in lance_start_xmit()
542 lp->new_rx ); in lance_start_xmit()
544 printk( "rx #%d: base=%04x blen=%04x mlen=%04x\n", in lance_start_xmit()
545 i, MEM->rx_head[i].base, in lance_start_xmit()
546 -MEM->rx_head[i].buf_length, in lance_start_xmit()
547 MEM->rx_head[i].msg_length); in lance_start_xmit()
549 printk("tx #%d: base=%04x len=%04x misc=%04x\n", in lance_start_xmit()
550 i, MEM->tx_head[i].base, in lance_start_xmit()
551 -MEM->tx_head[i].length, in lance_start_xmit()
552 MEM->tx_head[i].misc ); in lance_start_xmit()
564 /* Block a timer-based transmit from overlapping. This could better be in lance_start_xmit()
565 done with atomic_swap(1, dev->tbusy), but set_bit() works as well. */ in lance_start_xmit()
567 /* Block a timer-based transmit from overlapping with us by in lance_start_xmit()
572 if (test_and_set_bit( 0, (void*)&lp->lock ) != 0) { in lance_start_xmit()
573 printk( "%s: tx queue lock!.\n", dev->name); in lance_start_xmit()
574 /* don't clear dev->tbusy flag. */ in lance_start_xmit()
580 dev->name, DREG )); in lance_start_xmit()
598 dev->name, lp->new_tx, ((u_short *)skb->data)[6], in lance_start_xmit()
599 DEV_ADDR(&skb->data[6]), DEV_ADDR(skb->data), in lance_start_xmit()
600 (int)skb->data, (int)skb->len ); in lance_start_xmit()
608 entry = lp->new_tx; in lance_start_xmit()
609 head = &(MEM->tx_head[entry]); in lance_start_xmit()
617 len = (ETH_ZLEN < skb->len) ? skb->len : ETH_ZLEN; in lance_start_xmit()
619 // head->length = -len; in lance_start_xmit()
620 head->length = (-len) | 0xf000; in lance_start_xmit()
621 head->misc = 0; in lance_start_xmit()
623 skb_copy_from_linear_data(skb, PKTBUF_ADDR(head), skb->len); in lance_start_xmit()
624 if (len != skb->len) in lance_start_xmit()
625 memset(PKTBUF_ADDR(head) + skb->len, 0, len-skb->len); in lance_start_xmit()
627 head->flag = TMD1_OWN_CHIP | TMD1_ENP | TMD1_STP; in lance_start_xmit()
628 lp->new_tx = (lp->new_tx + 1) & TX_RING_MOD_MASK; in lance_start_xmit()
629 dev->stats.tx_bytes += skb->len; in lance_start_xmit()
635 dev->name, DREG )); in lance_start_xmit()
638 lp->lock = 0; in lance_start_xmit()
639 if ((MEM->tx_head[(entry+1) & TX_RING_MOD_MASK].flag & TMD1_OWN) == in lance_start_xmit()
671 dev->name, csr0, DREG )); in lance_interrupt()
673 if (csr0 & CSR0_TINT) { /* Tx-done interrupt */ in lance_interrupt()
674 int old_tx = lp->old_tx; in lance_interrupt()
679 // printk("%s: tx int\n", dev->name); in lance_interrupt()
683 // MEM->tx_head[i].flag); in lance_interrupt()
686 while( old_tx != lp->new_tx) { in lance_interrupt()
687 struct lance_tx_head *head = &(MEM->tx_head[old_tx]); in lance_interrupt()
691 if (head->flag & TMD1_OWN_CHIP) in lance_interrupt()
694 if (head->flag & TMD1_ERR) { in lance_interrupt()
695 int status = head->misc; in lance_interrupt()
696 dev->stats.tx_errors++; in lance_interrupt()
697 if (status & TMD3_RTRY) dev->stats.tx_aborted_errors++; in lance_interrupt()
698 if (status & TMD3_LCAR) dev->stats.tx_carrier_errors++; in lance_interrupt()
699 if (status & TMD3_LCOL) dev->stats.tx_window_errors++; in lance_interrupt()
701 dev->stats.tx_fifo_errors++; in lance_interrupt()
703 dev->name); in lance_interrupt()
710 } else if(head->flag & (TMD1_ENP | TMD1_STP)) { in lance_interrupt()
712 head->flag &= ~(TMD1_ENP | TMD1_STP); in lance_interrupt()
713 if(head->flag & (TMD1_ONE | TMD1_MORE)) in lance_interrupt()
714 dev->stats.collisions++; in lance_interrupt()
716 dev->stats.tx_packets++; in lance_interrupt()
722 lp->old_tx = old_tx; in lance_interrupt()
736 if (csr0 & CSR0_BABL) dev->stats.tx_errors++; /* Tx babble. */ in lance_interrupt()
737 if (csr0 & CSR0_MISS) dev->stats.rx_errors++; /* Missed a Rx frame. */ in lance_interrupt()
740 "status %04x.\n", dev->name, csr0 )); in lance_interrupt()
761 dev->name, DREG )); in lance_interrupt()
769 int entry = lp->new_rx; in lance_rx()
772 while( (MEM->rx_head[entry].flag & RMD1_OWN) == RMD1_OWN_HOST ) { in lance_rx()
773 struct lance_rx_head *head = &(MEM->rx_head[entry]); in lance_rx()
774 int status = head->flag; in lance_rx()
779 full-sized buffers it's possible for a jabber packet to use two in lance_rx()
782 dev->stats.rx_errors++; /* end of a packet.*/ in lance_rx()
783 if (status & RMD1_FRAM) dev->stats.rx_frame_errors++; in lance_rx()
784 if (status & RMD1_OFLO) dev->stats.rx_over_errors++; in lance_rx()
785 if (status & RMD1_CRC) dev->stats.rx_crc_errors++; in lance_rx()
786 if (status & RMD1_BUFF) dev->stats.rx_fifo_errors++; in lance_rx()
787 head->flag &= (RMD1_ENP|RMD1_STP); in lance_rx()
789 /* Malloc up new buffer, compatible with net-3. */ in lance_rx()
790 // short pkt_len = head->msg_length;// & 0xfff; in lance_rx()
791 short pkt_len = (head->msg_length & 0xfff) - 4; in lance_rx()
795 printk( "%s: Runt packet!\n", dev->name ); in lance_rx()
796 dev->stats.rx_errors++; in lance_rx()
801 dev->stats.rx_dropped++; in lance_rx()
802 head->msg_length = 0; in lance_rx()
803 head->flag |= RMD1_OWN_CHIP; in lance_rx()
804 lp->new_rx = (lp->new_rx+1) & in lance_rx()
813 dev->name, lp->new_tx, ((u_short *)data)[6], in lance_rx()
825 … printk( "%s: RX pkt %d type 0x%04x len %d\n ", dev->name, entry, ((u_short *)data)[6], pkt_len); in lance_rx()
835 skb->protocol = eth_type_trans( skb, dev ); in lance_rx()
837 dev->stats.rx_packets++; in lance_rx()
838 dev->stats.rx_bytes += pkt_len; in lance_rx()
842 // head->buf_length = -PKT_BUF_SZ | 0xf000; in lance_rx()
843 head->msg_length = 0; in lance_rx()
844 head->flag = RMD1_OWN_CHIP; in lance_rx()
846 entry = lp->new_rx = (lp->new_rx +1) & RX_RING_MOD_MASK; in lance_rx()
851 If not, we should free one and mark stats->rx_dropped++. */ in lance_rx()
866 dev->name, DREG )); in lance_close()
868 /* We stop the LANCE here -- it occasionally polls in lance_close()
876 num_addrs == -1 Promiscuous mode, receive all packets
879 best-effort filtering.
894 if (dev->flags & IFF_PROMISC) { in set_multicast_list()
896 DPRINTK( 3, ( "%s: Promiscuous mode enabled.\n", dev->name )); in set_multicast_list()
902 /* We don't use the multicast table, but rely on upper-layer in set_multicast_list()
904 memset( multicast_table, (num_addrs == 0) ? 0 : -1, in set_multicast_list()
935 iounmap((void __iomem *)sun3lance_dev->base_addr); in sun3lance_cleanup()