1 /******************************************************************************
2 * include/asm-ia64/paravirt.h
4 * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
5 * VA Linux Systems Japan K.K.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #ifndef __ASM_PARAVIRT_H
25 #define __ASM_PARAVIRT_H
27 #ifdef CONFIG_PARAVIRT_GUEST
29 #define PARAVIRT_HYPERVISOR_TYPE_DEFAULT 0
30 #define PARAVIRT_HYPERVISOR_TYPE_XEN 1
34 #include <asm/hw_irq.h>
35 #include <asm/meminit.h>
37 /******************************************************************************
41 unsigned int kernel_rpl;
46 extern struct pv_info pv_info;
48 static inline int paravirt_enabled(void)
50 return pv_info.paravirt_enabled;
53 static inline unsigned int get_kernel_rpl(void)
55 return pv_info.kernel_rpl;
58 /******************************************************************************
59 * initialization hooks.
66 int (*reserve_memory)(struct rsvd_region *region);
68 void (*arch_setup_early)(void);
69 void (*arch_setup_console)(char **cmdline_p);
70 int (*arch_setup_nomca)(void);
72 void (*post_smp_prepare_boot_cpu)(void);
75 extern struct pv_init_ops pv_init_ops;
77 static inline void paravirt_banner(void)
79 if (pv_init_ops.banner)
83 static inline int paravirt_reserve_memory(struct rsvd_region *region)
85 if (pv_init_ops.reserve_memory)
86 return pv_init_ops.reserve_memory(region);
90 static inline void paravirt_arch_setup_early(void)
92 if (pv_init_ops.arch_setup_early)
93 pv_init_ops.arch_setup_early();
96 static inline void paravirt_arch_setup_console(char **cmdline_p)
98 if (pv_init_ops.arch_setup_console)
99 pv_init_ops.arch_setup_console(cmdline_p);
102 static inline int paravirt_arch_setup_nomca(void)
104 if (pv_init_ops.arch_setup_nomca)
105 return pv_init_ops.arch_setup_nomca();
109 static inline void paravirt_post_smp_prepare_boot_cpu(void)
111 if (pv_init_ops.post_smp_prepare_boot_cpu)
112 pv_init_ops.post_smp_prepare_boot_cpu();
115 /******************************************************************************
116 * replacement of iosapic operations.
119 struct pv_iosapic_ops {
120 void (*pcat_compat_init)(void);
122 struct irq_chip *(*get_irq_chip)(unsigned long trigger);
124 unsigned int (*__read)(char __iomem *iosapic, unsigned int reg);
125 void (*__write)(char __iomem *iosapic, unsigned int reg, u32 val);
128 extern struct pv_iosapic_ops pv_iosapic_ops;
131 iosapic_pcat_compat_init(void)
133 if (pv_iosapic_ops.pcat_compat_init)
134 pv_iosapic_ops.pcat_compat_init();
137 static inline struct irq_chip*
138 iosapic_get_irq_chip(unsigned long trigger)
140 return pv_iosapic_ops.get_irq_chip(trigger);
143 static inline unsigned int
144 __iosapic_read(char __iomem *iosapic, unsigned int reg)
146 return pv_iosapic_ops.__read(iosapic, reg);
150 __iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val)
152 return pv_iosapic_ops.__write(iosapic, reg, val);
155 #endif /* !__ASSEMBLY__ */
158 /* fallback for native case */
162 #define paravirt_banner() do { } while (0)
163 #define paravirt_reserve_memory(region) 0
165 #define paravirt_arch_setup_early() do { } while (0)
166 #define paravirt_arch_setup_console(cmdline_p) do { } while (0)
167 #define paravirt_arch_setup_nomca() 0
168 #define paravirt_post_smp_prepare_boot_cpu() do { } while (0)
170 #endif /* __ASSEMBLY__ */
173 #endif /* CONFIG_PARAVIRT_GUEST */
175 #endif /* __ASM_PARAVIRT_H */