1
2
3
4
5
6
7
8
9
10#ifndef _ASM_IA64_MACHVEC_H
11#define _ASM_IA64_MACHVEC_H
12
13#include <linux/types.h>
14#include <linux/swiotlb.h>
15
16
17struct device;
18struct pt_regs;
19struct scatterlist;
20struct page;
21struct mm_struct;
22struct pci_bus;
23struct task_struct;
24struct pci_dev;
25struct msi_desc;
26struct dma_attrs;
27
28typedef void ia64_mv_setup_t (char **);
29typedef void ia64_mv_cpu_init_t (void);
30typedef void ia64_mv_irq_init_t (void);
31typedef void ia64_mv_send_ipi_t (int, int, int, int);
32typedef void ia64_mv_timer_interrupt_t (int, void *);
33typedef void ia64_mv_global_tlb_purge_t (struct mm_struct *, unsigned long, unsigned long, unsigned long);
34typedef void ia64_mv_tlb_migrate_finish_t (struct mm_struct *);
35typedef u8 ia64_mv_irq_to_vector (int);
36typedef unsigned int ia64_mv_local_vector_to_irq (u8);
37typedef char *ia64_mv_pci_get_legacy_mem_t (struct pci_bus *);
38typedef int ia64_mv_pci_legacy_read_t (struct pci_bus *, u16 port, u32 *val,
39 u8 size);
40typedef int ia64_mv_pci_legacy_write_t (struct pci_bus *, u16 port, u32 val,
41 u8 size);
42typedef void ia64_mv_migrate_t(struct task_struct * task);
43typedef void ia64_mv_pci_fixup_bus_t (struct pci_bus *);
44typedef void ia64_mv_kernel_launch_event_t(void);
45
46
47typedef void ia64_mv_dma_init (void);
48typedef void *ia64_mv_dma_alloc_coherent (struct device *, size_t, dma_addr_t *, gfp_t);
49typedef void ia64_mv_dma_free_coherent (struct device *, size_t, void *, dma_addr_t);
50typedef dma_addr_t ia64_mv_dma_map_single (struct device *, void *, size_t, int);
51typedef void ia64_mv_dma_unmap_single (struct device *, dma_addr_t, size_t, int);
52typedef int ia64_mv_dma_map_sg (struct device *, struct scatterlist *, int, int);
53typedef void ia64_mv_dma_unmap_sg (struct device *, struct scatterlist *, int, int);
54typedef void ia64_mv_dma_sync_single_for_cpu (struct device *, dma_addr_t, size_t, int);
55typedef void ia64_mv_dma_sync_sg_for_cpu (struct device *, struct scatterlist *, int, int);
56typedef void ia64_mv_dma_sync_single_for_device (struct device *, dma_addr_t, size_t, int);
57typedef void ia64_mv_dma_sync_sg_for_device (struct device *, struct scatterlist *, int, int);
58typedef int ia64_mv_dma_mapping_error(struct device *, dma_addr_t dma_addr);
59typedef int ia64_mv_dma_supported (struct device *, u64);
60
61typedef dma_addr_t ia64_mv_dma_map_single_attrs (struct device *, void *, size_t, int, struct dma_attrs *);
62typedef void ia64_mv_dma_unmap_single_attrs (struct device *, dma_addr_t, size_t, int, struct dma_attrs *);
63typedef int ia64_mv_dma_map_sg_attrs (struct device *, struct scatterlist *, int, int, struct dma_attrs *);
64typedef void ia64_mv_dma_unmap_sg_attrs (struct device *, struct scatterlist *, int, int, struct dma_attrs *);
65
66
67
68
69
70
71
72
73
74
75typedef unsigned int ia64_mv_inb_t (unsigned long);
76typedef unsigned int ia64_mv_inw_t (unsigned long);
77typedef unsigned int ia64_mv_inl_t (unsigned long);
78typedef void ia64_mv_outb_t (unsigned char, unsigned long);
79typedef void ia64_mv_outw_t (unsigned short, unsigned long);
80typedef void ia64_mv_outl_t (unsigned int, unsigned long);
81typedef void ia64_mv_mmiowb_t (void);
82typedef unsigned char ia64_mv_readb_t (const volatile void __iomem *);
83typedef unsigned short ia64_mv_readw_t (const volatile void __iomem *);
84typedef unsigned int ia64_mv_readl_t (const volatile void __iomem *);
85typedef unsigned long ia64_mv_readq_t (const volatile void __iomem *);
86typedef unsigned char ia64_mv_readb_relaxed_t (const volatile void __iomem *);
87typedef unsigned short ia64_mv_readw_relaxed_t (const volatile void __iomem *);
88typedef unsigned int ia64_mv_readl_relaxed_t (const volatile void __iomem *);
89typedef unsigned long ia64_mv_readq_relaxed_t (const volatile void __iomem *);
90
91typedef int ia64_mv_setup_msi_irq_t (struct pci_dev *pdev, struct msi_desc *);
92typedef void ia64_mv_teardown_msi_irq_t (unsigned int irq);
93
94static inline void
95machvec_noop (void)
96{
97}
98
99static inline void
100machvec_noop_mm (struct mm_struct *mm)
101{
102}
103
104static inline void
105machvec_noop_task (struct task_struct *task)
106{
107}
108
109static inline void
110machvec_noop_bus (struct pci_bus *bus)
111{
112}
113
114extern void machvec_setup (char **);
115extern void machvec_timer_interrupt (int, void *);
116extern void machvec_dma_sync_single (struct device *, dma_addr_t, size_t, int);
117extern void machvec_dma_sync_sg (struct device *, struct scatterlist *, int, int);
118extern void machvec_tlb_migrate_finish (struct mm_struct *);
119
120# if defined (CONFIG_IA64_HP_SIM)
121# include <asm/machvec_hpsim.h>
122# elif defined (CONFIG_IA64_DIG)
123# include <asm/machvec_dig.h>
124# elif defined(CONFIG_IA64_DIG_VTD)
125# include <asm/machvec_dig_vtd.h>
126# elif defined (CONFIG_IA64_HP_ZX1)
127# include <asm/machvec_hpzx1.h>
128# elif defined (CONFIG_IA64_HP_ZX1_SWIOTLB)
129# include <asm/machvec_hpzx1_swiotlb.h>
130# elif defined (CONFIG_IA64_SGI_SN2)
131# include <asm/machvec_sn2.h>
132# elif defined (CONFIG_IA64_SGI_UV)
133# include <asm/machvec_uv.h>
134# elif defined (CONFIG_IA64_XEN_GUEST)
135# include <asm/machvec_xen.h>
136# elif defined (CONFIG_IA64_GENERIC)
137
138# ifdef MACHVEC_PLATFORM_HEADER
139# include MACHVEC_PLATFORM_HEADER
140# else
141# define platform_name ia64_mv.name
142# define platform_setup ia64_mv.setup
143# define platform_cpu_init ia64_mv.cpu_init
144# define platform_irq_init ia64_mv.irq_init
145# define platform_send_ipi ia64_mv.send_ipi
146# define platform_timer_interrupt ia64_mv.timer_interrupt
147# define platform_global_tlb_purge ia64_mv.global_tlb_purge
148# define platform_tlb_migrate_finish ia64_mv.tlb_migrate_finish
149# define platform_dma_init ia64_mv.dma_init
150# define platform_dma_alloc_coherent ia64_mv.dma_alloc_coherent
151# define platform_dma_free_coherent ia64_mv.dma_free_coherent
152# define platform_dma_map_single_attrs ia64_mv.dma_map_single_attrs
153# define platform_dma_unmap_single_attrs ia64_mv.dma_unmap_single_attrs
154# define platform_dma_map_sg_attrs ia64_mv.dma_map_sg_attrs
155# define platform_dma_unmap_sg_attrs ia64_mv.dma_unmap_sg_attrs
156# define platform_dma_sync_single_for_cpu ia64_mv.dma_sync_single_for_cpu
157# define platform_dma_sync_sg_for_cpu ia64_mv.dma_sync_sg_for_cpu
158# define platform_dma_sync_single_for_device ia64_mv.dma_sync_single_for_device
159# define platform_dma_sync_sg_for_device ia64_mv.dma_sync_sg_for_device
160# define platform_dma_mapping_error ia64_mv.dma_mapping_error
161# define platform_dma_supported ia64_mv.dma_supported
162# define platform_irq_to_vector ia64_mv.irq_to_vector
163# define platform_local_vector_to_irq ia64_mv.local_vector_to_irq
164# define platform_pci_get_legacy_mem ia64_mv.pci_get_legacy_mem
165# define platform_pci_legacy_read ia64_mv.pci_legacy_read
166# define platform_pci_legacy_write ia64_mv.pci_legacy_write
167# define platform_inb ia64_mv.inb
168# define platform_inw ia64_mv.inw
169# define platform_inl ia64_mv.inl
170# define platform_outb ia64_mv.outb
171# define platform_outw ia64_mv.outw
172# define platform_outl ia64_mv.outl
173# define platform_mmiowb ia64_mv.mmiowb
174# define platform_readb ia64_mv.readb
175# define platform_readw ia64_mv.readw
176# define platform_readl ia64_mv.readl
177# define platform_readq ia64_mv.readq
178# define platform_readb_relaxed ia64_mv.readb_relaxed
179# define platform_readw_relaxed ia64_mv.readw_relaxed
180# define platform_readl_relaxed ia64_mv.readl_relaxed
181# define platform_readq_relaxed ia64_mv.readq_relaxed
182# define platform_migrate ia64_mv.migrate
183# define platform_setup_msi_irq ia64_mv.setup_msi_irq
184# define platform_teardown_msi_irq ia64_mv.teardown_msi_irq
185# define platform_pci_fixup_bus ia64_mv.pci_fixup_bus
186# define platform_kernel_launch_event ia64_mv.kernel_launch_event
187# endif
188
189
190
191
192
193
194struct ia64_machine_vector {
195 const char *name;
196 ia64_mv_setup_t *setup;
197 ia64_mv_cpu_init_t *cpu_init;
198 ia64_mv_irq_init_t *irq_init;
199 ia64_mv_send_ipi_t *send_ipi;
200 ia64_mv_timer_interrupt_t *timer_interrupt;
201 ia64_mv_global_tlb_purge_t *global_tlb_purge;
202 ia64_mv_tlb_migrate_finish_t *tlb_migrate_finish;
203 ia64_mv_dma_init *dma_init;
204 ia64_mv_dma_alloc_coherent *dma_alloc_coherent;
205 ia64_mv_dma_free_coherent *dma_free_coherent;
206 ia64_mv_dma_map_single_attrs *dma_map_single_attrs;
207 ia64_mv_dma_unmap_single_attrs *dma_unmap_single_attrs;
208 ia64_mv_dma_map_sg_attrs *dma_map_sg_attrs;
209 ia64_mv_dma_unmap_sg_attrs *dma_unmap_sg_attrs;
210 ia64_mv_dma_sync_single_for_cpu *dma_sync_single_for_cpu;
211 ia64_mv_dma_sync_sg_for_cpu *dma_sync_sg_for_cpu;
212 ia64_mv_dma_sync_single_for_device *dma_sync_single_for_device;
213 ia64_mv_dma_sync_sg_for_device *dma_sync_sg_for_device;
214 ia64_mv_dma_mapping_error *dma_mapping_error;
215 ia64_mv_dma_supported *dma_supported;
216 ia64_mv_irq_to_vector *irq_to_vector;
217 ia64_mv_local_vector_to_irq *local_vector_to_irq;
218 ia64_mv_pci_get_legacy_mem_t *pci_get_legacy_mem;
219 ia64_mv_pci_legacy_read_t *pci_legacy_read;
220 ia64_mv_pci_legacy_write_t *pci_legacy_write;
221 ia64_mv_inb_t *inb;
222 ia64_mv_inw_t *inw;
223 ia64_mv_inl_t *inl;
224 ia64_mv_outb_t *outb;
225 ia64_mv_outw_t *outw;
226 ia64_mv_outl_t *outl;
227 ia64_mv_mmiowb_t *mmiowb;
228 ia64_mv_readb_t *readb;
229 ia64_mv_readw_t *readw;
230 ia64_mv_readl_t *readl;
231 ia64_mv_readq_t *readq;
232 ia64_mv_readb_relaxed_t *readb_relaxed;
233 ia64_mv_readw_relaxed_t *readw_relaxed;
234 ia64_mv_readl_relaxed_t *readl_relaxed;
235 ia64_mv_readq_relaxed_t *readq_relaxed;
236 ia64_mv_migrate_t *migrate;
237 ia64_mv_setup_msi_irq_t *setup_msi_irq;
238 ia64_mv_teardown_msi_irq_t *teardown_msi_irq;
239 ia64_mv_pci_fixup_bus_t *pci_fixup_bus;
240 ia64_mv_kernel_launch_event_t *kernel_launch_event;
241} __attribute__((__aligned__(16)));
242
243#define MACHVEC_INIT(name) \
244{ \
245 #name, \
246 platform_setup, \
247 platform_cpu_init, \
248 platform_irq_init, \
249 platform_send_ipi, \
250 platform_timer_interrupt, \
251 platform_global_tlb_purge, \
252 platform_tlb_migrate_finish, \
253 platform_dma_init, \
254 platform_dma_alloc_coherent, \
255 platform_dma_free_coherent, \
256 platform_dma_map_single_attrs, \
257 platform_dma_unmap_single_attrs, \
258 platform_dma_map_sg_attrs, \
259 platform_dma_unmap_sg_attrs, \
260 platform_dma_sync_single_for_cpu, \
261 platform_dma_sync_sg_for_cpu, \
262 platform_dma_sync_single_for_device, \
263 platform_dma_sync_sg_for_device, \
264 platform_dma_mapping_error, \
265 platform_dma_supported, \
266 platform_irq_to_vector, \
267 platform_local_vector_to_irq, \
268 platform_pci_get_legacy_mem, \
269 platform_pci_legacy_read, \
270 platform_pci_legacy_write, \
271 platform_inb, \
272 platform_inw, \
273 platform_inl, \
274 platform_outb, \
275 platform_outw, \
276 platform_outl, \
277 platform_mmiowb, \
278 platform_readb, \
279 platform_readw, \
280 platform_readl, \
281 platform_readq, \
282 platform_readb_relaxed, \
283 platform_readw_relaxed, \
284 platform_readl_relaxed, \
285 platform_readq_relaxed, \
286 platform_migrate, \
287 platform_setup_msi_irq, \
288 platform_teardown_msi_irq, \
289 platform_pci_fixup_bus, \
290 platform_kernel_launch_event \
291}
292
293extern struct ia64_machine_vector ia64_mv;
294extern void machvec_init (const char *name);
295extern void machvec_init_from_cmdline(const char *cmdline);
296
297# else
298# error Unknown configuration. Update arch/ia64/include/asm/machvec.h.
299# endif
300
301
302
303
304
305#ifndef platform_setup
306# define platform_setup machvec_setup
307#endif
308#ifndef platform_cpu_init
309# define platform_cpu_init machvec_noop
310#endif
311#ifndef platform_irq_init
312# define platform_irq_init machvec_noop
313#endif
314
315#ifndef platform_send_ipi
316# define platform_send_ipi ia64_send_ipi
317#endif
318#ifndef platform_timer_interrupt
319# define platform_timer_interrupt machvec_timer_interrupt
320#endif
321#ifndef platform_global_tlb_purge
322# define platform_global_tlb_purge ia64_global_tlb_purge
323#endif
324#ifndef platform_tlb_migrate_finish
325# define platform_tlb_migrate_finish machvec_noop_mm
326#endif
327#ifndef platform_kernel_launch_event
328# define platform_kernel_launch_event machvec_noop
329#endif
330#ifndef platform_dma_init
331# define platform_dma_init swiotlb_init
332#endif
333#ifndef platform_dma_alloc_coherent
334# define platform_dma_alloc_coherent swiotlb_alloc_coherent
335#endif
336#ifndef platform_dma_free_coherent
337# define platform_dma_free_coherent swiotlb_free_coherent
338#endif
339#ifndef platform_dma_map_single_attrs
340# define platform_dma_map_single_attrs swiotlb_map_single_attrs
341#endif
342#ifndef platform_dma_unmap_single_attrs
343# define platform_dma_unmap_single_attrs swiotlb_unmap_single_attrs
344#endif
345#ifndef platform_dma_map_sg_attrs
346# define platform_dma_map_sg_attrs swiotlb_map_sg_attrs
347#endif
348#ifndef platform_dma_unmap_sg_attrs
349# define platform_dma_unmap_sg_attrs swiotlb_unmap_sg_attrs
350#endif
351#ifndef platform_dma_sync_single_for_cpu
352# define platform_dma_sync_single_for_cpu swiotlb_sync_single_for_cpu
353#endif
354#ifndef platform_dma_sync_sg_for_cpu
355# define platform_dma_sync_sg_for_cpu swiotlb_sync_sg_for_cpu
356#endif
357#ifndef platform_dma_sync_single_for_device
358# define platform_dma_sync_single_for_device swiotlb_sync_single_for_device
359#endif
360#ifndef platform_dma_sync_sg_for_device
361# define platform_dma_sync_sg_for_device swiotlb_sync_sg_for_device
362#endif
363#ifndef platform_dma_mapping_error
364# define platform_dma_mapping_error swiotlb_dma_mapping_error
365#endif
366#ifndef platform_dma_supported
367# define platform_dma_supported swiotlb_dma_supported
368#endif
369#ifndef platform_irq_to_vector
370# define platform_irq_to_vector __ia64_irq_to_vector
371#endif
372#ifndef platform_local_vector_to_irq
373# define platform_local_vector_to_irq __ia64_local_vector_to_irq
374#endif
375#ifndef platform_pci_get_legacy_mem
376# define platform_pci_get_legacy_mem ia64_pci_get_legacy_mem
377#endif
378#ifndef platform_pci_legacy_read
379# define platform_pci_legacy_read ia64_pci_legacy_read
380extern int ia64_pci_legacy_read(struct pci_bus *bus, u16 port, u32 *val, u8 size);
381#endif
382#ifndef platform_pci_legacy_write
383# define platform_pci_legacy_write ia64_pci_legacy_write
384extern int ia64_pci_legacy_write(struct pci_bus *bus, u16 port, u32 val, u8 size);
385#endif
386#ifndef platform_inb
387# define platform_inb __ia64_inb
388#endif
389#ifndef platform_inw
390# define platform_inw __ia64_inw
391#endif
392#ifndef platform_inl
393# define platform_inl __ia64_inl
394#endif
395#ifndef platform_outb
396# define platform_outb __ia64_outb
397#endif
398#ifndef platform_outw
399# define platform_outw __ia64_outw
400#endif
401#ifndef platform_outl
402# define platform_outl __ia64_outl
403#endif
404#ifndef platform_mmiowb
405# define platform_mmiowb __ia64_mmiowb
406#endif
407#ifndef platform_readb
408# define platform_readb __ia64_readb
409#endif
410#ifndef platform_readw
411# define platform_readw __ia64_readw
412#endif
413#ifndef platform_readl
414# define platform_readl __ia64_readl
415#endif
416#ifndef platform_readq
417# define platform_readq __ia64_readq
418#endif
419#ifndef platform_readb_relaxed
420# define platform_readb_relaxed __ia64_readb_relaxed
421#endif
422#ifndef platform_readw_relaxed
423# define platform_readw_relaxed __ia64_readw_relaxed
424#endif
425#ifndef platform_readl_relaxed
426# define platform_readl_relaxed __ia64_readl_relaxed
427#endif
428#ifndef platform_readq_relaxed
429# define platform_readq_relaxed __ia64_readq_relaxed
430#endif
431#ifndef platform_migrate
432# define platform_migrate machvec_noop_task
433#endif
434#ifndef platform_setup_msi_irq
435# define platform_setup_msi_irq ((ia64_mv_setup_msi_irq_t*)NULL)
436#endif
437#ifndef platform_teardown_msi_irq
438# define platform_teardown_msi_irq ((ia64_mv_teardown_msi_irq_t*)NULL)
439#endif
440#ifndef platform_pci_fixup_bus
441# define platform_pci_fixup_bus machvec_noop_bus
442#endif
443
444#endif
445