devices: Add pci_types

Start PCI work by defining an enum to represent the four PCI interrupt
lines.

Change-Id: Ib95a4e4a03f0d6917ed2bed4b1afb97d18ff4f9e
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1072573
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
This commit is contained in:
Dylan Reid 2018-05-24 19:19:22 +00:00 committed by chrome-bot
parent 228e4a6a91
commit 9b871c2db3
2 changed files with 22 additions and 0 deletions

View file

@ -20,6 +20,7 @@ extern crate vm_control;
mod bus;
mod cmos;
mod i8042;
mod pci;
mod proxy;
mod serial;
pub mod pl030;
@ -29,6 +30,7 @@ pub use self::bus::{Bus, BusDevice};
pub use self::cmos::Cmos;
pub use self::pl030::Pl030;
pub use self::i8042::I8042Device;
pub use self::pci::PciInterruptPin;
pub use self::proxy::ProxyDevice;
pub use self::proxy::Error as ProxyError;
pub use self::serial::Serial;

20
devices/src/pci/mod.rs Normal file
View file

@ -0,0 +1,20 @@
// Copyright 2018 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//! Implements pci devices and busses.
/// 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
}
}