Attention is currently required from: Anton Samsonov.
Alexander Goncharov has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/77089?usp=email )
Change subject: Remove dependency on C23 __has_include()
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
Thanks for the patch! Can you please provide what compiler and version you used to test this patch? It would be great to include that in the commit message.
--
To view, visit https://review.coreboot.org/c/flashrom/+/77089?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ic544963ffd29626ae0a21bdddb1c78850cc43ec6
Gerrit-Change-Number: 77089
Gerrit-PatchSet: 1
Gerrit-Owner: Anton Samsonov <devel(a)zxlab.ru>
Gerrit-Reviewer: Alexander Goncharov <chat(a)joursoir.net>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Attention: Anton Samsonov <devel(a)zxlab.ru>
Gerrit-Comment-Date: Thu, 31 Aug 2023 07:15:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Nikolai Artemiev has submitted this change. ( https://review.coreboot.org/c/flashrom/+/75991?usp=email )
Change subject: flashrom: only perform WP unlock for write/erase operations
......................................................................
flashrom: only perform WP unlock for write/erase operations
Don't unlock using WP for read/verify operations because WP will only
disable write locks. Most chips don't have read locks anyway, but some
do, so we still call the chip's unlock function for read/verify
operations.
Unconditionally unlocking using WP slows down flashrom significantly
with some programmers, particularly linux_mtd due to inefficiency in the
current kernel MTD interface.
BUG=b:283779258
BRANCH=none
TEST=`ninja test`
TEST=`flashrom -{r,w,E,v}` on strongbad
TEST=`flashrom --wp-enable; flashrom -{w,E}` on strongbad
Change-Id: I5dc66474a0b7969b51b86ac9f5daa2c95ae968f1
Signed-off-by: Nikolai Artemiev <nartemiev(a)google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/75991
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec(a)chromium.org>
---
M flashrom.c
1 file changed, 41 insertions(+), 11 deletions(-)
Approvals:
build bot (Jenkins): Verified
Edward O'Callaghan: Looks good to me, approved
diff --git a/flashrom.c b/flashrom.c
index b6e5cf8..630c69d 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -2052,24 +2052,49 @@
return 0;
}
-static int unlock_flash_wp(struct flashctx *const flash)
+static int unlock_flash_wp(struct flashctx *const flash,
+ const bool write_it, const bool erase_it)
+
{
- /* Save original WP state to be restored later */
- if (save_initial_flash_wp(flash))
+ int ret = 0;
+
+ /* WP only disables write protection, so only use WP to unlock
+ * for write/erase operations.
+ *
+ * For read/verify operations, we still call the chip's unlock
+ * function, which may disable read locks if the chip has them.
+ */
+ if (!write_it && !erase_it) {
+ msg_cdbg("Skipping writeprotect-based unlocking for read/verify operations.\n");
return -1;
+ }
+
+ /* Save original WP state to be restored later */
+ if (save_initial_flash_wp(flash)) {
+ ret = -1;
+ goto warn_out;
+ }
/* Disable WP */
struct flashrom_wp_cfg *unlocked_wp_cfg;
- if (flashrom_wp_cfg_new(&unlocked_wp_cfg) != FLASHROM_WP_OK)
- return -1;
+ if (flashrom_wp_cfg_new(&unlocked_wp_cfg) != FLASHROM_WP_OK) {
+ ret = -1;
+ goto warn_out;
+ }
flashrom_wp_set_range(unlocked_wp_cfg, 0, 0);
flashrom_wp_set_mode(unlocked_wp_cfg, FLASHROM_WP_MODE_DISABLED);
- enum flashrom_wp_result ret = flashrom_wp_write_cfg(flash, unlocked_wp_cfg);
+ if (flashrom_wp_write_cfg(flash, unlocked_wp_cfg) != FLASHROM_WP_OK) {
+ ret = -1;
+ }
flashrom_wp_cfg_release(unlocked_wp_cfg);
- return (ret == FLASHROM_WP_OK) ? 0 : -1;
+warn_out:
+ if (ret)
+ msg_cerr("Failed to unlock flash status reg with wp support.\n");
+
+ return ret;
}
int prepare_flash_access(struct flashctx *const flash,
@@ -2092,14 +2117,19 @@
/* Initialize chip_restore_fn_count before chip unlock calls. */
flash->chip_restore_fn_count = 0;
- /* Given the existence of read locks, we want to unlock for read, erase and write. */
int ret = 1;
if (flash->chip->decode_range != NO_DECODE_RANGE_FUNC ||
(flash->mst->buses_supported & BUS_PROG && flash->mst->opaque.wp_write_cfg)) {
- ret = unlock_flash_wp(flash);
- if (ret)
- msg_cerr("Failed to unlock flash status reg with wp support.\n");
+ ret = unlock_flash_wp(flash, write_it, erase_it);
}
+ /*
+ * Fall back to chip unlock function if we haven't already successfully
+ * unlocked using WP (e.g. WP unlocking failed, chip had no WP support,
+ * WP was skipped for read/verify ops).
+ *
+ * Given the existence of read locks, we want to unlock for read,
+ * erase, write, and verify.
+ */
blockprotect_func_t *bp_func = lookup_blockprotect_func_ptr(flash->chip);
if (ret && bp_func)
bp_func(flash);
--
To view, visit https://review.coreboot.org/c/flashrom/+/75991?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I5dc66474a0b7969b51b86ac9f5daa2c95ae968f1
Gerrit-Change-Number: 75991
Gerrit-PatchSet: 5
Gerrit-Owner: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Reviewer: Brian Norris <briannorris(a)chromium.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Alexander Goncharov <chat(a)joursoir.net>
Gerrit-MessageType: merged
Alexander Goncharov has submitted this change. ( https://review.coreboot.org/c/flashrom/+/77293?usp=email )
Change subject: doc: Fix nesting of About flashrom group of menu items
......................................................................
doc: Fix nesting of About flashrom group of menu items
Adding the title to About flashrom index page allows the engine
to recognise it as a group with a list of menu items inside, which
is as expected.
Without the title on the index page, all menu items inside About
flashrom are inlined into the menu.
Change-Id: I595acc282a536a6d5fa26cf2f8d18dbe549f9716
Signed-off-by: Anastasia Klimchuk <aklm(a)flashrom.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/77293
Reviewed-by: Edward O'Callaghan <quasisec(a)chromium.org>
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Alexander Goncharov <chat(a)joursoir.net>
---
M doc/about_flashrom/index.rst
1 file changed, 3 insertions(+), 0 deletions(-)
Approvals:
build bot (Jenkins): Verified
Alexander Goncharov: Looks good to me, approved
Edward O'Callaghan: Looks good to me, approved
diff --git a/doc/about_flashrom/index.rst b/doc/about_flashrom/index.rst
index 11d845f..de36fc2 100644
--- a/doc/about_flashrom/index.rst
+++ b/doc/about_flashrom/index.rst
@@ -1,3 +1,6 @@
+About flashrom
+==============
+
.. toctree::
:maxdepth: 1
--
To view, visit https://review.coreboot.org/c/flashrom/+/77293?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I595acc282a536a6d5fa26cf2f8d18dbe549f9716
Gerrit-Change-Number: 77293
Gerrit-PatchSet: 2
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Alexander Goncharov <chat(a)joursoir.net>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Thomas Heijligen <src(a)posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: merged
Attention is currently required from: Anastasia Klimchuk, Thomas Heijligen.
Alexander Goncharov has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/77293?usp=email )
Change subject: doc: Fix nesting of About flashrom group of menu items
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://review.coreboot.org/c/flashrom/+/77293?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I595acc282a536a6d5fa26cf2f8d18dbe549f9716
Gerrit-Change-Number: 77293
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Alexander Goncharov <chat(a)joursoir.net>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Thomas Heijligen <src(a)posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Wed, 30 Aug 2023 21:08:10 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Anastasia Klimchuk has submitted this change. ( https://review.coreboot.org/c/flashrom/+/77288?usp=email )
Change subject: Makefile: Remove a bashism when searching for sphinx-build
......................................................................
Makefile: Remove a bashism when searching for sphinx-build
e.g. when the shell is dash and sphinx-build is not installed, HAS_SPHINXBUILD would be wrongly set to yes.
Change-Id: I4d89e24ec3401446acec857eae134928bc3064d2
Signed-off-by: Bart De Schuymer <bdschuym(a)artinalgorithms.be>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/77288
Reviewed-by: Peter Marheine <pmarheine(a)chromium.org>
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Patrick Georgi <patrick(a)coreboot.org>
Reviewed-by: Jan Samek <jan.samek(a)siemens.com>
---
M Makefile
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Patrick Georgi: Looks good to me, approved
build bot (Jenkins): Verified
Peter Marheine: Looks good to me, approved
Jan Samek: Looks good to me, but someone else must approve
diff --git a/Makefile b/Makefile
index bc3eecb..bf01d0f 100644
--- a/Makefile
+++ b/Makefile
@@ -250,7 +250,7 @@
HAS_LINUX_SPI := $(call c_compile_test, Makefile.d/linux_spi_test.c)
HAS_LINUX_I2C := $(call c_compile_test, Makefile.d/linux_i2c_test.c)
HAS_SERIAL := $(strip $(if $(filter $(TARGET_OS), DOS libpayload), no, yes))
-HAS_SPHINXBUILD := $(shell command -v $(SPHINXBUILD) &>/dev/null && echo yes || echo no)
+HAS_SPHINXBUILD := $(shell command -v $(SPHINXBUILD) >/dev/null 2>/dev/null && echo yes || echo no)
EXEC_SUFFIX := $(strip $(if $(filter $(TARGET_OS), DOS MinGW), .exe))
override CFLAGS += -Iinclude
--
To view, visit https://review.coreboot.org/c/flashrom/+/77288?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I4d89e24ec3401446acec857eae134928bc3064d2
Gerrit-Change-Number: 77288
Gerrit-PatchSet: 3
Gerrit-Owner: Bart De Schuymer <bdschuym(a)artinalgorithms.be>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Jan Samek <jan.samek(a)siemens.com>
Gerrit-Reviewer: Patrick Georgi <patrick(a)coreboot.org>
Gerrit-Reviewer: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: Thomas Heijligen <src(a)posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: merged
Attention is currently required from: Vasily Galkin.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/77529?usp=email )
Change subject: spi25_statusreg: add verbose output on status registers read results
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
> Yes, logged only for super-verbose -VVV. […]
The verbosity is fine for -VVV, all good.
I would say, it's really good to add something to help "a person quite new to SPI flashing". This helped you, and might also help a hundred of other people in future. Thank you for contributing.
--
To view, visit https://review.coreboot.org/c/flashrom/+/77529?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ibc8e9229ab5d6578479564d11cc7aff9442e24ad
Gerrit-Change-Number: 77529
Gerrit-PatchSet: 1
Gerrit-Owner: Vasily Galkin
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Vasily Galkin
Gerrit-Comment-Date: Mon, 28 Aug 2023 10:25:36 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Vasily Galkin
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: comment
Attention is currently required from: Anastasia Klimchuk.
Vasily Galkin has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/77529?usp=email )
Change subject: spi25_statusreg: add verbose output on status registers read results
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
> Just to check, this will log only for super verbose mode -VVV right? […]
Yes, logged only for super-verbose -VVV.
The less verbose -VV does not log it.
The count of produced lines depends on a chip. In general, say near 4 lines are produced (flashrom really rereads it several times).
Also, since WP registers are automatically touched by flashrom's "--write" operation - it is also displayed during --write. This was especially important: before it I thought that WP is not working, but it turned out that flashrom automatically disabled it. (after that I tested WP with an external tool talking directly to programmer at lower level and seen that the WP is really working)
BTW, if this is too verbose for flashrom standards - I'm fine with dropping this patch from a series. I'm seeing its usefulness only as "a person quite new to SPI flashing"
--
To view, visit https://review.coreboot.org/c/flashrom/+/77529?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ibc8e9229ab5d6578479564d11cc7aff9442e24ad
Gerrit-Change-Number: 77529
Gerrit-PatchSet: 1
Gerrit-Owner: Vasily Galkin
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Mon, 28 Aug 2023 08:19:09 +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: Vasily Galkin.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/77529?usp=email )
Change subject: spi25_statusreg: add verbose output on status registers read results
......................................................................
Patch Set 1: Code-Review+2
(1 comment)
Patchset:
PS1:
Just to check, this will log only for super verbose mode -VVV right?
How many lines it produces in the log, one line per WP operation, or more?
--
To view, visit https://review.coreboot.org/c/flashrom/+/77529?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ibc8e9229ab5d6578479564d11cc7aff9442e24ad
Gerrit-Change-Number: 77529
Gerrit-PatchSet: 1
Gerrit-Owner: Vasily Galkin
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Vasily Galkin
Gerrit-Comment-Date: Mon, 28 Aug 2023 04:25:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment