PciDevice

Trait PciDevice 

Source
pub trait PciDevice: Send {
    // Required methods
    fn write_config_register(
        &mut self,
        reg_idx: usize,
        offset: u64,
        data: &[u8],
    ) -> Option<Arc<Barrier>>;
    fn read_config_register(&mut self, reg_idx: usize) -> u32;

    // Provided methods
    fn detect_bar_reprogramming(
        &mut self,
        _reg_idx: usize,
        _data: &[u8],
    ) -> Option<BarReprogrammingParams> { ... }
    fn read_bar(&mut self, _base: u64, _offset: u64, _data: &mut [u8]) { ... }
    fn write_bar(
        &mut self,
        _base: u64,
        _offset: u64,
        _data: &[u8],
    ) -> Option<Arc<Barrier>> { ... }
    fn move_bar(
        &mut self,
        _old_base: u64,
        _new_base: u64,
    ) -> Result<(), DeviceRelocationError> { ... }
}
Expand description

Common logic of all PCI devices

Required Methods§

Source

fn write_config_register( &mut self, reg_idx: usize, offset: u64, data: &[u8], ) -> Option<Arc<Barrier>>

Sets a register in the configuration space.

  • reg_idx - The index of the config register to modify.
  • offset - Offset into the register.
Source

fn read_config_register(&mut self, reg_idx: usize) -> u32

Gets a register from the configuration space.

  • reg_idx - The index of the config register to read.

Provided Methods§

Source

fn detect_bar_reprogramming( &mut self, _reg_idx: usize, _data: &[u8], ) -> Option<BarReprogrammingParams>

Detects if a BAR is being reprogrammed.

Source

fn read_bar(&mut self, _base: u64, _offset: u64, _data: &mut [u8])

Reads from a BAR region mapped into the device.

  • addr - The guest address inside the BAR.
  • data - Filled with the data from addr.
Source

fn write_bar( &mut self, _base: u64, _offset: u64, _data: &[u8], ) -> Option<Arc<Barrier>>

Writes to a BAR region mapped into the device.

  • addr - The guest address inside the BAR.
  • data - The data to write.
Source

fn move_bar( &mut self, _old_base: u64, _new_base: u64, ) -> Result<(), DeviceRelocationError>

Relocates the BAR to a different address in guest address space.

Implementors§