for (i = 0; i < TX_DCNT; i++) {
if (lp->tx_insert_ptr->skb_ptr) {
- pci_unmap_single(lp->pdev,
- le32_to_cpu(lp->tx_insert_ptr->buf),
- MAX_BUF_SIZE, PCI_DMA_TODEVICE);
+ dma_unmap_single(&lp->pdev->dev,
+ le32_to_cpu(lp->tx_insert_ptr->buf),
+ MAX_BUF_SIZE, DMA_TO_DEVICE);
dev_kfree_skb(lp->tx_insert_ptr->skb_ptr);
lp->tx_insert_ptr->skb_ptr = NULL;
}
for (i = 0; i < RX_DCNT; i++) {
if (lp->rx_insert_ptr->skb_ptr) {
- pci_unmap_single(lp->pdev,
- le32_to_cpu(lp->rx_insert_ptr->buf),
- MAX_BUF_SIZE, PCI_DMA_FROMDEVICE);
+ dma_unmap_single(&lp->pdev->dev,
+ le32_to_cpu(lp->rx_insert_ptr->buf),
+ MAX_BUF_SIZE, DMA_FROM_DEVICE);
dev_kfree_skb(lp->rx_insert_ptr->skb_ptr);
lp->rx_insert_ptr->skb_ptr = NULL;
}
goto err_exit;
}
desc->skb_ptr = skb;
- desc->buf = cpu_to_le32(pci_map_single(lp->pdev,
- desc->skb_ptr->data,
- MAX_BUF_SIZE, PCI_DMA_FROMDEVICE));
+ desc->buf = cpu_to_le32(dma_map_single(&lp->pdev->dev,
+ desc->skb_ptr->data,
+ MAX_BUF_SIZE,
+ DMA_FROM_DEVICE));
desc->status = DSC_OWNER_MAC;
desc = desc->vndescp;
} while (desc != lp->rx_ring);
/* Free Descriptor memory */
if (lp->rx_ring) {
- pci_free_consistent(pdev,
- RX_DESC_SIZE, lp->rx_ring, lp->rx_ring_dma);
+ dma_free_coherent(&pdev->dev, RX_DESC_SIZE, lp->rx_ring,
+ lp->rx_ring_dma);
lp->rx_ring = NULL;
}
if (lp->tx_ring) {
- pci_free_consistent(pdev,
- TX_DESC_SIZE, lp->tx_ring, lp->tx_ring_dma);
+ dma_free_coherent(&pdev->dev, TX_DESC_SIZE, lp->tx_ring,
+ lp->tx_ring_dma);
lp->tx_ring = NULL;
}
/* Do not count the CRC */
skb_put(skb_ptr, descptr->len - 4);
- pci_unmap_single(priv->pdev, le32_to_cpu(descptr->buf),
- MAX_BUF_SIZE, PCI_DMA_FROMDEVICE);
+ dma_unmap_single(&priv->pdev->dev, le32_to_cpu(descptr->buf),
+ MAX_BUF_SIZE, DMA_FROM_DEVICE);
skb_ptr->protocol = eth_type_trans(skb_ptr, priv->dev);
/* Send to upper layer */
/* put new skb into descriptor */
descptr->skb_ptr = new_skb;
- descptr->buf = cpu_to_le32(pci_map_single(priv->pdev,
- descptr->skb_ptr->data,
- MAX_BUF_SIZE, PCI_DMA_FROMDEVICE));
+ descptr->buf = cpu_to_le32(dma_map_single(&priv->pdev->dev,
+ descptr->skb_ptr->data,
+ MAX_BUF_SIZE,
+ DMA_FROM_DEVICE));
next_descr:
/* put the descriptor back to the MAC */
dev->stats.tx_packets++;
dev->stats.tx_bytes += skb_ptr->len;
- pci_unmap_single(priv->pdev, le32_to_cpu(descptr->buf),
- skb_ptr->len, PCI_DMA_TODEVICE);
+ dma_unmap_single(&priv->pdev->dev, le32_to_cpu(descptr->buf),
+ skb_ptr->len, DMA_TO_DEVICE);
/* Free buffer */
dev_kfree_skb(skb_ptr);
descptr->skb_ptr = NULL;
/* Allocate Descriptor memory */
lp->rx_ring =
- pci_alloc_consistent(lp->pdev, RX_DESC_SIZE, &lp->rx_ring_dma);
+ dma_alloc_coherent(&lp->pdev->dev, RX_DESC_SIZE,
+ &lp->rx_ring_dma, GFP_KERNEL);
if (!lp->rx_ring) {
ret = -ENOMEM;
goto err_free_irq;
}
lp->tx_ring =
- pci_alloc_consistent(lp->pdev, TX_DESC_SIZE, &lp->tx_ring_dma);
+ dma_alloc_coherent(&lp->pdev->dev, TX_DESC_SIZE,
+ &lp->tx_ring_dma, GFP_KERNEL);
if (!lp->tx_ring) {
ret = -ENOMEM;
goto err_free_rx_ring;
return 0;
err_free_tx_ring:
- pci_free_consistent(lp->pdev, TX_DESC_SIZE, lp->tx_ring,
- lp->tx_ring_dma);
+ dma_free_coherent(&lp->pdev->dev, TX_DESC_SIZE, lp->tx_ring,
+ lp->tx_ring_dma);
err_free_rx_ring:
- pci_free_consistent(lp->pdev, RX_DESC_SIZE, lp->rx_ring,
- lp->rx_ring_dma);
+ dma_free_coherent(&lp->pdev->dev, RX_DESC_SIZE, lp->rx_ring,
+ lp->rx_ring_dma);
err_free_irq:
free_irq(dev->irq, dev);
out:
descptr = lp->tx_insert_ptr;
descptr->len = skb->len;
descptr->skb_ptr = skb;
- descptr->buf = cpu_to_le32(pci_map_single(lp->pdev,
- skb->data, skb->len, PCI_DMA_TODEVICE));
+ descptr->buf = cpu_to_le32(dma_map_single(&lp->pdev->dev, skb->data,
+ skb->len, DMA_TO_DEVICE));
descptr->status = DSC_OWNER_MAC;
skb_tx_timestamp(skb);
goto err_out;
/* this should always be supported */
- err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
+ err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
if (err) {
dev_err(&pdev->dev, "32-bit PCI DMA addresses not supported by the card\n");
goto err_out_disable_dev;
}
- err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
+ err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
if (err) {
dev_err(&pdev->dev, "32-bit PCI DMA addresses not supported by the card\n");
goto err_out_disable_dev;