squib_virtio/device_status.rs
1//! virtio device-status bits.
2//!
3//! Defined in the [virtio v1.2 specification][spec] § 2.1; written by the
4//! guest driver into the MMIO `Status` register at offset `0x70`. Squib's
5//! transport state machine in [`crate::transport`] enforces the canonical
6//! transition graph and rejects illegal moves — the device cannot be
7//! activated until the driver has acked features and posted `DRIVER_OK`.
8//!
9//! [spec]: https://docs.oasis-open.org/virtio/virtio/v1.2/csd01/virtio-v1.2-csd01.html#x1-110001
10
11/// `0` — fresh / reset device. The driver writes this to reset.
12pub const INIT: u32 = 0;
13/// `1` — driver has noticed the device.
14pub const ACKNOWLEDGE: u32 = 1;
15/// `2` — driver knows how to drive the device.
16pub const DRIVER: u32 = 2;
17/// `4` — driver is up; queues are live.
18pub const DRIVER_OK: u32 = 4;
19/// `8` — driver has acked features; features are now negotiated.
20pub const FEATURES_OK: u32 = 8;
21/// `64` — device has noticed an error; driver should reset.
22pub const DEVICE_NEEDS_RESET: u32 = 64;
23/// `128` — driver has noticed an error; device is unrecoverable until reset.
24pub const FAILED: u32 = 128;