1 /******************************************************************************
2 * arch/ia64/kernel/paravirt.c
4 * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
5 * VA Linux Systems Japan K.K.
6 * Yaozu (Eddie) Dong <eddie.dong@intel.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include <linux/init.h>
26 #include <linux/compiler.h>
28 #include <linux/irq.h>
29 #include <linux/module.h>
30 #include <linux/types.h>
32 #include <asm/iosapic.h>
33 #include <asm/paravirt.h>
35 /***************************************************************************
38 struct pv_info pv_info = {
40 .paravirt_enabled = 0,
41 .name = "bare hardware"
44 /***************************************************************************
49 /* ia64_native_xxx are macros so that we have to make them real functions */
51 #define DEFINE_VOID_FUNC1(name) \
53 ia64_native_ ## name ## _func(unsigned long arg) \
55 ia64_native_ ## name(arg); \
58 #define DEFINE_VOID_FUNC2(name) \
60 ia64_native_ ## name ## _func(unsigned long arg0, \
63 ia64_native_ ## name(arg0, arg1); \
66 #define DEFINE_FUNC0(name) \
67 static unsigned long \
68 ia64_native_ ## name ## _func(void) \
70 return ia64_native_ ## name(); \
73 #define DEFINE_FUNC1(name, type) \
74 static unsigned long \
75 ia64_native_ ## name ## _func(type arg) \
77 return ia64_native_ ## name(arg); \
80 DEFINE_VOID_FUNC1(fc);
81 DEFINE_VOID_FUNC1(intrin_local_irq_restore);
83 DEFINE_VOID_FUNC2(ptcga);
84 DEFINE_VOID_FUNC2(set_rr);
86 DEFINE_FUNC0(get_psr_i);
88 DEFINE_FUNC1(thash, unsigned long);
89 DEFINE_FUNC1(get_cpuid, int);
90 DEFINE_FUNC1(get_pmd, int);
91 DEFINE_FUNC1(get_rr, unsigned long);
94 ia64_native_ssm_i_func(void)
96 ia64_native_ssm(IA64_PSR_I);
100 ia64_native_rsm_i_func(void)
102 ia64_native_rsm(IA64_PSR_I);
106 ia64_native_set_rr0_to_rr4_func(unsigned long val0, unsigned long val1,
107 unsigned long val2, unsigned long val3,
110 ia64_native_set_rr0_to_rr4(val0, val1, val2, val3, val4);
113 #define CASE_GET_REG(id) \
114 case _IA64_REG_ ## id: \
115 res = ia64_native_getreg(_IA64_REG_ ## id); \
117 #define CASE_GET_AR(id) CASE_GET_REG(AR_ ## id)
118 #define CASE_GET_CR(id) CASE_GET_REG(CR_ ## id)
121 ia64_native_getreg_func(int regnum)
123 unsigned long res = -1;
141 CASE_GET_AR(BSPSTORE);
187 printk(KERN_CRIT "wrong_getreg %d\n", regnum);
193 #define CASE_SET_REG(id) \
194 case _IA64_REG_ ## id: \
195 ia64_native_setreg(_IA64_REG_ ## id, val); \
197 #define CASE_SET_AR(id) CASE_SET_REG(AR_ ## id)
198 #define CASE_SET_CR(id) CASE_SET_REG(CR_ ## id)
201 ia64_native_setreg_func(int regnum, unsigned long val)
204 case _IA64_REG_PSR_L:
205 ia64_native_setreg(_IA64_REG_PSR_L, val);
206 ia64_dv_serialize_data();
221 CASE_SET_AR(BSPSTORE);
266 printk(KERN_CRIT "wrong setreg %d\n", regnum);
271 struct pv_cpu_ops pv_cpu_ops = {
272 .fc = ia64_native_fc_func,
273 .thash = ia64_native_thash_func,
274 .get_cpuid = ia64_native_get_cpuid_func,
275 .get_pmd = ia64_native_get_pmd_func,
276 .ptcga = ia64_native_ptcga_func,
277 .get_rr = ia64_native_get_rr_func,
278 .set_rr = ia64_native_set_rr_func,
279 .set_rr0_to_rr4 = ia64_native_set_rr0_to_rr4_func,
280 .ssm_i = ia64_native_ssm_i_func,
281 .getreg = ia64_native_getreg_func,
282 .setreg = ia64_native_setreg_func,
283 .rsm_i = ia64_native_rsm_i_func,
284 .get_psr_i = ia64_native_get_psr_i_func,
285 .intrin_local_irq_restore
286 = ia64_native_intrin_local_irq_restore_func,
288 EXPORT_SYMBOL(pv_cpu_ops);