pub struct VirtioDevice {
pub pci_dev: PciDevice,
pub io_base: u16,
}Expand description
VirtIO device base
Common functionality for all VirtIO devices
Fields§
§pci_dev: PciDevicePCI device
io_base: u16I/O base address (BAR0 for legacy devices)
Implementations§
Source§impl VirtioDevice
impl VirtioDevice
Sourcepub fn read_reg_u8(&self, offset: u16) -> u8
pub fn read_reg_u8(&self, offset: u16) -> u8
Read an 8-bit value from a device register
Sourcepub fn read_reg_u16(&self, offset: u16) -> u16
pub fn read_reg_u16(&self, offset: u16) -> u16
Read a 16-bit value from a device register
Sourcepub fn read_reg_u32(&self, offset: u16) -> u32
pub fn read_reg_u32(&self, offset: u16) -> u32
Read a 32-bit value from a device register
Sourcepub fn write_reg_u8(&self, offset: u16, value: u8)
pub fn write_reg_u8(&self, offset: u16, value: u8)
Write an 8-bit value to a device register
Sourcepub fn write_reg_u16(&self, offset: u16, value: u16)
pub fn write_reg_u16(&self, offset: u16, value: u16)
Write a 16-bit value to a device register
Sourcepub fn write_reg_u32(&self, offset: u16, value: u32)
pub fn write_reg_u32(&self, offset: u16, value: u32)
Write a 32-bit value to a device register
Sourcepub fn read_device_features(&self) -> u32
pub fn read_device_features(&self) -> u32
Read device features
Sourcepub fn write_guest_features(&self, features: u32)
pub fn write_guest_features(&self, features: u32)
Write guest features
Sourcepub fn get_status(&self) -> u8
pub fn get_status(&self) -> u8
Get device status
Sourcepub fn set_status(&self, status: u8)
pub fn set_status(&self, status: u8)
Set device status
Sourcepub fn add_status(&self, status: u8)
pub fn add_status(&self, status: u8)
Add status flags
Sourcepub fn read_isr_status(&self) -> u8
pub fn read_isr_status(&self) -> u8
Read ISR status (clears interrupt)
Sourcepub fn ack_interrupt(&self)
pub fn ack_interrupt(&self)
Acknowledge interrupt (write 0 to ISR)
Sourcepub fn setup_queue(&self, queue_index: u16, queue: &Virtqueue)
pub fn setup_queue(&self, queue_index: u16, queue: &Virtqueue)
Setup a virtqueue
Sourcepub fn notify_queue(&self, queue_index: u16)
pub fn notify_queue(&self, queue_index: u16)
Notify a queue
Auto Trait Implementations§
impl Freeze for VirtioDevice
impl RefUnwindSafe for VirtioDevice
impl Send for VirtioDevice
impl Sync for VirtioDevice
impl Unpin for VirtioDevice
impl UnsafeUnpin for VirtioDevice
impl UnwindSafe for VirtioDevice
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more