pub struct PciExpressCapability { /* private fields */ }Expand description
Configurable PCI Express capability.
Implementations§
Source§impl PciExpressCapability
impl PciExpressCapability
Sourcepub fn new(
typ: DevicePortType,
flr_handler: Option<Arc<dyn FlrHandler>>,
) -> Self
pub fn new( typ: DevicePortType, flr_handler: Option<Arc<dyn FlrHandler>>, ) -> Self
Creates a new PCI Express capability with FLR support.
§Arguments
typ- The spec-defined device or port type.flr_handler- Optional handler to be called when FLR is initiated. This emulator will report that FLR is supported if flr_handler = Some(_)
Sourcepub fn with_hotplug_support(self, slot_number: u32) -> Self
pub fn with_hotplug_support(self, slot_number: u32) -> Self
Enable hotplug support for this PCIe capability. This configures the appropriate registers to support hotpluggable devices. Panics if called on device types other than RootPort or DownstreamSwitchPort.
§Arguments
slot_number- The physical slot number to assign to this hotplug-capable port
Sourcepub fn set_presence_detect_state(&self, present: bool)
pub fn set_presence_detect_state(&self, present: bool)
Set the presence detect state for the slot. This method only has effect if the slot is implemented (slot_implemented = true). If slot is not implemented, the call is silently ignored, as the spec says “If this register is implemented but the Slot Implemented bit is Clear, the field behavior of this entire register with the exception of the DLLSC bit is undefined.”
§Arguments
present- true if a device is present in the slot, false if the slot is empty
Sourcepub fn set_hotplug_changed_bits(&self)
pub fn set_hotplug_changed_bits(&self)
Set the RW1C changed bits in Slot Status to signal a hotplug event. Call this only for runtime hotplug events, not build-time device attachment.
Sourcepub fn set_hotplug_state(&self, present: bool)
pub fn set_hotplug_state(&self, present: bool)
Atomically update presence detect state, link active state, and changed bits for a hotplug event.
Sourcepub fn hot_plug_interrupt_enabled(&self) -> bool
pub fn hot_plug_interrupt_enabled(&self) -> bool
Returns whether the hot plug interrupt is enabled in Slot Control.
Sourcepub fn slot_capabilities(&self) -> &SlotCapabilities
pub fn slot_capabilities(&self) -> &SlotCapabilities
Returns a reference to the slot capabilities register.