iPXE
physdev.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright (c) 2006, Keir Fraser
4  */
5 
6 #ifndef __XEN_PUBLIC_PHYSDEV_H__
7 #define __XEN_PUBLIC_PHYSDEV_H__
8 
9 FILE_LICENCE ( MIT );
10 
11 #include "xen.h"
12 
13 /*
14  * Prototype for this hypercall is:
15  * int physdev_op(int cmd, void *args)
16  * @cmd == PHYSDEVOP_??? (physdev operation).
17  * @args == Operation-specific extra arguments (NULL if none).
18  */
19 
20 /*
21  * Notify end-of-interrupt (EOI) for the specified IRQ.
22  * @arg == pointer to physdev_eoi structure.
23  */
24 #define PHYSDEVOP_eoi 12
25 struct physdev_eoi {
26  /* IN */
28 };
29 typedef struct physdev_eoi physdev_eoi_t;
31 
32 /*
33  * Register a shared page for the hypervisor to indicate whether the guest
34  * must issue PHYSDEVOP_eoi. The semantics of PHYSDEVOP_eoi change slightly
35  * once the guest used this function in that the associated event channel
36  * will automatically get unmasked. The page registered is used as a bit
37  * array indexed by Xen's PIRQ value.
38  */
39 #define PHYSDEVOP_pirq_eoi_gmfn_v1 17
40 /*
41  * Register a shared page for the hypervisor to indicate whether the
42  * guest must issue PHYSDEVOP_eoi. This hypercall is very similar to
43  * PHYSDEVOP_pirq_eoi_gmfn_v1 but it doesn't change the semantics of
44  * PHYSDEVOP_eoi. The page registered is used as a bit array indexed by
45  * Xen's PIRQ value.
46  */
47 #define PHYSDEVOP_pirq_eoi_gmfn_v2 28
49  /* IN */
51 };
54 
55 /*
56  * Query the status of an IRQ line.
57  * @arg == pointer to physdev_irq_status_query structure.
58  */
59 #define PHYSDEVOP_irq_status_query 5
61  /* IN */
63  /* OUT */
64  uint32_t flags; /* XENIRQSTAT_* */
65 };
68 
69 /* Need to call PHYSDEVOP_eoi when the IRQ has been serviced? */
70 #define _XENIRQSTAT_needs_eoi (0)
71 #define XENIRQSTAT_needs_eoi (1U<<_XENIRQSTAT_needs_eoi)
72 
73 /* IRQ shared by multiple guests? */
74 #define _XENIRQSTAT_shared (1)
75 #define XENIRQSTAT_shared (1U<<_XENIRQSTAT_shared)
76 
77 /*
78  * Set the current VCPU's I/O privilege level.
79  * @arg == pointer to physdev_set_iopl structure.
80  */
81 #define PHYSDEVOP_set_iopl 6
83  /* IN */
85 };
88 
89 /*
90  * Set the current VCPU's I/O-port permissions bitmap.
91  * @arg == pointer to physdev_set_iobitmap structure.
92  */
93 #define PHYSDEVOP_set_iobitmap 7
95  /* IN */
96 #if __XEN_INTERFACE_VERSION__ >= 0x00030205
98 #else
100 #endif
102 };
105 
106 /*
107  * Read or write an IO-APIC register.
108  * @arg == pointer to physdev_apic structure.
109  */
110 #define PHYSDEVOP_apic_read 8
111 #define PHYSDEVOP_apic_write 9
112 struct physdev_apic {
113  /* IN */
114  unsigned long apic_physbase;
116  /* IN or OUT */
118 };
121 
122 /*
123  * Allocate or free a physical upcall vector for the specified IRQ line.
124  * @arg == pointer to physdev_irq structure.
125  */
126 #define PHYSDEVOP_alloc_irq_vector 10
127 #define PHYSDEVOP_free_irq_vector 11
128 struct physdev_irq {
129  /* IN */
131  /* IN or OUT */
133 };
134 typedef struct physdev_irq physdev_irq_t;
136 
137 #define MAP_PIRQ_TYPE_MSI 0x0
138 #define MAP_PIRQ_TYPE_GSI 0x1
139 #define MAP_PIRQ_TYPE_UNKNOWN 0x2
140 #define MAP_PIRQ_TYPE_MSI_SEG 0x3
141 #define MAP_PIRQ_TYPE_MULTI_MSI 0x4
142 
143 #define PHYSDEVOP_map_pirq 13
146  /* IN */
147  int type;
148  /* IN (ignored for ..._MULTI_MSI) */
149  int index;
150  /* IN or OUT */
151  int pirq;
152  /* IN - high 16 bits hold segment for ..._MSI_SEG and ..._MULTI_MSI */
153  int bus;
154  /* IN */
155  int devfn;
156  /* IN (also OUT for ..._MULTI_MSI) */
157  int entry_nr;
158  /* IN */
160 };
163 
164 #define PHYSDEVOP_unmap_pirq 14
167  /* IN */
168  int pirq;
169 };
170 
173 
174 #define PHYSDEVOP_manage_pci_add 15
175 #define PHYSDEVOP_manage_pci_remove 16
177  /* IN */
180 };
181 
184 
185 #define PHYSDEVOP_restore_msi 19
187  /* IN */
190 };
193 
194 #define PHYSDEVOP_manage_pci_add_ext 20
196  /* IN */
201  struct {
202  uint8_t bus;
203  uint8_t devfn;
204  } physfn;
205 };
206 
209 
210 /*
211  * Argument to physdev_op_compat() hypercall. Superceded by new physdev_op()
212  * hypercall since 0x00030202.
213  */
214 struct physdev_op {
216  union {
222  } u;
223 };
224 typedef struct physdev_op physdev_op_t;
226 
227 #define PHYSDEVOP_setup_gsi 21
229  int gsi;
230  /* IN */
232  /* IN */
234  /* IN */
235 };
236 
239 
240 /* leave PHYSDEVOP 22 free */
241 
242 /* type is MAP_PIRQ_TYPE_GSI or MAP_PIRQ_TYPE_MSI
243  * the hypercall returns a free pirq */
244 #define PHYSDEVOP_get_free_pirq 23
246  /* IN */
247  int type;
248  /* OUT */
250 };
251 
254 
255 #define XEN_PCI_MMCFG_RESERVED 0x1
256 
257 #define PHYSDEVOP_pci_mmcfg_reserved 24
264 };
267 
268 #define XEN_PCI_DEV_EXTFN 0x1
269 #define XEN_PCI_DEV_VIRTFN 0x2
270 #define XEN_PCI_DEV_PXM 0x4
271 
272 #define PHYSDEVOP_pci_device_add 25
274  /* IN */
279  struct {
280  uint8_t bus;
281  uint8_t devfn;
282  } physfn;
283  /*
284  * Optional parameters array.
285  * First element ([0]) is PXM domain associated with the device (if
286  * XEN_PCI_DEV_PXM is set)
287  */
289 };
292 
293 #define PHYSDEVOP_pci_device_remove 26
294 #define PHYSDEVOP_restore_msi_ext 27
295 /*
296  * Dom0 should use these two to announce MMIO resources assigned to
297  * MSI-X capable devices won't (prepare) or may (release) change.
298  */
299 #define PHYSDEVOP_prepare_msix 30
300 #define PHYSDEVOP_release_msix 31
302  /* IN */
306 };
309 
310 #define PHYSDEVOP_DBGP_RESET_PREPARE 1
311 #define PHYSDEVOP_DBGP_RESET_DONE 2
312 
313 #define PHYSDEVOP_DBGP_BUS_UNKNOWN 0
314 #define PHYSDEVOP_DBGP_BUS_PCI 1
315 
316 #define PHYSDEVOP_dbgp_op 29
318  /* IN */
321  union {
323  } u;
324 };
327 
328 /*
329  * Notify that some PIRQ-bound event channels have been unmasked.
330  * ** This command is obsolete since interface version 0x00030202 and is **
331  * ** unsupported by newer versions of Xen. **
332  */
333 #define PHYSDEVOP_IRQ_UNMASK_NOTIFY 4
334 
335 #if __XEN_INTERFACE_VERSION__ < 0x00040600
336 /*
337  * These all-capitals physdev operation names are superceded by the new names
338  * (defined above) since interface version 0x00030202. The guard above was
339  * added post-4.5 only though and hence shouldn't check for 0x00030202.
340  */
341 #define PHYSDEVOP_IRQ_STATUS_QUERY PHYSDEVOP_irq_status_query
342 #define PHYSDEVOP_SET_IOPL PHYSDEVOP_set_iopl
343 #define PHYSDEVOP_SET_IOBITMAP PHYSDEVOP_set_iobitmap
344 #define PHYSDEVOP_APIC_READ PHYSDEVOP_apic_read
345 #define PHYSDEVOP_APIC_WRITE PHYSDEVOP_apic_write
346 #define PHYSDEVOP_ASSIGN_VECTOR PHYSDEVOP_alloc_irq_vector
347 #define PHYSDEVOP_FREE_VECTOR PHYSDEVOP_free_irq_vector
348 #define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY XENIRQSTAT_needs_eoi
349 #define PHYSDEVOP_IRQ_SHARED XENIRQSTAT_shared
350 #endif
351 
352 #if __XEN_INTERFACE_VERSION__ < 0x00040200
353 #define PHYSDEVOP_pirq_eoi_gmfn PHYSDEVOP_pirq_eoi_gmfn_v1
354 #else
355 #define PHYSDEVOP_pirq_eoi_gmfn PHYSDEVOP_pirq_eoi_gmfn_v2
356 #endif
357 
358 #endif /* __XEN_PUBLIC_PHYSDEV_H__ */
359 
360 /*
361  * Local variables:
362  * mode: C
363  * c-file-style: "BSD"
364  * c-basic-offset: 4
365  * tab-width: 4
366  * indent-tabs-mode: nil
367  * End:
368  */
physdev_pci_device_t pci
Definition: physdev.h:322
uint32_t iopl
Definition: physdev.h:84
unsigned short uint16_t
Definition: stdint.h:11
physdev_set_iopl_t set_iopl
Definition: physdev.h:218
domid_t domid
Definition: physdev.h:145
uint16_t domid_t
Definition: xen.h:608
physdev_irq_status_query_t irq_status_query
Definition: physdev.h:217
unsigned long apic_physbase
Definition: physdev.h:114
unsigned long long uint64_t
Definition: stdint.h:13
physdev_apic_t apic_op
Definition: physdev.h:220
uint8_t uint8
Definition: stdint.h:28
uint64_t table_base
Definition: physdev.h:159
uint32_t optarr[XEN_FLEX_ARRAY_DIM]
Definition: physdev.h:288
uint32_t nr_ports
Definition: physdev.h:101
FILE_LICENCE(MIT)
xen_pfn_t gmfn
Definition: physdev.h:50
uint16_t seg
Definition: physdev.h:303
uint8_t bus
Definition: physdev.h:320
uint8_t op
Definition: physdev.h:319
uint8_t triggering
Definition: physdev.h:231
physdev_irq_t irq_op
Definition: physdev.h:221
DEFINE_XEN_GUEST_HANDLE(physdev_eoi_t)
unsigned long xen_pfn_t
Definition: nonxen.h:25
union physdev_dbgp_op::@619 u
unsigned char uint8_t
Definition: stdint.h:10
uint32_t irq
Definition: physdev.h:130
unsigned int uint32_t
Definition: stdint.h:12
uint32_t irq
Definition: physdev.h:27
struct physdev_manage_pci_ext::@616 physfn
uint32_t value
Definition: physdev.h:117
physdev_set_iobitmap_t set_iobitmap
Definition: physdev.h:219
#define XEN_FLEX_ARRAY_DIM
Definition: xen.h:47
union physdev_op::@617 u
uint32_t reg
Definition: physdev.h:115
uint8_t * bitmap
Definition: physdev.h:99
uint8_t polarity
Definition: physdev.h:233
#define XEN_GUEST_HANDLE(name)
Definition: nonxen.h:14
struct physdev_pci_device_add::@618 physfn
uint32_t vector
Definition: physdev.h:132
uint32_t cmd
Definition: physdev.h:215