DeviceRegistersVolatileFieldAccess

Trait DeviceRegistersVolatileFieldAccess 

Source
pub trait DeviceRegistersVolatileFieldAccess<'a, A> {
Show 30 methods // Required methods fn magic_value(self) -> VolatilePtr<'a, le32, A::Restricted> where A: RestrictAccess<ReadOnly>; fn version(self) -> VolatilePtr<'a, le32, A::Restricted> where A: RestrictAccess<ReadOnly>; fn device_id(self) -> OveralignedVolatilePtr<'a, Id, le32, A::Restricted> where A: RestrictAccess<ReadOnly>; fn vendor_id(self) -> VolatilePtr<'a, le32, A::Restricted> where A: RestrictAccess<ReadOnly>; fn device_features(self) -> VolatilePtr<'a, le32, A::Restricted> where A: RestrictAccess<ReadOnly>; fn device_features_sel(self) -> VolatilePtr<'a, le32, A::Restricted> where A: RestrictAccess<WriteOnly>; fn driver_features(self) -> VolatilePtr<'a, le32, A::Restricted> where A: RestrictAccess<WriteOnly>; fn driver_features_sel(self) -> VolatilePtr<'a, le32, A::Restricted> where A: RestrictAccess<WriteOnly>; fn queue_sel(self) -> OveralignedVolatilePtr<'a, le16, le32, A::Restricted> where A: RestrictAccess<WriteOnly>; fn queue_num_max( self, ) -> OveralignedVolatilePtr<'a, le16, le32, A::Restricted> where A: RestrictAccess<ReadOnly>; fn queue_num(self) -> OveralignedVolatilePtr<'a, le16, le32, A::Restricted> where A: RestrictAccess<WriteOnly>; fn queue_ready( self, ) -> OveralignedVolatilePtr<'a, bool, le32, A::Restricted> where A: RestrictAccess<ReadWrite>; fn queue_notify(self) -> VolatilePtr<'a, le32, A::Restricted> where A: RestrictAccess<WriteOnly>; fn interrupt_status( self, ) -> OveralignedVolatilePtr<'a, InterruptStatus, le32, A::Restricted> where A: RestrictAccess<ReadOnly>; fn interrupt_ack( self, ) -> OveralignedVolatilePtr<'a, InterruptStatus, le32, A::Restricted> where A: RestrictAccess<WriteOnly>; fn status( self, ) -> OveralignedVolatilePtr<'a, DeviceStatus, le32, A::Restricted> where A: RestrictAccess<ReadWrite>; fn queue_desc_low(self) -> VolatilePtr<'a, le32, A::Restricted> where A: RestrictAccess<WriteOnly>; fn queue_desc_high(self) -> VolatilePtr<'a, le32, A::Restricted> where A: RestrictAccess<WriteOnly>; fn queue_driver_low(self) -> VolatilePtr<'a, le32, A::Restricted> where A: RestrictAccess<WriteOnly>; fn queue_driver_high(self) -> VolatilePtr<'a, le32, A::Restricted> where A: RestrictAccess<WriteOnly>; fn queue_device_low(self) -> VolatilePtr<'a, le32, A::Restricted> where A: RestrictAccess<WriteOnly>; fn queue_device_high(self) -> VolatilePtr<'a, le32, A::Restricted> where A: RestrictAccess<WriteOnly>; fn shm_sel(self) -> VolatilePtr<'a, le32, A::Restricted> where A: RestrictAccess<WriteOnly>; fn shm_len_low(self) -> VolatilePtr<'a, le32, A::Restricted> where A: RestrictAccess<ReadOnly>; fn shm_len_high(self) -> VolatilePtr<'a, le32, A::Restricted> where A: RestrictAccess<ReadOnly>; fn shm_base_low(self) -> VolatilePtr<'a, le32, A::Restricted> where A: RestrictAccess<ReadOnly>; fn shm_base_high(self) -> VolatilePtr<'a, le32, A::Restricted> where A: RestrictAccess<ReadOnly>; fn queue_reset(self) -> VolatilePtr<'a, le32, A::Restricted> where A: RestrictAccess<ReadWrite>; fn config_generation(self) -> VolatilePtr<'a, le32, A::Restricted> where A: RestrictAccess<ReadOnly>; fn config(self) -> VolatilePtr<'a, (), A::Restricted> where A: RestrictAccess<ReadWrite>;
}
Expand description

MMIO Device Registers

Required Methods§

Source

fn magic_value(self) -> VolatilePtr<'a, le32, A::Restricted>

Magic Value

0x74726976 (a Little Endian equivalent of the “virt” string).

Source

fn version(self) -> VolatilePtr<'a, le32, A::Restricted>

Device version number

0x2.

Legacy devices (see Virtio Transport Options / Virtio Over MMIO / Legacy interface) used 0x1.

Source

fn device_id(self) -> OveralignedVolatilePtr<'a, Id, le32, A::Restricted>

Virtio Subsystem Device ID

See Device Types for possible values. Value zero (0x0) is used to define a system memory map with placeholder devices at static, well known addresses, assigning functions to them depending on user’s needs.

Source

fn vendor_id(self) -> VolatilePtr<'a, le32, A::Restricted>

Virtio Subsystem Vendor ID

Source

fn device_features(self) -> VolatilePtr<'a, le32, A::Restricted>

Flags representing features the device supports

Reading from this register returns 32 consecutive flag bits, the least significant bit depending on the last value written to DeviceFeaturesSel. Access to this register returns bits DeviceFeaturesSel*32 to (DeviceFeaturesSel*32)+31, eg. feature bits 0 to 31 if DeviceFeaturesSel is set to 0 and features bits 32 to 63 if DeviceFeaturesSel is set to 1. Also see Basic Facilities of a Virtio Device / Feature Bits.

Source

fn device_features_sel(self) -> VolatilePtr<'a, le32, A::Restricted>

Device (host) features word selection.

Writing to this register selects a set of 32 device feature bits accessible by reading from DeviceFeatures.

Source

fn driver_features(self) -> VolatilePtr<'a, le32, A::Restricted>

Flags representing device features understood and activated by the driver

Writing to this register sets 32 consecutive flag bits, the least significant bit depending on the last value written to DriverFeaturesSel. Access to this register sets bits DriverFeaturesSel*32 to (DriverFeaturesSel*32)+31, eg. feature bits 0 to 31 if DriverFeaturesSel is set to 0 and features bits 32 to 63 if DriverFeaturesSel is set to 1. Also see Basic Facilities of a Virtio Device / Feature Bits.

Source

fn driver_features_sel(self) -> VolatilePtr<'a, le32, A::Restricted>

Activated (guest) features word selection

Writing to this register selects a set of 32 activated feature bits accessible by writing to DriverFeatures.

Source

fn queue_sel(self) -> OveralignedVolatilePtr<'a, le16, le32, A::Restricted>

Virtual queue index

Writing to this register selects the virtual queue that the following operations on QueueNumMax, QueueNum, QueueReady, QueueDescLow, QueueDescHigh, QueueDriverlLow, QueueDriverHigh, QueueDeviceLow, QueueDeviceHigh and QueueReset apply to. The index number of the first queue is zero (0x0).

Source

fn queue_num_max(self) -> OveralignedVolatilePtr<'a, le16, le32, A::Restricted>

Maximum virtual queue size

Reading from the register returns the maximum size (number of elements) of the queue the device is ready to process or zero (0x0) if the queue is not available. This applies to the queue selected by writing to QueueSel.

Source

fn queue_num(self) -> OveralignedVolatilePtr<'a, le16, le32, A::Restricted>

Virtual queue size

Queue size is the number of elements in the queue. Writing to this register notifies the device what size of the queue the driver will use. This applies to the queue selected by writing to QueueSel.

Source

fn queue_ready(self) -> OveralignedVolatilePtr<'a, bool, le32, A::Restricted>

Virtual queue ready bit

Writing one (0x1) to this register notifies the device that it can execute requests from this virtual queue. Reading from this register returns the last value written to it. Both read and write accesses apply to the queue selected by writing to QueueSel.

Source

fn queue_notify(self) -> VolatilePtr<'a, le32, A::Restricted>

Queue notifier

Writing a value to this register notifies the device that there are new buffers to process in a queue.

When VIRTIO_F_NOTIFICATION_DATA has not been negotiated, the value written is the queue index.

When VIRTIO_F_NOTIFICATION_DATA has been negotiated, the Notification data value has the following format:

le32 {
  vqn : 16;
  next_off : 15;
  next_wrap : 1;
};

See Virtqueues / Driver notifications for the definition of the components.

Source

fn interrupt_status( self, ) -> OveralignedVolatilePtr<'a, InterruptStatus, le32, A::Restricted>

Interrupt status

Reading from this register returns a bit mask of events that caused the device interrupt to be asserted.

Source

fn interrupt_ack( self, ) -> OveralignedVolatilePtr<'a, InterruptStatus, le32, A::Restricted>

Interrupt acknowledge

Writing a value with bits set as defined in InterruptStatus to this register notifies the device that events causing the interrupt have been handled.

Source

fn status(self) -> OveralignedVolatilePtr<'a, DeviceStatus, le32, A::Restricted>

Device status

Reading from this register returns the current device status flags. Writing non-zero values to this register sets the status flags, indicating the driver progress. Writing zero (0x0) to this register triggers a device reset. See also p. Virtio Transport Options / Virtio Over MMIO / MMIO-specific Initialization And Device Operation / Device Initialization.

Source

fn queue_desc_low(self) -> VolatilePtr<'a, le32, A::Restricted>

Virtual queue’s Descriptor Area 64 bit long physical address

Writing to these two registers (lower 32 bits of the address to QueueDescLow, higher 32 bits to QueueDescHigh) notifies the device about location of the Descriptor Area of the queue selected by writing to QueueSel register.

Source

fn queue_desc_high(self) -> VolatilePtr<'a, le32, A::Restricted>

Virtual queue’s Descriptor Area 64 bit long physical address

Writing to these two registers (lower 32 bits of the address to QueueDescLow, higher 32 bits to QueueDescHigh) notifies the device about location of the Descriptor Area of the queue selected by writing to QueueSel register.

Source

fn queue_driver_low(self) -> VolatilePtr<'a, le32, A::Restricted>

Virtual queue’s Driver Area 64 bit long physical address

Writing to these two registers (lower 32 bits of the address to QueueDriverLow, higher 32 bits to QueueDriverHigh) notifies the device about location of the Driver Area of the queue selected by writing to QueueSel.

Source

fn queue_driver_high(self) -> VolatilePtr<'a, le32, A::Restricted>

Virtual queue’s Driver Area 64 bit long physical address

Writing to these two registers (lower 32 bits of the address to QueueDriverLow, higher 32 bits to QueueDriverHigh) notifies the device about location of the Driver Area of the queue selected by writing to QueueSel.

Source

fn queue_device_low(self) -> VolatilePtr<'a, le32, A::Restricted>

Virtual queue’s Device Area 64 bit long physical address

Writing to these two registers (lower 32 bits of the address to QueueDeviceLow, higher 32 bits to QueueDeviceHigh) notifies the device about location of the Device Area of the queue selected by writing to QueueSel.

Source

fn queue_device_high(self) -> VolatilePtr<'a, le32, A::Restricted>

Virtual queue’s Device Area 64 bit long physical address

Writing to these two registers (lower 32 bits of the address to QueueDeviceLow, higher 32 bits to QueueDeviceHigh) notifies the device about location of the Device Area of the queue selected by writing to QueueSel.

Source

fn shm_sel(self) -> VolatilePtr<'a, le32, A::Restricted>

Shared memory id

Writing to this register selects the shared memory region Basic Facilities of a Virtio Device / Shared Memory Regions following operations on SHMLenLow, SHMLenHigh, SHMBaseLow and SHMBaseHigh apply to.

Source

fn shm_len_low(self) -> VolatilePtr<'a, le32, A::Restricted>

Shared memory region 64 bit long length

These registers return the length of the shared memory region in bytes, as defined by the device for the region selected by the SHMSel register. The lower 32 bits of the length are read from SHMLenLow and the higher 32 bits from SHMLenHigh. Reading from a non-existent region (i.e. where the ID written to SHMSel is unused) results in a length of -1.

Source

fn shm_len_high(self) -> VolatilePtr<'a, le32, A::Restricted>

Shared memory region 64 bit long length

These registers return the length of the shared memory region in bytes, as defined by the device for the region selected by the SHMSel register. The lower 32 bits of the length are read from SHMLenLow and the higher 32 bits from SHMLenHigh. Reading from a non-existent region (i.e. where the ID written to SHMSel is unused) results in a length of -1.

Source

fn shm_base_low(self) -> VolatilePtr<'a, le32, A::Restricted>

Shared memory region 64 bit long physical address

The driver reads these registers to discover the base address of the region in physical address space. This address is chosen by the device (or other part of the VMM). The lower 32 bits of the address are read from SHMBaseLow with the higher 32 bits from SHMBaseHigh. Reading from a non-existent region (i.e. where the ID written to SHMSel is unused) results in a base address of 0xffffffffffffffff.

Source

fn shm_base_high(self) -> VolatilePtr<'a, le32, A::Restricted>

Shared memory region 64 bit long physical address

The driver reads these registers to discover the base address of the region in physical address space. This address is chosen by the device (or other part of the VMM). The lower 32 bits of the address are read from SHMBaseLow with the higher 32 bits from SHMBaseHigh. Reading from a non-existent region (i.e. where the ID written to SHMSel is unused) results in a base address of 0xffffffffffffffff.

Source

fn queue_reset(self) -> VolatilePtr<'a, le32, A::Restricted>

Virtual queue reset bit

If VIRTIO_F_RING_RESET has been negotiated, writing one (0x1) to this register selectively resets the queue. Both read and write accesses apply to the queue selected by writing to QueueSel.

Source

fn config_generation(self) -> VolatilePtr<'a, le32, A::Restricted>

Configuration atomicity value

Reading from this register returns a value describing a version of the device-specific configuration space (see Config). The driver can then access the configuration space and, when finished, read ConfigGeneration again. If no part of the configuration space has changed between these two ConfigGeneration reads, the returned values are identical. If the values are different, the configuration space accesses were not atomic and the driver has to perform the operations again. See also Basic Facilities of a Virtio Device / Device Configuration Space.

Source

fn config(self) -> VolatilePtr<'a, (), A::Restricted>

Configuration space

Device-specific configuration space starts at the offset 0x100 and is accessed with byte alignment. Its meaning and size depend on the device and the driver.

Implementations on Foreign Types§

Source§

impl<'a, A> DeviceRegistersVolatileFieldAccess<'a, A> for VolatilePtr<'a, DeviceRegisters, A>

Source§

fn magic_value(self) -> VolatilePtr<'a, le32, A::Restricted>

Source§

fn version(self) -> VolatilePtr<'a, le32, A::Restricted>

Source§

fn device_id(self) -> OveralignedVolatilePtr<'a, Id, le32, A::Restricted>

Source§

fn vendor_id(self) -> VolatilePtr<'a, le32, A::Restricted>

Source§

fn device_features(self) -> VolatilePtr<'a, le32, A::Restricted>

Source§

fn device_features_sel(self) -> VolatilePtr<'a, le32, A::Restricted>

Source§

fn driver_features(self) -> VolatilePtr<'a, le32, A::Restricted>

Source§

fn driver_features_sel(self) -> VolatilePtr<'a, le32, A::Restricted>

Source§

fn queue_sel(self) -> OveralignedVolatilePtr<'a, le16, le32, A::Restricted>

Source§

fn queue_num_max(self) -> OveralignedVolatilePtr<'a, le16, le32, A::Restricted>

Source§

fn queue_num(self) -> OveralignedVolatilePtr<'a, le16, le32, A::Restricted>

Source§

fn queue_ready(self) -> OveralignedVolatilePtr<'a, bool, le32, A::Restricted>

Source§

fn queue_notify(self) -> VolatilePtr<'a, le32, A::Restricted>

Source§

fn interrupt_status( self, ) -> OveralignedVolatilePtr<'a, InterruptStatus, le32, A::Restricted>

Source§

fn interrupt_ack( self, ) -> OveralignedVolatilePtr<'a, InterruptStatus, le32, A::Restricted>

Source§

fn status(self) -> OveralignedVolatilePtr<'a, DeviceStatus, le32, A::Restricted>

Source§

fn queue_desc_low(self) -> VolatilePtr<'a, le32, A::Restricted>

Source§

fn queue_desc_high(self) -> VolatilePtr<'a, le32, A::Restricted>

Source§

fn queue_driver_low(self) -> VolatilePtr<'a, le32, A::Restricted>

Source§

fn queue_driver_high(self) -> VolatilePtr<'a, le32, A::Restricted>

Source§

fn queue_device_low(self) -> VolatilePtr<'a, le32, A::Restricted>

Source§

fn queue_device_high(self) -> VolatilePtr<'a, le32, A::Restricted>

Source§

fn shm_sel(self) -> VolatilePtr<'a, le32, A::Restricted>

Source§

fn shm_len_low(self) -> VolatilePtr<'a, le32, A::Restricted>

Source§

fn shm_len_high(self) -> VolatilePtr<'a, le32, A::Restricted>

Source§

fn shm_base_low(self) -> VolatilePtr<'a, le32, A::Restricted>

Source§

fn shm_base_high(self) -> VolatilePtr<'a, le32, A::Restricted>

Source§

fn queue_reset(self) -> VolatilePtr<'a, le32, A::Restricted>

Source§

fn config_generation(self) -> VolatilePtr<'a, le32, A::Restricted>

Source§

fn config(self) -> VolatilePtr<'a, (), A::Restricted>

Implementors§