~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/pci-dma-compat.h

Version: ~ [ linux-5.12-rc7 ] ~ [ linux-5.11.13 ] ~ [ linux-5.10.29 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.111 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.186 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.230 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.266 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.266 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  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 /* 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 
 15 static inline void *
 16 pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
 17                      dma_addr_t *dma_handle)
 18 {
 19         return dma_alloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, dma_handle, GFP_ATOMIC);
 20 }
 21 
 22 static inline void *
 23 pci_zalloc_consistent(struct pci_dev *hwdev, size_t size,
 24                       dma_addr_t *dma_handle)
 25 {
 26         return dma_zalloc_coherent(hwdev == NULL ? NULL : &hwdev->dev,
 27                                    size, dma_handle, GFP_ATOMIC);
 28 }
 29 
 30 static inline void
 31 pci_free_consistent(struct pci_dev *hwdev, size_t size,
 32                     void *vaddr, dma_addr_t dma_handle)
 33 {
 34         dma_free_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, vaddr, dma_handle);
 35 }
 36 
 37 static inline dma_addr_t
 38 pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction)
 39 {
 40         return dma_map_single(hwdev == NULL ? NULL : &hwdev->dev, ptr, size, (enum dma_data_direction)direction);
 41 }
 42 
 43 static inline void
 44 pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
 45                  size_t size, int direction)
 46 {
 47         dma_unmap_single(hwdev == NULL ? NULL : &hwdev->dev, dma_addr, size, (enum dma_data_direction)direction);
 48 }
 49 
 50 static inline dma_addr_t
 51 pci_map_page(struct pci_dev *hwdev, struct page *page,
 52              unsigned long offset, size_t size, int direction)
 53 {
 54         return dma_map_page(hwdev == NULL ? NULL : &hwdev->dev, page, offset, size, (enum dma_data_direction)direction);
 55 }
 56 
 57 static inline void
 58 pci_unmap_page(struct pci_dev *hwdev, dma_addr_t dma_address,
 59                size_t size, int direction)
 60 {
 61         dma_unmap_page(hwdev == NULL ? NULL : &hwdev->dev, dma_address, size, (enum dma_data_direction)direction);
 62 }
 63 
 64 static inline int
 65 pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
 66            int nents, int direction)
 67 {
 68         return dma_map_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nents, (enum dma_data_direction)direction);
 69 }
 70 
 71 static inline void
 72 pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
 73              int nents, int direction)
 74 {
 75         dma_unmap_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nents, (enum dma_data_direction)direction);
 76 }
 77 
 78 static inline void
 79 pci_dma_sync_single_for_cpu(struct pci_dev *hwdev, dma_addr_t dma_handle,
 80                     size_t size, int direction)
 81 {
 82         dma_sync_single_for_cpu(hwdev == NULL ? NULL : &hwdev->dev, dma_handle, size, (enum dma_data_direction)direction);
 83 }
 84 
 85 static inline void
 86 pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle,
 87                     size_t size, int direction)
 88 {
 89         dma_sync_single_for_device(hwdev == NULL ? NULL : &hwdev->dev, dma_handle, size, (enum dma_data_direction)direction);
 90 }
 91 
 92 static inline void
 93 pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg,
 94                 int nelems, int direction)
 95 {
 96         dma_sync_sg_for_cpu(hwdev == NULL ? NULL : &hwdev->dev, sg, nelems, (enum dma_data_direction)direction);
 97 }
 98 
 99 static inline void
100 pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg,
101                 int nelems, int direction)
102 {
103         dma_sync_sg_for_device(hwdev == NULL ? NULL : &hwdev->dev, sg, nelems, (enum dma_data_direction)direction);
104 }
105 
106 static inline int
107 pci_dma_mapping_error(struct pci_dev *pdev, dma_addr_t dma_addr)
108 {
109         return dma_mapping_error(&pdev->dev, dma_addr);
110 }
111 
112 #ifdef CONFIG_PCI
113 static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
114 {
115         return dma_set_mask(&dev->dev, mask);
116 }
117 
118 static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
119 {
120         return dma_set_coherent_mask(&dev->dev, mask);
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; }
145 #endif
146 
147 #endif
148 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp