diff options
Diffstat (limited to 'arch/alpha/kernel/pci-noop.c')
-rw-r--r-- | arch/alpha/kernel/pci-noop.c | 101 |
1 files changed, 40 insertions, 61 deletions
diff --git a/arch/alpha/kernel/pci-noop.c b/arch/alpha/kernel/pci-noop.c index c19a376520f4..823a540f9f5b 100644 --- a/arch/alpha/kernel/pci-noop.c +++ b/arch/alpha/kernel/pci-noop.c | |||
@@ -106,58 +106,8 @@ sys_pciconfig_write(unsigned long bus, unsigned long dfn, | |||
106 | return -ENODEV; | 106 | return -ENODEV; |
107 | } | 107 | } |
108 | 108 | ||
109 | /* Stubs for the routines in pci_iommu.c: */ | 109 | static void *alpha_noop_alloc_coherent(struct device *dev, size_t size, |
110 | 110 | dma_addr_t *dma_handle, gfp_t gfp) | |
111 | void * | ||
112 | __pci_alloc_consistent(struct pci_dev *pdev, size_t size, | ||
113 | dma_addr_t *dma_addrp, gfp_t gfp) | ||
114 | { | ||
115 | return NULL; | ||
116 | } | ||
117 | |||
118 | void | ||
119 | pci_free_consistent(struct pci_dev *pdev, size_t size, void *cpu_addr, | ||
120 | dma_addr_t dma_addr) | ||
121 | { | ||
122 | } | ||
123 | |||
124 | dma_addr_t | ||
125 | pci_map_single(struct pci_dev *pdev, void *cpu_addr, size_t size, | ||
126 | int direction) | ||
127 | { | ||
128 | return (dma_addr_t) 0; | ||
129 | } | ||
130 | |||
131 | void | ||
132 | pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr, size_t size, | ||
133 | int direction) | ||
134 | { | ||
135 | } | ||
136 | |||
137 | int | ||
138 | pci_map_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents, | ||
139 | int direction) | ||
140 | { | ||
141 | return 0; | ||
142 | } | ||
143 | |||
144 | void | ||
145 | pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents, | ||
146 | int direction) | ||
147 | { | ||
148 | } | ||
149 | |||
150 | int | ||
151 | pci_dma_supported(struct pci_dev *hwdev, dma_addr_t mask) | ||
152 | { | ||
153 | return 0; | ||
154 | } | ||
155 | |||
156 | /* Generic DMA mapping functions: */ | ||
157 | |||
158 | void * | ||
159 | dma_alloc_coherent(struct device *dev, size_t size, | ||
160 | dma_addr_t *dma_handle, gfp_t gfp) | ||
161 | { | 111 | { |
162 | void *ret; | 112 | void *ret; |
163 | 113 | ||
@@ -171,11 +121,22 @@ dma_alloc_coherent(struct device *dev, size_t size, | |||
171 | return ret; | 121 | return ret; |
172 | } | 122 | } |
173 | 123 | ||
174 | EXPORT_SYMBOL(dma_alloc_coherent); | 124 | static void alpha_noop_free_coherent(struct device *dev, size_t size, |
125 | void *cpu_addr, dma_addr_t dma_addr) | ||
126 | { | ||
127 | free_pages((unsigned long)cpu_addr, get_order(size)); | ||
128 | } | ||
129 | |||
130 | static dma_addr_t alpha_noop_map_page(struct device *dev, struct page *page, | ||
131 | unsigned long offset, size_t size, | ||
132 | enum dma_data_direction dir, | ||
133 | struct dma_attrs *attrs) | ||
134 | { | ||
135 | return page_to_pa(page) + offset; | ||
136 | } | ||
175 | 137 | ||
176 | int | 138 | static int alpha_noop_map_sg(struct device *dev, struct scatterlist *sgl, int nents, |
177 | dma_map_sg(struct device *dev, struct scatterlist *sgl, int nents, | 139 | enum dma_data_direction dir, struct dma_attrs *attrs) |
178 | enum dma_data_direction direction) | ||
179 | { | 140 | { |
180 | int i; | 141 | int i; |
181 | struct scatterlist *sg; | 142 | struct scatterlist *sg; |
@@ -192,19 +153,37 @@ dma_map_sg(struct device *dev, struct scatterlist *sgl, int nents, | |||
192 | return nents; | 153 | return nents; |
193 | } | 154 | } |
194 | 155 | ||
195 | EXPORT_SYMBOL(dma_map_sg); | 156 | static int alpha_noop_mapping_error(struct device *dev, dma_addr_t dma_addr) |
157 | { | ||
158 | return 0; | ||
159 | } | ||
160 | |||
161 | static int alpha_noop_supported(struct device *dev, u64 mask) | ||
162 | { | ||
163 | return mask < 0x00ffffffUL ? 0 : 1; | ||
164 | } | ||
196 | 165 | ||
197 | int | 166 | static int alpha_noop_set_mask(struct device *dev, u64 mask) |
198 | dma_set_mask(struct device *dev, u64 mask) | ||
199 | { | 167 | { |
200 | if (!dev->dma_mask || !dma_supported(dev, mask)) | 168 | if (!dev->dma_mask || !dma_supported(dev, mask)) |
201 | return -EIO; | 169 | return -EIO; |
202 | 170 | ||
203 | *dev->dma_mask = mask; | 171 | *dev->dma_mask = mask; |
204 | |||
205 | return 0; | 172 | return 0; |
206 | } | 173 | } |
207 | EXPORT_SYMBOL(dma_set_mask); | 174 | |
175 | struct dma_map_ops alpha_noop_ops = { | ||
176 | .alloc_coherent = alpha_noop_alloc_coherent, | ||
177 | .free_coherent = alpha_noop_free_coherent, | ||
178 | .map_page = alpha_noop_map_page, | ||
179 | .map_sg = alpha_noop_map_sg, | ||
180 | .mapping_error = alpha_noop_mapping_error, | ||
181 | .dma_supported = alpha_noop_supported, | ||
182 | .set_dma_mask = alpha_noop_set_mask, | ||
183 | }; | ||
184 | |||
185 | struct dma_map_ops *dma_ops = &alpha_noop_ops; | ||
186 | EXPORT_SYMBOL(dma_ops); | ||
208 | 187 | ||
209 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | 188 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) |
210 | { | 189 | { |