Rev 6934 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6934 | Rev 7143 | ||
---|---|---|---|
1 | /* include this file if the platform implements the dma_ DMA Mapping API |
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 */ |
2 | * and wants to provide the pci_ DMA Mapping API in terms of it */ |
3 | 3 | ||
4 | #ifndef _ASM_GENERIC_PCI_DMA_COMPAT_H |
4 | #ifndef _ASM_GENERIC_PCI_DMA_COMPAT_H |
5 | #define _ASM_GENERIC_PCI_DMA_COMPAT_H |
5 | #define _ASM_GENERIC_PCI_DMA_COMPAT_H |
6 | 6 | ||
7 | #include |
7 | #include |
8 | 8 | ||
9 | static inline void * |
9 | static inline void * |
10 | pci_alloc_consistent(struct pci_dev *hwdev, size_t size, |
10 | pci_alloc_consistent(struct pci_dev *hwdev, size_t size, |
11 | dma_addr_t *dma_handle) |
11 | dma_addr_t *dma_handle) |
12 | { |
12 | { |
13 | return dma_alloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, dma_handle, GFP_ATOMIC); |
13 | return dma_alloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, dma_handle, GFP_ATOMIC); |
14 | } |
14 | } |
15 | 15 | ||
16 | static inline void * |
16 | static inline void * |
17 | pci_zalloc_consistent(struct pci_dev *hwdev, size_t size, |
17 | pci_zalloc_consistent(struct pci_dev *hwdev, size_t size, |
18 | dma_addr_t *dma_handle) |
18 | dma_addr_t *dma_handle) |
19 | { |
19 | { |
20 | return dma_zalloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, |
20 | return dma_zalloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, |
21 | size, dma_handle, GFP_ATOMIC); |
21 | size, dma_handle, GFP_ATOMIC); |
22 | } |
22 | } |
23 | 23 | ||
24 | static inline void |
24 | static inline void |
25 | pci_free_consistent(struct pci_dev *hwdev, size_t size, |
25 | pci_free_consistent(struct pci_dev *hwdev, size_t size, |
26 | void *vaddr, dma_addr_t dma_handle) |
26 | void *vaddr, dma_addr_t dma_handle) |
27 | { |
27 | { |
28 | dma_free_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, vaddr, dma_handle); |
28 | dma_free_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, vaddr, dma_handle); |
29 | } |
29 | } |
30 | 30 | ||
31 | static inline dma_addr_t |
31 | static inline dma_addr_t |
32 | pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction) |
32 | pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction) |
33 | { |
33 | { |
34 | return dma_map_single(hwdev == NULL ? NULL : &hwdev->dev, ptr, size, (enum dma_data_direction)direction); |
34 | return dma_map_single(hwdev == NULL ? NULL : &hwdev->dev, ptr, size, (enum dma_data_direction)direction); |
35 | } |
35 | } |
36 | 36 | ||
37 | static inline void |
37 | static inline void |
38 | pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, |
38 | pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, |
39 | size_t size, int direction) |
39 | size_t size, int direction) |
40 | { |
40 | { |
41 | dma_unmap_single(hwdev == NULL ? NULL : &hwdev->dev, dma_addr, size, (enum dma_data_direction)direction); |
41 | dma_unmap_single(hwdev == NULL ? NULL : &hwdev->dev, dma_addr, size, (enum dma_data_direction)direction); |
42 | } |
42 | } |
43 | 43 | ||
44 | static inline dma_addr_t |
44 | static inline dma_addr_t |
45 | pci_map_page(struct pci_dev *hwdev, struct page *page, |
45 | pci_map_page(struct pci_dev *hwdev, struct page *page, |
46 | unsigned long offset, size_t size, int direction) |
46 | unsigned long offset, size_t size, int direction) |
47 | { |
47 | { |
48 | return (dma_addr_t)( (offset)+page_to_phys(page)); |
48 | return (dma_addr_t)( (offset)+page_to_phys(page)); |
49 | } |
49 | } |
50 | 50 | ||
51 | static inline void |
51 | static inline void |
52 | pci_unmap_page(struct pci_dev *hwdev, dma_addr_t dma_address, |
52 | pci_unmap_page(struct pci_dev *hwdev, dma_addr_t dma_address, |
53 | size_t size, int direction) |
53 | size_t size, int direction) |
54 | { |
54 | { |
55 | 55 | ||
56 | } |
56 | } |
57 | #define pci_map_page(dev, page, offset, size, direction) \ |
- | |
58 | (dma_addr_t)( (offset)+page_to_phys(page)) |
- | |
59 | - | ||
60 | #define pci_unmap_page(dev, dma_address, size, direction) |
- | |
61 | 57 | ||
62 | static inline int |
58 | static inline int |
63 | pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, |
59 | pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, |
64 | int nents, int direction) |
60 | int nents, int direction) |
65 | { |
61 | { |
66 | return dma_map_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nents, (enum dma_data_direction)direction); |
62 | return dma_map_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nents, (enum dma_data_direction)direction); |
67 | } |
63 | } |
68 | 64 | ||
69 | static inline void |
65 | static inline void |
70 | pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, |
66 | pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, |
71 | int nents, int direction) |
67 | int nents, int direction) |
72 | { |
68 | { |
73 | dma_unmap_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nents, (enum dma_data_direction)direction); |
69 | dma_unmap_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nents, (enum dma_data_direction)direction); |
74 | } |
70 | } |
75 | 71 | ||
76 | static inline void |
72 | static inline void |
77 | pci_dma_sync_single_for_cpu(struct pci_dev *hwdev, dma_addr_t dma_handle, |
73 | pci_dma_sync_single_for_cpu(struct pci_dev *hwdev, dma_addr_t dma_handle, |
78 | size_t size, int direction) |
74 | size_t size, int direction) |
79 | { |
75 | { |
80 | dma_sync_single_for_cpu(hwdev == NULL ? NULL : &hwdev->dev, dma_handle, size, (enum dma_data_direction)direction); |
76 | dma_sync_single_for_cpu(hwdev == NULL ? NULL : &hwdev->dev, dma_handle, size, (enum dma_data_direction)direction); |
81 | } |
77 | } |
82 | 78 | ||
83 | static inline void |
79 | static inline void |
84 | pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle, |
80 | pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle, |
85 | size_t size, int direction) |
81 | size_t size, int direction) |
86 | { |
82 | { |
87 | dma_sync_single_for_device(hwdev == NULL ? NULL : &hwdev->dev, dma_handle, size, (enum dma_data_direction)direction); |
83 | dma_sync_single_for_device(hwdev == NULL ? NULL : &hwdev->dev, dma_handle, size, (enum dma_data_direction)direction); |
88 | } |
84 | } |
89 | 85 | ||
90 | static inline void |
86 | static inline void |
91 | pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg, |
87 | pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg, |
92 | int nelems, int direction) |
88 | int nelems, int direction) |
93 | { |
89 | { |
94 | dma_sync_sg_for_cpu(hwdev == NULL ? NULL : &hwdev->dev, sg, nelems, (enum dma_data_direction)direction); |
90 | dma_sync_sg_for_cpu(hwdev == NULL ? NULL : &hwdev->dev, sg, nelems, (enum dma_data_direction)direction); |
95 | } |
91 | } |
96 | 92 | ||
97 | static inline void |
93 | static inline void |
98 | pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg, |
94 | pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg, |
99 | int nelems, int direction) |
95 | int nelems, int direction) |
100 | { |
96 | { |
101 | dma_sync_sg_for_device(hwdev == NULL ? NULL : &hwdev->dev, sg, nelems, (enum dma_data_direction)direction); |
97 | dma_sync_sg_for_device(hwdev == NULL ? NULL : &hwdev->dev, sg, nelems, (enum dma_data_direction)direction); |
102 | } |
98 | } |
103 | 99 | ||
104 | static inline int |
100 | static inline int |
105 | pci_dma_mapping_error(struct pci_dev *pdev, dma_addr_t dma_addr) |
101 | pci_dma_mapping_error(struct pci_dev *pdev, dma_addr_t dma_addr) |
106 | { |
102 | { |
107 | return dma_mapping_error(&pdev->dev, dma_addr); |
103 | return dma_mapping_error(&pdev->dev, dma_addr); |
108 | } |
104 | } |
109 | 105 | ||
110 | #ifdef CONFIG_PCI |
106 | #ifdef CONFIG_PCI |
111 | static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask) |
107 | static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask) |
112 | { |
108 | { |
113 | return 0; |
109 | return 0; |
114 | } |
110 | } |
115 | 111 | ||
116 | static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask) |
112 | static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask) |
117 | { |
113 | { |
118 | return 0; |
114 | return 0; |
119 | } |
115 | } |
120 | #endif |
116 | #endif |
121 | 117 | ||
122 | #endif |
118 | #endif |