Lines Matching refs:hmp

584 	struct hamachi_private *hmp;  in hamachi_init_one()  local
642 hmp = netdev_priv(dev); in hamachi_init_one()
643 spin_lock_init(&hmp->lock); in hamachi_init_one()
645 hmp->mii_if.dev = dev; in hamachi_init_one()
646 hmp->mii_if.mdio_read = mdio_read; in hamachi_init_one()
647 hmp->mii_if.mdio_write = mdio_write; in hamachi_init_one()
648 hmp->mii_if.phy_id_mask = 0x1f; in hamachi_init_one()
649 hmp->mii_if.reg_num_mask = 0x1f; in hamachi_init_one()
655 hmp->tx_ring = ring_space; in hamachi_init_one()
656 hmp->tx_ring_dma = ring_dma; in hamachi_init_one()
662 hmp->rx_ring = ring_space; in hamachi_init_one()
663 hmp->rx_ring_dma = ring_dma; in hamachi_init_one()
690 hmp->base = ioaddr; in hamachi_init_one()
693 hmp->chip_id = chip_id; in hamachi_init_one()
694 hmp->pci_dev = pdev; in hamachi_init_one()
698 hmp->option = option; in hamachi_init_one()
700 hmp->mii_if.full_duplex = 1; in hamachi_init_one()
702 hmp->mii_if.full_duplex = 0; in hamachi_init_one()
703 hmp->default_port = option & 15; in hamachi_init_one()
704 if (hmp->default_port) in hamachi_init_one()
705 hmp->mii_if.force_media = 1; in hamachi_init_one()
708 hmp->mii_if.full_duplex = 1; in hamachi_init_one()
711 if (hmp->mii_if.full_duplex || (option & 0x080)) in hamachi_init_one()
712 hmp->duplex_lock = 1; in hamachi_init_one()
724 hmp->rx_int_var = rx_int_var >= 0 ? rx_int_var : in hamachi_init_one()
726 hmp->tx_int_var = tx_int_var >= 0 ? tx_int_var : in hamachi_init_one()
732 dev->ethtool_ops = (chip_tbl[hmp->chip_id].flags & CanHaveMII) ? in hamachi_init_one()
754 if (chip_tbl[hmp->chip_id].flags & CanHaveMII) { in hamachi_init_one()
760 hmp->phys[phy_idx++] = phy; in hamachi_init_one()
761 hmp->mii_if.advertising = mdio_read(dev, phy, MII_ADVERTISE); in hamachi_init_one()
764 dev->name, phy, mii_status, hmp->mii_if.advertising); in hamachi_init_one()
767 hmp->mii_cnt = phy_idx; in hamachi_init_one()
768 if (hmp->mii_cnt > 0) in hamachi_init_one()
769 hmp->mii_if.phy_id = hmp->phys[0]; in hamachi_init_one()
771 memset(&hmp->mii_if, 0, sizeof(hmp->mii_if)); in hamachi_init_one()
782 dma_free_coherent(&pdev->dev, RX_TOTAL_SIZE, hmp->rx_ring, in hamachi_init_one()
783 hmp->rx_ring_dma); in hamachi_init_one()
785 dma_free_coherent(&pdev->dev, TX_TOTAL_SIZE, hmp->tx_ring, in hamachi_init_one()
786 hmp->tx_ring_dma); in hamachi_init_one()
819 struct hamachi_private *hmp = netdev_priv(dev); in mdio_read() local
820 void __iomem *ioaddr = hmp->base; in mdio_read()
837 struct hamachi_private *hmp = netdev_priv(dev); in mdio_write() local
838 void __iomem *ioaddr = hmp->base; in mdio_write()
857 struct hamachi_private *hmp = netdev_priv(dev); in hamachi_open() local
858 void __iomem *ioaddr = hmp->base; in hamachi_open()
863 i = request_irq(hmp->pci_dev->irq, hamachi_interrupt, IRQF_SHARED, in hamachi_open()
872 writel(hmp->rx_ring_dma, ioaddr + RxPtr); in hamachi_open()
873 writel(hmp->rx_ring_dma >> 32, ioaddr + RxPtr + 4); in hamachi_open()
874 writel(hmp->tx_ring_dma, ioaddr + TxPtr); in hamachi_open()
875 writel(hmp->tx_ring_dma >> 32, ioaddr + TxPtr + 4); in hamachi_open()
877 writel(hmp->rx_ring_dma, ioaddr + RxPtr); in hamachi_open()
878 writel(hmp->tx_ring_dma, ioaddr + TxPtr); in hamachi_open()
918 dev->if_port = hmp->default_port; in hamachi_open()
923 if (hmp->duplex_lock != 1) in hamachi_open()
924 hmp->mii_if.full_duplex = 1; in hamachi_open()
948 rx_int_var = hmp->rx_int_var; in hamachi_open()
949 tx_int_var = hmp->tx_int_var; in hamachi_open()
988 timer_setup(&hmp->timer, hamachi_timer, 0); in hamachi_open()
989 hmp->timer.expires = RUN_AT((24*HZ)/10); /* 2.4 sec. */ in hamachi_open()
990 add_timer(&hmp->timer); in hamachi_open()
997 struct hamachi_private *hmp = netdev_priv(dev); in hamachi_tx() local
1001 for (; hmp->cur_tx - hmp->dirty_tx > 0; hmp->dirty_tx++) { in hamachi_tx()
1002 int entry = hmp->dirty_tx % TX_RING_SIZE; in hamachi_tx()
1005 if (hmp->tx_ring[entry].status_n_length & cpu_to_le32(DescOwn)) in hamachi_tx()
1008 skb = hmp->tx_skbuff[entry]; in hamachi_tx()
1010 dma_unmap_single(&hmp->pci_dev->dev, in hamachi_tx()
1011 leXX_to_cpu(hmp->tx_ring[entry].addr), in hamachi_tx()
1014 hmp->tx_skbuff[entry] = NULL; in hamachi_tx()
1016 hmp->tx_ring[entry].status_n_length = 0; in hamachi_tx()
1018 hmp->tx_ring[TX_RING_SIZE-1].status_n_length |= in hamachi_tx()
1028 struct hamachi_private *hmp = from_timer(hmp, t, timer); in hamachi_timer() local
1029 struct net_device *dev = hmp->mii_if.dev; in hamachi_timer()
1030 void __iomem *ioaddr = hmp->base; in hamachi_timer()
1047 hmp->timer.expires = RUN_AT(next_tick); in hamachi_timer()
1048 add_timer(&hmp->timer); in hamachi_timer()
1054 struct hamachi_private *hmp = netdev_priv(dev); in hamachi_tx_timeout() local
1055 void __iomem *ioaddr = hmp->base; in hamachi_tx_timeout()
1061 printk(KERN_DEBUG " Rx ring %p: ", hmp->rx_ring); in hamachi_tx_timeout()
1064 le32_to_cpu(hmp->rx_ring[i].status_n_length)); in hamachi_tx_timeout()
1066 printk(KERN_DEBUG" Tx ring %p: ", hmp->tx_ring); in hamachi_tx_timeout()
1069 le32_to_cpu(hmp->tx_ring[i].status_n_length)); in hamachi_tx_timeout()
1085 hmp->rx_ring[i].status_n_length &= cpu_to_le32(~DescOwn); in hamachi_tx_timeout()
1094 hmp->tx_ring[i].status_n_length = in hamachi_tx_timeout()
1096 (hmp->tx_ring[i].status_n_length & in hamachi_tx_timeout()
1099 hmp->tx_ring[i].status_n_length &= cpu_to_le32(0x0000ffff); in hamachi_tx_timeout()
1100 skb = hmp->tx_skbuff[i]; in hamachi_tx_timeout()
1102 dma_unmap_single(&hmp->pci_dev->dev, in hamachi_tx_timeout()
1103 leXX_to_cpu(hmp->tx_ring[i].addr), in hamachi_tx_timeout()
1106 hmp->tx_skbuff[i] = NULL; in hamachi_tx_timeout()
1115 hmp->tx_full = 0; in hamachi_tx_timeout()
1116 hmp->cur_rx = hmp->cur_tx = 0; in hamachi_tx_timeout()
1117 hmp->dirty_rx = hmp->dirty_tx = 0; in hamachi_tx_timeout()
1122 struct sk_buff *skb = hmp->rx_skbuff[i]; in hamachi_tx_timeout()
1125 dma_unmap_single(&hmp->pci_dev->dev, in hamachi_tx_timeout()
1126 leXX_to_cpu(hmp->rx_ring[i].addr), in hamachi_tx_timeout()
1127 hmp->rx_buf_sz, DMA_FROM_DEVICE); in hamachi_tx_timeout()
1129 hmp->rx_skbuff[i] = NULL; in hamachi_tx_timeout()
1136 skb = netdev_alloc_skb_ip_align(dev, hmp->rx_buf_sz); in hamachi_tx_timeout()
1137 hmp->rx_skbuff[i] = skb; in hamachi_tx_timeout()
1141 hmp->rx_ring[i].addr = cpu_to_leXX(dma_map_single(&hmp->pci_dev->dev, in hamachi_tx_timeout()
1143 hmp->rx_buf_sz, in hamachi_tx_timeout()
1145 hmp->rx_ring[i].status_n_length = cpu_to_le32(DescOwn | in hamachi_tx_timeout()
1146 DescEndPacket | DescIntr | (hmp->rx_buf_sz - 2)); in hamachi_tx_timeout()
1148 hmp->dirty_rx = (unsigned int)(i - RX_RING_SIZE); in hamachi_tx_timeout()
1150 hmp->rx_ring[RX_RING_SIZE-1].status_n_length |= cpu_to_le32(DescEndRing); in hamachi_tx_timeout()
1168 struct hamachi_private *hmp = netdev_priv(dev); in hamachi_init_ring() local
1171 hmp->tx_full = 0; in hamachi_init_ring()
1172 hmp->cur_rx = hmp->cur_tx = 0; in hamachi_init_ring()
1173 hmp->dirty_rx = hmp->dirty_tx = 0; in hamachi_init_ring()
1180 hmp->rx_buf_sz = (dev->mtu <= 1492 ? PKT_BUF_SZ : in hamachi_init_ring()
1185 hmp->rx_ring[i].status_n_length = 0; in hamachi_init_ring()
1186 hmp->rx_skbuff[i] = NULL; in hamachi_init_ring()
1190 struct sk_buff *skb = netdev_alloc_skb(dev, hmp->rx_buf_sz + 2); in hamachi_init_ring()
1191 hmp->rx_skbuff[i] = skb; in hamachi_init_ring()
1195 hmp->rx_ring[i].addr = cpu_to_leXX(dma_map_single(&hmp->pci_dev->dev, in hamachi_init_ring()
1197 hmp->rx_buf_sz, in hamachi_init_ring()
1200 hmp->rx_ring[i].status_n_length = cpu_to_le32(DescOwn | in hamachi_init_ring()
1201 DescEndPacket | DescIntr | (hmp->rx_buf_sz -2)); in hamachi_init_ring()
1203 hmp->dirty_rx = (unsigned int)(i - RX_RING_SIZE); in hamachi_init_ring()
1204 hmp->rx_ring[RX_RING_SIZE-1].status_n_length |= cpu_to_le32(DescEndRing); in hamachi_init_ring()
1207 hmp->tx_skbuff[i] = NULL; in hamachi_init_ring()
1208 hmp->tx_ring[i].status_n_length = 0; in hamachi_init_ring()
1211 hmp->tx_ring[TX_RING_SIZE-1].status_n_length |= cpu_to_le32(DescEndRing); in hamachi_init_ring()
1218 struct hamachi_private *hmp = netdev_priv(dev); in hamachi_start_xmit() local
1227 if (hmp->tx_full) { in hamachi_start_xmit()
1229 printk(KERN_WARNING "%s: Hamachi transmit queue full at slot %d.\n",dev->name, hmp->cur_tx); in hamachi_start_xmit()
1233 status=readw(hmp->base + TxStatus); in hamachi_start_xmit()
1235 writew(0x0001, hmp->base + TxCmd); in hamachi_start_xmit()
1243 entry = hmp->cur_tx % TX_RING_SIZE; in hamachi_start_xmit()
1245 hmp->tx_skbuff[entry] = skb; in hamachi_start_xmit()
1247 hmp->tx_ring[entry].addr = cpu_to_leXX(dma_map_single(&hmp->pci_dev->dev, in hamachi_start_xmit()
1262 hmp->tx_ring[entry].status_n_length = cpu_to_le32(DescOwn | in hamachi_start_xmit()
1265 hmp->tx_ring[entry].status_n_length = cpu_to_le32(DescOwn | in hamachi_start_xmit()
1267 hmp->cur_tx++; in hamachi_start_xmit()
1273 status=readw(hmp->base + TxStatus); in hamachi_start_xmit()
1275 writew(0x0001, hmp->base + TxCmd); in hamachi_start_xmit()
1286 if ((hmp->cur_tx - hmp->dirty_tx) < (TX_RING_SIZE - 4)) in hamachi_start_xmit()
1289 hmp->tx_full = 1; in hamachi_start_xmit()
1295 dev->name, hmp->cur_tx, entry); in hamachi_start_xmit()
1305 struct hamachi_private *hmp = netdev_priv(dev); in hamachi_interrupt() local
1306 void __iomem *ioaddr = hmp->base; in hamachi_interrupt()
1317 spin_lock(&hmp->lock); in hamachi_interrupt()
1339 if (hmp->tx_full){ in hamachi_interrupt()
1340 for (; hmp->cur_tx - hmp->dirty_tx > 0; hmp->dirty_tx++){ in hamachi_interrupt()
1341 int entry = hmp->dirty_tx % TX_RING_SIZE; in hamachi_interrupt()
1344 if (hmp->tx_ring[entry].status_n_length & cpu_to_le32(DescOwn)) in hamachi_interrupt()
1346 skb = hmp->tx_skbuff[entry]; in hamachi_interrupt()
1349 dma_unmap_single(&hmp->pci_dev->dev, in hamachi_interrupt()
1350 leXX_to_cpu(hmp->tx_ring[entry].addr), in hamachi_interrupt()
1354 hmp->tx_skbuff[entry] = NULL; in hamachi_interrupt()
1356 hmp->tx_ring[entry].status_n_length = 0; in hamachi_interrupt()
1358 hmp->tx_ring[TX_RING_SIZE-1].status_n_length |= in hamachi_interrupt()
1362 if (hmp->cur_tx - hmp->dirty_tx < TX_RING_SIZE - 4){ in hamachi_interrupt()
1364 hmp->tx_full = 0; in hamachi_interrupt()
1402 spin_unlock(&hmp->lock); in hamachi_interrupt()
1410 struct hamachi_private *hmp = netdev_priv(dev); in hamachi_rx() local
1411 int entry = hmp->cur_rx % RX_RING_SIZE; in hamachi_rx()
1412 int boguscnt = (hmp->dirty_rx + RX_RING_SIZE) - hmp->cur_rx; in hamachi_rx()
1416 entry, hmp->rx_ring[entry].status_n_length); in hamachi_rx()
1421 struct hamachi_desc *desc = &(hmp->rx_ring[entry]); in hamachi_rx()
1429 dma_sync_single_for_cpu(&hmp->pci_dev->dev, in hamachi_rx()
1431 hmp->rx_buf_sz, DMA_FROM_DEVICE); in hamachi_rx()
1432 buf_addr = (u8 *) hmp->rx_skbuff[entry]->data; in hamachi_rx()
1442 dev->name, hmp->cur_rx, data_size, desc_status); in hamachi_rx()
1444 dev->name, desc, &hmp->rx_ring[hmp->cur_rx % RX_RING_SIZE]); in hamachi_rx()
1447 le32_to_cpu(hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length) & 0xffff0000, in hamachi_rx()
1448 le32_to_cpu(hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length) & 0x0000ffff, in hamachi_rx()
1449 le32_to_cpu(hmp->rx_ring[(hmp->cur_rx-1) % RX_RING_SIZE].status_n_length)); in hamachi_rx()
1498 dma_sync_single_for_cpu(&hmp->pci_dev->dev, in hamachi_rx()
1499 leXX_to_cpu(hmp->rx_ring[entry].addr), in hamachi_rx()
1500 hmp->rx_buf_sz, in hamachi_rx()
1505 hmp->rx_skbuff[entry]->data, pkt_len); in hamachi_rx()
1508 skb_put_data(skb, hmp->rx_ring_dma in hamachi_rx()
1511 dma_sync_single_for_device(&hmp->pci_dev->dev, in hamachi_rx()
1512 leXX_to_cpu(hmp->rx_ring[entry].addr), in hamachi_rx()
1513 hmp->rx_buf_sz, in hamachi_rx()
1516 dma_unmap_single(&hmp->pci_dev->dev, in hamachi_rx()
1517 leXX_to_cpu(hmp->rx_ring[entry].addr), in hamachi_rx()
1518 hmp->rx_buf_sz, in hamachi_rx()
1520 skb_put(skb = hmp->rx_skbuff[entry], pkt_len); in hamachi_rx()
1521 hmp->rx_skbuff[entry] = NULL; in hamachi_rx()
1586 entry = (++hmp->cur_rx) % RX_RING_SIZE; in hamachi_rx()
1590 for (; hmp->cur_rx - hmp->dirty_rx > 0; hmp->dirty_rx++) { in hamachi_rx()
1593 entry = hmp->dirty_rx % RX_RING_SIZE; in hamachi_rx()
1594 desc = &(hmp->rx_ring[entry]); in hamachi_rx()
1595 if (hmp->rx_skbuff[entry] == NULL) { in hamachi_rx()
1596 struct sk_buff *skb = netdev_alloc_skb(dev, hmp->rx_buf_sz + 2); in hamachi_rx()
1598 hmp->rx_skbuff[entry] = skb; in hamachi_rx()
1602 desc->addr = cpu_to_leXX(dma_map_single(&hmp->pci_dev->dev, in hamachi_rx()
1604 hmp->rx_buf_sz, in hamachi_rx()
1607 desc->status_n_length = cpu_to_le32(hmp->rx_buf_sz); in hamachi_rx()
1618 if (readw(hmp->base + RxStatus) & 0x0002) in hamachi_rx()
1619 writew(0x0001, hmp->base + RxCmd); in hamachi_rx()
1628 struct hamachi_private *hmp = netdev_priv(dev); in hamachi_error() local
1629 void __iomem *ioaddr = hmp->base; in hamachi_error()
1662 struct hamachi_private *hmp = netdev_priv(dev); in hamachi_close() local
1663 void __iomem *ioaddr = hmp->base; in hamachi_close()
1674 dev->name, hmp->cur_tx, hmp->dirty_tx, hmp->cur_rx, hmp->dirty_rx); in hamachi_close()
1687 (int)hmp->tx_ring_dma); in hamachi_close()
1690 readl(ioaddr + TxCurPtr) == (long)&hmp->tx_ring[i] ? '>' : ' ', in hamachi_close()
1691 i, hmp->tx_ring[i].status_n_length, hmp->tx_ring[i].addr); in hamachi_close()
1693 (int)hmp->rx_ring_dma); in hamachi_close()
1696 readl(ioaddr + RxCurPtr) == (long)&hmp->rx_ring[i] ? '>' : ' ', in hamachi_close()
1697 i, hmp->rx_ring[i].status_n_length, hmp->rx_ring[i].addr); in hamachi_close()
1699 if (*(u8*)hmp->rx_skbuff[i]->data != 0x69) { in hamachi_close()
1701 hmp->rx_skbuff[i]->data; in hamachi_close()
1713 free_irq(hmp->pci_dev->irq, dev); in hamachi_close()
1715 del_timer_sync(&hmp->timer); in hamachi_close()
1719 skb = hmp->rx_skbuff[i]; in hamachi_close()
1720 hmp->rx_ring[i].status_n_length = 0; in hamachi_close()
1722 dma_unmap_single(&hmp->pci_dev->dev, in hamachi_close()
1723 leXX_to_cpu(hmp->rx_ring[i].addr), in hamachi_close()
1724 hmp->rx_buf_sz, DMA_FROM_DEVICE); in hamachi_close()
1726 hmp->rx_skbuff[i] = NULL; in hamachi_close()
1728 hmp->rx_ring[i].addr = cpu_to_leXX(0xBADF00D0); /* An invalid address. */ in hamachi_close()
1731 skb = hmp->tx_skbuff[i]; in hamachi_close()
1733 dma_unmap_single(&hmp->pci_dev->dev, in hamachi_close()
1734 leXX_to_cpu(hmp->tx_ring[i].addr), in hamachi_close()
1737 hmp->tx_skbuff[i] = NULL; in hamachi_close()
1748 struct hamachi_private *hmp = netdev_priv(dev); in hamachi_get_stats() local
1749 void __iomem *ioaddr = hmp->base; in hamachi_get_stats()
1784 struct hamachi_private *hmp = netdev_priv(dev); in set_rx_mode() local
1785 void __iomem *ioaddr = hmp->base; in set_rx_mode()
1925 struct hamachi_private *hmp = netdev_priv(dev); in hamachi_remove_one() local
1927 dma_free_coherent(&pdev->dev, RX_TOTAL_SIZE, hmp->rx_ring, in hamachi_remove_one()
1928 hmp->rx_ring_dma); in hamachi_remove_one()
1929 dma_free_coherent(&pdev->dev, TX_TOTAL_SIZE, hmp->tx_ring, in hamachi_remove_one()
1930 hmp->tx_ring_dma); in hamachi_remove_one()
1932 iounmap(hmp->base); in hamachi_remove_one()