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;
|
2020-06-02 02:29:54 +00:00
|
|
|
extern crate hypervisor;
|
2020-05-06 15:50:56 +00:00
|
|
|
extern crate serde;
|
|
|
|
#[macro_use]
|
|
|
|
extern crate serde_derive;
|
|
|
|
extern crate serde_json;
|
2019-04-18 09:59:12 +00:00
|
|
|
extern crate vm_memory;
|
|
|
|
|
2019-06-04 06:51:00 +00:00
|
|
|
mod bus;
|
2019-04-18 09:59:12 +00:00
|
|
|
mod configuration;
|
|
|
|
mod device;
|
2019-07-17 05:01:32 +00:00
|
|
|
mod msi;
|
2019-05-29 23:33:29 +00:00
|
|
|
mod msix;
|
2019-11-08 14:50:39 +00:00
|
|
|
mod vfio;
|
2019-04-18 09:59:12 +00:00
|
|
|
|
2019-09-30 14:23:57 +00:00
|
|
|
pub use self::bus::{PciBus, PciConfigIo, PciConfigMmio, PciRoot, PciRootError};
|
2019-04-18 09:59:12 +00:00
|
|
|
pub use self::configuration::{
|
2021-03-25 17:01:21 +00:00
|
|
|
PciBarConfiguration, PciBarPrefetchable, PciBarRegionType, PciCapability, PciCapabilityId,
|
2019-07-02 15:08:51 +00:00
|
|
|
PciClassCode, PciConfiguration, PciHeaderType, PciMassStorageSubclass,
|
|
|
|
PciNetworkControllerSubclass, PciProgrammingInterface, PciSerialBusSubClass, PciSubclass,
|
2019-04-18 09:59:12 +00:00
|
|
|
};
|
2019-06-04 06:51:00 +00:00
|
|
|
pub use self::device::{
|
2020-01-20 15:41:25 +00:00
|
|
|
BarReprogrammingParams, DeviceRelocation, Error as PciDeviceError, PciDevice,
|
2019-06-04 06:51:00 +00:00
|
|
|
};
|
2020-01-14 22:47:41 +00:00
|
|
|
pub use self::msi::{msi_num_enabled_vectors, MsiCap, MsiConfig};
|
2019-07-17 00:19:21 +00:00
|
|
|
pub use self::msix::{MsixCap, MsixConfig, MsixTableEntry, MSIX_TABLE_ENTRY_SIZE};
|
2019-11-08 14:50:39 +00:00
|
|
|
pub use self::vfio::{VfioPciDevice, VfioPciError};
|
2019-04-18 09:59:12 +00:00
|
|
|
|
|
|
|
/// 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
|
|
|
|
}
|
|
|
|
}
|