pub struct PciRoot {
mmio_bus: Weak<Bus>,
io_bus: Weak<Bus>,
root_bus: Arc<Mutex<PciBus>>,
root_configuration: PciRootConfiguration,
devices: BTreeMap<PciAddress, Arc<Mutex<dyn BusDevice>>>,
pcie_cfg_mmio: Option<u64>,
pci_mmio_state: PciRootMmioState,
}
Expand description
Emulates the PCI Root bridge.
Fields§
§mmio_bus: Weak<Bus>
Memory (MMIO) bus.
io_bus: Weak<Bus>
IO bus (x86 only - for non-x86 platforms, this is just an empty Bus).
root_bus: Arc<Mutex<PciBus>>
Root pci bus (bus 0)
root_configuration: PciRootConfiguration
Bus configuration for the root device.
devices: BTreeMap<PciAddress, Arc<Mutex<dyn BusDevice>>>
Devices attached to this bridge.
pcie_cfg_mmio: Option<u64>
pcie enhanced configuration access mmio base
pci_mmio_state: PciRootMmioState
Implementations§
source§impl PciRoot
impl PciRoot
sourcepub fn new(
vm: &mut impl Vm,
mmio_bus: Weak<Bus>,
mmio_base: GuestAddress,
mmio_register_bit_num: usize,
io_bus: Weak<Bus>,
root_bus: Arc<Mutex<PciBus>>,
) -> Result<Self>
pub fn new( vm: &mut impl Vm, mmio_bus: Weak<Bus>, mmio_base: GuestAddress, mmio_register_bit_num: usize, io_bus: Weak<Bus>, root_bus: Arc<Mutex<PciBus>>, ) -> Result<Self>
Create an empty PCI root bus.
fn create_for_test( mmio_bus: Weak<Bus>, mmio_base: GuestAddress, mmio_register_bit_num: usize, io_bus: Weak<Bus>, root_bus: Arc<Mutex<PciBus>>, ) -> Self
sourcepub fn get_root_bus(&self) -> Arc<Mutex<PciBus>>
pub fn get_root_bus(&self) -> Arc<Mutex<PciBus>>
Get the root pci bus
sourcepub fn acpi_path(&self, address: &PciAddress) -> Option<String>
pub fn acpi_path(&self, address: &PciAddress) -> Option<String>
Get the ACPI path to a PCI device
sourcepub fn enable_pcie_cfg_mmio(&mut self, pcie_cfg_mmio: u64)
pub fn enable_pcie_cfg_mmio(&mut self, pcie_cfg_mmio: u64)
enable pcie enhanced configuration access and set base mmio
sourcepub fn add_device<T>(
&mut self,
address: PciAddress,
device: Arc<Mutex<dyn BusDevice>>,
mapper: &mut T,
) -> Result<(), Error>where
T: PciMmioMapper,
pub fn add_device<T>(
&mut self,
address: PciAddress,
device: Arc<Mutex<dyn BusDevice>>,
mapper: &mut T,
) -> Result<(), Error>where
T: PciMmioMapper,
Add a device
to this root PCI bus.
fn sync_multifunction_bit_to_mmio_mappings( &mut self, address: &PciAddress, on_add: bool, )
pub fn add_bridge( &mut self, bridge_bus: Arc<Mutex<PciBus>>, ) -> Result<(), Error>
pub fn remove_device(&mut self, address: PciAddress)
pub fn config_space_read(&self, address: PciAddress, register: usize) -> u32
pub fn config_space_write( &mut self, address: PciAddress, register: usize, offset: u64, data: &[u8], )
pub fn virtual_config_space_read( &self, address: PciAddress, register: usize, ) -> u32
pub fn virtual_config_space_write( &mut self, address: PciAddress, register: usize, value: u32, )
pub fn snapshot(&mut self) -> Result<AnySnapshot>
pub fn restore(&mut self, data: AnySnapshot) -> Result<()>
fn num_multifunction_device(&self, address: &PciAddress) -> usize
Auto Trait Implementations§
impl Freeze for PciRoot
impl !RefUnwindSafe for PciRoot
impl Send for PciRoot
impl !Sync for PciRoot
impl Unpin for PciRoot
impl !UnwindSafe for PciRoot
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.