Skip to main content

DeviceStatus

Struct DeviceStatus 

Source
#[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: u8

Implementations§

Source§

impl DeviceStatus

Source

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.

Source

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.

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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).

Source

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.

Source

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.

Source

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.

Source

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

Source

pub const RESET: DeviceStatus

The status value that indicates the device has been reset.

Trait Implementations§

Source§

impl<T> BitRange<T> for DeviceStatus
where u8: BitRange<T>,

Source§

fn bit_range(&self, msb: usize, lsb: usize) -> T

Get a range of bits.
Source§

impl<T> BitRangeMut<T> for DeviceStatus
where u8: BitRangeMut<T>,

Source§

fn set_bit_range(&mut self, msb: usize, lsb: usize, value: T)

Set a range of bits.
Source§

impl Clone for DeviceStatus

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for DeviceStatus

Source§

impl Debug for DeviceStatus

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DeviceStatus

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for DeviceStatus

Source§

impl PartialEq for DeviceStatus

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DeviceStatus

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Bit for T
where T: BitRange<u8>,

Source§

fn bit(&self, bit: usize) -> bool

Get a single bit.
Source§

impl<T> BitMut for T
where T: BitRangeMut<u8>,

Source§

fn set_bit(&mut self, bit: usize, value: bool)

Set a single bit.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> InstanceFromServiceTransport<T> for T

§

fn from_service_transport(handle: T) -> T

Converts the given service transport handle of type T to [Self]
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<E> RunsTransport<Mpsc> for E

§

impl<E> RunsTransport<Mpsc> for E
where E: RunsTransport<Mpsc>,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.