This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / include / xen / interface / physdev.h
1
2 #ifndef __XEN_PUBLIC_PHYSDEV_H__
3 #define __XEN_PUBLIC_PHYSDEV_H__
4
5 /*
6  * Prototype for this hypercall is:
7  *  int physdev_op(int cmd, void *args)
8  * @cmd  == PHYSDEVOP_??? (physdev operation).
9  * @args == Operation-specific extra arguments (NULL if none).
10  */
11
12 /*
13  * Notify end-of-interrupt (EOI) for the specified IRQ.
14  * @arg == pointer to physdev_eoi structure.
15  */
16 #define PHYSDEVOP_eoi                   12
17 struct physdev_eoi {
18     /* IN */
19     uint32_t irq;
20 };
21 typedef struct physdev_eoi physdev_eoi_t;
22 DEFINE_XEN_GUEST_HANDLE(physdev_eoi_t);
23
24 /*
25  * Query the status of an IRQ line.
26  * @arg == pointer to physdev_irq_status_query structure.
27  */
28 #define PHYSDEVOP_irq_status_query       5
29 struct physdev_irq_status_query {
30     /* IN */
31     uint32_t irq;
32     /* OUT */
33     uint32_t flags; /* XENIRQSTAT_* */
34 };
35 typedef struct physdev_irq_status_query physdev_irq_status_query_t;
36 DEFINE_XEN_GUEST_HANDLE(physdev_irq_status_query_t);
37
38 /* Need to call PHYSDEVOP_eoi when the IRQ has been serviced? */
39 #define _XENIRQSTAT_needs_eoi   (0)
40 #define  XENIRQSTAT_needs_eoi   (1U<<_XENIRQSTAT_needs_eoi)
41
42 /* IRQ shared by multiple guests? */
43 #define _XENIRQSTAT_shared      (1)
44 #define  XENIRQSTAT_shared      (1U<<_XENIRQSTAT_shared)
45
46 /*
47  * Set the current VCPU's I/O privilege level.
48  * @arg == pointer to physdev_set_iopl structure.
49  */
50 #define PHYSDEVOP_set_iopl               6
51 struct physdev_set_iopl {
52     /* IN */
53     uint32_t iopl;
54 };
55 typedef struct physdev_set_iopl physdev_set_iopl_t;
56 DEFINE_XEN_GUEST_HANDLE(physdev_set_iopl_t);
57
58 /*
59  * Set the current VCPU's I/O-port permissions bitmap.
60  * @arg == pointer to physdev_set_iobitmap structure.
61  */
62 #define PHYSDEVOP_set_iobitmap           7
63 struct physdev_set_iobitmap {
64     /* IN */
65     uint8_t *bitmap;
66     uint32_t nr_ports;
67 };
68 typedef struct physdev_set_iobitmap physdev_set_iobitmap_t;
69 DEFINE_XEN_GUEST_HANDLE(physdev_set_iobitmap_t);
70
71 /*
72  * Read or write an IO-APIC register.
73  * @arg == pointer to physdev_apic structure.
74  */
75 #define PHYSDEVOP_apic_read              8
76 #define PHYSDEVOP_apic_write             9
77 struct physdev_apic {
78     /* IN */
79     unsigned long apic_physbase;
80     uint32_t reg;
81     /* IN or OUT */
82     uint32_t value;
83 };
84 typedef struct physdev_apic physdev_apic_t;
85 DEFINE_XEN_GUEST_HANDLE(physdev_apic_t);
86
87 /*
88  * Allocate or free a physical upcall vector for the specified IRQ line.
89  * @arg == pointer to physdev_irq structure.
90  */
91 #define PHYSDEVOP_alloc_irq_vector      10
92 #define PHYSDEVOP_free_irq_vector       11
93 struct physdev_irq {
94     /* IN */
95     uint32_t irq;
96     /* IN or OUT */
97     uint32_t vector;
98 };
99 typedef struct physdev_irq physdev_irq_t;
100 DEFINE_XEN_GUEST_HANDLE(physdev_irq_t);
101
102 /*
103  * Argument to physdev_op_compat() hypercall. Superceded by new physdev_op()
104  * hypercall since 0x00030202.
105  */
106 struct physdev_op {
107     uint32_t cmd;
108     union {
109         struct physdev_irq_status_query      irq_status_query;
110         struct physdev_set_iopl              set_iopl;
111         struct physdev_set_iobitmap          set_iobitmap;
112         struct physdev_apic                  apic_op;
113         struct physdev_irq                   irq_op;
114     } u;
115 };
116 typedef struct physdev_op physdev_op_t;
117 DEFINE_XEN_GUEST_HANDLE(physdev_op_t);
118
119 /*
120  * Notify that some PIRQ-bound event channels have been unmasked.
121  * ** This command is obsolete since interface version 0x00030202 and is **
122  * ** unsupported by newer versions of Xen.                              **
123  */
124 #define PHYSDEVOP_IRQ_UNMASK_NOTIFY      4
125
126 /*
127  * These all-capitals physdev operation names are superceded by the new names
128  * (defined above) since interface version 0x00030202.
129  */
130 #define PHYSDEVOP_IRQ_STATUS_QUERY       PHYSDEVOP_irq_status_query
131 #define PHYSDEVOP_SET_IOPL               PHYSDEVOP_set_iopl
132 #define PHYSDEVOP_SET_IOBITMAP           PHYSDEVOP_set_iobitmap
133 #define PHYSDEVOP_APIC_READ              PHYSDEVOP_apic_read
134 #define PHYSDEVOP_APIC_WRITE             PHYSDEVOP_apic_write
135 #define PHYSDEVOP_ASSIGN_VECTOR          PHYSDEVOP_alloc_irq_vector
136 #define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY XENIRQSTAT_needs_eoi
137 #define PHYSDEVOP_IRQ_SHARED             XENIRQSTAT_shared
138
139 #endif /* __XEN_PUBLIC_PHYSDEV_H__ */
140
141 /*
142  * Local variables:
143  * mode: C
144  * c-set-style: "BSD"
145  * c-basic-offset: 4
146  * tab-width: 4
147  * indent-tabs-mode: nil
148  * End:
149  */