make oldconfig will rebuild these...
[linux-2.4.21-pre4.git] / include / asm-ia64 / machvec.h
1 /*
2  * Machine vector for IA-64.
3  *
4  * Copyright (C) 1999 Silicon Graphics, Inc.
5  * Copyright (C) Srinivasa Thirumalachar <sprasad@engr.sgi.com>
6  * Copyright (C) Vijay Chander <vijay@engr.sgi.com>
7  * Copyright (C) 1999-2001 Hewlett-Packard Co.
8  *      David Mosberger-Tang <davidm@hpl.hp.com>
9  */
10 #ifndef _ASM_IA64_MACHVEC_H
11 #define _ASM_IA64_MACHVEC_H
12
13 #include <linux/config.h>
14 #include <linux/types.h>
15
16 /* forward declarations: */
17 struct pci_dev;
18 struct pt_regs;
19 struct scatterlist;
20 struct irq_desc;
21 struct page;
22
23 typedef void ia64_mv_setup_t (char **);
24 typedef void ia64_mv_cpu_init_t(void);
25 typedef void ia64_mv_irq_init_t (void);
26 typedef void ia64_mv_pci_fixup_t (int);
27 typedef void ia64_mv_pci_enable_device_t (struct pci_dev *);
28 typedef unsigned long ia64_mv_map_nr_t (void *);
29 typedef void ia64_mv_mca_init_t (void);
30 typedef void ia64_mv_mca_handler_t (void);
31 typedef void ia64_mv_cmci_handler_t (int, void *, struct pt_regs *);
32 typedef void ia64_mv_log_print_t (void);
33 typedef void ia64_mv_send_ipi_t (int, int, int, int);
34 typedef void ia64_mv_global_tlb_purge_t (unsigned long, unsigned long, unsigned long);
35 typedef struct irq_desc *ia64_mv_irq_desc (unsigned int);
36 typedef u8 ia64_mv_irq_to_vector (u8);
37 typedef unsigned int ia64_mv_local_vector_to_irq (u8 vector);
38
39 /* PCI-DMA interface: */
40 typedef void ia64_mv_pci_dma_init (void);
41 typedef void *ia64_mv_pci_alloc_consistent (struct pci_dev *, size_t, dma_addr_t *);
42 typedef void ia64_mv_pci_free_consistent (struct pci_dev *, size_t, void *, dma_addr_t);
43 typedef dma_addr_t ia64_mv_pci_map_single (struct pci_dev *, void *, size_t, int);
44 typedef void ia64_mv_pci_unmap_single (struct pci_dev *, dma_addr_t, size_t, int);
45 typedef int ia64_mv_pci_map_sg (struct pci_dev *, struct scatterlist *, int, int);
46 typedef void ia64_mv_pci_unmap_sg (struct pci_dev *, struct scatterlist *, int, int);
47 typedef void ia64_mv_pci_dma_sync_single (struct pci_dev *, dma_addr_t, size_t, int);
48 typedef void ia64_mv_pci_dma_sync_sg (struct pci_dev *, struct scatterlist *, int, int);
49 typedef int ia64_mv_pci_dma_supported (struct pci_dev *, u64);
50
51 /*
52  * WARNING: The legacy I/O space is _architected_.  Platforms are
53  * expected to follow this architected model (see Section 10.7 in the
54  * IA-64 Architecture Software Developer's Manual).  Unfortunately,
55  * some broken machines do not follow that model, which is why we have
56  * to make the inX/outX operations part of the machine vector.
57  * Platform designers should follow the architected model whenever
58  * possible.
59  */
60 typedef unsigned int ia64_mv_inb_t (unsigned long);
61 typedef unsigned int ia64_mv_inw_t (unsigned long);
62 typedef unsigned int ia64_mv_inl_t (unsigned long);
63 typedef void ia64_mv_outb_t (unsigned char, unsigned long);
64 typedef void ia64_mv_outw_t (unsigned short, unsigned long);
65 typedef void ia64_mv_outl_t (unsigned int, unsigned long);
66
67 extern void machvec_noop (void);
68
69 # if defined (CONFIG_IA64_HP_SIM)
70 #  include <asm/machvec_hpsim.h>
71 # elif defined (CONFIG_IA64_DIG)
72 #  include <asm/machvec_dig.h>
73 # elif defined (CONFIG_IA64_HP_ZX1)
74 #  include <asm/machvec_hpzx1.h>
75 # elif defined (CONFIG_IA64_SGI_SN1)
76 #  include <asm/machvec_sn1.h>
77 # elif defined (CONFIG_IA64_SGI_SN2)
78 #  include <asm/machvec_sn2.h>
79 # elif defined (CONFIG_IA64_GENERIC)
80
81 # ifdef MACHVEC_PLATFORM_HEADER
82 #  include MACHVEC_PLATFORM_HEADER
83 # else
84 #  define platform_name         ia64_mv.name
85 #  define platform_setup        ia64_mv.setup
86 #  define platform_cpu_init     ia64_mv.cpu_init
87 #  define platform_irq_init     ia64_mv.irq_init
88 #  define platform_map_nr       ia64_mv.map_nr
89 #  define platform_mca_init     ia64_mv.mca_init
90 #  define platform_mca_handler  ia64_mv.mca_handler
91 #  define platform_cmci_handler ia64_mv.cmci_handler
92 #  define platform_log_print    ia64_mv.log_print
93 #  define platform_pci_fixup    ia64_mv.pci_fixup
94 #  define platform_pci_enable_device    ia64_mv.pci_enable_device
95 #  define platform_send_ipi             ia64_mv.send_ipi
96 #  define platform_global_tlb_purge     ia64_mv.global_tlb_purge
97 #  define platform_pci_dma_init         ia64_mv.dma_init
98 #  define platform_pci_alloc_consistent ia64_mv.alloc_consistent
99 #  define platform_pci_free_consistent  ia64_mv.free_consistent
100 #  define platform_pci_map_single       ia64_mv.map_single
101 #  define platform_pci_unmap_single     ia64_mv.unmap_single
102 #  define platform_pci_map_sg           ia64_mv.map_sg
103 #  define platform_pci_unmap_sg         ia64_mv.unmap_sg
104 #  define platform_pci_dma_sync_single  ia64_mv.sync_single
105 #  define platform_pci_dma_sync_sg      ia64_mv.sync_sg
106 #  define platform_pci_dma_supported    ia64_mv.dma_supported
107 #  define platform_irq_desc             ia64_mv.irq_desc
108 #  define platform_irq_to_vector        ia64_mv.irq_to_vector
109 #  define platform_local_vector_to_irq  ia64_mv.local_vector_to_irq
110 #  define platform_inb          ia64_mv.inb
111 #  define platform_inw          ia64_mv.inw
112 #  define platform_inl          ia64_mv.inl
113 #  define platform_outb         ia64_mv.outb
114 #  define platform_outw         ia64_mv.outw
115 #  define platform_outl         ia64_mv.outl
116 # endif
117
118 struct ia64_machine_vector {
119         const char *name;
120         ia64_mv_setup_t *setup;
121         ia64_mv_cpu_init_t *cpu_init;
122         ia64_mv_irq_init_t *irq_init;
123         ia64_mv_pci_fixup_t *pci_fixup;
124         ia64_mv_pci_enable_device_t *pci_enable_device;
125         ia64_mv_map_nr_t *map_nr;
126         ia64_mv_mca_init_t *mca_init;
127         ia64_mv_mca_handler_t *mca_handler;
128         ia64_mv_cmci_handler_t *cmci_handler;
129         ia64_mv_log_print_t *log_print;
130         ia64_mv_send_ipi_t *send_ipi;
131         ia64_mv_global_tlb_purge_t *global_tlb_purge;
132         ia64_mv_pci_dma_init *dma_init;
133         ia64_mv_pci_alloc_consistent *alloc_consistent;
134         ia64_mv_pci_free_consistent *free_consistent;
135         ia64_mv_pci_map_single *map_single;
136         ia64_mv_pci_unmap_single *unmap_single;
137         ia64_mv_pci_map_sg *map_sg;
138         ia64_mv_pci_unmap_sg *unmap_sg;
139         ia64_mv_pci_dma_sync_single *sync_single;
140         ia64_mv_pci_dma_sync_sg *sync_sg;
141         ia64_mv_pci_dma_supported *dma_supported;
142         ia64_mv_irq_desc *irq_desc;
143         ia64_mv_irq_to_vector *irq_to_vector;
144         ia64_mv_local_vector_to_irq *local_vector_to_irq;
145         ia64_mv_inb_t *inb;
146         ia64_mv_inw_t *inw;
147         ia64_mv_inl_t *inl;
148         ia64_mv_outb_t *outb;
149         ia64_mv_outw_t *outw;
150         ia64_mv_outl_t *outl;
151 };
152
153 #define MACHVEC_INIT(name)                      \
154 {                                               \
155         #name,                                  \
156         platform_setup,                         \
157         platform_cpu_init,                      \
158         platform_irq_init,                      \
159         platform_pci_fixup,                     \
160         platform_pci_enable_device,             \
161         platform_map_nr,                        \
162         platform_mca_init,                      \
163         platform_mca_handler,                   \
164         platform_cmci_handler,                  \
165         platform_log_print,                     \
166         platform_send_ipi,                      \
167         platform_global_tlb_purge,              \
168         platform_pci_dma_init,                  \
169         platform_pci_alloc_consistent,          \
170         platform_pci_free_consistent,           \
171         platform_pci_map_single,                \
172         platform_pci_unmap_single,              \
173         platform_pci_map_sg,                    \
174         platform_pci_unmap_sg,                  \
175         platform_pci_dma_sync_single,           \
176         platform_pci_dma_sync_sg,               \
177         platform_pci_dma_supported,             \
178         platform_irq_desc,                      \
179         platform_irq_to_vector,                 \
180         platform_local_vector_to_irq,           \
181         platform_inb,                           \
182         platform_inw,                           \
183         platform_inl,                           \
184         platform_outb,                          \
185         platform_outw,                          \
186         platform_outl                           \
187 }
188
189 extern struct ia64_machine_vector ia64_mv;
190 extern void machvec_init (const char *name);
191
192 # else
193 #  error Unknown configuration.  Update asm-ia64/machvec.h.
194 # endif /* CONFIG_IA64_GENERIC */
195
196 /*
197  * Declare default routines which aren't declared anywhere else:
198  */
199 extern ia64_mv_pci_dma_init swiotlb_init;
200 extern ia64_mv_pci_alloc_consistent swiotlb_alloc_consistent;
201 extern ia64_mv_pci_free_consistent swiotlb_free_consistent;
202 extern ia64_mv_pci_map_single swiotlb_map_single;
203 extern ia64_mv_pci_unmap_single swiotlb_unmap_single;
204 extern ia64_mv_pci_map_sg swiotlb_map_sg;
205 extern ia64_mv_pci_unmap_sg swiotlb_unmap_sg;
206 extern ia64_mv_pci_dma_sync_single swiotlb_sync_single;
207 extern ia64_mv_pci_dma_sync_sg swiotlb_sync_sg;
208 extern ia64_mv_pci_dma_supported swiotlb_pci_dma_supported;
209
210 /*
211  * Define default versions so we can extend machvec for new platforms without having
212  * to update the machvec files for all existing platforms.
213  */
214 #ifndef platform_setup
215 # define platform_setup         ((ia64_mv_setup_t *) machvec_noop)
216 #endif
217 #ifndef platform_cpu_init
218 # define platform_cpu_init      ((ia64_mv_cpu_init_t *) machvec_noop)
219 #endif
220 #ifndef platform_irq_init
221 # define platform_irq_init      ((ia64_mv_irq_init_t *) machvec_noop)
222 #endif
223 #ifndef platform_mca_init
224 # define platform_mca_init      ((ia64_mv_mca_init_t *) machvec_noop)
225 #endif
226 #ifndef platform_mca_handler
227 # define platform_mca_handler   ((ia64_mv_mca_handler_t *) machvec_noop)
228 #endif
229 #ifndef platform_cmci_handler
230 # define platform_cmci_handler  ((ia64_mv_cmci_handler_t *) machvec_noop)
231 #endif
232 #ifndef platform_log_print
233 # define platform_log_print     ((ia64_mv_log_print_t *) machvec_noop)
234 #endif
235 #ifndef platform_pci_fixup
236 # define platform_pci_fixup     ((ia64_mv_pci_fixup_t *) machvec_noop)
237 #endif
238 #ifndef platform_pci_enable_device
239 # define platform_pci_enable_device     ((ia64_mv_pci_enable_device_t *) machvec_noop)
240 #endif
241 #ifndef platform_send_ipi
242 # define platform_send_ipi      ia64_send_ipi   /* default to architected version */
243 #endif
244 #ifndef platform_global_tlb_purge
245 # define platform_global_tlb_purge      ia64_global_tlb_purge /* default to architected version */
246 #endif
247 #ifndef platform_pci_dma_init
248 # define platform_pci_dma_init          swiotlb_init
249 #endif
250 #ifndef platform_pci_alloc_consistent
251 # define platform_pci_alloc_consistent  swiotlb_alloc_consistent
252 #endif
253 #ifndef platform_pci_free_consistent
254 # define platform_pci_free_consistent   swiotlb_free_consistent
255 #endif
256 #ifndef platform_pci_map_single
257 # define platform_pci_map_single        swiotlb_map_single
258 #endif
259 #ifndef platform_pci_unmap_single
260 # define platform_pci_unmap_single      swiotlb_unmap_single
261 #endif
262 #ifndef platform_pci_map_sg
263 # define platform_pci_map_sg            swiotlb_map_sg
264 #endif
265 #ifndef platform_pci_unmap_sg
266 # define platform_pci_unmap_sg          swiotlb_unmap_sg
267 #endif
268 #ifndef platform_pci_dma_sync_single
269 # define platform_pci_dma_sync_single   swiotlb_sync_single
270 #endif
271 #ifndef platform_pci_dma_sync_sg
272 # define platform_pci_dma_sync_sg       swiotlb_sync_sg
273 #endif
274 #ifndef platform_pci_dma_supported
275 # define  platform_pci_dma_supported    swiotlb_pci_dma_supported
276 #endif
277 #ifndef platform_irq_desc
278 # define platform_irq_desc              __ia64_irq_desc
279 #endif
280 #ifndef platform_irq_to_vector
281 # define platform_irq_to_vector         __ia64_irq_to_vector
282 #endif
283 #ifndef platform_local_vector_to_irq
284 # define platform_local_vector_to_irq   __ia64_local_vector_to_irq
285 #endif
286 #ifndef platform_inb
287 # define platform_inb           __ia64_inb
288 #endif
289 #ifndef platform_inw
290 # define platform_inw           __ia64_inw
291 #endif
292 #ifndef platform_inl
293 # define platform_inl           __ia64_inl
294 #endif
295 #ifndef platform_outb
296 # define platform_outb          __ia64_outb
297 #endif
298 #ifndef platform_outw
299 # define platform_outw          __ia64_outw
300 #endif
301 #ifndef platform_outl
302 # define platform_outl          __ia64_outl
303 #endif
304
305 #endif /* _ASM_IA64_MACHVEC_H */