aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic/pci-dma-compat.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-generic/pci-dma-compat.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/asm-generic/pci-dma-compat.h')
-rw-r--r--include/asm-generic/pci-dma-compat.h107
1 files changed, 107 insertions, 0 deletions
diff --git a/include/asm-generic/pci-dma-compat.h b/include/asm-generic/pci-dma-compat.h
new file mode 100644
index 000000000000..25c10e96b2b7
--- /dev/null
+++ b/include/asm-generic/pci-dma-compat.h
@@ -0,0 +1,107 @@
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 */
3
4#ifndef _ASM_GENERIC_PCI_DMA_COMPAT_H
5#define _ASM_GENERIC_PCI_DMA_COMPAT_H
6
7#include <linux/dma-mapping.h>
8
9/* note pci_set_dma_mask isn't here, since it's a public function
10 * exported from drivers/pci, use dma_supported instead */
11
12static inline int
13pci_dma_supported(struct pci_dev *hwdev, u64 mask)
14{
15 return dma_supported(hwdev == NULL ? NULL : &hwdev->dev, mask);
16}
17
18static inline void *
19pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
20 dma_addr_t *dma_handle)
21{
22 return dma_alloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, dma_handle, GFP_ATOMIC);
23}
24
25static inline void
26pci_free_consistent(struct pci_dev *hwdev, size_t size,
27 void *vaddr, dma_addr_t dma_handle)
28{
29 dma_free_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, vaddr, dma_handle);
30}
31
32static inline dma_addr_t
33pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction)
34{
35 return dma_map_single(hwdev == NULL ? NULL : &hwdev->dev, ptr, size, (enum dma_data_direction)direction);
36}
37
38static inline void
39pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
40 size_t size, int direction)
41{
42 dma_unmap_single(hwdev == NULL ? NULL : &hwdev->dev, dma_addr, size, (enum dma_data_direction)direction);
43}
44
45static inline dma_addr_t
46pci_map_page(struct pci_dev *hwdev, struct page *page,
47 unsigned long offset, size_t size, int direction)
48{
49 return dma_map_page(hwdev == NULL ? NULL : &hwdev->dev, page, offset, size, (enum dma_data_direction)direction);
50}
51
52static inline void
53pci_unmap_page(struct pci_dev *hwdev, dma_addr_t dma_address,
54 size_t size, int direction)
55{
56 dma_unmap_page(hwdev == NULL ? NULL : &hwdev->dev, dma_address, size, (enum dma_data_direction)direction);
57}
58
59static inline int
60pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
61 int nents, int direction)
62{
63 return dma_map_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nents, (enum dma_data_direction)direction);
64}
65
66static inline void
67pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
68 int nents, int direction)
69{
70 dma_unmap_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nents, (enum dma_data_direction)direction);
71}
72
73static inline void
74pci_dma_sync_single_for_cpu(struct pci_dev *hwdev, dma_addr_t dma_handle,
75 size_t size, int direction)
76{
77 dma_sync_single_for_cpu(hwdev == NULL ? NULL : &hwdev->dev, dma_handle, size, (enum dma_data_direction)direction);
78}
79
80static inline void
81pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle,
82 size_t size, int direction)
83{
84 dma_sync_single_for_device(hwdev == NULL ? NULL : &hwdev->dev, dma_handle, size, (enum dma_data_direction)direction);
85}
86
87static inline void
88pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg,
89 int nelems, int direction)
90{
91 dma_sync_sg_for_cpu(hwdev == NULL ? NULL : &hwdev->dev, sg, nelems, (enum dma_data_direction)direction);
92}
93
94static inline void
95pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg,
96 int nelems, int direction)
97{
98 dma_sync_sg_for_device(hwdev == NULL ? NULL : &hwdev->dev, sg, nelems, (enum dma_data_direction)direction);
99}
100
101static inline int
102pci_dma_mapping_error(dma_addr_t dma_addr)
103{
104 return dma_mapping_error(dma_addr);
105}
106
107#endif