xref: /titanic_52/usr/src/uts/common/xen/sys/privcmd.h (revision 843e19887f64dde75055cf8842fc4db2171eff45)
1*843e1988Sjohnlev /*
2*843e1988Sjohnlev  * Copyright (c) 2003-2005, K A Fraser
3*843e1988Sjohnlev  *
4*843e1988Sjohnlev  * This file may be distributed separately from the Linux kernel, or
5*843e1988Sjohnlev  * incorporated into other software packages, subject to the following license:
6*843e1988Sjohnlev  *
7*843e1988Sjohnlev  * Permission is hereby granted, free of charge, to any person obtaining a copy
8*843e1988Sjohnlev  * of this source file (the "Software"), to deal in the Software without
9*843e1988Sjohnlev  * restriction, including without limitation the rights to use, copy, modify,
10*843e1988Sjohnlev  * merge, publish, distribute, sublicense, and/or sell copies of the Software,
11*843e1988Sjohnlev  * and to permit persons to whom the Software is furnished to do so, subject to
12*843e1988Sjohnlev  * the following conditions:
13*843e1988Sjohnlev  *
14*843e1988Sjohnlev  * The above copyright notice and this permission notice shall be included in
15*843e1988Sjohnlev  * all copies or substantial portions of the Software.
16*843e1988Sjohnlev  *
17*843e1988Sjohnlev  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18*843e1988Sjohnlev  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19*843e1988Sjohnlev  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20*843e1988Sjohnlev  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21*843e1988Sjohnlev  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22*843e1988Sjohnlev  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
23*843e1988Sjohnlev  * IN THE SOFTWARE.
24*843e1988Sjohnlev  */
25*843e1988Sjohnlev 
26*843e1988Sjohnlev /*
27*843e1988Sjohnlev  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
28*843e1988Sjohnlev  * Use is subject to license terms.
29*843e1988Sjohnlev  */
30*843e1988Sjohnlev 
31*843e1988Sjohnlev #ifndef	_XEN_SYS_PRIVCMD_H
32*843e1988Sjohnlev #define	_XEN_SYS_PRIVCMD_H
33*843e1988Sjohnlev 
34*843e1988Sjohnlev #pragma ident	"%Z%%M%	%I%	%E% SMI"
35*843e1988Sjohnlev 
36*843e1988Sjohnlev /*
37*843e1988Sjohnlev  * WARNING:
38*843e1988Sjohnlev  *	These numbers and structure are built into the ON privcmd
39*843e1988Sjohnlev  *	driver, as well as the low-level tools and libraries in
40*843e1988Sjohnlev  *	the Xen consolidation.
41*843e1988Sjohnlev  */
42*843e1988Sjohnlev 
43*843e1988Sjohnlev #include <sys/types.h>
44*843e1988Sjohnlev 
45*843e1988Sjohnlev #ifdef __cplusplus
46*843e1988Sjohnlev extern "C" {
47*843e1988Sjohnlev #endif
48*843e1988Sjohnlev 
49*843e1988Sjohnlev /*
50*843e1988Sjohnlev  * ioctl numbers and corresponding data structures
51*843e1988Sjohnlev  */
52*843e1988Sjohnlev 
53*843e1988Sjohnlev #define	__PRIVCMD_IOC			(('p'<<24)|('r'<<16)|('v'<<8))
54*843e1988Sjohnlev 
55*843e1988Sjohnlev #define	IOCTL_PRIVCMD_HYPERCALL		(__PRIVCMD_IOC|0)
56*843e1988Sjohnlev #define	IOCTL_PRIVCMD_MMAP		(__PRIVCMD_IOC|1)
57*843e1988Sjohnlev #define	IOCTL_PRIVCMD_MMAPBATCH		(__PRIVCMD_IOC|2)
58*843e1988Sjohnlev 
59*843e1988Sjohnlev typedef struct __privcmd_hypercall {
60*843e1988Sjohnlev 	unsigned long op;
61*843e1988Sjohnlev 	unsigned long arg[5];
62*843e1988Sjohnlev } privcmd_hypercall_t;
63*843e1988Sjohnlev 
64*843e1988Sjohnlev typedef struct __privcmd_mmap_entry {
65*843e1988Sjohnlev 	unsigned long va;
66*843e1988Sjohnlev 	unsigned long mfn;
67*843e1988Sjohnlev 	unsigned long npages;
68*843e1988Sjohnlev } privcmd_mmap_entry_t;
69*843e1988Sjohnlev 
70*843e1988Sjohnlev typedef struct __privcmd_mmap {
71*843e1988Sjohnlev 	int num;
72*843e1988Sjohnlev 	domid_t dom;	/* target domain */
73*843e1988Sjohnlev 	privcmd_mmap_entry_t *entry;
74*843e1988Sjohnlev } privcmd_mmap_t;
75*843e1988Sjohnlev 
76*843e1988Sjohnlev typedef struct __privcmd_mmapbatch {
77*843e1988Sjohnlev 	int num;	/* number of pages to populate */
78*843e1988Sjohnlev 	domid_t dom;	/* target domain */
79*843e1988Sjohnlev 	unsigned long addr;	  /* virtual address */
80*843e1988Sjohnlev 	unsigned long *arr;	  /* array of mfns - top nibble set on err */
81*843e1988Sjohnlev } privcmd_mmapbatch_t;
82*843e1988Sjohnlev 
83*843e1988Sjohnlev #ifdef __cplusplus
84*843e1988Sjohnlev }
85*843e1988Sjohnlev #endif
86*843e1988Sjohnlev 
87*843e1988Sjohnlev #endif /* _XEN_SYS_PRIVCMD_H */
88