1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-04 15:25:17 +02:00

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>
This commit is contained in:
Evan Benn
2022-11-10 16:35:07 +11:00
committed by Edward O'Callaghan
parent 4c8572f103
commit 8528ea0845
2 changed files with 24 additions and 4 deletions

View File

@ -272,10 +272,12 @@ fn partial_lock_test(section: LayoutNames) -> impl Fn(&mut TestEnv) -> TestResul
env.ensure_golden()?;
let (wp_section_name, start, len) = utils::layout_section(env.layout(), section);
// Disable software WP so we can do range protection, but hardware WP
// must remain enabled for (most) range protection to do anything.
env.wp.set_hw(false)?.set_sw(false)?;
env.cmd.wp_range((start, len), true)?;
// Disable hardware WP so we can modify the protected range.
env.wp.set_hw(false)?;
// Then enable software WP so the range is enforced and enable hardware
// WP so that flashrom does not disable software WP during the
// operation.
env.wp.set_range((start, len), true)?;
env.wp.set_hw(true)?;
// Check that we cannot write to the protected region.