Trait devices::HotPlugBus
source · pub trait HotPlugBus: Send {
// Required methods
fn hot_plug(&mut self, addr: PciAddress) -> Result<Option<Event>>;
fn hot_unplug(&mut self, addr: PciAddress) -> Result<Option<Event>>;
fn get_ready_notification(&mut self) -> Result<Event>;
fn is_match(&self, host_addr: PciAddress) -> Option<u8>;
fn get_address(&self) -> Option<PciAddress>;
fn get_secondary_bus_number(&self) -> Option<u8>;
fn add_hotplug_device(
&mut self,
hotplug_key: HotPlugKey,
guest_addr: PciAddress
);
fn get_hotplug_device(&self, hotplug_key: HotPlugKey) -> Option<PciAddress>;
fn is_empty(&self) -> bool;
fn get_hotplug_key(&self) -> Option<HotPlugKey>;
}
Expand description
Trait for devices that notify hotplug event into guest
Required Methods§
sourcefn hot_plug(&mut self, addr: PciAddress) -> Result<Option<Event>>
fn hot_plug(&mut self, addr: PciAddress) -> Result<Option<Event>>
Request hot plug event. Returns error if the request is not sent. Upon success, optionally returns an event, which is triggerred once when the guest OS completes the request (by sending PCI_EXP_SLTCTL_CCIE). Returns None if no such mechanism is provided.
- ‘addr’ - the guest pci address for hotplug in device
sourcefn hot_unplug(&mut self, addr: PciAddress) -> Result<Option<Event>>
fn hot_unplug(&mut self, addr: PciAddress) -> Result<Option<Event>>
Request hot unplug event. Returns error if the request is not sent. Upon success, optionally returns an event, which is triggerred once when the guest OS completes the request (by sending PCI_EXP_SLTCTL_CCIE). Returns None if no such mechanism is provided.
- ‘addr’ - the guest pci address for hotplug out device
sourcefn get_ready_notification(&mut self) -> Result<Event>
fn get_ready_notification(&mut self) -> Result<Event>
Get a notification event when the HotPlugBus is ready for hot plug commands. If the port is already ready, then the notification event is triggerred immediately.
sourcefn is_match(&self, host_addr: PciAddress) -> Option<u8>
fn is_match(&self, host_addr: PciAddress) -> Option<u8>
Check whether the hotplug bus is available to add the new device
- ‘None’: hotplug bus isn’t match with host pci device
- ‘Some(bus_num)’: hotplug bus is match and put the device at bus_num
sourcefn get_address(&self) -> Option<PciAddress>
fn get_address(&self) -> Option<PciAddress>
Gets the upstream PCI Address of the hotplug bus
sourcefn get_secondary_bus_number(&self) -> Option<u8>
fn get_secondary_bus_number(&self) -> Option<u8>
Gets the secondary bus number of this bus
sourcefn add_hotplug_device(
&mut self,
hotplug_key: HotPlugKey,
guest_addr: PciAddress
)
fn add_hotplug_device( &mut self, hotplug_key: HotPlugKey, guest_addr: PciAddress )
Add hotplug device into this bus
- ‘hotplug_key’ - the key to identify hotplug device from host view
- ‘guest_addr’ - the guest pci address for hotplug device
sourcefn get_hotplug_device(&self, hotplug_key: HotPlugKey) -> Option<PciAddress>
fn get_hotplug_device(&self, hotplug_key: HotPlugKey) -> Option<PciAddress>
get guest pci address from the specified hotplug_key
sourcefn get_hotplug_key(&self) -> Option<HotPlugKey>
fn get_hotplug_key(&self) -> Option<HotPlugKey>
Get hotplug key of this hotplug bus