Lines Matching refs:hmp

581 	struct hamachi_private *hmp;  in hamachi_init_one()  local
638 hmp = netdev_priv(dev); in hamachi_init_one()
639 spin_lock_init(&hmp->lock); in hamachi_init_one()
641 hmp->mii_if.dev = dev; in hamachi_init_one()
642 hmp->mii_if.mdio_read = mdio_read; in hamachi_init_one()
643 hmp->mii_if.mdio_write = mdio_write; in hamachi_init_one()
644 hmp->mii_if.phy_id_mask = 0x1f; in hamachi_init_one()
645 hmp->mii_if.reg_num_mask = 0x1f; in hamachi_init_one()
651 hmp->tx_ring = ring_space; in hamachi_init_one()
652 hmp->tx_ring_dma = ring_dma; in hamachi_init_one()
658 hmp->rx_ring = ring_space; in hamachi_init_one()
659 hmp->rx_ring_dma = ring_dma; in hamachi_init_one()
686 hmp->base = ioaddr; in hamachi_init_one()
689 hmp->chip_id = chip_id; in hamachi_init_one()
690 hmp->pci_dev = pdev; in hamachi_init_one()
694 hmp->option = option; in hamachi_init_one()
696 hmp->mii_if.full_duplex = 1; in hamachi_init_one()
698 hmp->mii_if.full_duplex = 0; in hamachi_init_one()
699 hmp->default_port = option & 15; in hamachi_init_one()
700 if (hmp->default_port) in hamachi_init_one()
701 hmp->mii_if.force_media = 1; in hamachi_init_one()
704 hmp->mii_if.full_duplex = 1; in hamachi_init_one()
707 if (hmp->mii_if.full_duplex || (option & 0x080)) in hamachi_init_one()
708 hmp->duplex_lock = 1; in hamachi_init_one()
720 hmp->rx_int_var = rx_int_var >= 0 ? rx_int_var : in hamachi_init_one()
722 hmp->tx_int_var = tx_int_var >= 0 ? tx_int_var : in hamachi_init_one()
728 dev->ethtool_ops = (chip_tbl[hmp->chip_id].flags & CanHaveMII) ? in hamachi_init_one()
750 if (chip_tbl[hmp->chip_id].flags & CanHaveMII) { in hamachi_init_one()
756 hmp->phys[phy_idx++] = phy; in hamachi_init_one()
757 hmp->mii_if.advertising = mdio_read(dev, phy, MII_ADVERTISE); in hamachi_init_one()
760 dev->name, phy, mii_status, hmp->mii_if.advertising); in hamachi_init_one()
763 hmp->mii_cnt = phy_idx; in hamachi_init_one()
764 if (hmp->mii_cnt > 0) in hamachi_init_one()
765 hmp->mii_if.phy_id = hmp->phys[0]; in hamachi_init_one()
767 memset(&hmp->mii_if, 0, sizeof(hmp->mii_if)); in hamachi_init_one()
778 dma_free_coherent(&pdev->dev, RX_TOTAL_SIZE, hmp->rx_ring, in hamachi_init_one()
779 hmp->rx_ring_dma); in hamachi_init_one()
781 dma_free_coherent(&pdev->dev, TX_TOTAL_SIZE, hmp->tx_ring, in hamachi_init_one()
782 hmp->tx_ring_dma); in hamachi_init_one()
815 struct hamachi_private *hmp = netdev_priv(dev); in mdio_read() local
816 void __iomem *ioaddr = hmp->base; in mdio_read()
833 struct hamachi_private *hmp = netdev_priv(dev); in mdio_write() local
834 void __iomem *ioaddr = hmp->base; in mdio_write()
853 struct hamachi_private *hmp = netdev_priv(dev); in hamachi_open() local
854 void __iomem *ioaddr = hmp->base; in hamachi_open()
859 i = request_irq(hmp->pci_dev->irq, hamachi_interrupt, IRQF_SHARED, in hamachi_open()
868 writel(hmp->rx_ring_dma, ioaddr + RxPtr); in hamachi_open()
869 writel(hmp->rx_ring_dma >> 32, ioaddr + RxPtr + 4); in hamachi_open()
870 writel(hmp->tx_ring_dma, ioaddr + TxPtr); in hamachi_open()
871 writel(hmp->tx_ring_dma >> 32, ioaddr + TxPtr + 4); in hamachi_open()
873 writel(hmp->rx_ring_dma, ioaddr + RxPtr); in hamachi_open()
874 writel(hmp->tx_ring_dma, ioaddr + TxPtr); in hamachi_open()
914 dev->if_port = hmp->default_port; in hamachi_open()
919 if (hmp->duplex_lock != 1) in hamachi_open()
920 hmp->mii_if.full_duplex = 1; in hamachi_open()
944 rx_int_var = hmp->rx_int_var; in hamachi_open()
945 tx_int_var = hmp->tx_int_var; in hamachi_open()
984 timer_setup(&hmp->timer, hamachi_timer, 0); in hamachi_open()
985 hmp->timer.expires = RUN_AT((24*HZ)/10); /* 2.4 sec. */ in hamachi_open()
986 add_timer(&hmp->timer); in hamachi_open()
993 struct hamachi_private *hmp = netdev_priv(dev); in hamachi_tx() local
997 for (; hmp->cur_tx - hmp->dirty_tx > 0; hmp->dirty_tx++) { in hamachi_tx()
998 int entry = hmp->dirty_tx % TX_RING_SIZE; in hamachi_tx()
1001 if (hmp->tx_ring[entry].status_n_length & cpu_to_le32(DescOwn)) in hamachi_tx()
1004 skb = hmp->tx_skbuff[entry]; in hamachi_tx()
1006 dma_unmap_single(&hmp->pci_dev->dev, in hamachi_tx()
1007 leXX_to_cpu(hmp->tx_ring[entry].addr), in hamachi_tx()
1010 hmp->tx_skbuff[entry] = NULL; in hamachi_tx()
1012 hmp->tx_ring[entry].status_n_length = 0; in hamachi_tx()
1014 hmp->tx_ring[TX_RING_SIZE-1].status_n_length |= in hamachi_tx()
1024 struct hamachi_private *hmp = from_timer(hmp, t, timer); in hamachi_timer() local
1025 struct net_device *dev = hmp->mii_if.dev; in hamachi_timer()
1026 void __iomem *ioaddr = hmp->base; in hamachi_timer()
1043 hmp->timer.expires = RUN_AT(next_tick); in hamachi_timer()
1044 add_timer(&hmp->timer); in hamachi_timer()
1050 struct hamachi_private *hmp = netdev_priv(dev); in hamachi_tx_timeout() local
1051 void __iomem *ioaddr = hmp->base; in hamachi_tx_timeout()
1057 printk(KERN_DEBUG " Rx ring %p: ", hmp->rx_ring); in hamachi_tx_timeout()
1060 le32_to_cpu(hmp->rx_ring[i].status_n_length)); in hamachi_tx_timeout()
1062 printk(KERN_DEBUG" Tx ring %p: ", hmp->tx_ring); in hamachi_tx_timeout()
1065 le32_to_cpu(hmp->tx_ring[i].status_n_length)); in hamachi_tx_timeout()
1081 hmp->rx_ring[i].status_n_length &= cpu_to_le32(~DescOwn); in hamachi_tx_timeout()
1090 hmp->tx_ring[i].status_n_length = in hamachi_tx_timeout()
1092 (hmp->tx_ring[i].status_n_length & in hamachi_tx_timeout()
1095 hmp->tx_ring[i].status_n_length &= cpu_to_le32(0x0000ffff); in hamachi_tx_timeout()
1096 skb = hmp->tx_skbuff[i]; in hamachi_tx_timeout()
1098 dma_unmap_single(&hmp->pci_dev->dev, in hamachi_tx_timeout()
1099 leXX_to_cpu(hmp->tx_ring[i].addr), in hamachi_tx_timeout()
1102 hmp->tx_skbuff[i] = NULL; in hamachi_tx_timeout()
1111 hmp->tx_full = 0; in hamachi_tx_timeout()
1112 hmp->cur_rx = hmp->cur_tx = 0; in hamachi_tx_timeout()
1113 hmp->dirty_rx = hmp->dirty_tx = 0; in hamachi_tx_timeout()
1118 struct sk_buff *skb = hmp->rx_skbuff[i]; in hamachi_tx_timeout()
1121 dma_unmap_single(&hmp->pci_dev->dev, in hamachi_tx_timeout()
1122 leXX_to_cpu(hmp->rx_ring[i].addr), in hamachi_tx_timeout()
1123 hmp->rx_buf_sz, DMA_FROM_DEVICE); in hamachi_tx_timeout()
1125 hmp->rx_skbuff[i] = NULL; in hamachi_tx_timeout()
1132 skb = netdev_alloc_skb_ip_align(dev, hmp->rx_buf_sz); in hamachi_tx_timeout()
1133 hmp->rx_skbuff[i] = skb; in hamachi_tx_timeout()
1137 hmp->rx_ring[i].addr = cpu_to_leXX(dma_map_single(&hmp->pci_dev->dev, in hamachi_tx_timeout()
1139 hmp->rx_buf_sz, in hamachi_tx_timeout()
1141 hmp->rx_ring[i].status_n_length = cpu_to_le32(DescOwn | in hamachi_tx_timeout()
1142 DescEndPacket | DescIntr | (hmp->rx_buf_sz - 2)); in hamachi_tx_timeout()
1144 hmp->dirty_rx = (unsigned int)(i - RX_RING_SIZE); in hamachi_tx_timeout()
1146 hmp->rx_ring[RX_RING_SIZE-1].status_n_length |= cpu_to_le32(DescEndRing); in hamachi_tx_timeout()
1164 struct hamachi_private *hmp = netdev_priv(dev); in hamachi_init_ring() local
1167 hmp->tx_full = 0; in hamachi_init_ring()
1168 hmp->cur_rx = hmp->cur_tx = 0; in hamachi_init_ring()
1169 hmp->dirty_rx = hmp->dirty_tx = 0; in hamachi_init_ring()
1176 hmp->rx_buf_sz = (dev->mtu <= 1492 ? PKT_BUF_SZ : in hamachi_init_ring()
1181 hmp->rx_ring[i].status_n_length = 0; in hamachi_init_ring()
1182 hmp->rx_skbuff[i] = NULL; in hamachi_init_ring()
1186 struct sk_buff *skb = netdev_alloc_skb(dev, hmp->rx_buf_sz + 2); in hamachi_init_ring()
1187 hmp->rx_skbuff[i] = skb; in hamachi_init_ring()
1191 hmp->rx_ring[i].addr = cpu_to_leXX(dma_map_single(&hmp->pci_dev->dev, in hamachi_init_ring()
1193 hmp->rx_buf_sz, in hamachi_init_ring()
1196 hmp->rx_ring[i].status_n_length = cpu_to_le32(DescOwn | in hamachi_init_ring()
1197 DescEndPacket | DescIntr | (hmp->rx_buf_sz -2)); in hamachi_init_ring()
1199 hmp->dirty_rx = (unsigned int)(i - RX_RING_SIZE); in hamachi_init_ring()
1200 hmp->rx_ring[RX_RING_SIZE-1].status_n_length |= cpu_to_le32(DescEndRing); in hamachi_init_ring()
1203 hmp->tx_skbuff[i] = NULL; in hamachi_init_ring()
1204 hmp->tx_ring[i].status_n_length = 0; in hamachi_init_ring()
1207 hmp->tx_ring[TX_RING_SIZE-1].status_n_length |= cpu_to_le32(DescEndRing); in hamachi_init_ring()
1214 struct hamachi_private *hmp = netdev_priv(dev); in hamachi_start_xmit() local
1223 if (hmp->tx_full) { in hamachi_start_xmit()
1225 printk(KERN_WARNING "%s: Hamachi transmit queue full at slot %d.\n",dev->name, hmp->cur_tx); in hamachi_start_xmit()
1229 status=readw(hmp->base + TxStatus); in hamachi_start_xmit()
1231 writew(0x0001, hmp->base + TxCmd); in hamachi_start_xmit()
1239 entry = hmp->cur_tx % TX_RING_SIZE; in hamachi_start_xmit()
1241 hmp->tx_skbuff[entry] = skb; in hamachi_start_xmit()
1243 hmp->tx_ring[entry].addr = cpu_to_leXX(dma_map_single(&hmp->pci_dev->dev, in hamachi_start_xmit()
1258 hmp->tx_ring[entry].status_n_length = cpu_to_le32(DescOwn | in hamachi_start_xmit()
1261 hmp->tx_ring[entry].status_n_length = cpu_to_le32(DescOwn | in hamachi_start_xmit()
1263 hmp->cur_tx++; in hamachi_start_xmit()
1269 status=readw(hmp->base + TxStatus); in hamachi_start_xmit()
1271 writew(0x0001, hmp->base + TxCmd); in hamachi_start_xmit()
1282 if ((hmp->cur_tx - hmp->dirty_tx) < (TX_RING_SIZE - 4)) in hamachi_start_xmit()
1285 hmp->tx_full = 1; in hamachi_start_xmit()
1291 dev->name, hmp->cur_tx, entry); in hamachi_start_xmit()
1301 struct hamachi_private *hmp = netdev_priv(dev); in hamachi_interrupt() local
1302 void __iomem *ioaddr = hmp->base; in hamachi_interrupt()
1313 spin_lock(&hmp->lock); in hamachi_interrupt()
1335 if (hmp->tx_full){ in hamachi_interrupt()
1336 for (; hmp->cur_tx - hmp->dirty_tx > 0; hmp->dirty_tx++){ in hamachi_interrupt()
1337 int entry = hmp->dirty_tx % TX_RING_SIZE; in hamachi_interrupt()
1340 if (hmp->tx_ring[entry].status_n_length & cpu_to_le32(DescOwn)) in hamachi_interrupt()
1342 skb = hmp->tx_skbuff[entry]; in hamachi_interrupt()
1345 dma_unmap_single(&hmp->pci_dev->dev, in hamachi_interrupt()
1346 leXX_to_cpu(hmp->tx_ring[entry].addr), in hamachi_interrupt()
1350 hmp->tx_skbuff[entry] = NULL; in hamachi_interrupt()
1352 hmp->tx_ring[entry].status_n_length = 0; in hamachi_interrupt()
1354 hmp->tx_ring[TX_RING_SIZE-1].status_n_length |= in hamachi_interrupt()
1358 if (hmp->cur_tx - hmp->dirty_tx < TX_RING_SIZE - 4){ in hamachi_interrupt()
1360 hmp->tx_full = 0; in hamachi_interrupt()
1398 spin_unlock(&hmp->lock); in hamachi_interrupt()
1406 struct hamachi_private *hmp = netdev_priv(dev); in hamachi_rx() local
1407 int entry = hmp->cur_rx % RX_RING_SIZE; in hamachi_rx()
1408 int boguscnt = (hmp->dirty_rx + RX_RING_SIZE) - hmp->cur_rx; in hamachi_rx()
1412 entry, hmp->rx_ring[entry].status_n_length); in hamachi_rx()
1417 struct hamachi_desc *desc = &(hmp->rx_ring[entry]); in hamachi_rx()
1425 dma_sync_single_for_cpu(&hmp->pci_dev->dev, in hamachi_rx()
1427 hmp->rx_buf_sz, DMA_FROM_DEVICE); in hamachi_rx()
1428 buf_addr = (u8 *) hmp->rx_skbuff[entry]->data; in hamachi_rx()
1438 dev->name, hmp->cur_rx, data_size, desc_status); in hamachi_rx()
1440 dev->name, desc, &hmp->rx_ring[hmp->cur_rx % RX_RING_SIZE]); in hamachi_rx()
1443 le32_to_cpu(hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length) & 0xffff0000, in hamachi_rx()
1444 le32_to_cpu(hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length) & 0x0000ffff, in hamachi_rx()
1445 le32_to_cpu(hmp->rx_ring[(hmp->cur_rx-1) % RX_RING_SIZE].status_n_length)); in hamachi_rx()
1494 dma_sync_single_for_cpu(&hmp->pci_dev->dev, in hamachi_rx()
1495 leXX_to_cpu(hmp->rx_ring[entry].addr), in hamachi_rx()
1496 hmp->rx_buf_sz, in hamachi_rx()
1501 hmp->rx_skbuff[entry]->data, pkt_len); in hamachi_rx()
1504 skb_put_data(skb, hmp->rx_ring_dma in hamachi_rx()
1507 dma_sync_single_for_device(&hmp->pci_dev->dev, in hamachi_rx()
1508 leXX_to_cpu(hmp->rx_ring[entry].addr), in hamachi_rx()
1509 hmp->rx_buf_sz, in hamachi_rx()
1512 dma_unmap_single(&hmp->pci_dev->dev, in hamachi_rx()
1513 leXX_to_cpu(hmp->rx_ring[entry].addr), in hamachi_rx()
1514 hmp->rx_buf_sz, in hamachi_rx()
1516 skb_put(skb = hmp->rx_skbuff[entry], pkt_len); in hamachi_rx()
1517 hmp->rx_skbuff[entry] = NULL; in hamachi_rx()
1582 entry = (++hmp->cur_rx) % RX_RING_SIZE; in hamachi_rx()
1586 for (; hmp->cur_rx - hmp->dirty_rx > 0; hmp->dirty_rx++) { in hamachi_rx()
1589 entry = hmp->dirty_rx % RX_RING_SIZE; in hamachi_rx()
1590 desc = &(hmp->rx_ring[entry]); in hamachi_rx()
1591 if (hmp->rx_skbuff[entry] == NULL) { in hamachi_rx()
1592 struct sk_buff *skb = netdev_alloc_skb(dev, hmp->rx_buf_sz + 2); in hamachi_rx()
1594 hmp->rx_skbuff[entry] = skb; in hamachi_rx()
1598 desc->addr = cpu_to_leXX(dma_map_single(&hmp->pci_dev->dev, in hamachi_rx()
1600 hmp->rx_buf_sz, in hamachi_rx()
1603 desc->status_n_length = cpu_to_le32(hmp->rx_buf_sz); in hamachi_rx()
1614 if (readw(hmp->base + RxStatus) & 0x0002) in hamachi_rx()
1615 writew(0x0001, hmp->base + RxCmd); in hamachi_rx()
1624 struct hamachi_private *hmp = netdev_priv(dev); in hamachi_error() local
1625 void __iomem *ioaddr = hmp->base; in hamachi_error()
1658 struct hamachi_private *hmp = netdev_priv(dev); in hamachi_close() local
1659 void __iomem *ioaddr = hmp->base; in hamachi_close()
1670 dev->name, hmp->cur_tx, hmp->dirty_tx, hmp->cur_rx, hmp->dirty_rx); in hamachi_close()
1683 (int)hmp->tx_ring_dma); in hamachi_close()
1686 readl(ioaddr + TxCurPtr) == (long)&hmp->tx_ring[i] ? '>' : ' ', in hamachi_close()
1687 i, hmp->tx_ring[i].status_n_length, hmp->tx_ring[i].addr); in hamachi_close()
1689 (int)hmp->rx_ring_dma); in hamachi_close()
1692 readl(ioaddr + RxCurPtr) == (long)&hmp->rx_ring[i] ? '>' : ' ', in hamachi_close()
1693 i, hmp->rx_ring[i].status_n_length, hmp->rx_ring[i].addr); in hamachi_close()
1695 if (*(u8*)hmp->rx_skbuff[i]->data != 0x69) { in hamachi_close()
1697 hmp->rx_skbuff[i]->data; in hamachi_close()
1709 free_irq(hmp->pci_dev->irq, dev); in hamachi_close()
1711 del_timer_sync(&hmp->timer); in hamachi_close()
1715 skb = hmp->rx_skbuff[i]; in hamachi_close()
1716 hmp->rx_ring[i].status_n_length = 0; in hamachi_close()
1718 dma_unmap_single(&hmp->pci_dev->dev, in hamachi_close()
1719 leXX_to_cpu(hmp->rx_ring[i].addr), in hamachi_close()
1720 hmp->rx_buf_sz, DMA_FROM_DEVICE); in hamachi_close()
1722 hmp->rx_skbuff[i] = NULL; in hamachi_close()
1724 hmp->rx_ring[i].addr = cpu_to_leXX(0xBADF00D0); /* An invalid address. */ in hamachi_close()
1727 skb = hmp->tx_skbuff[i]; in hamachi_close()
1729 dma_unmap_single(&hmp->pci_dev->dev, in hamachi_close()
1730 leXX_to_cpu(hmp->tx_ring[i].addr), in hamachi_close()
1733 hmp->tx_skbuff[i] = NULL; in hamachi_close()
1744 struct hamachi_private *hmp = netdev_priv(dev); in hamachi_get_stats() local
1745 void __iomem *ioaddr = hmp->base; in hamachi_get_stats()
1780 struct hamachi_private *hmp = netdev_priv(dev); in set_rx_mode() local
1781 void __iomem *ioaddr = hmp->base; in set_rx_mode()
1911 struct hamachi_private *hmp = netdev_priv(dev); in hamachi_remove_one() local
1913 dma_free_coherent(&pdev->dev, RX_TOTAL_SIZE, hmp->rx_ring, in hamachi_remove_one()
1914 hmp->rx_ring_dma); in hamachi_remove_one()
1915 dma_free_coherent(&pdev->dev, TX_TOTAL_SIZE, hmp->tx_ring, in hamachi_remove_one()
1916 hmp->tx_ring_dma); in hamachi_remove_one()
1918 iounmap(hmp->base); in hamachi_remove_one()