Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _ALPHA_DMA_MAPPING_H |
| 2 | #define _ALPHA_DMA_MAPPING_H |
| 3 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | |
| 5 | #ifdef CONFIG_PCI |
| 6 | |
| 7 | #include <linux/pci.h> |
| 8 | |
| 9 | #define dma_map_single(dev, va, size, dir) \ |
| 10 | pci_map_single(alpha_gendev_to_pci(dev), va, size, dir) |
| 11 | #define dma_unmap_single(dev, addr, size, dir) \ |
| 12 | pci_unmap_single(alpha_gendev_to_pci(dev), addr, size, dir) |
| 13 | #define dma_alloc_coherent(dev, size, addr, gfp) \ |
Ivan Kokshaysky | c143d43 | 2008-04-02 13:04:43 -0700 | [diff] [blame] | 14 | __pci_alloc_consistent(alpha_gendev_to_pci(dev), size, addr, gfp) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | #define dma_free_coherent(dev, size, va, addr) \ |
| 16 | pci_free_consistent(alpha_gendev_to_pci(dev), size, va, addr) |
| 17 | #define dma_map_page(dev, page, off, size, dir) \ |
Andrew Morton | 817c41d | 2006-01-06 00:09:50 -0800 | [diff] [blame] | 18 | pci_map_page(alpha_gendev_to_pci(dev), page, off, size, dir) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | #define dma_unmap_page(dev, addr, size, dir) \ |
| 20 | pci_unmap_page(alpha_gendev_to_pci(dev), addr, size, dir) |
| 21 | #define dma_map_sg(dev, sg, nents, dir) \ |
| 22 | pci_map_sg(alpha_gendev_to_pci(dev), sg, nents, dir) |
| 23 | #define dma_unmap_sg(dev, sg, nents, dir) \ |
| 24 | pci_unmap_sg(alpha_gendev_to_pci(dev), sg, nents, dir) |
| 25 | #define dma_supported(dev, mask) \ |
| 26 | pci_dma_supported(alpha_gendev_to_pci(dev), mask) |
| 27 | #define dma_mapping_error(addr) \ |
| 28 | pci_dma_mapping_error(addr) |
| 29 | |
| 30 | #else /* no PCI - no IOMMU. */ |
| 31 | |
Alexey Dobriyan | ce5f8d7 | 2006-02-01 03:04:56 -0800 | [diff] [blame] | 32 | struct scatterlist; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | void *dma_alloc_coherent(struct device *dev, size_t size, |
Al Viro | 55c5d74 | 2005-10-21 03:21:08 -0400 | [diff] [blame] | 34 | dma_addr_t *dma_handle, gfp_t gfp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, |
| 36 | enum dma_data_direction direction); |
| 37 | |
| 38 | #define dma_free_coherent(dev, size, va, addr) \ |
| 39 | free_pages((unsigned long)va, get_order(size)) |
| 40 | #define dma_supported(dev, mask) (mask < 0x00ffffffUL ? 0 : 1) |
| 41 | #define dma_map_single(dev, va, size, dir) virt_to_phys(va) |
| 42 | #define dma_map_page(dev, page, off, size, dir) (page_to_pa(page) + off) |
| 43 | |
Al Viro | 6a13f66 | 2007-01-30 13:24:00 +0000 | [diff] [blame] | 44 | #define dma_unmap_single(dev, addr, size, dir) ((void)0) |
| 45 | #define dma_unmap_page(dev, addr, size, dir) ((void)0) |
| 46 | #define dma_unmap_sg(dev, sg, nents, dir) ((void)0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | |
| 48 | #define dma_mapping_error(addr) (0) |
| 49 | |
| 50 | #endif /* !CONFIG_PCI */ |
| 51 | |
| 52 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) |
| 53 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) |
Ralf Baechle | f67637e | 2006-12-06 20:38:54 -0800 | [diff] [blame] | 54 | #define dma_is_consistent(d, h) (1) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | |
| 56 | int dma_set_mask(struct device *dev, u64 mask); |
| 57 | |
Al Viro | d0a2339 | 2007-01-30 13:23:55 +0000 | [diff] [blame] | 58 | #define dma_sync_single_for_cpu(dev, addr, size, dir) ((void)0) |
| 59 | #define dma_sync_single_for_device(dev, addr, size, dir) ((void)0) |
| 60 | #define dma_sync_single_range(dev, addr, off, size, dir) ((void)0) |
| 61 | #define dma_sync_sg_for_cpu(dev, sg, nents, dir) ((void)0) |
| 62 | #define dma_sync_sg_for_device(dev, sg, nents, dir) ((void)0) |
| 63 | #define dma_cache_sync(dev, va, size, dir) ((void)0) |
| 64 | #define dma_sync_single_range_for_cpu(dev, addr, offset, size, dir) ((void)0) |
| 65 | #define dma_sync_single_range_for_device(dev, addr, offset, size, dir) ((void)0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | |
| 67 | #define dma_get_cache_alignment() L1_CACHE_BYTES |
| 68 | |
| 69 | #endif /* _ALPHA_DMA_MAPPING_H */ |