Isaku Yamahata | 1ff730b5 | 2008-05-19 22:13:34 +0900 | [diff] [blame^] | 1 | /****************************************************************************** |
| 2 | * include/asm-ia64/paravirt_privops.h |
| 3 | * |
| 4 | * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp> |
| 5 | * VA Linux Systems Japan K.K. |
| 6 | * |
| 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. |
| 11 | * |
| 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. |
| 16 | * |
| 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 |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | #ifndef _ASM_IA64_PARAVIRT_PRIVOP_H |
| 24 | #define _ASM_IA64_PARAVIRT_PRIVOP_H |
| 25 | |
| 26 | #ifdef CONFIG_PARAVIRT |
| 27 | |
| 28 | #ifndef __ASSEMBLY__ |
| 29 | |
| 30 | #include <linux/types.h> |
| 31 | #include <asm/kregs.h> /* for IA64_PSR_I */ |
| 32 | |
| 33 | /****************************************************************************** |
| 34 | * replacement of intrinsics operations. |
| 35 | */ |
| 36 | |
| 37 | struct pv_cpu_ops { |
| 38 | void (*fc)(unsigned long addr); |
| 39 | unsigned long (*thash)(unsigned long addr); |
| 40 | unsigned long (*get_cpuid)(int index); |
| 41 | unsigned long (*get_pmd)(int index); |
| 42 | unsigned long (*getreg)(int reg); |
| 43 | void (*setreg)(int reg, unsigned long val); |
| 44 | void (*ptcga)(unsigned long addr, unsigned long size); |
| 45 | unsigned long (*get_rr)(unsigned long index); |
| 46 | void (*set_rr)(unsigned long index, unsigned long val); |
| 47 | void (*set_rr0_to_rr4)(unsigned long val0, unsigned long val1, |
| 48 | unsigned long val2, unsigned long val3, |
| 49 | unsigned long val4); |
| 50 | void (*ssm_i)(void); |
| 51 | void (*rsm_i)(void); |
| 52 | unsigned long (*get_psr_i)(void); |
| 53 | void (*intrin_local_irq_restore)(unsigned long flags); |
| 54 | }; |
| 55 | |
| 56 | extern struct pv_cpu_ops pv_cpu_ops; |
| 57 | |
| 58 | extern void ia64_native_setreg_func(int regnum, unsigned long val); |
| 59 | extern unsigned long ia64_native_getreg_func(int regnum); |
| 60 | |
| 61 | /************************************************/ |
| 62 | /* Instructions paravirtualized for performance */ |
| 63 | /************************************************/ |
| 64 | |
| 65 | /* mask for ia64_native_ssm/rsm() must be constant.("i" constraing). |
| 66 | * static inline function doesn't satisfy it. */ |
| 67 | #define paravirt_ssm(mask) \ |
| 68 | do { \ |
| 69 | if ((mask) == IA64_PSR_I) \ |
| 70 | pv_cpu_ops.ssm_i(); \ |
| 71 | else \ |
| 72 | ia64_native_ssm(mask); \ |
| 73 | } while (0) |
| 74 | |
| 75 | #define paravirt_rsm(mask) \ |
| 76 | do { \ |
| 77 | if ((mask) == IA64_PSR_I) \ |
| 78 | pv_cpu_ops.rsm_i(); \ |
| 79 | else \ |
| 80 | ia64_native_rsm(mask); \ |
| 81 | } while (0) |
| 82 | |
| 83 | #endif /* __ASSEMBLY__ */ |
| 84 | |
| 85 | #else |
| 86 | |
| 87 | /* fallback for native case */ |
| 88 | |
| 89 | #endif /* CONFIG_PARAVIRT */ |
| 90 | |
| 91 | #endif /* _ASM_IA64_PARAVIRT_PRIVOP_H */ |