Isaku Yamahata | 080104c | 2008-10-17 11:17:58 +0900 | [diff] [blame^] | 1 | /****************************************************************************** |
| 2 | * arch/ia64/xen/xen_pv_ops.c |
| 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 | #include <linux/console.h> |
| 24 | #include <linux/irq.h> |
| 25 | #include <linux/kernel.h> |
| 26 | #include <linux/pm.h> |
| 27 | |
| 28 | #include <asm/xen/hypervisor.h> |
| 29 | #include <asm/xen/xencomm.h> |
| 30 | #include <asm/xen/privop.h> |
| 31 | |
| 32 | /*************************************************************************** |
| 33 | * general info |
| 34 | */ |
| 35 | static struct pv_info xen_info __initdata = { |
| 36 | .kernel_rpl = 2, /* or 1: determin at runtime */ |
| 37 | .paravirt_enabled = 1, |
| 38 | .name = "Xen/ia64", |
| 39 | }; |
| 40 | |
| 41 | #define IA64_RSC_PL_SHIFT 2 |
| 42 | #define IA64_RSC_PL_BIT_SIZE 2 |
| 43 | #define IA64_RSC_PL_MASK \ |
| 44 | (((1UL << IA64_RSC_PL_BIT_SIZE) - 1) << IA64_RSC_PL_SHIFT) |
| 45 | |
| 46 | static void __init |
| 47 | xen_info_init(void) |
| 48 | { |
| 49 | /* Xenified Linux/ia64 may run on pl = 1 or 2. |
| 50 | * determin at run time. */ |
| 51 | unsigned long rsc = ia64_getreg(_IA64_REG_AR_RSC); |
| 52 | unsigned int rpl = (rsc & IA64_RSC_PL_MASK) >> IA64_RSC_PL_SHIFT; |
| 53 | xen_info.kernel_rpl = rpl; |
| 54 | } |
| 55 | |
| 56 | /*************************************************************************** |
| 57 | * pv_ops initialization |
| 58 | */ |
| 59 | |
| 60 | void __init |
| 61 | xen_setup_pv_ops(void) |
| 62 | { |
| 63 | xen_info_init(); |
| 64 | pv_info = xen_info; |
| 65 | } |