aboutsummaryrefslogtreecommitdiffstats
path: root/arch/alpha/include/asm/pci.h
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2010-03-10 18:23:37 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-12 18:52:42 -0500
commitc186caca3dbe7f44da624cb4f9d78e1b1dfb13b8 (patch)
treedcd42e55362b9b2d882a16822524c14971f812a3 /arch/alpha/include/asm/pci.h
parent349004294c365cb99a0ee84149286d6f29b1e6b9 (diff)
dma-mapping: alpha: use include/linux/pci-dma-compat.h
This converts Alpha to use include/linux/pci-dma-compat.h. Alpha is the only architecutre that implements the PCI DMA API in the own way. That makes it difficult to implement the generic DMA API via the PCI bus specific DMA API. The generic DMA API calls the PCI DMA API implementation in arch/alpha/kernel/pci_iommu.c on non Jensen systems. It calls the DMA API in arch/alpha/kernel/pci-noop.c on Jensen systems. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Matt Turner <mattst88@gmail.com> Cc: Jesse Barnes <jbarnes@virtuousgeek.org> Cc: Greg KH <greg@kroah.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/alpha/include/asm/pci.h')
-rw-r--r--arch/alpha/include/asm/pci.h125
1 files changed, 3 insertions, 122 deletions
diff --git a/arch/alpha/include/asm/pci.h b/arch/alpha/include/asm/pci.h
index e1846ba6aaba..28d0497fd3c7 100644
--- a/arch/alpha/include/asm/pci.h
+++ b/arch/alpha/include/asm/pci.h
@@ -70,128 +70,11 @@ extern inline void pcibios_penalize_isa_irq(int irq, int active)
70 decisions. */ 70 decisions. */
71#define PCI_DMA_BUS_IS_PHYS 0 71#define PCI_DMA_BUS_IS_PHYS 0
72 72
73/* Allocate and map kernel buffer using consistent mode DMA for PCI 73#ifdef CONFIG_PCI
74 device. Returns non-NULL cpu-view pointer to the buffer if
75 successful and sets *DMA_ADDRP to the pci side dma address as well,
76 else DMA_ADDRP is undefined. */
77
78extern void *__pci_alloc_consistent(struct pci_dev *, size_t,
79 dma_addr_t *, gfp_t);
80static inline void *
81pci_alloc_consistent(struct pci_dev *dev, size_t size, dma_addr_t *dma)
82{
83 return __pci_alloc_consistent(dev, size, dma, GFP_ATOMIC);
84}
85
86/* Free and unmap a consistent DMA buffer. CPU_ADDR and DMA_ADDR must
87 be values that were returned from pci_alloc_consistent. SIZE must
88 be the same as what as passed into pci_alloc_consistent.
89 References to the memory and mappings associated with CPU_ADDR or
90 DMA_ADDR past this call are illegal. */
91
92extern void pci_free_consistent(struct pci_dev *, size_t, void *, dma_addr_t);
93
94/* Map a single buffer of the indicate size for PCI DMA in streaming mode.
95 The 32-bit PCI bus mastering address to use is returned. Once the device
96 is given the dma address, the device owns this memory until either
97 pci_unmap_single or pci_dma_sync_single_for_cpu is performed. */
98
99extern dma_addr_t pci_map_single(struct pci_dev *, void *, size_t, int);
100
101/* Likewise, but for a page instead of an address. */
102extern dma_addr_t pci_map_page(struct pci_dev *, struct page *,
103 unsigned long, size_t, int);
104
105/* Test for pci_map_single or pci_map_page having generated an error. */
106
107static inline int
108pci_dma_mapping_error(struct pci_dev *pdev, dma_addr_t dma_addr)
109{
110 return dma_addr == 0;
111}
112
113/* Unmap a single streaming mode DMA translation. The DMA_ADDR and
114 SIZE must match what was provided for in a previous pci_map_single
115 call. All other usages are undefined. After this call, reads by
116 the cpu to the buffer are guaranteed to see whatever the device
117 wrote there. */
118
119extern void pci_unmap_single(struct pci_dev *, dma_addr_t, size_t, int);
120extern void pci_unmap_page(struct pci_dev *, dma_addr_t, size_t, int);
121
122/* Map a set of buffers described by scatterlist in streaming mode for
123 PCI DMA. This is the scatter-gather version of the above
124 pci_map_single interface. Here the scatter gather list elements
125 are each tagged with the appropriate PCI dma address and length.
126 They are obtained via sg_dma_{address,length}(SG).
127
128 NOTE: An implementation may be able to use a smaller number of DMA
129 address/length pairs than there are SG table elements. (for
130 example via virtual mapping capabilities) The routine returns the
131 number of addr/length pairs actually used, at most nents.
132
133 Device ownership issues as mentioned above for pci_map_single are
134 the same here. */
135
136extern int pci_map_sg(struct pci_dev *, struct scatterlist *, int, int);
137
138/* Unmap a set of streaming mode DMA translations. Again, cpu read
139 rules concerning calls here are the same as for pci_unmap_single()
140 above. */
141
142extern void pci_unmap_sg(struct pci_dev *, struct scatterlist *, int, int);
143
144/* Make physical memory consistent for a single streaming mode DMA
145 translation after a transfer and device currently has ownership
146 of the buffer.
147
148 If you perform a pci_map_single() but wish to interrogate the
149 buffer using the cpu, yet do not wish to teardown the PCI dma
150 mapping, you must call this function before doing so. At the next
151 point you give the PCI dma address back to the card, you must first
152 perform a pci_dma_sync_for_device, and then the device again owns
153 the buffer. */
154
155static inline void
156pci_dma_sync_single_for_cpu(struct pci_dev *dev, dma_addr_t dma_addr,
157 long size, int direction)
158{
159 /* Nothing to do. */
160}
161
162static inline void
163pci_dma_sync_single_for_device(struct pci_dev *dev, dma_addr_t dma_addr,
164 size_t size, int direction)
165{
166 /* Nothing to do. */
167}
168
169/* Make physical memory consistent for a set of streaming mode DMA
170 translations after a transfer. The same as pci_dma_sync_single_*
171 but for a scatter-gather list, same rules and usage. */
172
173static inline void
174pci_dma_sync_sg_for_cpu(struct pci_dev *dev, struct scatterlist *sg,
175 int nents, int direction)
176{
177 /* Nothing to do. */
178}
179
180static inline void
181pci_dma_sync_sg_for_device(struct pci_dev *dev, struct scatterlist *sg,
182 int nents, int direction)
183{
184 /* Nothing to do. */
185}
186
187/* Return whether the given PCI device DMA address mask can
188 be supported properly. For example, if your device can
189 only drive the low 24-bits during PCI bus mastering, then
190 you would pass 0x00ffffff as the mask to this function. */
191 74
192extern int pci_dma_supported(struct pci_dev *hwdev, u64 mask); 75/* implement the pci_ DMA API in terms of the generic device dma_ one */
76#include <asm-generic/pci-dma-compat.h>
193 77
194#ifdef CONFIG_PCI
195static inline void pci_dma_burst_advice(struct pci_dev *pdev, 78static inline void pci_dma_burst_advice(struct pci_dev *pdev,
196 enum pci_dma_burst_strategy *strat, 79 enum pci_dma_burst_strategy *strat,
197 unsigned long *strategy_parameter) 80 unsigned long *strategy_parameter)
@@ -230,8 +113,6 @@ static inline int pci_proc_domain(struct pci_bus *bus)
230 return hose->need_domain_info; 113 return hose->need_domain_info;
231} 114}
232 115
233struct pci_dev *alpha_gendev_to_pci(struct device *dev);
234
235#endif /* __KERNEL__ */ 116#endif /* __KERNEL__ */
236 117
237/* Values for the `which' argument to sys_pciconfig_iobase. */ 118/* Values for the `which' argument to sys_pciconfig_iobase. */