Lines Matching full:mp
91 static inline void mace_clean_rings(struct mace_data *mp);
112 struct mace_data *mp; in mace_probe() local
155 mp = netdev_priv(dev); in mace_probe()
156 mp->mdev = mdev; in mace_probe()
160 mp->mace = ioremap(dev->base_addr, 0x1000); in mace_probe()
161 if (mp->mace == NULL) { in mace_probe()
173 mp->chipid = (in_8(&mp->mace->chipid_hi) << 8) | in mace_probe()
174 in_8(&mp->mace->chipid_lo); in mace_probe()
177 mp = netdev_priv(dev); in mace_probe()
178 mp->maccc = ENXMT | ENRCV; in mace_probe()
180 mp->tx_dma = ioremap(macio_resource_start(mdev, 1), 0x1000); in mace_probe()
181 if (mp->tx_dma == NULL) { in mace_probe()
186 mp->tx_dma_intr = macio_irq(mdev, 1); in mace_probe()
188 mp->rx_dma = ioremap(macio_resource_start(mdev, 2), 0x1000); in mace_probe()
189 if (mp->rx_dma == NULL) { in mace_probe()
194 mp->rx_dma_intr = macio_irq(mdev, 2); in mace_probe()
196 mp->tx_cmds = (volatile struct dbdma_cmd *) DBDMA_ALIGN(mp + 1); in mace_probe()
197 mp->rx_cmds = mp->tx_cmds + NCMDS_TX * N_TX_RING + 1; in mace_probe()
199 memset((char *) mp->tx_cmds, 0, in mace_probe()
201 timer_setup(&mp->tx_timeout, mace_tx_timeout, 0); in mace_probe()
202 spin_lock_init(&mp->lock); in mace_probe()
203 mp->timeout_active = 0; in mace_probe()
206 mp->port_aaui = port_aaui; in mace_probe()
210 mp->port_aaui = 1; in mace_probe()
213 mp->port_aaui = 1; in mace_probe()
215 mp->port_aaui = 0; in mace_probe()
232 rc = request_irq(mp->tx_dma_intr, mace_txdma_intr, 0, "MACE-txdma", dev); in mace_probe()
234 printk(KERN_ERR "MACE: can't get irq %d\n", mp->tx_dma_intr); in mace_probe()
237 rc = request_irq(mp->rx_dma_intr, mace_rxdma_intr, 0, "MACE-rxdma", dev); in mace_probe()
239 printk(KERN_ERR "MACE: can't get irq %d\n", mp->rx_dma_intr); in mace_probe()
251 mp->chipid >> 8, mp->chipid & 0xff); in mace_probe()
262 iounmap(mp->rx_dma); in mace_probe()
264 iounmap(mp->tx_dma); in mace_probe()
266 iounmap(mp->mace); in mace_probe()
278 struct mace_data *mp; in mace_remove() local
284 mp = netdev_priv(dev); in mace_remove()
289 free_irq(mp->tx_dma_intr, dev); in mace_remove()
290 free_irq(mp->rx_dma_intr, dev); in mace_remove()
292 iounmap(mp->rx_dma); in mace_remove()
293 iounmap(mp->tx_dma); in mace_remove()
294 iounmap(mp->mace); in mace_remove()
318 struct mace_data *mp = netdev_priv(dev); in mace_reset() local
319 volatile struct mace __iomem *mb = mp->mace; in mace_reset()
351 if (mp->chipid == BROKEN_ADDRCHG_REV) in mace_reset()
362 if (mp->chipid != BROKEN_ADDRCHG_REV) in mace_reset()
365 if (mp->port_aaui) in mace_reset()
373 struct mace_data *mp = netdev_priv(dev); in __mace_set_address() local
374 volatile struct mace __iomem *mb = mp->mace; in __mace_set_address()
380 if (mp->chipid == BROKEN_ADDRCHG_REV) in __mace_set_address()
392 if (mp->chipid != BROKEN_ADDRCHG_REV) in __mace_set_address()
398 struct mace_data *mp = netdev_priv(dev); in mace_set_address() local
399 volatile struct mace __iomem *mb = mp->mace; in mace_set_address()
402 spin_lock_irqsave(&mp->lock, flags); in mace_set_address()
407 out_8(&mb->maccc, mp->maccc); in mace_set_address()
409 spin_unlock_irqrestore(&mp->lock, flags); in mace_set_address()
413 static inline void mace_clean_rings(struct mace_data *mp) in mace_clean_rings() argument
419 if (mp->rx_bufs[i] != NULL) { in mace_clean_rings()
420 dev_kfree_skb(mp->rx_bufs[i]); in mace_clean_rings()
421 mp->rx_bufs[i] = NULL; in mace_clean_rings()
424 for (i = mp->tx_empty; i != mp->tx_fill; ) { in mace_clean_rings()
425 dev_kfree_skb(mp->tx_bufs[i]); in mace_clean_rings()
433 struct mace_data *mp = netdev_priv(dev); in mace_open() local
434 volatile struct mace __iomem *mb = mp->mace; in mace_open()
435 volatile struct dbdma_regs __iomem *rd = mp->rx_dma; in mace_open()
436 volatile struct dbdma_regs __iomem *td = mp->tx_dma; in mace_open()
446 mace_clean_rings(mp); in mace_open()
447 memset((char *)mp->rx_cmds, 0, N_RX_RING * sizeof(struct dbdma_cmd)); in mace_open()
448 cp = mp->rx_cmds; in mace_open()
457 mp->rx_bufs[i] = skb; in mace_open()
464 mp->rx_bufs[i] = NULL; in mace_open()
466 mp->rx_fill = i; in mace_open()
467 mp->rx_empty = 0; in mace_open()
472 cp->cmd_dep = cpu_to_le32(virt_to_bus(mp->rx_cmds)); in mace_open()
476 out_le32(&rd->cmdptr, virt_to_bus(mp->rx_cmds)); in mace_open()
480 cp = mp->tx_cmds + NCMDS_TX * N_TX_RING; in mace_open()
482 cp->cmd_dep = cpu_to_le32(virt_to_bus(mp->tx_cmds)); in mace_open()
486 out_le32(&td->cmdptr, virt_to_bus(mp->tx_cmds)); in mace_open()
487 mp->tx_fill = 0; in mace_open()
488 mp->tx_empty = 0; in mace_open()
489 mp->tx_fullup = 0; in mace_open()
490 mp->tx_active = 0; in mace_open()
491 mp->tx_bad_runt = 0; in mace_open()
494 out_8(&mb->maccc, mp->maccc); in mace_open()
503 struct mace_data *mp = netdev_priv(dev); in mace_close() local
504 volatile struct mace __iomem *mb = mp->mace; in mace_close()
505 volatile struct dbdma_regs __iomem *rd = mp->rx_dma; in mace_close()
506 volatile struct dbdma_regs __iomem *td = mp->tx_dma; in mace_close()
516 mace_clean_rings(mp); in mace_close()
523 struct mace_data *mp = netdev_priv(dev); in mace_set_timeout() local
525 if (mp->timeout_active) in mace_set_timeout()
526 del_timer(&mp->tx_timeout); in mace_set_timeout()
527 mp->tx_timeout.expires = jiffies + TX_TIMEOUT; in mace_set_timeout()
528 add_timer(&mp->tx_timeout); in mace_set_timeout()
529 mp->timeout_active = 1; in mace_set_timeout()
534 struct mace_data *mp = netdev_priv(dev); in mace_xmit_start() local
535 volatile struct dbdma_regs __iomem *td = mp->tx_dma; in mace_xmit_start()
541 spin_lock_irqsave(&mp->lock, flags); in mace_xmit_start()
542 fill = mp->tx_fill; in mace_xmit_start()
546 if (next == mp->tx_empty) { in mace_xmit_start()
548 mp->tx_fullup = 1; in mace_xmit_start()
549 spin_unlock_irqrestore(&mp->lock, flags); in mace_xmit_start()
552 spin_unlock_irqrestore(&mp->lock, flags); in mace_xmit_start()
560 mp->tx_bufs[fill] = skb; in mace_xmit_start()
561 cp = mp->tx_cmds + NCMDS_TX * fill; in mace_xmit_start()
565 np = mp->tx_cmds + NCMDS_TX * next; in mace_xmit_start()
569 spin_lock_irqsave(&mp->lock, flags); in mace_xmit_start()
570 mp->tx_fill = next; in mace_xmit_start()
571 if (!mp->tx_bad_runt && mp->tx_active < MAX_TX_ACTIVE) { in mace_xmit_start()
575 ++mp->tx_active; in mace_xmit_start()
580 if (next == mp->tx_empty) in mace_xmit_start()
582 spin_unlock_irqrestore(&mp->lock, flags); in mace_xmit_start()
589 struct mace_data *mp = netdev_priv(dev); in mace_set_multicast() local
590 volatile struct mace __iomem *mb = mp->mace; in mace_set_multicast()
595 spin_lock_irqsave(&mp->lock, flags); in mace_set_multicast()
596 mp->maccc &= ~PROM; in mace_set_multicast()
598 mp->maccc |= PROM; in mace_set_multicast()
622 if (mp->chipid == BROKEN_ADDRCHG_REV) in mace_set_multicast()
631 if (mp->chipid != BROKEN_ADDRCHG_REV) in mace_set_multicast()
635 out_8(&mb->maccc, mp->maccc); in mace_set_multicast()
636 spin_unlock_irqrestore(&mp->lock, flags); in mace_set_multicast()
639 static void mace_handle_misc_intrs(struct mace_data *mp, int intr, struct net_device *dev) in mace_handle_misc_intrs() argument
641 volatile struct mace __iomem *mb = mp->mace; in mace_handle_misc_intrs()
663 struct mace_data *mp = netdev_priv(dev); in mace_interrupt() local
664 volatile struct mace __iomem *mb = mp->mace; in mace_interrupt()
665 volatile struct dbdma_regs __iomem *td = mp->tx_dma; in mace_interrupt()
672 spin_lock_irqsave(&mp->lock, flags); in mace_interrupt()
675 mace_handle_misc_intrs(mp, intr, dev); in mace_interrupt()
677 i = mp->tx_empty; in mace_interrupt()
679 del_timer(&mp->tx_timeout); in mace_interrupt()
680 mp->timeout_active = 0; in mace_interrupt()
688 mace_handle_misc_intrs(mp, intr, dev); in mace_interrupt()
689 if (mp->tx_bad_runt) { in mace_interrupt()
691 mp->tx_bad_runt = 0; in mace_interrupt()
727 cp = mp->tx_cmds + NCMDS_TX * i; in mace_interrupt()
738 mp->tx_bad_runt = 1; in mace_interrupt()
755 if (i == mp->tx_fill) { in mace_interrupt()
768 dev->stats.tx_bytes += mp->tx_bufs[i]->len; in mace_interrupt()
771 dev_consume_skb_irq(mp->tx_bufs[i]); in mace_interrupt()
772 --mp->tx_active; in mace_interrupt()
781 if (i != mp->tx_empty) { in mace_interrupt()
782 mp->tx_fullup = 0; in mace_interrupt()
785 mp->tx_empty = i; in mace_interrupt()
786 i += mp->tx_active; in mace_interrupt()
789 if (!mp->tx_bad_runt && i != mp->tx_fill && mp->tx_active < MAX_TX_ACTIVE) { in mace_interrupt()
792 cp = mp->tx_cmds + NCMDS_TX * i; in mace_interrupt()
795 ++mp->tx_active; in mace_interrupt()
798 } while (i != mp->tx_fill && mp->tx_active < MAX_TX_ACTIVE); in mace_interrupt()
802 spin_unlock_irqrestore(&mp->lock, flags); in mace_interrupt()
808 struct mace_data *mp = from_timer(mp, t, tx_timeout); in mace_tx_timeout() local
809 struct net_device *dev = macio_get_drvdata(mp->mdev); in mace_tx_timeout()
810 volatile struct mace __iomem *mb = mp->mace; in mace_tx_timeout()
811 volatile struct dbdma_regs __iomem *td = mp->tx_dma; in mace_tx_timeout()
812 volatile struct dbdma_regs __iomem *rd = mp->rx_dma; in mace_tx_timeout()
817 spin_lock_irqsave(&mp->lock, flags); in mace_tx_timeout()
818 mp->timeout_active = 0; in mace_tx_timeout()
819 if (mp->tx_active == 0 && !mp->tx_bad_runt) in mace_tx_timeout()
823 mace_handle_misc_intrs(mp, in_8(&mb->ir), dev); in mace_tx_timeout()
825 cp = mp->tx_cmds + NCMDS_TX * mp->tx_empty; in mace_tx_timeout()
841 i = mp->tx_empty; in mace_tx_timeout()
842 mp->tx_active = 0; in mace_tx_timeout()
844 if (mp->tx_bad_runt) { in mace_tx_timeout()
845 mp->tx_bad_runt = 0; in mace_tx_timeout()
846 } else if (i != mp->tx_fill) { in mace_tx_timeout()
847 dev_kfree_skb_irq(mp->tx_bufs[i]); in mace_tx_timeout()
850 mp->tx_empty = i; in mace_tx_timeout()
852 mp->tx_fullup = 0; in mace_tx_timeout()
854 if (i != mp->tx_fill) { in mace_tx_timeout()
855 cp = mp->tx_cmds + NCMDS_TX * i; in mace_tx_timeout()
860 ++mp->tx_active; in mace_tx_timeout()
866 out_8(&mb->maccc, mp->maccc); in mace_tx_timeout()
869 spin_unlock_irqrestore(&mp->lock, flags); in mace_tx_timeout()
880 struct mace_data *mp = netdev_priv(dev); in mace_rxdma_intr() local
881 volatile struct dbdma_regs __iomem *rd = mp->rx_dma; in mace_rxdma_intr()
890 spin_lock_irqsave(&mp->lock, flags); in mace_rxdma_intr()
891 for (i = mp->rx_empty; i != mp->rx_fill; ) { in mace_rxdma_intr()
892 cp = mp->rx_cmds + i; in mace_rxdma_intr()
898 np = mp->rx_cmds + next; in mace_rxdma_intr()
899 if (next != mp->rx_fill && in mace_rxdma_intr()
909 skb = mp->rx_bufs[i]; in mace_rxdma_intr()
936 mp->rx_bufs[i] = NULL; in mace_rxdma_intr()
948 mp->rx_empty = i; in mace_rxdma_intr()
950 i = mp->rx_fill; in mace_rxdma_intr()
955 if (next == mp->rx_empty) in mace_rxdma_intr()
957 cp = mp->rx_cmds + i; in mace_rxdma_intr()
958 skb = mp->rx_bufs[i]; in mace_rxdma_intr()
963 mp->rx_bufs[i] = skb; in mace_rxdma_intr()
980 if (i != mp->rx_fill) { in mace_rxdma_intr()
982 mp->rx_fill = i; in mace_rxdma_intr()
984 spin_unlock_irqrestore(&mp->lock, flags); in mace_rxdma_intr()