pci_core/capabilities/
mod.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4//! PCI capabilities.
5
6pub use self::read_only::ReadOnlyCapability;
7
8use inspect::Inspect;
9use vmcore::save_restore::ProtobufSaveRestore;
10
11pub mod msix;
12pub mod read_only;
13
14/// A generic PCI configuration space capability structure.
15pub trait PciCapability: Send + Sync + Inspect + ProtobufSaveRestore {
16    /// A descriptive label for use in Save/Restore + Inspect output
17    fn label(&self) -> &str;
18
19    /// Length of the capability structure
20    fn len(&self) -> usize;
21
22    /// Read a u32 at the given offset
23    fn read_u32(&self, offset: u16) -> u32;
24
25    /// Write a u32 at the given offset
26    fn write_u32(&mut self, offset: u16, val: u32);
27
28    /// Reset the capability
29    fn reset(&mut self);
30}