• Home
  • Raw
  • Download

Lines Matching refs:mp

91 static inline void mace_clean_rings(struct mace_data *mp);
112 struct mace_data *mp; in mace_probe() local
154 mp = netdev_priv(dev); in mace_probe()
155 mp->mdev = mdev; in mace_probe()
159 mp->mace = ioremap(dev->base_addr, 0x1000); in mace_probe()
160 if (mp->mace == NULL) { in mace_probe()
171 mp->chipid = (in_8(&mp->mace->chipid_hi) << 8) | in mace_probe()
172 in_8(&mp->mace->chipid_lo); in mace_probe()
175 mp = netdev_priv(dev); in mace_probe()
176 mp->maccc = ENXMT | ENRCV; in mace_probe()
178 mp->tx_dma = ioremap(macio_resource_start(mdev, 1), 0x1000); in mace_probe()
179 if (mp->tx_dma == NULL) { in mace_probe()
184 mp->tx_dma_intr = macio_irq(mdev, 1); in mace_probe()
186 mp->rx_dma = ioremap(macio_resource_start(mdev, 2), 0x1000); in mace_probe()
187 if (mp->rx_dma == NULL) { in mace_probe()
192 mp->rx_dma_intr = macio_irq(mdev, 2); in mace_probe()
194 mp->tx_cmds = (volatile struct dbdma_cmd *) DBDMA_ALIGN(mp + 1); in mace_probe()
195 mp->rx_cmds = mp->tx_cmds + NCMDS_TX * N_TX_RING + 1; in mace_probe()
197 memset((char *) mp->tx_cmds, 0, in mace_probe()
199 init_timer(&mp->tx_timeout); in mace_probe()
200 spin_lock_init(&mp->lock); in mace_probe()
201 mp->timeout_active = 0; in mace_probe()
204 mp->port_aaui = port_aaui; in mace_probe()
208 mp->port_aaui = 1; in mace_probe()
211 mp->port_aaui = 1; in mace_probe()
213 mp->port_aaui = 0; in mace_probe()
230 rc = request_irq(mp->tx_dma_intr, mace_txdma_intr, 0, "MACE-txdma", dev); in mace_probe()
232 printk(KERN_ERR "MACE: can't get irq %d\n", mp->tx_dma_intr); in mace_probe()
235 rc = request_irq(mp->rx_dma_intr, mace_rxdma_intr, 0, "MACE-rxdma", dev); in mace_probe()
237 printk(KERN_ERR "MACE: can't get irq %d\n", mp->rx_dma_intr); in mace_probe()
249 mp->chipid >> 8, mp->chipid & 0xff); in mace_probe()
260 iounmap(mp->rx_dma); in mace_probe()
262 iounmap(mp->tx_dma); in mace_probe()
264 iounmap(mp->mace); in mace_probe()
276 struct mace_data *mp; in mace_remove() local
282 mp = netdev_priv(dev); in mace_remove()
287 free_irq(mp->tx_dma_intr, dev); in mace_remove()
288 free_irq(mp->rx_dma_intr, dev); in mace_remove()
290 iounmap(mp->rx_dma); in mace_remove()
291 iounmap(mp->tx_dma); in mace_remove()
292 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()
379 if (mp->chipid == BROKEN_ADDRCHG_REV) in __mace_set_address()
388 if (mp->chipid != BROKEN_ADDRCHG_REV) in __mace_set_address()
394 struct mace_data *mp = netdev_priv(dev); in mace_set_address() local
395 volatile struct mace __iomem *mb = mp->mace; in mace_set_address()
398 spin_lock_irqsave(&mp->lock, flags); in mace_set_address()
403 out_8(&mb->maccc, mp->maccc); in mace_set_address()
405 spin_unlock_irqrestore(&mp->lock, flags); in mace_set_address()
409 static inline void mace_clean_rings(struct mace_data *mp) in mace_clean_rings() argument
415 if (mp->rx_bufs[i] != NULL) { in mace_clean_rings()
416 dev_kfree_skb(mp->rx_bufs[i]); in mace_clean_rings()
417 mp->rx_bufs[i] = NULL; in mace_clean_rings()
420 for (i = mp->tx_empty; i != mp->tx_fill; ) { in mace_clean_rings()
421 dev_kfree_skb(mp->tx_bufs[i]); in mace_clean_rings()
429 struct mace_data *mp = netdev_priv(dev); in mace_open() local
430 volatile struct mace __iomem *mb = mp->mace; in mace_open()
431 volatile struct dbdma_regs __iomem *rd = mp->rx_dma; in mace_open()
432 volatile struct dbdma_regs __iomem *td = mp->tx_dma; in mace_open()
442 mace_clean_rings(mp); in mace_open()
443 memset((char *)mp->rx_cmds, 0, N_RX_RING * sizeof(struct dbdma_cmd)); in mace_open()
444 cp = mp->rx_cmds; in mace_open()
453 mp->rx_bufs[i] = skb; in mace_open()
460 mp->rx_bufs[i] = NULL; in mace_open()
462 mp->rx_fill = i; in mace_open()
463 mp->rx_empty = 0; in mace_open()
468 cp->cmd_dep = cpu_to_le32(virt_to_bus(mp->rx_cmds)); in mace_open()
472 out_le32(&rd->cmdptr, virt_to_bus(mp->rx_cmds)); in mace_open()
476 cp = mp->tx_cmds + NCMDS_TX * N_TX_RING; in mace_open()
478 cp->cmd_dep = cpu_to_le32(virt_to_bus(mp->tx_cmds)); in mace_open()
482 out_le32(&td->cmdptr, virt_to_bus(mp->tx_cmds)); in mace_open()
483 mp->tx_fill = 0; in mace_open()
484 mp->tx_empty = 0; in mace_open()
485 mp->tx_fullup = 0; in mace_open()
486 mp->tx_active = 0; in mace_open()
487 mp->tx_bad_runt = 0; in mace_open()
490 out_8(&mb->maccc, mp->maccc); in mace_open()
499 struct mace_data *mp = netdev_priv(dev); in mace_close() local
500 volatile struct mace __iomem *mb = mp->mace; in mace_close()
501 volatile struct dbdma_regs __iomem *rd = mp->rx_dma; in mace_close()
502 volatile struct dbdma_regs __iomem *td = mp->tx_dma; in mace_close()
512 mace_clean_rings(mp); in mace_close()
519 struct mace_data *mp = netdev_priv(dev); in mace_set_timeout() local
521 if (mp->timeout_active) in mace_set_timeout()
522 del_timer(&mp->tx_timeout); in mace_set_timeout()
523 mp->tx_timeout.expires = jiffies + TX_TIMEOUT; in mace_set_timeout()
524 mp->tx_timeout.function = mace_tx_timeout; in mace_set_timeout()
525 mp->tx_timeout.data = (unsigned long) dev; in mace_set_timeout()
526 add_timer(&mp->tx_timeout); in mace_set_timeout()
527 mp->timeout_active = 1; in mace_set_timeout()
532 struct mace_data *mp = netdev_priv(dev); in mace_xmit_start() local
533 volatile struct dbdma_regs __iomem *td = mp->tx_dma; in mace_xmit_start()
539 spin_lock_irqsave(&mp->lock, flags); in mace_xmit_start()
540 fill = mp->tx_fill; in mace_xmit_start()
544 if (next == mp->tx_empty) { in mace_xmit_start()
546 mp->tx_fullup = 1; in mace_xmit_start()
547 spin_unlock_irqrestore(&mp->lock, flags); in mace_xmit_start()
550 spin_unlock_irqrestore(&mp->lock, flags); in mace_xmit_start()
558 mp->tx_bufs[fill] = skb; in mace_xmit_start()
559 cp = mp->tx_cmds + NCMDS_TX * fill; in mace_xmit_start()
563 np = mp->tx_cmds + NCMDS_TX * next; in mace_xmit_start()
567 spin_lock_irqsave(&mp->lock, flags); in mace_xmit_start()
568 mp->tx_fill = next; in mace_xmit_start()
569 if (!mp->tx_bad_runt && mp->tx_active < MAX_TX_ACTIVE) { in mace_xmit_start()
573 ++mp->tx_active; in mace_xmit_start()
578 if (next == mp->tx_empty) in mace_xmit_start()
580 spin_unlock_irqrestore(&mp->lock, flags); in mace_xmit_start()
587 struct mace_data *mp = netdev_priv(dev); in mace_set_multicast() local
588 volatile struct mace __iomem *mb = mp->mace; in mace_set_multicast()
593 spin_lock_irqsave(&mp->lock, flags); in mace_set_multicast()
594 mp->maccc &= ~PROM; in mace_set_multicast()
596 mp->maccc |= PROM; in mace_set_multicast()
620 if (mp->chipid == BROKEN_ADDRCHG_REV) in mace_set_multicast()
629 if (mp->chipid != BROKEN_ADDRCHG_REV) in mace_set_multicast()
633 out_8(&mb->maccc, mp->maccc); in mace_set_multicast()
634 spin_unlock_irqrestore(&mp->lock, flags); in mace_set_multicast()
637 static void mace_handle_misc_intrs(struct mace_data *mp, int intr, struct net_device *dev) in mace_handle_misc_intrs() argument
639 volatile struct mace __iomem *mb = mp->mace; in mace_handle_misc_intrs()
661 struct mace_data *mp = netdev_priv(dev); in mace_interrupt() local
662 volatile struct mace __iomem *mb = mp->mace; in mace_interrupt()
663 volatile struct dbdma_regs __iomem *td = mp->tx_dma; in mace_interrupt()
670 spin_lock_irqsave(&mp->lock, flags); in mace_interrupt()
673 mace_handle_misc_intrs(mp, intr, dev); in mace_interrupt()
675 i = mp->tx_empty; in mace_interrupt()
677 del_timer(&mp->tx_timeout); in mace_interrupt()
678 mp->timeout_active = 0; in mace_interrupt()
686 mace_handle_misc_intrs(mp, intr, dev); in mace_interrupt()
687 if (mp->tx_bad_runt) { in mace_interrupt()
689 mp->tx_bad_runt = 0; in mace_interrupt()
725 cp = mp->tx_cmds + NCMDS_TX * i; in mace_interrupt()
736 mp->tx_bad_runt = 1; in mace_interrupt()
753 if (i == mp->tx_fill) { in mace_interrupt()
766 dev->stats.tx_bytes += mp->tx_bufs[i]->len; in mace_interrupt()
769 dev_kfree_skb_irq(mp->tx_bufs[i]); in mace_interrupt()
770 --mp->tx_active; in mace_interrupt()
779 if (i != mp->tx_empty) { in mace_interrupt()
780 mp->tx_fullup = 0; in mace_interrupt()
783 mp->tx_empty = i; in mace_interrupt()
784 i += mp->tx_active; in mace_interrupt()
787 if (!mp->tx_bad_runt && i != mp->tx_fill && mp->tx_active < MAX_TX_ACTIVE) { in mace_interrupt()
790 cp = mp->tx_cmds + NCMDS_TX * i; in mace_interrupt()
793 ++mp->tx_active; in mace_interrupt()
796 } while (i != mp->tx_fill && mp->tx_active < MAX_TX_ACTIVE); in mace_interrupt()
800 spin_unlock_irqrestore(&mp->lock, flags); in mace_interrupt()
807 struct mace_data *mp = netdev_priv(dev); in mace_tx_timeout() local
808 volatile struct mace __iomem *mb = mp->mace; in mace_tx_timeout()
809 volatile struct dbdma_regs __iomem *td = mp->tx_dma; in mace_tx_timeout()
810 volatile struct dbdma_regs __iomem *rd = mp->rx_dma; in mace_tx_timeout()
815 spin_lock_irqsave(&mp->lock, flags); in mace_tx_timeout()
816 mp->timeout_active = 0; in mace_tx_timeout()
817 if (mp->tx_active == 0 && !mp->tx_bad_runt) in mace_tx_timeout()
821 mace_handle_misc_intrs(mp, in_8(&mb->ir), dev); in mace_tx_timeout()
823 cp = mp->tx_cmds + NCMDS_TX * mp->tx_empty; in mace_tx_timeout()
839 i = mp->tx_empty; in mace_tx_timeout()
840 mp->tx_active = 0; in mace_tx_timeout()
842 if (mp->tx_bad_runt) { in mace_tx_timeout()
843 mp->tx_bad_runt = 0; in mace_tx_timeout()
844 } else if (i != mp->tx_fill) { in mace_tx_timeout()
845 dev_kfree_skb(mp->tx_bufs[i]); in mace_tx_timeout()
848 mp->tx_empty = i; in mace_tx_timeout()
850 mp->tx_fullup = 0; in mace_tx_timeout()
852 if (i != mp->tx_fill) { in mace_tx_timeout()
853 cp = mp->tx_cmds + NCMDS_TX * i; in mace_tx_timeout()
858 ++mp->tx_active; in mace_tx_timeout()
864 out_8(&mb->maccc, mp->maccc); in mace_tx_timeout()
867 spin_unlock_irqrestore(&mp->lock, flags); in mace_tx_timeout()
878 struct mace_data *mp = netdev_priv(dev); in mace_rxdma_intr() local
879 volatile struct dbdma_regs __iomem *rd = mp->rx_dma; in mace_rxdma_intr()
888 spin_lock_irqsave(&mp->lock, flags); in mace_rxdma_intr()
889 for (i = mp->rx_empty; i != mp->rx_fill; ) { in mace_rxdma_intr()
890 cp = mp->rx_cmds + i; in mace_rxdma_intr()
896 np = mp->rx_cmds + next; in mace_rxdma_intr()
897 if (next != mp->rx_fill && in mace_rxdma_intr()
907 skb = mp->rx_bufs[i]; in mace_rxdma_intr()
934 mp->rx_bufs[i] = NULL; in mace_rxdma_intr()
946 mp->rx_empty = i; in mace_rxdma_intr()
948 i = mp->rx_fill; in mace_rxdma_intr()
953 if (next == mp->rx_empty) in mace_rxdma_intr()
955 cp = mp->rx_cmds + i; in mace_rxdma_intr()
956 skb = mp->rx_bufs[i]; in mace_rxdma_intr()
961 mp->rx_bufs[i] = skb; in mace_rxdma_intr()
978 if (i != mp->rx_fill) { in mace_rxdma_intr()
980 mp->rx_fill = i; in mace_rxdma_intr()
982 spin_unlock_irqrestore(&mp->lock, flags); in mace_rxdma_intr()