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 pci_express;
13pub mod read_only;
14
15/// A generic PCI configuration space capability structure.
16pub trait PciCapability: Send + Sync + Inspect + ProtobufSaveRestore {
17 /// A descriptive label for use in Save/Restore + Inspect output
18 fn label(&self) -> &str;
19
20 /// Length of the capability structure
21 fn len(&self) -> usize;
22
23 /// Read a u32 at the given offset
24 fn read_u32(&self, offset: u16) -> u32;
25
26 /// Write a u32 at the given offset
27 fn write_u32(&mut self, offset: u16, val: u32);
28
29 /// Reset the capability
30 fn reset(&mut self);
31}