1#![allow(non_upper_case_globals)]
10#![allow(non_camel_case_types)]
11#![allow(non_snake_case)]
12
13use base::ioctl_io_nr;
14
15pub mod plat;
16pub mod vfio;
17
18use crate::plat::ACPI_EVT_FORWARD_BASE;
19use crate::plat::PLAT_IRQ_FORWARD_BASE;
20use crate::plat::PLAT_IRQ_FORWARD_TYPE;
21pub use crate::vfio::vfio_device_feature;
22pub use crate::vfio::vfio_device_info;
23pub use crate::vfio::vfio_device_low_power_entry_with_wakeup;
24pub use crate::vfio::vfio_group_status;
25pub use crate::vfio::vfio_info_cap_header;
26pub use crate::vfio::vfio_iommu_type1_dma_map;
27pub use crate::vfio::vfio_iommu_type1_dma_unmap;
28pub use crate::vfio::vfio_iommu_type1_info;
29pub use crate::vfio::vfio_iommu_type1_info_cap_iova_range;
30pub use crate::vfio::vfio_iommu_type1_info_cap_iova_range_header;
31pub use crate::vfio::vfio_iova_range;
32pub use crate::vfio::vfio_irq_info;
33pub use crate::vfio::vfio_irq_set;
34pub use crate::vfio::vfio_region_info;
35pub use crate::vfio::vfio_region_info_cap_sparse_mmap;
36pub use crate::vfio::vfio_region_info_cap_type;
37pub use crate::vfio::vfio_region_info_with_cap;
38pub use crate::vfio::vfio_region_sparse_mmap_area;
39pub use crate::vfio::VFIO_TYPE1v2_IOMMU;
40use crate::vfio::VFIO_BASE;
41pub use crate::vfio::VFIO_DEVICE_FEATURE_LOW_POWER_ENTRY;
42pub use crate::vfio::VFIO_DEVICE_FEATURE_LOW_POWER_ENTRY_WITH_WAKEUP;
43pub use crate::vfio::VFIO_DEVICE_FEATURE_LOW_POWER_EXIT;
44pub use crate::vfio::VFIO_DEVICE_FEATURE_SET;
45pub use crate::vfio::VFIO_DEVICE_FLAGS_PCI;
46pub use crate::vfio::VFIO_DEVICE_FLAGS_PLATFORM;
47pub use crate::vfio::VFIO_DMA_MAP_FLAG_READ;
48pub use crate::vfio::VFIO_DMA_MAP_FLAG_WRITE;
49pub use crate::vfio::VFIO_GROUP_FLAGS_VIABLE;
50pub use crate::vfio::VFIO_IOMMU_INFO_CAPS;
51pub use crate::vfio::VFIO_IOMMU_INFO_PGSIZES;
52pub use crate::vfio::VFIO_IOMMU_TYPE1_INFO_CAP_IOVA_RANGE;
53pub use crate::vfio::VFIO_IRQ_INFO_AUTOMASKED;
54pub use crate::vfio::VFIO_IRQ_SET_ACTION_MASK;
55pub use crate::vfio::VFIO_IRQ_SET_ACTION_TRIGGER;
56pub use crate::vfio::VFIO_IRQ_SET_ACTION_UNMASK;
57pub use crate::vfio::VFIO_IRQ_SET_DATA_EVENTFD;
58pub use crate::vfio::VFIO_IRQ_SET_DATA_NONE;
59pub use crate::vfio::VFIO_PCI_BAR0_REGION_INDEX;
60pub use crate::vfio::VFIO_PCI_CONFIG_REGION_INDEX;
61pub use crate::vfio::VFIO_PCI_INTX_IRQ_INDEX;
62pub use crate::vfio::VFIO_PCI_MSIX_IRQ_INDEX;
63pub use crate::vfio::VFIO_PCI_MSI_IRQ_INDEX;
64pub use crate::vfio::VFIO_PCI_REQ_IRQ_INDEX;
65pub use crate::vfio::VFIO_PCI_ROM_REGION_INDEX;
66pub use crate::vfio::VFIO_PKVM_PVIOMMU;
67pub use crate::vfio::VFIO_REGION_INFO_CAP_MSIX_MAPPABLE;
68pub use crate::vfio::VFIO_REGION_INFO_CAP_SPARSE_MMAP;
69pub use crate::vfio::VFIO_REGION_INFO_CAP_TYPE;
70pub use crate::vfio::VFIO_REGION_INFO_FLAG_CAPS;
71pub use crate::vfio::VFIO_REGION_INFO_FLAG_MMAP;
72pub use crate::vfio::VFIO_REGION_INFO_FLAG_WRITE;
73pub use crate::vfio::VFIO_REGION_SUBTYPE_INTEL_IGD_OPREGION;
74pub use crate::vfio::VFIO_REGION_TYPE_PCI_VENDOR_TYPE;
75use crate::vfio::VFIO_TYPE;
76
77ioctl_io_nr!(VFIO_GET_API_VERSION, VFIO_TYPE, VFIO_BASE);
78ioctl_io_nr!(VFIO_CHECK_EXTENSION, VFIO_TYPE, VFIO_BASE + 1);
79ioctl_io_nr!(VFIO_SET_IOMMU, VFIO_TYPE, VFIO_BASE + 2);
80ioctl_io_nr!(VFIO_GROUP_GET_STATUS, VFIO_TYPE, VFIO_BASE + 3);
81ioctl_io_nr!(VFIO_GROUP_SET_CONTAINER, VFIO_TYPE, VFIO_BASE + 4);
82ioctl_io_nr!(VFIO_GROUP_UNSET_CONTAINER, VFIO_TYPE, VFIO_BASE + 5);
83ioctl_io_nr!(VFIO_GROUP_GET_DEVICE_FD, VFIO_TYPE, VFIO_BASE + 6);
84ioctl_io_nr!(VFIO_DEVICE_GET_INFO, VFIO_TYPE, VFIO_BASE + 7);
85ioctl_io_nr!(VFIO_DEVICE_GET_REGION_INFO, VFIO_TYPE, VFIO_BASE + 8);
86ioctl_io_nr!(VFIO_DEVICE_GET_IRQ_INFO, VFIO_TYPE, VFIO_BASE + 9);
87ioctl_io_nr!(VFIO_DEVICE_SET_IRQS, VFIO_TYPE, VFIO_BASE + 10);
88ioctl_io_nr!(VFIO_DEVICE_RESET, VFIO_TYPE, VFIO_BASE + 11);
89ioctl_io_nr!(
90 VFIO_DEVICE_GET_PCI_HOT_RESET_INFO,
91 VFIO_TYPE,
92 VFIO_BASE + 12
93);
94ioctl_io_nr!(VFIO_DEVICE_PCI_HOT_RESET, VFIO_TYPE, VFIO_BASE + 13);
95ioctl_io_nr!(VFIO_DEVICE_QUERY_GFX_PLANE, VFIO_TYPE, VFIO_BASE + 14);
96ioctl_io_nr!(VFIO_DEVICE_GET_GFX_DMABUF, VFIO_TYPE, VFIO_BASE + 15);
97ioctl_io_nr!(VFIO_DEVICE_IOEVENTFD, VFIO_TYPE, VFIO_BASE + 16);
98ioctl_io_nr!(VFIO_IOMMU_GET_INFO, VFIO_TYPE, VFIO_BASE + 12);
99ioctl_io_nr!(VFIO_IOMMU_MAP_DMA, VFIO_TYPE, VFIO_BASE + 13);
100ioctl_io_nr!(VFIO_IOMMU_UNMAP_DMA, VFIO_TYPE, VFIO_BASE + 14);
101ioctl_io_nr!(VFIO_IOMMU_ENABLE, VFIO_TYPE, VFIO_BASE + 15);
102ioctl_io_nr!(VFIO_IOMMU_DISABLE, VFIO_TYPE, VFIO_BASE + 16);
103ioctl_io_nr!(VFIO_DEVICE_FEATURE, VFIO_TYPE, VFIO_BASE + 17);
104ioctl_io_nr!(VFIO_DEVICE_ACPI_DSM, VFIO_TYPE, VFIO_BASE + 18);
105
106ioctl_io_nr!(
107 PLAT_IRQ_FORWARD_SET,
108 PLAT_IRQ_FORWARD_TYPE,
109 PLAT_IRQ_FORWARD_BASE
110);
111
112ioctl_io_nr!(
113 ACPI_EVT_FORWARD_SET,
114 PLAT_IRQ_FORWARD_TYPE,
115 ACPI_EVT_FORWARD_BASE
116);