diff --git a/tool/Cargo.toml b/tool/Cargo.toml index dd1fd384..4a829ad4 100644 --- a/tool/Cargo.toml +++ b/tool/Cargo.toml @@ -20,9 +20,11 @@ clap = { version = "4.5", features = ["derive"], optional = true } libc = { version = "0.2", optional = true } # NOTE: Upgrading to 2.x blocked on Ubuntu shipping newer hidapi hidapi = { version = "1.5", default-features = false, features = ["linux-shared-hidraw"], optional = true } -redox_hwio = { version = "0.1.6", default-features = false, optional = true } downcast-rs = { version = "1.2.0", default-features = false } +[target.'cfg(any(target_arch = "x86", target_arch = "x86_64"))'.dependencies] +redox_hwio = { version = "0.1.6", default-features = false, optional = true } + [features] default = ["std", "hidapi", "clap"] std = ["libc", "downcast-rs/std"] diff --git a/tool/src/access/mod.rs b/tool/src/access/mod.rs index dad44334..da6bc5e7 100644 --- a/tool/src/access/mod.rs +++ b/tool/src/access/mod.rs @@ -11,9 +11,15 @@ pub use self::hid::AccessHid; #[cfg(feature = "hidapi")] mod hid; -#[cfg(any(feature = "redox_hwio", all(feature = "std", target_os = "linux")))] +#[cfg(all( + any(target_arch = "x86", target_arch = "x86_64"), + any(feature = "redox_hwio", all(feature = "std", target_os = "linux")) +))] pub use self::lpc::*; -#[cfg(any(feature = "redox_hwio", all(feature = "std", target_os = "linux")))] +#[cfg(all( + any(target_arch = "x86", target_arch = "x86_64"), + any(feature = "redox_hwio", all(feature = "std", target_os = "linux")) +))] mod lpc; /// Access method for running an EC command diff --git a/tool/src/lib.rs b/tool/src/lib.rs index 72bd0df6..129a662b 100644 --- a/tool/src/lib.rs +++ b/tool/src/lib.rs @@ -6,13 +6,12 @@ //! //! There are some differences between targets and features that are listed below: //! - `AccessHid` requires the `hidapi` feature. Only functional on USB ECs. -//! - `AccessLpcDirect` requires the `redox_hwio` feature and a nightly compiler. This method is +//! - `AccessLpcDirect` requires the `redox_hwio` feature and an x86 target. This method is //! only recommended for use in firmware with LPC ECs, as mutual exclusion is not guaranteed. -//! - `AccessLpcLinux` requires the `std` feature and `linux` target_os. Recommended for LPC ECs, -//! as this method can utilize mutual exclusion. -//! - `EcLegacy`, `Pmc`, and `SuperIo` all require the `redox_hwio` feature and a nightly -//! compiler. It is only recommended to use these in firmware, as mutual exclusion is not -//! guaranteed. +//! - `AccessLpcLinux` requires the `std` feature, `linux` target_os, and x86 target. Recommended +//! for LPC ECs, as this method can utilize mutual exclusion. +//! - `EcLegacy`, `Pmc`, and `SuperIo` all require the `redox_hwio` feature and an x86 target. +//! It is only recommended to use these in firmware, as mutual exclusion is not guaranteed. #![allow(clippy::missing_safety_doc)] #![allow(clippy::needless_range_loop)] @@ -33,22 +32,40 @@ mod error; pub use self::firmware::Firmware; mod firmware; -#[cfg(feature = "redox_hwio")] +#[cfg(all( + feature = "redox_hwio", + any(target_arch = "x86", target_arch = "x86_64") +))] pub use self::legacy::EcLegacy; -#[cfg(feature = "redox_hwio")] +#[cfg(all( + feature = "redox_hwio", + any(target_arch = "x86", target_arch = "x86_64") +))] mod legacy; -#[cfg(feature = "redox_hwio")] +#[cfg(all( + feature = "redox_hwio", + any(target_arch = "x86", target_arch = "x86_64") +))] pub use self::pmc::Pmc; -#[cfg(feature = "redox_hwio")] +#[cfg(all( + feature = "redox_hwio", + any(target_arch = "x86", target_arch = "x86_64") +))] mod pmc; pub use self::spi::{Spi, SpiRom, SpiTarget}; mod spi; -#[cfg(feature = "redox_hwio")] +#[cfg(all( + feature = "redox_hwio", + any(target_arch = "x86", target_arch = "x86_64") +))] pub use self::super_io::SuperIo; -#[cfg(feature = "redox_hwio")] +#[cfg(all( + feature = "redox_hwio", + any(target_arch = "x86", target_arch = "x86_64") +))] mod super_io; #[cfg(feature = "std")]