-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dma-mapping: alpha: use include/linux/pci-dma-compat.h
This converts Alpha to use include/linux/pci-dma-compat.h. Alpha is the only architecutre that implements the PCI DMA API in the own way. That makes it difficult to implement the generic DMA API via the PCI bus specific DMA API. The generic DMA API calls the PCI DMA API implementation in arch/alpha/kernel/pci_iommu.c on non Jensen systems. It calls the DMA API in arch/alpha/kernel/pci-noop.c on Jensen systems. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Matt Turner <mattst88@gmail.com> Cc: Jesse Barnes <jbarnes@virtuousgeek.org> Cc: Greg KH <greg@kroah.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
- Loading branch information
FUJITA Tomonori
authored and
Linus Torvalds
committed
Mar 12, 2010
1 parent
3490042
commit c186cac
Showing
5 changed files
with
165 additions
and
342 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,49 @@ | ||
#ifndef _ALPHA_DMA_MAPPING_H | ||
#define _ALPHA_DMA_MAPPING_H | ||
|
||
#include <linux/dma-attrs.h> | ||
|
||
#ifdef CONFIG_PCI | ||
extern struct dma_map_ops *dma_ops; | ||
|
||
#include <linux/pci.h> | ||
static inline struct dma_map_ops *get_dma_ops(struct device *dev) | ||
{ | ||
return dma_ops; | ||
} | ||
|
||
#define dma_map_single(dev, va, size, dir) \ | ||
pci_map_single(alpha_gendev_to_pci(dev), va, size, dir) | ||
#define dma_unmap_single(dev, addr, size, dir) \ | ||
pci_unmap_single(alpha_gendev_to_pci(dev), addr, size, dir) | ||
#define dma_alloc_coherent(dev, size, addr, gfp) \ | ||
__pci_alloc_consistent(alpha_gendev_to_pci(dev), size, addr, gfp) | ||
#define dma_free_coherent(dev, size, va, addr) \ | ||
pci_free_consistent(alpha_gendev_to_pci(dev), size, va, addr) | ||
#define dma_map_page(dev, page, off, size, dir) \ | ||
pci_map_page(alpha_gendev_to_pci(dev), page, off, size, dir) | ||
#define dma_unmap_page(dev, addr, size, dir) \ | ||
pci_unmap_page(alpha_gendev_to_pci(dev), addr, size, dir) | ||
#define dma_map_sg(dev, sg, nents, dir) \ | ||
pci_map_sg(alpha_gendev_to_pci(dev), sg, nents, dir) | ||
#define dma_unmap_sg(dev, sg, nents, dir) \ | ||
pci_unmap_sg(alpha_gendev_to_pci(dev), sg, nents, dir) | ||
#define dma_supported(dev, mask) \ | ||
pci_dma_supported(alpha_gendev_to_pci(dev), mask) | ||
#define dma_mapping_error(dev, addr) \ | ||
pci_dma_mapping_error(alpha_gendev_to_pci(dev), addr) | ||
#include <asm-generic/dma-mapping-common.h> | ||
|
||
#else /* no PCI - no IOMMU. */ | ||
static inline void *dma_alloc_coherent(struct device *dev, size_t size, | ||
dma_addr_t *dma_handle, gfp_t gfp) | ||
{ | ||
return get_dma_ops(dev)->alloc_coherent(dev, size, dma_handle, gfp); | ||
} | ||
|
||
#include <asm/io.h> /* for virt_to_phys() */ | ||
static inline void dma_free_coherent(struct device *dev, size_t size, | ||
void *vaddr, dma_addr_t dma_handle) | ||
{ | ||
get_dma_ops(dev)->free_coherent(dev, size, vaddr, dma_handle); | ||
} | ||
|
||
struct scatterlist; | ||
void *dma_alloc_coherent(struct device *dev, size_t size, | ||
dma_addr_t *dma_handle, gfp_t gfp); | ||
int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | ||
enum dma_data_direction direction); | ||
static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | ||
{ | ||
return get_dma_ops(dev)->mapping_error(dev, dma_addr); | ||
} | ||
|
||
#define dma_free_coherent(dev, size, va, addr) \ | ||
free_pages((unsigned long)va, get_order(size)) | ||
#define dma_supported(dev, mask) (mask < 0x00ffffffUL ? 0 : 1) | ||
#define dma_map_single(dev, va, size, dir) virt_to_phys(va) | ||
#define dma_map_page(dev, page, off, size, dir) (page_to_pa(page) + off) | ||
static inline int dma_supported(struct device *dev, u64 mask) | ||
{ | ||
return get_dma_ops(dev)->dma_supported(dev, mask); | ||
} | ||
|
||
#define dma_unmap_single(dev, addr, size, dir) ((void)0) | ||
#define dma_unmap_page(dev, addr, size, dir) ((void)0) | ||
#define dma_unmap_sg(dev, sg, nents, dir) ((void)0) | ||
|
||
#define dma_mapping_error(dev, addr) (0) | ||
|
||
#endif /* !CONFIG_PCI */ | ||
static inline int dma_set_mask(struct device *dev, u64 mask) | ||
{ | ||
return get_dma_ops(dev)->set_dma_mask(dev, mask); | ||
} | ||
|
||
#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) | ||
#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) | ||
#define dma_is_consistent(d, h) (1) | ||
|
||
int dma_set_mask(struct device *dev, u64 mask); | ||
|
||
#define dma_sync_single_for_cpu(dev, addr, size, dir) ((void)0) | ||
#define dma_sync_single_for_device(dev, addr, size, dir) ((void)0) | ||
#define dma_sync_sg_for_cpu(dev, sg, nents, dir) ((void)0) | ||
#define dma_sync_sg_for_device(dev, sg, nents, dir) ((void)0) | ||
#define dma_cache_sync(dev, va, size, dir) ((void)0) | ||
#define dma_sync_single_range_for_cpu(dev, addr, offset, size, dir) ((void)0) | ||
#define dma_sync_single_range_for_device(dev, addr, offset, size, dir) ((void)0) | ||
|
||
#define dma_get_cache_alignment() L1_CACHE_BYTES | ||
|
||
#endif /* _ALPHA_DMA_MAPPING_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.