[ARM] S3C: Make common <plat/dma.h> header
[linux-2.6/verdex.git] / include / asm-generic / pci-dma-compat.h
blob37b3706226e74f67e52d80dce326968e05c0655c
1 /* include this file if the platform implements the dma_ DMA Mapping API
2 * and wants to provide the pci_ DMA Mapping API in terms of it */
4 #ifndef _ASM_GENERIC_PCI_DMA_COMPAT_H
5 #define _ASM_GENERIC_PCI_DMA_COMPAT_H
7 #include <linux/dma-mapping.h>
9 /* note pci_set_dma_mask isn't here, since it's a public function
10 * exported from drivers/pci, use dma_supported instead */
12 static inline int
13 pci_dma_supported(struct pci_dev *hwdev, u64 mask)
15 return dma_supported(hwdev == NULL ? NULL : &hwdev->dev, mask);
18 static inline void *
19 pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
20 dma_addr_t *dma_handle)
22 return dma_alloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, dma_handle, GFP_ATOMIC);
25 static inline void
26 pci_free_consistent(struct pci_dev *hwdev, size_t size,
27 void *vaddr, dma_addr_t dma_handle)
29 dma_free_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, vaddr, dma_handle);
32 static inline dma_addr_t
33 pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction)
35 return dma_map_single(hwdev == NULL ? NULL : &hwdev->dev, ptr, size, (enum dma_data_direction)direction);
38 static inline void
39 pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
40 size_t size, int direction)
42 dma_unmap_single(hwdev == NULL ? NULL : &hwdev->dev, dma_addr, size, (enum dma_data_direction)direction);
45 static inline dma_addr_t
46 pci_map_page(struct pci_dev *hwdev, struct page *page,
47 unsigned long offset, size_t size, int direction)
49 return dma_map_page(hwdev == NULL ? NULL : &hwdev->dev, page, offset, size, (enum dma_data_direction)direction);
52 static inline void
53 pci_unmap_page(struct pci_dev *hwdev, dma_addr_t dma_address,
54 size_t size, int direction)
56 dma_unmap_page(hwdev == NULL ? NULL : &hwdev->dev, dma_address, size, (enum dma_data_direction)direction);
59 static inline int
60 pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
61 int nents, int direction)
63 return dma_map_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nents, (enum dma_data_direction)direction);
66 static inline void
67 pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
68 int nents, int direction)
70 dma_unmap_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nents, (enum dma_data_direction)direction);
73 static inline void
74 pci_dma_sync_single_for_cpu(struct pci_dev *hwdev, dma_addr_t dma_handle,
75 size_t size, int direction)
77 dma_sync_single_for_cpu(hwdev == NULL ? NULL : &hwdev->dev, dma_handle, size, (enum dma_data_direction)direction);
80 static inline void
81 pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle,
82 size_t size, int direction)
84 dma_sync_single_for_device(hwdev == NULL ? NULL : &hwdev->dev, dma_handle, size, (enum dma_data_direction)direction);
87 static inline void
88 pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg,
89 int nelems, int direction)
91 dma_sync_sg_for_cpu(hwdev == NULL ? NULL : &hwdev->dev, sg, nelems, (enum dma_data_direction)direction);
94 static inline void
95 pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg,
96 int nelems, int direction)
98 dma_sync_sg_for_device(hwdev == NULL ? NULL : &hwdev->dev, sg, nelems, (enum dma_data_direction)direction);
101 static inline int
102 pci_dma_mapping_error(struct pci_dev *pdev, dma_addr_t dma_addr)
104 return dma_mapping_error(&pdev->dev, dma_addr);
107 #endif