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
10FILE_SECBOOT ( PERMITTED );
11
12#include "xen.h"
13
14/*
15 * Prototype for this hypercall is:
16 * int physdev_op(int cmd, void *args)
17 * @cmd == PHYSDEVOP_??? (physdev operation).
18 * @args == Operation-specific extra arguments (NULL if none).
19 */
20
21/*
22 * Notify end-of-interrupt (EOI) for the specified IRQ.
23 * @arg == pointer to physdev_eoi structure.
24 */
25#define PHYSDEVOP_eoi 12
27 /* IN */
29};
32
33/*
34 * Register a shared page for the hypervisor to indicate whether the guest
35 * must issue PHYSDEVOP_eoi. The semantics of PHYSDEVOP_eoi change slightly
36 * once the guest used this function in that the associated event channel
37 * will automatically get unmasked. The page registered is used as a bit
38 * array indexed by Xen's PIRQ value.
39 */
40#define PHYSDEVOP_pirq_eoi_gmfn_v1 17
41/*
42 * Register a shared page for the hypervisor to indicate whether the
43 * guest must issue PHYSDEVOP_eoi. This hypercall is very similar to
44 * PHYSDEVOP_pirq_eoi_gmfn_v1 but it doesn't change the semantics of
45 * PHYSDEVOP_eoi. The page registered is used as a bit array indexed by
46 * Xen's PIRQ value.
47 */
48#define PHYSDEVOP_pirq_eoi_gmfn_v2 28
50 /* IN */
52};
55
56/*
57 * Query the status of an IRQ line.
58 * @arg == pointer to physdev_irq_status_query structure.
59 */
60#define PHYSDEVOP_irq_status_query 5
62 /* IN */
64 /* OUT */
65 uint32_t flags; /* XENIRQSTAT_* */
66};
69
70/* Need to call PHYSDEVOP_eoi when the IRQ has been serviced? */
71#define _XENIRQSTAT_needs_eoi (0)
72#define XENIRQSTAT_needs_eoi (1U<<_XENIRQSTAT_needs_eoi)
73
74/* IRQ shared by multiple guests? */
75#define _XENIRQSTAT_shared (1)
76#define XENIRQSTAT_shared (1U<<_XENIRQSTAT_shared)
77
78/*
79 * Set the current VCPU's I/O privilege level.
80 * @arg == pointer to physdev_set_iopl structure.
81 */
82#define PHYSDEVOP_set_iopl 6
84 /* IN */
86};
89
90/*
91 * Set the current VCPU's I/O-port permissions bitmap.
92 * @arg == pointer to physdev_set_iobitmap structure.
93 *
94 * When @nr_ports is non-zero, Xen, like real CPUs and the TSS IOPB, always
95 * reads 2 bytes from @bitmap, which might be one byte beyond @nr_ports.
96 */
97#define PHYSDEVOP_set_iobitmap 7
99 /* IN */
100#if __XEN_INTERFACE_VERSION__ >= 0x00030205
102#else
104#endif
106};
109
110/*
111 * Read or write an IO-APIC register.
112 * @arg == pointer to physdev_apic structure.
113 */
114#define PHYSDEVOP_apic_read 8
115#define PHYSDEVOP_apic_write 9
117 /* IN */
118 unsigned long apic_physbase;
120 /* IN or OUT */
122};
125
126/*
127 * Allocate or free a physical upcall vector for the specified IRQ line.
128 * @arg == pointer to physdev_irq structure.
129 */
130#define PHYSDEVOP_alloc_irq_vector 10
131#define PHYSDEVOP_free_irq_vector 11
133 /* IN */
135 /* IN or OUT */
137};
140
141#define MAP_PIRQ_TYPE_MSI 0x0
142#define MAP_PIRQ_TYPE_GSI 0x1
143#define MAP_PIRQ_TYPE_UNKNOWN 0x2
144#define MAP_PIRQ_TYPE_MSI_SEG 0x3
145#define MAP_PIRQ_TYPE_MULTI_MSI 0x4
146
147#define PHYSDEVOP_map_pirq 13
150 /* IN */
151 int type;
152 /* IN (ignored for ..._MULTI_MSI) */
153 int index;
154 /* IN or OUT */
155 int pirq;
156 /* IN - high 16 bits hold segment for ..._MSI_SEG and ..._MULTI_MSI */
157 int bus;
158 /* IN */
159 int devfn;
160 /* IN (also OUT for ..._MULTI_MSI) */
162 /* IN */
164};
167
168#define PHYSDEVOP_unmap_pirq 14
171 /* IN */
172 int pirq;
173};
174
177
178#define PHYSDEVOP_manage_pci_add 15
179#define PHYSDEVOP_manage_pci_remove 16
181 /* IN */
184};
185
188
189#define PHYSDEVOP_restore_msi 19
197
198#define PHYSDEVOP_manage_pci_add_ext 20
210
213
214/*
215 * Argument to physdev_op_compat() hypercall. Superceded by new physdev_op()
216 * hypercall since 0x00030202.
217 */
230
231#define PHYSDEVOP_setup_gsi 21
233 int gsi;
234 /* IN */
236 /* IN */
238 /* IN */
239};
240
243
244/* leave PHYSDEVOP 22 free */
245
246/* type is MAP_PIRQ_TYPE_GSI or MAP_PIRQ_TYPE_MSI
247 * the hypercall returns a free pirq */
248#define PHYSDEVOP_get_free_pirq 23
250 /* IN */
251 int type;
252 /* OUT */
254};
255
258
259#define XEN_PCI_MMCFG_RESERVED 0x1
260
261#define PHYSDEVOP_pci_mmcfg_reserved 24
271
272#define XEN_PCI_DEV_EXTFN 0x1
273#define XEN_PCI_DEV_VIRTFN 0x2
274#define XEN_PCI_DEV_PXM 0x4
275
276#define PHYSDEVOP_pci_device_add 25
278 /* IN */
283 struct {
284 uint8_t bus;
287 /*
288 * Optional parameters array.
289 * First element ([0]) is PXM domain associated with the device (if
290 * XEN_PCI_DEV_PXM is set)
291 */
293};
296
297#define PHYSDEVOP_pci_device_remove 26
298#define PHYSDEVOP_restore_msi_ext 27
299/*
300 * Dom0 should use these two to announce MMIO resources assigned to
301 * MSI-X capable devices won't (prepare) or may (release) change.
302 */
303#define PHYSDEVOP_prepare_msix 30
304#define PHYSDEVOP_release_msix 31
305/*
306 * Notify the hypervisor that a PCI device has been reset, so that any
307 * internally cached state is regenerated. Should be called after any
308 * device reset performed by the hardware domain.
309 */
310#define PHYSDEVOP_pci_device_reset 32
311
320
323#define PCI_DEVICE_RESET_COLD 0x0
324#define PCI_DEVICE_RESET_WARM 0x1
325#define PCI_DEVICE_RESET_HOT 0x2
326#define PCI_DEVICE_RESET_FLR 0x3
327#define PCI_DEVICE_RESET_MASK 0x3
329};
330
331#define PHYSDEVOP_DBGP_RESET_PREPARE 1
332#define PHYSDEVOP_DBGP_RESET_DONE 2
333
334#define PHYSDEVOP_DBGP_BUS_UNKNOWN 0
335#define PHYSDEVOP_DBGP_BUS_PCI 1
336
337#define PHYSDEVOP_dbgp_op 29
339 /* IN */
342 union {
344 } u;
345};
348
349/*
350 * Notify that some PIRQ-bound event channels have been unmasked.
351 * ** This command is obsolete since interface version 0x00030202 and is **
352 * ** unsupported by newer versions of Xen. **
353 */
354#define PHYSDEVOP_IRQ_UNMASK_NOTIFY 4
355
356#if __XEN_INTERFACE_VERSION__ < 0x00040600
357/*
358 * These all-capitals physdev operation names are superceded by the new names
359 * (defined above) since interface version 0x00030202. The guard above was
360 * added post-4.5 only though and hence shouldn't check for 0x00030202.
361 */
362#define PHYSDEVOP_IRQ_STATUS_QUERY PHYSDEVOP_irq_status_query
363#define PHYSDEVOP_SET_IOPL PHYSDEVOP_set_iopl
364#define PHYSDEVOP_SET_IOBITMAP PHYSDEVOP_set_iobitmap
365#define PHYSDEVOP_APIC_READ PHYSDEVOP_apic_read
366#define PHYSDEVOP_APIC_WRITE PHYSDEVOP_apic_write
367#define PHYSDEVOP_ASSIGN_VECTOR PHYSDEVOP_alloc_irq_vector
368#define PHYSDEVOP_FREE_VECTOR PHYSDEVOP_free_irq_vector
369#define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY XENIRQSTAT_needs_eoi
370#define PHYSDEVOP_IRQ_SHARED XENIRQSTAT_shared
371#endif
372
373#if __XEN_INTERFACE_VERSION__ < 0x00040200
374#define PHYSDEVOP_pirq_eoi_gmfn PHYSDEVOP_pirq_eoi_gmfn_v1
375#else
376#define PHYSDEVOP_pirq_eoi_gmfn PHYSDEVOP_pirq_eoi_gmfn_v2
377#endif
378
379#endif /* __XEN_PUBLIC_PHYSDEV_H__ */
380
381/*
382 * Local variables:
383 * mode: C
384 * c-file-style: "BSD"
385 * c-basic-offset: 4
386 * tab-width: 4
387 * indent-tabs-mode: nil
388 * End:
389 */
unsigned short uint16_t
Definition stdint.h:11
unsigned int uint32_t
Definition stdint.h:12
unsigned long long uint64_t
Definition stdint.h:13
unsigned char uint8_t
Definition stdint.h:10
union @104331263140136355135267063077374276003064103115 u
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
uint8_t uint8
Definition stdint.h:29
uint16_t domid_t
Definition xen.h:622
#define XEN_FLEX_ARRAY_DIM
Definition xen.h:52
#define XEN_GUEST_HANDLE(name)
Definition nonxen.h:17
#define DEFINE_XEN_GUEST_HANDLE(name)
Definition nonxen.h:26
unsigned long xen_pfn_t
Definition nonxen.h:28
struct physdev_set_iobitmap physdev_set_iobitmap_t
Definition physdev.h:107
struct physdev_manage_pci physdev_manage_pci_t
Definition physdev.h:186
struct physdev_set_iopl physdev_set_iopl_t
Definition physdev.h:87
struct physdev_irq physdev_irq_t
Definition physdev.h:138
struct physdev_pci_mmcfg_reserved physdev_pci_mmcfg_reserved_t
Definition physdev.h:269
struct physdev_dbgp_op physdev_dbgp_op_t
Definition physdev.h:346
struct physdev_unmap_pirq physdev_unmap_pirq_t
Definition physdev.h:175
struct physdev_pci_device physdev_pci_device_t
Definition physdev.h:318
struct physdev_op physdev_op_t
Definition physdev.h:228
struct physdev_pci_device_add physdev_pci_device_add_t
Definition physdev.h:294
struct physdev_setup_gsi physdev_setup_gsi_t
Definition physdev.h:241
struct physdev_manage_pci_ext physdev_manage_pci_ext_t
Definition physdev.h:211
struct physdev_map_pirq physdev_map_pirq_t
Definition physdev.h:165
struct physdev_get_free_pirq physdev_get_free_pirq_t
Definition physdev.h:256
struct physdev_eoi physdev_eoi_t
Definition physdev.h:30
struct physdev_apic physdev_apic_t
Definition physdev.h:123
struct physdev_pirq_eoi_gmfn physdev_pirq_eoi_gmfn_t
Definition physdev.h:53
struct physdev_restore_msi physdev_restore_msi_t
Definition physdev.h:195
struct physdev_irq_status_query physdev_irq_status_query_t
Definition physdev.h:67
uint32_t flags
Definition physdev.h:328
physdev_pci_device_t dev
Definition physdev.h:322
uint32_t reg
Definition physdev.h:119
unsigned long apic_physbase
Definition physdev.h:118
uint32_t value
Definition physdev.h:121
physdev_pci_device_t pci
Definition physdev.h:343
uint8_t bus
Definition physdev.h:341
uint32_t irq
Definition physdev.h:28
uint32_t irq
Definition physdev.h:134
uint32_t vector
Definition physdev.h:136
struct physdev_manage_pci_ext::@360312354132316156306074125052233124205165175312 physfn
domid_t domid
Definition physdev.h:149
uint64_t table_base
Definition physdev.h:163
physdev_set_iobitmap_t set_iobitmap
Definition physdev.h:223
physdev_set_iopl_t set_iopl
Definition physdev.h:222
physdev_irq_t irq_op
Definition physdev.h:225
physdev_apic_t apic_op
Definition physdev.h:224
physdev_irq_status_query_t irq_status_query
Definition physdev.h:221
uint32_t cmd
Definition physdev.h:219
struct physdev_pci_device_add::@000367300025022072360276344324220255026316357161 physfn
uint32_t optarr[XEN_FLEX_ARRAY_DIM]
Definition physdev.h:292
uint32_t iopl
Definition physdev.h:85
uint8_t triggering
Definition physdev.h:235
uint8_t polarity
Definition physdev.h:237