xenio.h revision 1.8 1 1.8 cegger /* $NetBSD: xenio.h,v 1.8 2010/12/15 14:45:47 cegger Exp $ */
2 1.1 cl
3 1.2 bouyer /******************************************************************************
4 1.2 bouyer * privcmd.h
5 1.2 bouyer *
6 1.2 bouyer * Copyright (c) 2003-2004, K A Fraser
7 1.2 bouyer *
8 1.2 bouyer * This file may be distributed separately from the Linux kernel, or
9 1.2 bouyer * incorporated into other software packages, subject to the following license:
10 1.2 bouyer *
11 1.1 cl * Permission is hereby granted, free of charge, to any person obtaining a copy
12 1.2 bouyer * of this source file (the "Software"), to deal in the Software without
13 1.2 bouyer * restriction, including without limitation the rights to use, copy, modify,
14 1.2 bouyer * merge, publish, distribute, sublicense, and/or sell copies of the Software,
15 1.2 bouyer * and to permit persons to whom the Software is furnished to do so, subject to
16 1.2 bouyer * the following conditions:
17 1.1 cl *
18 1.1 cl * The above copyright notice and this permission notice shall be included in
19 1.1 cl * all copies or substantial portions of the Software.
20 1.1 cl *
21 1.2 bouyer * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 1.2 bouyer * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 1.2 bouyer * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 1.2 bouyer * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 1.2 bouyer * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 1.2 bouyer * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
27 1.2 bouyer * IN THE SOFTWARE.
28 1.1 cl */
29 1.1 cl
30 1.7 cegger #ifndef __XEN_XENIO_H__
31 1.7 cegger #define __XEN_XENIO_H__
32 1.1 cl
33 1.2 bouyer /* Interface to /proc/xen/privcmd */
34 1.1 cl
35 1.2 bouyer typedef struct privcmd_hypercall
36 1.2 bouyer {
37 1.2 bouyer unsigned long op;
38 1.2 bouyer unsigned long arg[5];
39 1.6 bouyer long retval;
40 1.1 cl } privcmd_hypercall_t;
41 1.1 cl
42 1.2 bouyer typedef struct privcmd_mmap_entry {
43 1.2 bouyer unsigned long va;
44 1.2 bouyer unsigned long mfn;
45 1.2 bouyer unsigned long npages;
46 1.2 bouyer } privcmd_mmap_entry_t;
47 1.2 bouyer
48 1.2 bouyer typedef struct privcmd_mmap {
49 1.2 bouyer int num;
50 1.2 bouyer domid_t dom; /* target domain */
51 1.2 bouyer privcmd_mmap_entry_t *entry;
52 1.2 bouyer } privcmd_mmap_t;
53 1.2 bouyer
54 1.2 bouyer typedef struct privcmd_mmapbatch {
55 1.2 bouyer int num; /* number of pages to populate */
56 1.2 bouyer domid_t dom; /* target domain */
57 1.2 bouyer unsigned long addr; /* virtual address */
58 1.2 bouyer unsigned long *arr; /* array of mfns - top nibble set on err */
59 1.2 bouyer } privcmd_mmapbatch_t;
60 1.2 bouyer
61 1.8 cegger typedef struct privcmd_mmapbatch_v2 {
62 1.8 cegger int num; /* number of pages to populate */
63 1.8 cegger domid_t dom; /* target domain */
64 1.8 cegger uint64_t addr; /* virtual address */
65 1.8 cegger const xen_pfn_t *arr; /* array of mfns */
66 1.8 cegger int *err; /* array of error codes */
67 1.8 cegger } privcmd_mmapbatch_v2_t;
68 1.8 cegger
69 1.2 bouyer typedef struct privcmd_blkmsg
70 1.2 bouyer {
71 1.2 bouyer unsigned long op;
72 1.2 bouyer void *buf;
73 1.2 bouyer int buf_size;
74 1.1 cl } privcmd_blkmsg_t;
75 1.1 cl
76 1.2 bouyer /*
77 1.2 bouyer * @cmd: IOCTL_PRIVCMD_HYPERCALL
78 1.2 bouyer * @arg: &privcmd_hypercall_t
79 1.2 bouyer * Return: Value returned from execution of the specified hypercall.
80 1.2 bouyer */
81 1.2 bouyer #define IOCTL_PRIVCMD_HYPERCALL \
82 1.2 bouyer _IOWR('P', 0, privcmd_hypercall_t)
83 1.2 bouyer
84 1.3 yamt #if defined(_KERNEL)
85 1.3 yamt /* compat */
86 1.3 yamt #define IOCTL_PRIVCMD_INITDOMAIN_EVTCHN_OLD \
87 1.2 bouyer _IO('P', 1)
88 1.6 bouyer
89 1.6 bouyer typedef struct oprivcmd_hypercall
90 1.6 bouyer {
91 1.6 bouyer unsigned long op;
92 1.6 bouyer unsigned long arg[5];
93 1.6 bouyer } oprivcmd_hypercall_t;
94 1.6 bouyer
95 1.6 bouyer #define IOCTL_PRIVCMD_HYPERCALL_OLD \
96 1.6 bouyer _IOWR('P', 0, oprivcmd_hypercall_t)
97 1.3 yamt #endif /* defined(_KERNEL) */
98 1.2 bouyer
99 1.2 bouyer #define IOCTL_PRIVCMD_MMAP \
100 1.2 bouyer _IOW('P', 2, privcmd_mmap_t)
101 1.2 bouyer #define IOCTL_PRIVCMD_MMAPBATCH \
102 1.2 bouyer _IOW('P', 3, privcmd_mmapbatch_t)
103 1.2 bouyer #define IOCTL_PRIVCMD_GET_MACH2PHYS_START_MFN \
104 1.4 bouyer _IOR('P', 4, unsigned long)
105 1.2 bouyer
106 1.3 yamt /*
107 1.3 yamt * @cmd: IOCTL_PRIVCMD_INITDOMAIN_EVTCHN
108 1.3 yamt * @arg: n/a
109 1.3 yamt * Return: Port associated with domain-controller end of control event channel
110 1.3 yamt * for the initial domain.
111 1.3 yamt */
112 1.3 yamt #define IOCTL_PRIVCMD_INITDOMAIN_EVTCHN \
113 1.3 yamt _IOR('P', 5, int)
114 1.8 cegger #define IOCTL_PRIVCMD_MMAPBATCH_V2 \
115 1.8 cegger _IOW('P", 6, privcmd_mmapbatch_v2_t)
116 1.3 yamt
117 1.2 bouyer /* Interface to /dev/xenevt */
118 1.2 bouyer /* EVTCHN_RESET: Clear and reinit the event buffer. Clear error condition. */
119 1.2 bouyer #define EVTCHN_RESET _IO('E', 1)
120 1.2 bouyer /* EVTCHN_BIND: Bind to the specified event-channel port. */
121 1.2 bouyer #define EVTCHN_BIND _IOW('E', 2, unsigned long)
122 1.2 bouyer /* EVTCHN_UNBIND: Unbind from the specified event-channel port. */
123 1.2 bouyer #define EVTCHN_UNBIND _IOW('E', 3, unsigned long)
124 1.1 cl
125 1.7 cegger #endif /* __XEN_XENIO_H__ */
126