diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2016-03-07 12:39:16 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2016-03-07 12:39:16 -0500 |
commit | fe537670eab767157eecc50538bd28e8d9b0ce9f (patch) | |
tree | 99314e763b2b8400974d5ab233c813495ed58098 /include/linux/pci-dma-compat.h | |
parent | bc4b024a8b8bd7dceb2697299aad2bda57d065e0 (diff) |
PCI: Consolidate PCI DMA constants and interfaces in linux/pci-dma-compat.h
Christoph added a generic include/linux/pci-dma-compat.h, so now there's
one place with most of the PCI DMA interfaces. Move more PCI DMA-related
things there:
- The PCI_DMA_* direction constants from linux/pci.h
- The pci_set_dma_max_seg_size() and pci_set_dma_seg_boundary()
CONFIG_PCI implementations from drivers/pci/pci.c
- The pci_set_dma_max_seg_size() and pci_set_dma_seg_boundary()
!CONFIG_PCI stubs from linux/pci.h
- The pci_set_dma_mask() and pci_set_consistent_dma_mask()
!CONFIG_PCI stubs from linux/pci.h
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'include/linux/pci-dma-compat.h')
-rw-r--r-- | include/linux/pci-dma-compat.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/linux/pci-dma-compat.h b/include/linux/pci-dma-compat.h index eafce7b6f052..39726caef5b1 100644 --- a/include/linux/pci-dma-compat.h +++ b/include/linux/pci-dma-compat.h | |||
@@ -6,6 +6,12 @@ | |||
6 | 6 | ||
7 | #include <linux/dma-mapping.h> | 7 | #include <linux/dma-mapping.h> |
8 | 8 | ||
9 | /* This defines the direction arg to the DMA mapping routines. */ | ||
10 | #define PCI_DMA_BIDIRECTIONAL 0 | ||
11 | #define PCI_DMA_TODEVICE 1 | ||
12 | #define PCI_DMA_FROMDEVICE 2 | ||
13 | #define PCI_DMA_NONE 3 | ||
14 | |||
9 | static inline void * | 15 | static inline void * |
10 | pci_alloc_consistent(struct pci_dev *hwdev, size_t size, | 16 | pci_alloc_consistent(struct pci_dev *hwdev, size_t size, |
11 | dma_addr_t *dma_handle) | 17 | dma_addr_t *dma_handle) |
@@ -113,6 +119,29 @@ static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask) | |||
113 | { | 119 | { |
114 | return dma_set_coherent_mask(&dev->dev, mask); | 120 | return dma_set_coherent_mask(&dev->dev, mask); |
115 | } | 121 | } |
122 | |||
123 | static inline int pci_set_dma_max_seg_size(struct pci_dev *dev, | ||
124 | unsigned int size) | ||
125 | { | ||
126 | return dma_set_max_seg_size(&dev->dev, size); | ||
127 | } | ||
128 | |||
129 | static inline int pci_set_dma_seg_boundary(struct pci_dev *dev, | ||
130 | unsigned long mask) | ||
131 | { | ||
132 | return dma_set_seg_boundary(&dev->dev, mask); | ||
133 | } | ||
134 | #else | ||
135 | static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask) | ||
136 | { return -EIO; } | ||
137 | static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask) | ||
138 | { return -EIO; } | ||
139 | static inline int pci_set_dma_max_seg_size(struct pci_dev *dev, | ||
140 | unsigned int size) | ||
141 | { return -EIO; } | ||
142 | static inline int pci_set_dma_seg_boundary(struct pci_dev *dev, | ||
143 | unsigned long mask) | ||
144 | { return -EIO; } | ||
116 | #endif | 145 | #endif |
117 | 146 | ||
118 | #endif | 147 | #endif |