pub struct VirtioPciTransport { /* private fields */ }Expand description
Virtio PCI transport handle.
Wraps the BAR0 I/O port base address for a legacy virtio PCI device and provides typed accessors for the common virtio register set.
Implementations§
Source§impl VirtioPciTransport
impl VirtioPciTransport
Sourcepub fn read_device_features(&self) -> u32
pub fn read_device_features(&self) -> u32
Read the device-offered feature bits (32-bit).
Sourcepub fn write_guest_features(&self, features: u32)
pub fn write_guest_features(&self, features: u32)
Write the driver-accepted feature bits (32-bit).
Sourcepub fn read_queue_size(&self) -> u16
pub fn read_queue_size(&self) -> u16
Read the queue size for the currently selected queue.
Sourcepub fn select_queue(&self, index: u16)
pub fn select_queue(&self, index: u16)
Select a virtqueue by index.
Sourcepub fn write_queue_address(&self, pfn: u32)
pub fn write_queue_address(&self, pfn: u32)
Set the physical page frame number (PFN) of the selected virtqueue.
The device uses this to locate the virtqueue descriptor table, available
ring, and used ring in guest physical memory. The address is pfn * 4096.
Sourcepub fn notify_queue(&self, queue_index: u16)
pub fn notify_queue(&self, queue_index: u16)
Notify (kick) the device that new buffers are available in the given queue.
Sourcepub fn read_status(&self) -> u8
pub fn read_status(&self) -> u8
Read the device status register.
Sourcepub fn write_status(&self, status: u8)
pub fn write_status(&self, status: u8)
Write the device status register.
Sourcepub fn read_device_config_u8(&self, offset: u16) -> u8
pub fn read_device_config_u8(&self, offset: u16) -> u8
Read a byte from device-specific configuration space.
Sourcepub fn read_device_config_u32(&self, offset: u16) -> u32
pub fn read_device_config_u32(&self, offset: u16) -> u32
Read a 32-bit word from device-specific configuration space.
Sourcepub fn read_device_config_u64(&self, offset: u16) -> u64
pub fn read_device_config_u64(&self, offset: u16) -> u64
Read a 64-bit value from device-specific configuration space (two 32-bit reads).
Sourcepub fn begin_init(&self)
pub fn begin_init(&self)
Perform the standard legacy device initialization sequence.
- Reset device
- Set ACKNOWLEDGE
- Set DRIVER
After calling this, the driver should read device features, negotiate,
then call set_features_ok() and set_driver_ok().
Sourcepub fn set_features_ok(&self) -> bool
pub fn set_features_ok(&self) -> bool
Signal that feature negotiation is complete.
Returns true if the device accepted FEATURES_OK; false means the
device does not support the selected feature subset and initialization
should be aborted.
Sourcepub fn set_driver_ok(&self)
pub fn set_driver_ok(&self)
Signal that the driver is fully initialized and ready.
Sourcepub fn set_failed(&self)
pub fn set_failed(&self)
Mark the device as failed.
Trait Implementations§
Source§impl Clone for VirtioPciTransport
impl Clone for VirtioPciTransport
Source§fn clone(&self) -> VirtioPciTransport
fn clone(&self) -> VirtioPciTransport
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VirtioPciTransport
impl Debug for VirtioPciTransport
impl Copy for VirtioPciTransport
Auto Trait Implementations§
impl Freeze for VirtioPciTransport
impl RefUnwindSafe for VirtioPciTransport
impl Send for VirtioPciTransport
impl Sync for VirtioPciTransport
impl Unpin for VirtioPciTransport
impl UnwindSafe for VirtioPciTransport
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)