Skip to main content

pci_core/
microsoft.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4//! Microsoft-allocated PCI identifiers used by OpenVMM's emulated devices.
5//!
6//! Unlike the values in [`crate::spec`], these are *not* defined by the PCI
7//! specification. They are allocations under Microsoft's PCI vendor ID, and so
8//! live in their own module to keep [`crate::spec`] free of vendor-specific
9//! constants.
10
11/// Microsoft's PCI vendor ID.
12///
13/// First-party OpenVMM devices report this as their vendor ID. Devices that
14/// emulate standardized hardware (and therefore report the real hardware
15/// vendor ID) instead report this as their *subsystem* vendor ID, to identify
16/// OpenVMM as the hosting environment.
17pub const VENDOR_ID: u16 = 0x1414;
18
19open_enum::open_enum! {
20    /// Device IDs allocated under [`VENDOR_ID`] for OpenVMM's first-party
21    /// emulated devices.
22    ///
23    /// These are centrally managed by Microsoft: a device ID must be formally
24    /// assigned before use so that it does not collide with any other Microsoft
25    /// product that shares this vendor ID.
26    pub enum DeviceId: u16 {
27        /// MANA/GDMA network adapter.
28        GDMA = 0x00BA,
29        /// VGA adapter.
30        VGA = 0x5353,
31        /// AZIHSM (Azure Integrated HSM) device.
32        AZIHSM = 0xC003,
33        /// PCIe root port.
34        PCIE_ROOT_PORT = 0xC030,
35        /// PCIe upstream switch port.
36        PCIE_UPSTREAM_SWITCH_PORT = 0xC031,
37        /// PCIe downstream switch port.
38        PCIE_DOWNSTREAM_SWITCH_PORT = 0xC032,
39        /// NVMe controller.
40        NVME = 0xC03E,
41    }
42}
43
44/// Default PCI subsystem ID reported by OpenVMM's emulated devices.
45///
46/// This is a generic marker, carved out of Microsoft's vendor-ID space, that
47/// identifies a device as being emulated by OpenVMM.
48///
49/// A device that must emulate a very specific piece of hardware (where the
50/// guest inspects the subsystem ID to identify the exact board) may override
51/// this with its own value.
52pub const DEFAULT_SUBSYSTEM_ID: u16 = 0x2000;