Subversion Repositories shark

Rev

Rev 422 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
422 giacomo 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
 
12
static inline int
13
pci_dma_supported(struct pci_dev *hwdev, u64 mask)
14
{
15
        return dma_supported(hwdev == NULL ? NULL : &hwdev->dev, mask);
16
}
17
 
18
static inline void *
19
pci_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
 
1047 mauro 25
static inline void *
26
pci_alloc_consistent_usb(struct pci_dev *hwdev, size_t size,
27
                         dma_addr_t *dma_handle)
28
{
29
        return dma_alloc_coherent_usb(hwdev == NULL ? NULL : &hwdev->dev, size, dma_handle, GFP_ATOMIC);
30
}
31
 
422 giacomo 32
static inline void
33
pci_free_consistent(struct pci_dev *hwdev, size_t size,
34
                    void *vaddr, dma_addr_t dma_handle)
35
{
36
        dma_free_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, vaddr, dma_handle);
37
}
38
 
39
static inline dma_addr_t
40
pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction)
41
{
42
        return dma_map_single(hwdev == NULL ? NULL : &hwdev->dev, ptr, size, (enum dma_data_direction)direction);
43
}
44
 
45
static inline void
46
pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
47
                 size_t size, int direction)
48
{
49
        dma_unmap_single(hwdev == NULL ? NULL : &hwdev->dev, dma_addr, size, (enum dma_data_direction)direction);
50
}
51
 
52
static inline dma_addr_t
53
pci_map_page(struct pci_dev *hwdev, struct page *page,
54
             unsigned long offset, size_t size, int direction)
55
{
56
        return dma_map_page(hwdev == NULL ? NULL : &hwdev->dev, page, offset, size, (enum dma_data_direction)direction);
57
}
58
 
59
static inline void
60
pci_unmap_page(struct pci_dev *hwdev, dma_addr_t dma_address,
61
               size_t size, int direction)
62
{
63
        dma_unmap_page(hwdev == NULL ? NULL : &hwdev->dev, dma_address, size, (enum dma_data_direction)direction);
64
}
65
 
66
static inline int
67
pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
68
           int nents, int direction)
69
{
70
        return dma_map_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nents, (enum dma_data_direction)direction);
71
}
72
 
73
static inline void
74
pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
75
             int nents, int direction)
76
{
77
        dma_unmap_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nents, (enum dma_data_direction)direction);
78
}
79
 
80
static inline void
81
pci_dma_sync_single(struct pci_dev *hwdev, dma_addr_t dma_handle,
82
                    size_t size, int direction)
83
{
84
        dma_sync_single(hwdev == NULL ? NULL : &hwdev->dev, dma_handle, size, (enum dma_data_direction)direction);
85
}
86
 
87
static inline void
88
pci_dma_sync_sg(struct pci_dev *hwdev, struct scatterlist *sg,
89
                int nelems, int direction)
90
{
91
        dma_sync_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nelems, (enum dma_data_direction)direction);
92
}
93
 
94
#endif