Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / xen / include / xen3-public / physdev.h
blob6a2d067de65639c2caef4769e381de5144af3bdd
1 /* $NetBSD: physdev.h,v 1.6 2008/05/04 19:56:28 cegger Exp $ */
2 /*
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to
5 * deal in the Software without restriction, including without limitation the
6 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 * sell copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
19 * DEALINGS IN THE SOFTWARE.
22 #ifndef __XEN_PUBLIC_PHYSDEV_H__
23 #define __XEN_PUBLIC_PHYSDEV_H__
26 * Prototype for this hypercall is:
27 * int physdev_op(int cmd, void *args)
28 * @cmd == PHYSDEVOP_??? (physdev operation).
29 * @args == Operation-specific extra arguments (NULL if none).
33 * Notify end-of-interrupt (EOI) for the specified IRQ.
34 * @arg == pointer to physdev_eoi structure.
36 #define PHYSDEVOP_eoi 12
37 struct physdev_eoi {
38 /* IN */
39 uint32_t irq;
41 typedef struct physdev_eoi physdev_eoi_t;
42 DEFINE_XEN_GUEST_HANDLE(physdev_eoi_t);
45 * Query the status of an IRQ line.
46 * @arg == pointer to physdev_irq_status_query structure.
48 #define PHYSDEVOP_irq_status_query 5
49 struct physdev_irq_status_query {
50 /* IN */
51 uint32_t irq;
52 /* OUT */
53 uint32_t flags; /* XENIRQSTAT_* */
55 typedef struct physdev_irq_status_query physdev_irq_status_query_t;
56 DEFINE_XEN_GUEST_HANDLE(physdev_irq_status_query_t);
58 /* Need to call PHYSDEVOP_eoi when the IRQ has been serviced? */
59 #define _XENIRQSTAT_needs_eoi (0)
60 #define XENIRQSTAT_needs_eoi (1U<<_XENIRQSTAT_needs_eoi)
62 /* IRQ shared by multiple guests? */
63 #define _XENIRQSTAT_shared (1)
64 #define XENIRQSTAT_shared (1U<<_XENIRQSTAT_shared)
67 * Set the current VCPU's I/O privilege level.
68 * @arg == pointer to physdev_set_iopl structure.
70 #define PHYSDEVOP_set_iopl 6
71 struct physdev_set_iopl {
72 /* IN */
73 uint32_t iopl;
75 typedef struct physdev_set_iopl physdev_set_iopl_t;
76 DEFINE_XEN_GUEST_HANDLE(physdev_set_iopl_t);
79 * Set the current VCPU's I/O-port permissions bitmap.
80 * @arg == pointer to physdev_set_iobitmap structure.
82 #define PHYSDEVOP_set_iobitmap 7
83 struct physdev_set_iobitmap {
84 /* IN */
85 #if __XEN_INTERFACE_VERSION__ >= 0x00030205
86 XEN_GUEST_HANDLE(uint8) bitmap;
87 #else
88 uint8_t *bitmap;
89 #endif
90 uint32_t nr_ports;
92 typedef struct physdev_set_iobitmap physdev_set_iobitmap_t;
93 DEFINE_XEN_GUEST_HANDLE(physdev_set_iobitmap_t);
96 * Read or write an IO-APIC register.
97 * @arg == pointer to physdev_apic structure.
99 #define PHYSDEVOP_apic_read 8
100 #define PHYSDEVOP_apic_write 9
101 struct physdev_apic {
102 /* IN */
103 unsigned long apic_physbase;
104 uint32_t reg;
105 /* IN or OUT */
106 uint32_t value;
108 typedef struct physdev_apic physdev_apic_t;
109 DEFINE_XEN_GUEST_HANDLE(physdev_apic_t);
112 * Allocate or free a physical upcall vector for the specified IRQ line.
113 * @arg == pointer to physdev_irq structure.
115 #define PHYSDEVOP_alloc_irq_vector 10
116 #define PHYSDEVOP_free_irq_vector 11
117 struct physdev_irq {
118 /* IN */
119 uint32_t irq;
120 /* IN or OUT */
121 uint32_t vector;
123 typedef struct physdev_irq physdev_irq_t;
124 DEFINE_XEN_GUEST_HANDLE(physdev_irq_t);
126 #define MAP_PIRQ_TYPE_MSI 0x0
127 #define MAP_PIRQ_TYPE_GSI 0x1
128 #define MAP_PIRQ_TYPE_UNKNOWN 0x2
130 #define PHYSDEVOP_map_pirq 13
131 struct physdev_map_pirq {
132 domid_t domid;
133 /* IN */
134 int type;
135 /* IN */
136 int index;
137 /* IN or OUT */
138 int pirq;
139 /* IN */
140 int bus;
141 /* IN */
142 int devfn;
143 /* IN */
144 int entry_nr;
145 /* IN */
146 uint64_t table_base;
148 typedef struct physdev_map_pirq physdev_map_pirq_t;
149 DEFINE_XEN_GUEST_HANDLE(physdev_map_pirq_t);
151 #define PHYSDEVOP_unmap_pirq 14
152 struct physdev_unmap_pirq {
153 domid_t domid;
154 /* IN */
155 int pirq;
158 typedef struct physdev_unmap_pirq physdev_unmap_pirq_t;
159 DEFINE_XEN_GUEST_HANDLE(physdev_unmap_pirq_t);
161 #define PHYSDEVOP_manage_pci_add 15
162 #define PHYSDEVOP_manage_pci_remove 16
163 struct physdev_manage_pci {
164 /* IN */
165 uint8_t bus;
166 uint8_t devfn;
169 typedef struct physdev_manage_pci physdev_manage_pci_t;
170 DEFINE_XEN_GUEST_HANDLE(physdev_manage_pci_t);
173 * Argument to physdev_op_compat() hypercall. Superceded by new physdev_op()
174 * hypercall since 0x00030202.
176 struct physdev_op {
177 uint32_t cmd;
178 union {
179 struct physdev_irq_status_query irq_status_query;
180 struct physdev_set_iopl set_iopl;
181 struct physdev_set_iobitmap set_iobitmap;
182 struct physdev_apic apic_op;
183 struct physdev_irq irq_op;
184 } u;
186 typedef struct physdev_op physdev_op_t;
187 DEFINE_XEN_GUEST_HANDLE(physdev_op_t);
190 * Notify that some PIRQ-bound event channels have been unmasked.
191 * ** This command is obsolete since interface version 0x00030202 and is **
192 * ** unsupported by newer versions of Xen. **
194 #define PHYSDEVOP_IRQ_UNMASK_NOTIFY 4
197 * These all-capitals physdev operation names are superceded by the new names
198 * (defined above) since interface version 0x00030202.
200 #define PHYSDEVOP_IRQ_STATUS_QUERY PHYSDEVOP_irq_status_query
201 #define PHYSDEVOP_SET_IOPL PHYSDEVOP_set_iopl
202 #define PHYSDEVOP_SET_IOBITMAP PHYSDEVOP_set_iobitmap
203 #define PHYSDEVOP_APIC_READ PHYSDEVOP_apic_read
204 #define PHYSDEVOP_APIC_WRITE PHYSDEVOP_apic_write
205 #define PHYSDEVOP_ASSIGN_VECTOR PHYSDEVOP_alloc_irq_vector
206 #define PHYSDEVOP_FREE_VECTOR PHYSDEVOP_free_irq_vector
207 #define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY XENIRQSTAT_needs_eoi
208 #define PHYSDEVOP_IRQ_SHARED XENIRQSTAT_shared
210 #endif /* __XEN_PUBLIC_PHYSDEV_H__ */
213 * Local variables:
214 * mode: C
215 * c-set-style: "BSD"
216 * c-basic-offset: 4
217 * tab-width: 4
218 * indent-tabs-mode: nil
219 * End: