static inline dma_addr_t pci_map_single_debug(struct pci_dev *pdev, void *ptr,
size_t size, int direction)
{
- dma_addr_t addr = pci_map_single(pdev, ptr, size, direction);
+ dma_addr_t addr = dma_map_single(&pdev->dev, ptr, size, direction);
if (addr + size > 0x100000000LL)
pr_crit("%s: pci_map_single() returned memory at 0x%llx!\n",
pci_name(pdev), (unsigned long long)addr);
dev->stats.tx_bytes += skb->len;
}
desc->stat = PACKET_EMPTY; /* Free descriptor */
- pci_unmap_single(port->card->pdev, desc->address, skb->len,
- PCI_DMA_TODEVICE);
+ dma_unmap_single(&port->card->pdev->dev, desc->address,
+ skb->len, DMA_TO_DEVICE);
dev_consume_skb_irq(skb);
port->tx_in = (port->tx_in + 1) % TX_BUFFERS;
}
if (!skb)
dev->stats.rx_dropped++;
else {
- pci_unmap_single(card->pdev, desc->address,
- BUFFER_LENGTH,
- PCI_DMA_FROMDEVICE);
+ dma_unmap_single(&card->pdev->dev,
+ desc->address, BUFFER_LENGTH,
+ DMA_FROM_DEVICE);
skb_put(skb, desc->length);
#ifdef DEBUG_PKT
if (!skb) {
skb = dev_alloc_skb(BUFFER_LENGTH);
desc->address = skb ?
- pci_map_single(card->pdev, skb->data,
+ dma_map_single(&card->pdev->dev,
+ skb->data,
BUFFER_LENGTH,
- PCI_DMA_FROMDEVICE) : 0;
+ DMA_FROM_DEVICE) : 0;
card->rx_skbs[card->rx_in] = skb;
}
}
#endif
port->tx_skbs[port->tx_out] = skb;
- desc->address = pci_map_single(port->card->pdev, skb->data, skb->len,
- PCI_DMA_TODEVICE);
+ desc->address = dma_map_single(&port->card->pdev->dev, skb->data,
+ skb->len, DMA_TO_DEVICE);
desc->length = skb->len;
desc->stat = PACKET_FULL;
writel(1 << (DOORBELL_TO_CARD_TX_0 + port->node),
if (desc->stat != PACKET_EMPTY) {
desc->stat = PACKET_EMPTY;
- pci_unmap_single(port->card->pdev, desc->address,
- port->tx_skbs[i]->len,
- PCI_DMA_TODEVICE);
+ dma_unmap_single(&port->card->pdev->dev,
+ desc->address, port->tx_skbs[i]->len,
+ DMA_TO_DEVICE);
dev_kfree_skb(port->tx_skbs[i]);
}
}
for (i = 0; i < RX_QUEUE_LENGTH; i++)
if (card->rx_skbs[i]) {
- pci_unmap_single(card->pdev,
+ dma_unmap_single(&card->pdev->dev,
card->status->rx_descs[i].address,
- BUFFER_LENGTH, PCI_DMA_FROMDEVICE);
+ BUFFER_LENGTH, DMA_FROM_DEVICE);
dev_kfree_skb(card->rx_skbs[i]);
}
iounmap(card->plx);
if (card->status)
- pci_free_consistent(pdev, sizeof(struct card_status),
- card->status, card->status_address);
+ dma_free_coherent(&pdev->dev, sizeof(struct card_status),
+ card->status, card->status_address);
pci_release_regions(pdev);
pci_disable_device(pdev);
We set both dma_mask and consistent_dma_mask to 28 bits
and pray pci_alloc_consistent() will use this info. It should
work on most platforms */
- if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(28)) ||
- pci_set_dma_mask(pdev, DMA_BIT_MASK(28))) {
+ if (dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(28)) ||
+ dma_set_mask(&pdev->dev, DMA_BIT_MASK(28))) {
pr_err("No usable DMA configuration\n");
pci_disable_device(pdev);
return -EIO;
pci_set_drvdata(pdev, card);
card->pdev = pdev;
- card->status = pci_alloc_consistent(pdev,
- sizeof(struct card_status),
- &card->status_address);
+ card->status = dma_alloc_coherent(&pdev->dev,
+ sizeof(struct card_status),
+ &card->status_address, GFP_KERNEL);
if (card->status == NULL) {
wanxl_pci_remove_one(pdev);
return -ENOBUFS;
/* FIXME when PCI/DMA subsystems are fixed.
We set both dma_mask and consistent_dma_mask back to 32 bits
to indicate the card can do 32-bit DMA addressing */
- if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)) ||
- pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
+ if (dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)) ||
+ dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
pr_err("No usable DMA configuration\n");
wanxl_pci_remove_one(pdev);
return -EIO;
card->rx_skbs[i] = skb;
if (skb)
card->status->rx_descs[i].address =
- pci_map_single(card->pdev, skb->data,
- BUFFER_LENGTH,
- PCI_DMA_FROMDEVICE);
+ dma_map_single(&card->pdev->dev, skb->data,
+ BUFFER_LENGTH, DMA_FROM_DEVICE);
}
mem = ioremap(mem_phy, PDM_OFFSET + sizeof(firmware));