#[repr(transparent)]pub struct DeviceStatus(pub u8);Expand description
Modified by both the driver and the device during lifecycle transitions.
The bits are intended to represent stages in the device + driver
lifecycle. After a device is reset, the value is guaranteed to be
DeviceStatus::RESET.
With the exception of resetting the device, the driver must not clear (write 0 to) a bit that is set (to 1).
Tuple Fields§
§0: u8Implementations§
Source§impl DeviceStatus
impl DeviceStatus
Sourcepub fn virtio_device_detected(&self) -> bool
pub fn virtio_device_detected(&self) -> bool
True iff the driver recognized the hardware as a virtio device.
Set to true (1) by the driver in step 2 of device initialization.
The specification recommends that the virtualized operating system sets this bit. Fuchsia does not special-case virtio devices, so this bit is set by Fuchsia drivers.
Sourcepub fn driver_found(&self) -> bool
pub fn driver_found(&self) -> bool
True iff the guest OS has found a driver for the device.
Set to true (1) by the driver in step 3 of device initialization. Fuchsia does not special-case virtio devices, so the driver must perform this step.
The driver may only read the feature bits offered by the device after setting this bit to true.
Sourcepub fn driver_initialized(&self) -> bool
pub fn driver_initialized(&self) -> bool
True iff the driver is sufficiently initialized to drive the device.
Set to true (1) by the driver in step 8 of device initialization.
The driver must only set this bit to true after it has completed the device-specific initialization process.
The driver may only operate the device’s virtqueues while this bit is set to true (1).
Sourcepub fn feature_negotiation_complete(&self) -> bool
pub fn feature_negotiation_complete(&self) -> bool
True iff the feature negotiation is complete.
Set to true (1) by the driver in step 5 of device initialization.
The driver must only set this bit to true after it has acknowledged all the features it understands.
Sourcepub fn suspended(&self) -> bool
pub fn suspended(&self) -> bool
True iff the device has been suspended by the driver.
The driver triggers device suspension by setting this bit to true (1).
The device sets the [driver_initialized] bit to false (0) after the
device completes suspending.
The driver triggers resuming a suspended device by setting the
[driver_initialized] bit to true (1). The device sets this bit to
false (0) after the device completes resuming.
The driver is only allowed to set this bit if
[VirtioFeatureBits::suspend_enabled] is negotiated.
Sourcepub fn device_needs_reset(&self) -> bool
pub fn device_needs_reset(&self) -> bool
True iff the device has experienced an unrecoverable error.
The device sends a configuration change notification when setting this bit to true (1). The driver cannot assume that virtqueue operations will complete (or, conversely, that the operations will be dropped) while this bit is set.
Sourcepub fn driver_terminated(&self) -> bool
pub fn driver_terminated(&self) -> bool
True iff the driver has experienced an unrecoverable error.
The driver sets this bit when it gives up on driving the device.
Sourcepub fn set_virtio_device_detected(&mut self, value: bool)
pub fn set_virtio_device_detected(&mut self, value: bool)
True iff the driver recognized the hardware as a virtio device.
Set to true (1) by the driver in step 2 of device initialization.
The specification recommends that the virtualized operating system sets this bit. Fuchsia does not special-case virtio devices, so this bit is set by Fuchsia drivers.
Sourcepub fn set_driver_found(&mut self, value: bool)
pub fn set_driver_found(&mut self, value: bool)
True iff the guest OS has found a driver for the device.
Set to true (1) by the driver in step 3 of device initialization. Fuchsia does not special-case virtio devices, so the driver must perform this step.
The driver may only read the feature bits offered by the device after setting this bit to true.
Sourcepub fn set_driver_initialized(&mut self, value: bool)
pub fn set_driver_initialized(&mut self, value: bool)
True iff the driver is sufficiently initialized to drive the device.
Set to true (1) by the driver in step 8 of device initialization.
The driver must only set this bit to true after it has completed the device-specific initialization process.
The driver may only operate the device’s virtqueues while this bit is set to true (1).
Sourcepub fn set_feature_negotiation_complete(&mut self, value: bool)
pub fn set_feature_negotiation_complete(&mut self, value: bool)
True iff the feature negotiation is complete.
Set to true (1) by the driver in step 5 of device initialization.
The driver must only set this bit to true after it has acknowledged all the features it understands.
Sourcepub fn set_suspended(&mut self, value: bool)
pub fn set_suspended(&mut self, value: bool)
True iff the device has been suspended by the driver.
The driver triggers device suspension by setting this bit to true (1).
The device sets the [driver_initialized] bit to false (0) after the
device completes suspending.
The driver triggers resuming a suspended device by setting the
[driver_initialized] bit to true (1). The device sets this bit to
false (0) after the device completes resuming.
The driver is only allowed to set this bit if
[VirtioFeatureBits::suspend_enabled] is negotiated.
Sourcepub fn set_device_needs_reset(&mut self, value: bool)
pub fn set_device_needs_reset(&mut self, value: bool)
True iff the device has experienced an unrecoverable error.
The device sends a configuration change notification when setting this bit to true (1). The driver cannot assume that virtqueue operations will complete (or, conversely, that the operations will be dropped) while this bit is set.
Sourcepub fn set_driver_terminated(&mut self, value: bool)
pub fn set_driver_terminated(&mut self, value: bool)
True iff the driver has experienced an unrecoverable error.
The driver sets this bit when it gives up on driving the device.
Source§impl DeviceStatus
impl DeviceStatus
Sourcepub const RESET: DeviceStatus
pub const RESET: DeviceStatus
The status value that indicates the device has been reset.
Trait Implementations§
Source§impl<T> BitRange<T> for DeviceStatus
impl<T> BitRange<T> for DeviceStatus
Source§impl<T> BitRangeMut<T> for DeviceStatuswhere
u8: BitRangeMut<T>,
impl<T> BitRangeMut<T> for DeviceStatuswhere
u8: BitRangeMut<T>,
Source§fn set_bit_range(&mut self, msb: usize, lsb: usize, value: T)
fn set_bit_range(&mut self, msb: usize, lsb: usize, value: T)
Source§impl Clone for DeviceStatus
impl Clone for DeviceStatus
impl Copy for DeviceStatus
Source§impl Debug for DeviceStatus
impl Debug for DeviceStatus
Source§impl Default for DeviceStatus
impl Default for DeviceStatus
impl Eq for DeviceStatus
Source§impl PartialEq for DeviceStatus
impl PartialEq for DeviceStatus
impl StructuralPartialEq for DeviceStatus
Auto Trait Implementations§
impl Freeze for DeviceStatus
impl RefUnwindSafe for DeviceStatus
impl Send for DeviceStatus
impl Sync for DeviceStatus
impl Unpin for DeviceStatus
impl UnsafeUnpin for DeviceStatus
impl UnwindSafe for DeviceStatus
Blanket Implementations§
Source§impl<T> BitMut for Twhere
T: BitRangeMut<u8>,
impl<T> BitMut for Twhere
T: BitRangeMut<u8>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to [Self]