GenericPcieSwitch

Struct GenericPcieSwitch 

Source
pub struct GenericPcieSwitch { /* private fields */ }
Expand description

A PCI Express switch emulator that implements a complete switch with upstream and downstream ports.

A PCIe switch consists of:

  • One upstream switch port that connects to the parent (root port or another switch)
  • Multiple downstream switch ports that connect to children (endpoints or other switches)

The switch implements routing functionality to forward configuration space accesses between the upstream and downstream ports based on bus number assignments.

Implementations§

Source§

impl GenericPcieSwitch

Source

pub fn new(definition: GenericPcieSwitchDefinition) -> Self

Constructs a new GenericPcieSwitch emulator.

Source

pub fn name(&self) -> &Arc<str>

Get the name of this switch.

Source

pub fn upstream_port(&self) -> &UpstreamSwitchPort

Get a reference to the upstream switch port.

Source

pub fn downstream_ports(&self) -> Vec<(u8, Arc<str>)>

Enumerate the downstream ports of the switch.

Source

pub fn add_pcie_device( &mut self, port: u8, name: &str, dev: Box<dyn GenericPciBusDevice>, ) -> Result<()>

Attach the provided GenericPciBusDevice to the port identified.

Trait Implementations§

Source§

impl ChangeDeviceState for GenericPcieSwitch

Source§

fn start(&mut self)

Starts a device, allowing it to interact with the guest asynchronously. Read more
Source§

async fn stop(&mut self)

Stops a device’s asynchronous work. Read more
Source§

async fn reset(&mut self)

Resets the device state to its initial state, for a fresh boot. Read more
Source§

impl ChipsetDevice for GenericPcieSwitch

Source§

fn supports_pci(&mut self) -> Option<&mut dyn PciConfigSpace>

Optionally returns a trait object to send PCI config space accesses to.
§

fn supports_pio(&mut self) -> Option<&mut (dyn PortIoIntercept + 'static)>

Optionally returns a trait object to send IO port intercepts to.
§

fn supports_mmio(&mut self) -> Option<&mut (dyn MmioIntercept + 'static)>

Optionally returns a trait object to send MMIO port intercepts to.
§

fn supports_poll_device(&mut self) -> Option<&mut dyn PollDevice>

Optionally returns a trait object to send poll requests to.
§

fn supports_line_interrupt_target( &mut self, ) -> Option<&mut dyn LineInterruptTarget>

Optionally returns a trait object to send interrupt line changes to.
§

fn supports_handle_eoi(&mut self) -> Option<&mut dyn HandleEoi>

Optionally returns a trait object to send EOI requests to.
§

fn supports_acknowledge_pic_interrupt( &mut self, ) -> Option<&mut dyn AcknowledgePicInterrupt>

Optionally returns a trait object with which to acknowledge PIC interrupts.
§

fn supports_tdisp(&mut self) -> Option<&mut dyn TdispHostDeviceTarget>

Optionally returns a trait object which implements TDISP host communication.
Source§

impl InspectMut for GenericPcieSwitch

Source§

fn inspect_mut(&mut self, req: Request<'_>)

Inspects the object.
Source§

impl PciConfigSpace for GenericPcieSwitch

Source§

fn pci_cfg_read(&mut self, offset: u16, value: &mut u32) -> IoResult

Dispatch a PCI config space read to the device with the given address.
Source§

fn pci_cfg_write(&mut self, offset: u16, value: u32) -> IoResult

Dispatch a PCI config space write to the device with the given address.
Source§

fn pci_cfg_read_forward( &mut self, bus: u8, device_function: u8, offset: u16, value: &mut u32, ) -> Option<IoResult>

Forward a PCI configuration space read to a downstream device. Read more
Source§

fn pci_cfg_write_forward( &mut self, bus: u8, device_function: u8, offset: u16, value: u32, ) -> Option<IoResult>

Forward a PCI configuration space write to a downstream device. Read more
Source§

fn suggested_bdf(&mut self) -> Option<(u8, u8, u8)>

Check if the device has a suggested (bus, device, function) it expects to be located at. Read more
Source§

impl SaveRestore for GenericPcieSwitch

Source§

type SavedState = SavedStateNotSupported

The concrete saved state type.
Source§

fn save(&mut self) -> Result<Self::SavedState, SaveError>

Saves the object’s state.
Source§

fn restore(&mut self, state: Self::SavedState) -> Result<(), RestoreError>

Restores the object’s state.

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> 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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PciChipsetDeviceExt for T
where T: ChipsetDevice + PciConfigSpace + ?Sized,

§

fn probe_bar_masks(&mut self) -> [u32; 6]

Probe the PCI device’s BAR registers to retrieve the BAR masks.
§

fn probe_hardware_ids(&mut self) -> HardwareIds

Probe the PCI device’s configuration space registers to obtain the device’s hardware ID values.
§

impl<T> ProtobufSaveRestore for T
where T: SaveRestore, <T as SaveRestore>::SavedState: 'static + Send + SavedStateRoot,

§

fn save(&mut self) -> Result<SavedStateBlob, SaveError>

Save the object.
§

fn restore(&mut self, state: SavedStateBlob) -> Result<(), RestoreError>

Restore the object.
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more