Attention is currently required from: Thomas Heijligen, Alexander Goncharov.
Felix Singer has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/69442 )
Change subject: Makefile: add `uninstall` target
......................................................................
Patch Set 1: Code-Review-2
(1 comment)
Patchset:
PS1:
As mentioned in my mail, the Make build system is deprecated by us and we decided to not add any more functionality to it. Please use the Meson build system.
--
To view, visit https://review.coreboot.org/c/flashrom/+/69442
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I04c4f8ac5ec8ffb715b2cc3104521b90b76d7e3a
Gerrit-Change-Number: 69442
Gerrit-PatchSet: 1
Gerrit-Owner: Alexander Goncharov <chat(a)joursoir.net>
Gerrit-Reviewer: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: Thomas Heijligen <src(a)posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Nico Huber <nico.h(a)gmx.de>
Gerrit-CC: Richard Hughes <hughsient(a)gmail.com>
Gerrit-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Alexander Goncharov <chat(a)joursoir.net>
Gerrit-Comment-Date: Thu, 10 Nov 2022 16:48:05 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Alexander Goncharov has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/69442 )
Change subject: Makefile: add `uninstall` target
......................................................................
Makefile: add `uninstall` target
This target will delete all the installed files (the copies that the
`install` target create).
According to GNU Makefile documentation, `uninstall` is standard
target. Part of flashrom's users will expect this target to be realized.
Change-Id: I04c4f8ac5ec8ffb715b2cc3104521b90b76d7e3a
Signed-off-by: Alexander Goncharov <chat(a)joursoir.net>
---
M Makefile
1 file changed, 21 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/42/69442/1
diff --git a/Makefile b/Makefile
index 425b58c..c0a3bc8 100644
--- a/Makefile
+++ b/Makefile
@@ -993,6 +993,11 @@
$(INSTALL) -m 0755 $(PROGRAM)$(EXEC_SUFFIX) $(DESTDIR)$(PREFIX)/sbin
$(INSTALL) -m 0644 $(PROGRAM).8 $(DESTDIR)$(MANDIR)/man8
+uninstall:
+ @rm -v \
+ "$(DESTDIR)$(PREFIX)/sbin/$(PROGRAM)$(EXEC_SUFFIX)" \
+ "$(DESTDIR)$(MANDIR)/man8/$(PROGRAM).8"
+
libinstall: libflashrom.a include/libflashrom.h
mkdir -p $(DESTDIR)$(PREFIX)/lib
$(INSTALL) -m 0644 libflashrom.a $(DESTDIR)$(PREFIX)/lib
--
To view, visit https://review.coreboot.org/c/flashrom/+/69442
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I04c4f8ac5ec8ffb715b2cc3104521b90b76d7e3a
Gerrit-Change-Number: 69442
Gerrit-PatchSet: 1
Gerrit-Owner: Alexander Goncharov <chat(a)joursoir.net>
Gerrit-MessageType: newchange
Attention is currently required from: Nico Huber, Thomas Heijligen, Aarya, Anastasia Klimchuk.
Simon Buhrow has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/66104 )
Change subject: flashrom.c: Add wrapper function to use the erase algorithm
......................................................................
Patch Set 67:
(1 comment)
File flashrom.c:
https://review.coreboot.org/c/flashrom/+/66104/comment/5f012e68_3ad04ba9
PS67, Line 1151: flashctx->chip->read(flashctx, curcontents + region_start, region_start, old_start - region_start);
> When I am running unit test CB:67535 it logs repeated invocations of reads with len==0 for all scena […]
What about checking if boundarys have been aligned? This would save the unnecessary read invocations and would make the code easier to understand as well (as l. 1148 to 1158 are only necessary in case of alignment).
--
To view, visit https://review.coreboot.org/c/flashrom/+/66104
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I29e3f2bd796759794184b125741a5abaac6f3ce8
Gerrit-Change-Number: 66104
Gerrit-PatchSet: 67
Gerrit-Owner: Aarya <aarya.chaumal(a)gmail.com>
Gerrit-Reviewer: Simon Buhrow
Gerrit-Reviewer: Thomas Heijligen <src(a)posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-CC: Nico Huber <nico.h(a)gmx.de>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Aarya <aarya.chaumal(a)gmail.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Thu, 10 Nov 2022 09:37:23 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: comment
Attention is currently required from: Nikolai Artemiev.
Evan Benn has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/69417 )
Change subject: flashrom_tester: Change the wp_toggle semantics
......................................................................
Patch Set 1:
(1 comment)
File util/flashrom_tester/flashrom/src/lib.rs:
https://review.coreboot.org/c/flashrom/+/69417/comment/02bd0be9_768d8af9
PS1, Line 148: /// This is the only supported behaviour from MTD
need better comment about MTD
--
To view, visit https://review.coreboot.org/c/flashrom/+/69417
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ia01d612d988e6580a7c5f0fd448ccc319ce9b181
Gerrit-Change-Number: 69417
Gerrit-PatchSet: 1
Gerrit-Owner: Evan Benn <evanbenn(a)google.com>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-CC: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Attention: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Comment-Date: Thu, 10 Nov 2022 05:41:17 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Evan Benn has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/69418 )
Change subject: flashrom_tester: partial_lock: Use WriteProtectState cache
......................................................................
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(a)chromium.org>
---
M util/flashrom_tester/src/tester.rs
M util/flashrom_tester/src/tests.rs
2 files changed, 43 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/18/69418/1
diff --git a/util/flashrom_tester/src/tester.rs b/util/flashrom_tester/src/tester.rs
index a97204d..3485a50 100644
--- a/util/flashrom_tester/src/tester.rs
+++ b/util/flashrom_tester/src/tester.rs
@@ -244,6 +244,24 @@
}
}
+ // 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);
diff --git a/util/flashrom_tester/src/tests.rs b/util/flashrom_tester/src/tests.rs
index 60f1c6e..996ce0e 100644
--- a/util/flashrom_tester/src/tests.rs
+++ b/util/flashrom_tester/src/tests.rs
@@ -271,10 +271,12 @@
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.
--
To view, visit https://review.coreboot.org/c/flashrom/+/69418
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ic3f89ff5d22e74e4e6c94e755b936e58cb27182d
Gerrit-Change-Number: 69418
Gerrit-PatchSet: 1
Gerrit-Owner: Evan Benn <evanbenn(a)google.com>
Gerrit-MessageType: newchange
Evan Benn has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/69417 )
Change subject: flashrom_tester: Change the wp_toggle semantics
......................................................................
flashrom_tester: Change the wp_toggle semantics
wp_toggle and wp_range had some confusing behaviour where enabling wp
would set a range, but disabling wp would not unset the range
(explicitly). This was a way to workaround the MTD kernel driver
semantics. Now make things very explicit, enabling software write
protect will set the range to the whole chip. Disabling write protect
will set the range to 0,0. This makes all drivers behave the same as
MTD, and documents the exact behaviour explicitly.
BUG=b:244663741
BRANCH=None
TEST=flashrom_tester --libflashrom host # MTD and non-MTD
TEST=flashrom_tester --flashrom_binary # MTD and non-MTD
Change-Id: Ia01d612d988e6580a7c5f0fd448ccc319ce9b181
Signed-off-by: Evan Benn <evanbenn(a)chromium.org>
---
M util/flashrom_tester/flashrom/src/cmd.rs
M util/flashrom_tester/flashrom/src/flashromlib.rs
M util/flashrom_tester/flashrom/src/lib.rs
3 files changed, 34 insertions(+), 24 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/17/69417/1
diff --git a/util/flashrom_tester/flashrom/src/cmd.rs b/util/flashrom_tester/flashrom/src/cmd.rs
index 4078910..458f054 100644
--- a/util/flashrom_tester/flashrom/src/cmd.rs
+++ b/util/flashrom_tester/flashrom/src/cmd.rs
@@ -149,11 +149,12 @@
Ok(true)
}
- fn wp_range(&self, range: (i64, i64), wp_enable: bool) -> Result<bool, FlashromError> {
+ fn wp_range(&self, range: (i64, i64), en: bool) -> Result<bool, FlashromError> {
let opts = FlashromOpt {
wp_opt: WPOpt {
+ enable: en,
+ disable: !en,
range: Some(range),
- enable: wp_enable,
..Default::default()
},
..Default::default()
@@ -200,28 +201,14 @@
}
fn wp_toggle(&self, en: bool) -> Result<bool, FlashromError> {
- let status = if en { "en" } else { "dis" };
-
- // For MTD, --wp-range and --wp-enable must be used simultaneously.
let range = if en {
let rom_sz: i64 = self.get_size()?;
- Some((0, rom_sz)) // (start, len)
+ (0, rom_sz) // (start, len)
} else {
- None
+ (0, 0)
};
-
- let opts = FlashromOpt {
- wp_opt: WPOpt {
- range,
- enable: en,
- disable: !en,
- ..Default::default()
- },
- ..Default::default()
- };
-
- self.dispatch(opts, "wp_toggle")?;
-
+ self.wp_range(range, en)?;
+ let status = if en { "en" } else { "dis" };
match self.wp_status(true) {
Ok(_ret) => {
info!("Successfully {}abled write-protect", status);
diff --git a/util/flashrom_tester/flashrom/src/flashromlib.rs b/util/flashrom_tester/flashrom/src/flashromlib.rs
index 3036394..c948564 100644
--- a/util/flashrom_tester/flashrom/src/flashromlib.rs
+++ b/util/flashrom_tester/flashrom/src/flashromlib.rs
@@ -102,9 +102,6 @@
}
fn wp_toggle(&self, en: bool) -> Result<bool, FlashromError> {
- // TODO why does the cmd impl not do this?
- // for cmd, range is only set for enable
- // and disable is not sent for the wp_range command
self.wp_range((0, self.get_size()?), en)
}
diff --git a/util/flashrom_tester/flashrom/src/lib.rs b/util/flashrom_tester/flashrom/src/lib.rs
index 11874f9..f84dea5 100644
--- a/util/flashrom_tester/flashrom/src/lib.rs
+++ b/util/flashrom_tester/flashrom/src/lib.rs
@@ -133,7 +133,7 @@
/// Write only a region of the flash.
fn write_file_with_layout(&self, rws: &ROMWriteSpecifics) -> Result<bool, FlashromError>;
- /// Set write protect status for a range.
+ /// Set write protect status and range.
fn wp_range(&self, range: (i64, i64), wp_enable: bool) -> Result<bool, FlashromError>;
/// Read the write protect regions for the flash.
@@ -143,6 +143,9 @@
fn wp_status(&self, en: bool) -> Result<bool, FlashromError>;
/// Set write protect status.
+ /// If en=true sets wp_range to the whole chip (0,getsize()).
+ /// If en=false sets wp_range to (0,0).
+ /// This is the only supported behaviour from MTD
fn wp_toggle(&self, en: bool) -> Result<bool, FlashromError>;
/// Read the whole flash to the file specified by `path`.
--
To view, visit https://review.coreboot.org/c/flashrom/+/69417
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ia01d612d988e6580a7c5f0fd448ccc319ce9b181
Gerrit-Change-Number: 69417
Gerrit-PatchSet: 1
Gerrit-Owner: Evan Benn <evanbenn(a)google.com>
Gerrit-MessageType: newchange
Attention is currently required from: Peter Marheine.
Evan Benn has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/69402 )
Change subject: flashrom_tester: Check the WP state when setting
......................................................................
Patch Set 4:
(1 comment)
File util/flashrom_tester/src/tester.rs:
https://review.coreboot.org/c/flashrom/+/69402/comment/e09d18f8_01f80184
PS4, Line 238: let actual_state = Self::get_sw(self.cmd).map_err(|e| e.to_string())?;
Aha I have discovered a bug with this. The `cmd` also has `wp_range` function, which is a bit strange and maybe enables wp but doesnt disable wp? anyway it bypasses the stored state here.
--
To view, visit https://review.coreboot.org/c/flashrom/+/69402
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ie7f90ab478dca6f92eaa0908443e3cb156ea0319
Gerrit-Change-Number: 69402
Gerrit-PatchSet: 4
Gerrit-Owner: Evan Benn <evanbenn(a)google.com>
Gerrit-Reviewer: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Nikolai Artemiev <nartemiev(a)chromium.org>
Gerrit-Attention: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Comment-Date: Thu, 10 Nov 2022 03:39:33 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Nikolai Artemiev.
Hello build bot (Jenkins), Edward O'Callaghan,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/69422
to look at the new patch set (#2).
Change subject: ichspi: clear byte count in ich_start_hwseq_xfer()
......................................................................
ichspi: clear byte count in ich_start_hwseq_xfer()
This fixes a regression introduced by a ichspi driver refactor in
`commit 7ed1337309d3fe74f5af09520970f0f1d417399a`
When preparing for a hwseq transfer in ich_start_hwseq_xfer(), clear the
HSFC_FDBC bits before setting the new byte count. Otherwise the old byte
count bits remain set, resulting in too many bytes being transferred.
In particular this causes status register read/write operations to fail,
and probably causes issues in other hwseq operations as well.
BUG=b:257845782,b:258280679
BRANCH=none
TEST=flashrom {--wp-enable,--wp-disable}
Change-Id: I2535bdfb77ff370bddcb507a229bbf4119681cdf
Signed-off-by: Nikolai Artemiev <nartemiev(a)google.com>
---
M ichspi.c
1 file changed, 25 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/22/69422/2
--
To view, visit https://review.coreboot.org/c/flashrom/+/69422
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I2535bdfb77ff370bddcb507a229bbf4119681cdf
Gerrit-Change-Number: 69422
Gerrit-PatchSet: 2
Gerrit-Owner: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Subrata Banik <subratabanik(a)google.com>
Gerrit-Attention: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-MessageType: newpatchset