win-pvdrivers

view xenpci/hypercall.h @ 835:e5651aba4e03

Multiple fixups.
Rename gnttab to gnttbl
Restore syscall msr's after suspend (workaround bug in xen)
Allocate gnttab from main memory instead of mmio to avoid leaving holes that crash hibernate
author James Harper <james.harper@bendigoit.com.au>
date Thu Jan 27 18:20:13 2011 +1100 (2011-01-27)
parents da7ec4df7dd6
children 95159ee58473
line source
1 /*
2 PV Drivers for Windows Xen HVM Domains
3 Copyright (C) 2007 James Harper
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
20 #if defined(_X86_)
21 #if defined(__MINGW32__)
22 #include "hypercall_x86_mingw.h"
23 #else
24 #include "hypercall_x86.h"
25 #endif
26 #elif defined(_AMD64_)
27 #include "hypercall_amd64.h"
28 #elif defined(__ia64__)
29 #include "hypercall_ia64.h"
30 #endif
32 static __inline ULONGLONG
33 hvm_get_parameter(PXENPCI_DEVICE_DATA xpdd, int hvm_param)
34 {
35 struct xen_hvm_param a;
36 int retval;
38 FUNCTION_ENTER();
39 a.domid = DOMID_SELF;
40 a.index = hvm_param;
41 //a.value = via;
42 retval = HYPERVISOR_hvm_op(xpdd, HVMOP_get_param, &a);
43 KdPrint((__DRIVER_NAME " HYPERVISOR_hvm_op retval = %d\n", retval));
44 FUNCTION_EXIT();
45 return a.value;
46 }
48 static __inline ULONGLONG
49 hvm_set_parameter(PXENPCI_DEVICE_DATA xpdd, int hvm_param, ULONGLONG value)
50 {
51 struct xen_hvm_param a;
52 int retval;
54 FUNCTION_ENTER();
55 a.domid = DOMID_SELF;
56 a.index = hvm_param;
57 a.value = value;
58 retval = HYPERVISOR_hvm_op(xpdd, HVMOP_set_param, &a);
59 KdPrint((__DRIVER_NAME " HYPERVISOR_hvm_op retval = %d\n", retval));
60 FUNCTION_EXIT();
61 return retval;
62 }
64 static __inline int
65 hvm_shutdown(PXENPCI_DEVICE_DATA xpdd, unsigned int reason)
66 {
67 struct sched_shutdown ss;
68 int retval;
70 FUNCTION_ENTER();
71 ss.reason = reason;
72 retval = HYPERVISOR_sched_op(xpdd, SCHEDOP_shutdown, &ss);
73 FUNCTION_EXIT();
74 return retval;
75 }
77 static __inline VOID
78 HYPERVISOR_yield(PXENPCI_DEVICE_DATA xpdd)
79 {
80 HYPERVISOR_sched_op(xpdd, SCHEDOP_yield, NULL);
81 }