summaryrefslogtreecommitdiffstats
path: root/util/flashrom_tester
diff options
context:
space:
mode:
authorNikolai Artemiev <nartemiev@google.com>2022-11-23 10:17:56 +1100
committerEdward O'Callaghan <quasisec@chromium.org>2022-12-21 03:59:50 +0000
commit8b0250b32b89a54df16989369c0cb8330d86cb77 (patch)
treee55259c6fedd23af7998650726ff759cac90afb3 /util/flashrom_tester
parentff5beeef409515d0db84f1e902388590f5b15c44 (diff)
downloadflashrom-8b0250b32b89a54df16989369c0cb8330d86cb77.tar.gz
flashrom-8b0250b32b89a54df16989369c0cb8330d86cb77.tar.bz2
flashrom-8b0250b32b89a54df16989369c0cb8330d86cb77.zip
flashrom_tester: Drop dediprog, ec, and servo targets
None of these targets have been maintained or used for several years: dediprog: - Wasn't accepted by the argument filter in main.rs. ec: - Is incompatible with most tests because the EC only supports one protection range. servo: - Has been broken for >3 years because it uses the programmer string "ft2231_spi:type=servo-v2", where "ft2231" should be "ft2232". BUG=b:239357853 BRANCH=none TEST=flashrom_tester on dedede Change-Id: Iee94f6bb5ff8c5451acb8bcaabf28119006d0ef5 Signed-off-by: Nikolai Artemiev <nartemiev@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/69921 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Diffstat (limited to 'util/flashrom_tester')
-rw-r--r--util/flashrom_tester/flashrom/src/cmd.rs29
-rw-r--r--util/flashrom_tester/flashrom/src/lib.rs14
-rw-r--r--util/flashrom_tester/src/main.rs2
-rw-r--r--util/flashrom_tester/src/tester.rs9
4 files changed, 3 insertions, 51 deletions
diff --git a/util/flashrom_tester/flashrom/src/cmd.rs b/util/flashrom_tester/flashrom/src/cmd.rs
index 458f05405..f24a2c95f 100644
--- a/util/flashrom_tester/flashrom/src/cmd.rs
+++ b/util/flashrom_tester/flashrom/src/cmd.rs
@@ -391,35 +391,6 @@ fn flashrom_dispatch<S: AsRef<OsStr>>(
Ok((stdout.into(), stderr.into()))
}
-pub fn dut_ctrl_toggle_wp(en: bool) -> Result<(Vec<u8>, Vec<u8>), FlashromError> {
- let args = if en {
- ["fw_wp_en:off", "fw_wp:on"]
- } else {
- ["fw_wp_en:on", "fw_wp:off"]
- };
- dut_ctrl(&args)
-}
-
-fn dut_ctrl(args: &[&str]) -> Result<(Vec<u8>, Vec<u8>), FlashromError> {
- let output = match Command::new("dut-control").args(args).output() {
- Ok(x) => x,
- Err(e) => return Err(format!("Failed to run dut-control: {}", e).into()),
- };
- if !output.status.success() {
- // There is two cases on failure;
- // i. ) A bad exit code,
- // ii.) A SIG killed us.
- match output.status.code() {
- Some(code) => {
- return Err(format!("Exited with error code: {}", code).into());
- }
- None => return Err("Process terminated by a signal".into()),
- }
- }
-
- Ok((output.stdout, output.stderr))
-}
-
fn hex_range_string(s: i64, l: i64) -> String {
format!("{:#08X},{:#08X}", s, l)
}
diff --git a/util/flashrom_tester/flashrom/src/lib.rs b/util/flashrom_tester/flashrom/src/lib.rs
index 90e40e2cc..6b0cca36e 100644
--- a/util/flashrom_tester/flashrom/src/lib.rs
+++ b/util/flashrom_tester/flashrom/src/lib.rs
@@ -41,7 +41,7 @@ mod flashromlib;
use std::{error, fmt, path::Path};
-pub use cmd::{dut_ctrl_toggle_wp, FlashromCmd};
+pub use cmd::FlashromCmd;
pub use flashromlib::FlashromLib;
pub use libflashrom::{
@@ -51,28 +51,19 @@ pub use libflashrom::{
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum FlashChip {
- EC,
HOST,
- SERVO,
- DEDIPROG,
}
impl FlashChip {
pub fn from(s: &str) -> Result<FlashChip, &str> {
match s {
- "ec" => Ok(FlashChip::EC),
"host" => Ok(FlashChip::HOST),
- "servo" => Ok(FlashChip::SERVO),
- "dediprog" => Ok(FlashChip::DEDIPROG),
_ => Err("cannot convert str to enum"),
}
}
pub fn to(fc: FlashChip) -> &'static str {
match fc {
- FlashChip::EC => "ec",
FlashChip::HOST => "host",
- FlashChip::SERVO => "ft2231_spi:type=servo-v2",
- FlashChip::DEDIPROG => "dediprog",
}
}
@@ -89,8 +80,7 @@ impl FlashChip {
/// disabled.
pub fn can_control_hw_wp(&self) -> bool {
match self {
- FlashChip::HOST | FlashChip::EC => true,
- FlashChip::SERVO | FlashChip::DEDIPROG => false,
+ FlashChip::HOST => true,
}
}
}
diff --git a/util/flashrom_tester/src/main.rs b/util/flashrom_tester/src/main.rs
index 129d1a9b7..44429ba86 100644
--- a/util/flashrom_tester/src/main.rs
+++ b/util/flashrom_tester/src/main.rs
@@ -83,7 +83,7 @@ fn main() {
.arg(
Arg::with_name("ccd_target_type")
.required(true)
- .possible_values(&["host", "ec", "servo"]),
+ .possible_values(&["host"]),
)
.arg(
Arg::with_name("print-layout")
diff --git a/util/flashrom_tester/src/tester.rs b/util/flashrom_tester/src/tester.rs
index 1fa44a84a..4629c2eb7 100644
--- a/util/flashrom_tester/src/tester.rs
+++ b/util/flashrom_tester/src/tester.rs
@@ -96,19 +96,10 @@ impl<'a> TestEnv<'a> {
}
pub fn run_test<T: TestCase>(&mut self, test: T) -> TestResult {
- let use_dut_control = self.chip_type == FlashChip::SERVO;
- if use_dut_control && flashrom::dut_ctrl_toggle_wp(false).is_err() {
- error!("failed to dispatch dut_ctrl_toggle_wp()!");
- }
-
let name = test.get_name();
info!("Beginning test: {}", name);
let out = test.run(self);
info!("Completed test: {}; result {:?}", name, out);
-
- if use_dut_control && flashrom::dut_ctrl_toggle_wp(true).is_err() {
- error!("failed to dispatch dut_ctrl_toggle_wp()!");
- }
out
}