aboutsummaryrefslogtreecommitdiffstats
path: root/util/flashrom_tester/src/tester.rs
diff options
context:
space:
mode:
authorEvan Benn <evanbenn@chromium.org>2022-11-10 16:35:07 +1100
committerEdward O'Callaghan <quasisec@chromium.org>2022-11-24 03:33:34 +0000
commit8528ea0845171a4b26de44757d5b30c9727e8d5b (patch)
tree9d0710a43f3e42af20f022346e4d4ada2ee84daf /util/flashrom_tester/src/tester.rs
parent4c8572f103989232b9a24c319c40c12cba2bde97 (diff)
downloadflashrom-8528ea0845171a4b26de44757d5b30c9727e8d5b.tar.gz
flashrom-8528ea0845171a4b26de44757d5b30c9727e8d5b.tar.bz2
flashrom-8528ea0845171a4b26de44757d5b30c9727e8d5b.zip
flashrom_tester: partial_lock: Use WriteProtectState cache
partial_lock test was bypassing the WriteProtectState cache of the software write protect by directly calling env.cmd.wp_range. It was also unnesesarily disabling software WP. Fix those issues and more clearly document what the test is doing and expecting. BUG=b:244663741 BRANCH=None TEST=flashrom_tester --libflashrom host Change-Id: Ic3f89ff5d22e74e4e6c94e755b936e58cb27182d Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/69418 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'util/flashrom_tester/src/tester.rs')
-rw-r--r--util/flashrom_tester/src/tester.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/util/flashrom_tester/src/tester.rs b/util/flashrom_tester/src/tester.rs
index d19e45cf..1fa44a84 100644
--- a/util/flashrom_tester/src/tester.rs
+++ b/util/flashrom_tester/src/tester.rs
@@ -246,6 +246,24 @@ impl<'a> WriteProtectState<'a> {
}
}
+ // Set software write protect with a custom range
+ pub fn set_range(&mut self, range: (i64, i64), enable: bool) -> Result<&mut Self, String> {
+ info!("set_range request={}, current={}", enable, self.current.sw);
+ self.cmd
+ .wp_range(range, enable)
+ .map_err(|e| e.to_string())?;
+ let actual_state = Self::get_sw(self.cmd).map_err(|e| e.to_string())?;
+ if actual_state != enable {
+ Err(format!(
+ "set_range request={}, real={}",
+ enable, actual_state
+ ))
+ } else {
+ self.current.sw = enable;
+ Ok(self)
+ }
+ }
+
/// Set the hardware write protect if supported and check that the state is as expected.
pub fn set_hw(&mut self, enable: bool) -> Result<&mut Self, String> {
info!("set_hw request={}, current={}", enable, self.current.hw);