1 /* $NetBSD: physdev.h,v 1.6 2008/05/04 19:56:28 cegger Exp $ */
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
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
{
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
{
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
{
85 #if __XEN_INTERFACE_VERSION__ >= 0x00030205
86 XEN_GUEST_HANDLE(uint8
) bitmap
;
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
{
103 unsigned long apic_physbase
;
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
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
{
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
{
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
{
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.
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
;
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__ */
218 * indent-tabs-mode: nil