Skip to main content

PciCapability

Trait PciCapability 

Source
pub trait PciCapability:
    Send
    + Sync
    + Inspect
    + ProtobufSaveRestore {
    // Required methods
    fn label(&self) -> &str;
    fn capability_id(&self) -> CapabilityId;
    fn len(&self) -> usize;
    fn read(&self, offset: u16, value: ByteEnabledDwordRead<'_>);
    fn write(&mut self, offset: u16, val: ByteEnabledDwordWrite);
    fn reset(&mut self);

    // Provided methods
    fn as_pci_express(&self) -> Option<&PciExpressCapability> { ... }
    fn as_pci_express_mut(&mut self) -> Option<&mut PciExpressCapability> { ... }
    fn as_msi_cap(&self) -> Option<&MsiCapability> { ... }
    fn as_msi_cap_mut(&mut self) -> Option<&mut MsiCapability> { ... }
}
Expand description

A generic PCI configuration space capability structure.

Required Methods§

Source

fn label(&self) -> &str

A descriptive label for use in Save/Restore + Inspect output

Source

fn capability_id(&self) -> CapabilityId

Returns the PCI capability ID for this capability

Source

fn len(&self) -> usize

Length of the capability structure

Source

fn read(&self, offset: u16, value: ByteEnabledDwordRead<'_>)

Read a byte-enabled DWORD at the given capability-relative offset. The offset must be 32-bit aligned.

Source

fn write(&mut self, offset: u16, val: ByteEnabledDwordWrite)

Write a byte-enabled DWORD to the given capability-relative offset. The offset must be 32-bit aligned.

Source

fn reset(&mut self)

Reset the capability

Provided Methods§

Source

fn as_pci_express(&self) -> Option<&PciExpressCapability>

Downcast to PCI Express capability

Source

fn as_pci_express_mut(&mut self) -> Option<&mut PciExpressCapability>

Downcast to PCI Express capability (mutable)

Source

fn as_msi_cap(&self) -> Option<&MsiCapability>

Downcast to MSI capability

Source

fn as_msi_cap_mut(&mut self) -> Option<&mut MsiCapability>

Downcast to MSI capability (mutable)

Implementors§

Source§

impl PciCapability for MsiCapability

Source§

impl PciCapability for PciExpressCapability

Source§

impl<T> PciCapability for ReadOnlyCapability<T>
where T: IntoBytes + Send + Sync + Debug + Immutable + KnownLayout + 'static,