1 // Copyright 2018 The Chromium OS Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE-BSD-3-Clause file. 4 5 //! Implements pci devices and busses. 6 #[macro_use] 7 extern crate log; 8 9 mod bus; 10 mod configuration; 11 mod device; 12 mod msi; 13 mod msix; 14 mod vfio; 15 mod vfio_user; 16 17 pub use self::bus::{PciBus, PciConfigIo, PciConfigMmio, PciRoot, PciRootError}; 18 pub use self::configuration::{ 19 PciBarConfiguration, PciBarPrefetchable, PciBarRegionType, PciCapability, PciCapabilityId, 20 PciClassCode, PciConfiguration, PciHeaderType, PciMassStorageSubclass, 21 PciNetworkControllerSubclass, PciProgrammingInterface, PciSerialBusSubClass, PciSubclass, 22 }; 23 pub use self::device::{ 24 BarReprogrammingParams, DeviceRelocation, Error as PciDeviceError, PciDevice, 25 }; 26 pub use self::msi::{msi_num_enabled_vectors, MsiCap, MsiConfig}; 27 pub use self::msix::{MsixCap, MsixConfig, MsixTableEntry, MSIX_TABLE_ENTRY_SIZE}; 28 pub use self::vfio::{VfioPciDevice, VfioPciError}; 29 pub use self::vfio_user::{VfioUserPciDevice, VfioUserPciDeviceError}; 30 31 /// PCI has four interrupt pins A->D. 32 #[derive(Copy, Clone)] 33 pub enum PciInterruptPin { 34 IntA, 35 IntB, 36 IntC, 37 IntD, 38 } 39 40 impl PciInterruptPin { 41 pub fn to_mask(self) -> u32 { 42 self as u32 43 } 44 } 45