/* This is the main wrapper for mapping host physical pages to CA PCI space. The mapping mode used is based on the devices dma_mask. As a last resort use the GART mapped mode.  */
static u64 tioca_dma_map(struct pci_dev *pdev, u64 paddr, size_t byte_count, int dma_flags)
/* This is the main wrapper for mapping host physical pages to CA PCI space. The mapping mode used is based on the devices dma_mask. As a last resort use the GART mapped mode.  */
static u64 tioca_dma_map(struct pci_dev *pdev, u64 paddr, size_t byte_count, int dma_flags)
{
	u64 mapaddr;
	if (dma_flags & SN_DMA_MSI)
		return 0;
	if (pdev->dma_mask == ~0UL)
		mapaddr = tioca_dma_d64(paddr);
	else if (pdev->dma_mask == 0xffffffffffffUL)
		mapaddr = tioca_dma_d48(pdev, paddr);
	else
		mapaddr = 0;
	if (mapaddr == 0)
		mapaddr = tioca_dma_mapped(pdev, paddr, byte_count);
	return mapaddr;
}