added 2.6.29.6 aldebaran kernel
[nao-ulib.git] / kernel / 2.6.29.6-aldebaran-rt / arch / ia64 / include / asm / paravirt.h
blob2bf3636473fe9c5b826b53488f00ff4aa5a1f33b
1 /******************************************************************************
2 * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
3 * VA Linux Systems Japan K.K.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef __ASM_PARAVIRT_H
23 #define __ASM_PARAVIRT_H
25 #ifdef CONFIG_PARAVIRT_GUEST
27 #define PARAVIRT_HYPERVISOR_TYPE_DEFAULT 0
28 #define PARAVIRT_HYPERVISOR_TYPE_XEN 1
30 #ifndef __ASSEMBLY__
32 #include <asm/hw_irq.h>
33 #include <asm/meminit.h>
35 /******************************************************************************
36 * general info
38 struct pv_info {
39 unsigned int kernel_rpl;
40 int paravirt_enabled;
41 const char *name;
44 extern struct pv_info pv_info;
46 static inline int paravirt_enabled(void)
48 return pv_info.paravirt_enabled;
51 static inline unsigned int get_kernel_rpl(void)
53 return pv_info.kernel_rpl;
56 /******************************************************************************
57 * initialization hooks.
59 struct rsvd_region;
61 struct pv_init_ops {
62 void (*banner)(void);
64 int (*reserve_memory)(struct rsvd_region *region);
66 void (*arch_setup_early)(void);
67 void (*arch_setup_console)(char **cmdline_p);
68 int (*arch_setup_nomca)(void);
70 void (*post_smp_prepare_boot_cpu)(void);
73 extern struct pv_init_ops pv_init_ops;
75 static inline void paravirt_banner(void)
77 if (pv_init_ops.banner)
78 pv_init_ops.banner();
81 static inline int paravirt_reserve_memory(struct rsvd_region *region)
83 if (pv_init_ops.reserve_memory)
84 return pv_init_ops.reserve_memory(region);
85 return 0;
88 static inline void paravirt_arch_setup_early(void)
90 if (pv_init_ops.arch_setup_early)
91 pv_init_ops.arch_setup_early();
94 static inline void paravirt_arch_setup_console(char **cmdline_p)
96 if (pv_init_ops.arch_setup_console)
97 pv_init_ops.arch_setup_console(cmdline_p);
100 static inline int paravirt_arch_setup_nomca(void)
102 if (pv_init_ops.arch_setup_nomca)
103 return pv_init_ops.arch_setup_nomca();
104 return 0;
107 static inline void paravirt_post_smp_prepare_boot_cpu(void)
109 if (pv_init_ops.post_smp_prepare_boot_cpu)
110 pv_init_ops.post_smp_prepare_boot_cpu();
113 /******************************************************************************
114 * replacement of iosapic operations.
117 struct pv_iosapic_ops {
118 void (*pcat_compat_init)(void);
120 struct irq_chip *(*__get_irq_chip)(unsigned long trigger);
122 unsigned int (*__read)(char __iomem *iosapic, unsigned int reg);
123 void (*__write)(char __iomem *iosapic, unsigned int reg, u32 val);
126 extern struct pv_iosapic_ops pv_iosapic_ops;
128 static inline void
129 iosapic_pcat_compat_init(void)
131 if (pv_iosapic_ops.pcat_compat_init)
132 pv_iosapic_ops.pcat_compat_init();
135 static inline struct irq_chip*
136 iosapic_get_irq_chip(unsigned long trigger)
138 return pv_iosapic_ops.__get_irq_chip(trigger);
141 static inline unsigned int
142 __iosapic_read(char __iomem *iosapic, unsigned int reg)
144 return pv_iosapic_ops.__read(iosapic, reg);
147 static inline void
148 __iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val)
150 return pv_iosapic_ops.__write(iosapic, reg, val);
153 /******************************************************************************
154 * replacement of irq operations.
157 struct pv_irq_ops {
158 void (*register_ipi)(void);
160 int (*assign_irq_vector)(int irq);
161 void (*free_irq_vector)(int vector);
163 void (*register_percpu_irq)(ia64_vector vec,
164 struct irqaction *action);
166 void (*resend_irq)(unsigned int vector);
169 extern struct pv_irq_ops pv_irq_ops;
171 static inline void
172 ia64_register_ipi(void)
174 pv_irq_ops.register_ipi();
177 static inline int
178 assign_irq_vector(int irq)
180 return pv_irq_ops.assign_irq_vector(irq);
183 static inline void
184 free_irq_vector(int vector)
186 return pv_irq_ops.free_irq_vector(vector);
189 static inline void
190 register_percpu_irq(ia64_vector vec, struct irqaction *action)
192 pv_irq_ops.register_percpu_irq(vec, action);
195 static inline void
196 ia64_resend_irq(unsigned int vector)
198 pv_irq_ops.resend_irq(vector);
201 /******************************************************************************
202 * replacement of time operations.
205 extern struct itc_jitter_data_t itc_jitter_data;
206 extern volatile int time_keeper_id;
208 struct pv_time_ops {
209 void (*init_missing_ticks_accounting)(int cpu);
210 int (*do_steal_accounting)(unsigned long *new_itm);
212 void (*clocksource_resume)(void);
215 extern struct pv_time_ops pv_time_ops;
217 static inline void
218 paravirt_init_missing_ticks_accounting(int cpu)
220 if (pv_time_ops.init_missing_ticks_accounting)
221 pv_time_ops.init_missing_ticks_accounting(cpu);
224 static inline int
225 paravirt_do_steal_accounting(unsigned long *new_itm)
227 return pv_time_ops.do_steal_accounting(new_itm);
230 #endif /* !__ASSEMBLY__ */
232 #else
233 /* fallback for native case */
235 #ifndef __ASSEMBLY__
237 #define paravirt_banner() do { } while (0)
238 #define paravirt_reserve_memory(region) 0
240 #define paravirt_arch_setup_early() do { } while (0)
241 #define paravirt_arch_setup_console(cmdline_p) do { } while (0)
242 #define paravirt_arch_setup_nomca() 0
243 #define paravirt_post_smp_prepare_boot_cpu() do { } while (0)
245 #define paravirt_init_missing_ticks_accounting(cpu) do { } while (0)
246 #define paravirt_do_steal_accounting(new_itm) 0
248 #endif /* __ASSEMBLY__ */
251 #endif /* CONFIG_PARAVIRT_GUEST */
253 #endif /* __ASM_PARAVIRT_H */