2019-04-18 09:59:12 +00:00
|
|
|
// Copyright 2018 The Chromium OS Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
2019-05-08 10:22:53 +00:00
|
|
|
// found in the LICENSE-BSD-3-Clause file.
|
2019-04-18 09:59:12 +00:00
|
|
|
|
|
|
|
//! Implements pci devices and busses.
|
|
|
|
#[macro_use]
|
|
|
|
extern crate log;
|
|
|
|
extern crate devices;
|
|
|
|
extern crate kvm_ioctls;
|
|
|
|
extern crate vm_memory;
|
|
|
|
extern crate vmm_sys_util;
|
|
|
|
|
|
|
|
mod configuration;
|
|
|
|
mod device;
|
2019-05-29 23:33:29 +00:00
|
|
|
mod msix;
|
2019-04-18 09:59:12 +00:00
|
|
|
mod root;
|
|
|
|
|
|
|
|
pub use self::configuration::{
|
|
|
|
PciBarConfiguration, PciBarPrefetchable, PciBarRegionType, PciCapability, PciCapabilityID,
|
|
|
|
PciClassCode, PciConfiguration, PciHeaderType, PciProgrammingInterface, PciSerialBusSubClass,
|
|
|
|
PciSubclass,
|
|
|
|
};
|
|
|
|
pub use self::device::Error as PciDeviceError;
|
2019-05-29 23:33:29 +00:00
|
|
|
pub use self::device::{IrqClosure, MsixClosure, PciDevice};
|
|
|
|
pub use self::msix::{MsixCap, MsixConfig, MsixTableEntry};
|
2019-04-18 09:59:12 +00:00
|
|
|
pub use self::root::{PciConfigIo, PciConfigMmio, PciRoot, PciRootError};
|
|
|
|
|
|
|
|
/// PCI has four interrupt pins A->D.
|
|
|
|
#[derive(Copy, Clone)]
|
|
|
|
pub enum PciInterruptPin {
|
|
|
|
IntA,
|
|
|
|
IntB,
|
|
|
|
IntC,
|
|
|
|
IntD,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl PciInterruptPin {
|
|
|
|
pub fn to_mask(self) -> u32 {
|
|
|
|
self as u32
|
|
|
|
}
|
|
|
|
}
|