Attention is currently required from: Anastasia Klimchuk.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/60070 )
Change subject: flashrom.c: Move do_*() helpers into cli_classic.c
......................................................................
Patch Set 1: Code-Review-2
--
To view, visit https://review.coreboot.org/c/flashrom/+/60070
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: If1112155e2421e0178fd73f847cbb80868387433
Gerrit-Change-Number: 60070
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(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, 13 Dec 2021 01:52:48 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: Daniel Campello, Angel Pons, Anastasia Klimchuk.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/59291 )
Change subject: flashrom: Convert do_read() into a libflashrom user
......................................................................
Patch Set 4:
(1 comment)
File flashrom.c:
https://review.coreboot.org/c/flashrom/+/59291/comment/19aa80e6_38da3c58
PS4, Line 2165: int do_read(struct flashctx *const flash, const char *const filename)
> It may make sense to move all of do_read() (and friends) to cli_classic. […]
I have done this as follow up patches to these.
--
To view, visit https://review.coreboot.org/c/flashrom/+/59291
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I4b690b688acf9d5deb46e8642a252a2132ea8c73
Gerrit-Change-Number: 59291
Gerrit-PatchSet: 4
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Daniel Campello <campello(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Nico Huber <nico.h(a)gmx.de>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Daniel Campello <campello(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Mon, 13 Dec 2021 01:49:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Daniel Campello <campello(a)chromium.org>
Gerrit-MessageType: comment
Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/60068 )
Change subject: cli_classic.c: Convert do_erase() to libflashrom call
......................................................................
cli_classic.c: Convert do_erase() to libflashrom call
Inline emergency_help_message() to flashrom_flash_erase()
to be consistent with the other libflashrom API's. This
leaves do_erase() a redudant wrapper and moves us a step
closer to cli_classic as a pure libflashrom user.
BUG=b:208132085
TEST=`make`
Change-Id: I8566164e7dbad69cf478b24208014f10fb99e4d0
Signed-off-by: Edward O'Callaghan <quasisec(a)google.com>
---
M cli_classic.c
M flash.h
M flashrom.c
M tests/chip.c
4 files changed, 13 insertions(+), 21 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/68/60068/1
diff --git a/cli_classic.c b/cli_classic.c
index 101d272..4d702cc 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -841,7 +841,7 @@
else if (extract_it)
ret = do_extract(fill_flash);
else if (erase_it)
- ret = do_erase(fill_flash);
+ ret = flashrom_flash_erase(fill_flash);
else if (write_it)
ret = do_write(fill_flash, filename, referencefile);
else if (verify_it)
diff --git a/flash.h b/flash.h
index 8c24c0c..134d7d3 100644
--- a/flash.h
+++ b/flash.h
@@ -354,7 +354,6 @@
void finalize_flash_access(struct flashctx *);
int do_read(struct flashctx *, const char *filename);
int do_extract(struct flashctx *);
-int do_erase(struct flashctx *);
int do_write(struct flashctx *, const char *const filename, const char *const referencefile);
int do_verify(struct flashctx *, const char *const filename);
int register_chip_restore(chip_restore_fn_cb_t func, struct flashctx *flash, uint8_t status);
diff --git a/flashrom.c b/flashrom.c
index dc09b89..c2bf9d8 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1899,6 +1899,16 @@
finalize_flash_access(flashctx);
+ /*
+ * FIXME: Do we really want the scary warning if erase failed?
+ * After all, after erase the chip is either blank or partially
+ * blank or it has the old contents. A blank chip won't boot,
+ * so if the user wanted erase and reboots afterwards, the user
+ * knows very well that booting won't work.
+ */
+ if (ret)
+ emergency_help_message();
+
return ret;
}
@@ -2196,23 +2206,6 @@
return do_read(flash, NULL);
}
-int do_erase(struct flashctx *const flash)
-{
- const int ret = flashrom_flash_erase(flash);
-
- /*
- * FIXME: Do we really want the scary warning if erase failed?
- * After all, after erase the chip is either blank or partially
- * blank or it has the old contents. A blank chip won't boot,
- * so if the user wanted erase and reboots afterwards, the user
- * knows very well that booting won't work.
- */
- if (ret)
- emergency_help_message();
-
- return ret;
-}
-
int do_write(struct flashctx *const flash, const char *const filename, const char *const referencefile)
{
const size_t flash_size = flash->chip->total_size * 1024;
diff --git a/tests/chip.c b/tests/chip.c
index 9c06fe7..e07c900 100644
--- a/tests/chip.c
+++ b/tests/chip.c
@@ -182,7 +182,7 @@
setup_chip(&flashctx, &layout, &mock_chip, param);
printf("Erase chip operation started.\n");
- assert_int_equal(0, do_erase(&flashctx));
+ assert_int_equal(0, flashrom_flash_erase(&flashctx));
printf("Erase chip operation done.\n");
teardown(&layout);
@@ -204,7 +204,7 @@
setup_chip(&flashctx, &layout, &mock_chip, param_dup);
printf("Erase chip operation started.\n");
- assert_int_equal(0, do_erase(&flashctx));
+ assert_int_equal(0, flashrom_flash_erase(&flashctx));
printf("Erase chip operation done.\n");
teardown(&layout);
--
To view, visit https://review.coreboot.org/c/flashrom/+/60068
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I8566164e7dbad69cf478b24208014f10fb99e4d0
Gerrit-Change-Number: 60068
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-MessageType: newchange
Attention is currently required from: Daniel Campello, Angel Pons, Anastasia Klimchuk.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/59921 )
Change subject: flashrom.c: extract operation only uses layout files
......................................................................
Patch Set 4: Code-Review+2
(1 comment)
Patchset:
PS4:
> > I don't understand the concern that goes away when "filename check would move from read_flash_to_f […]
I tend to agree with Daniel here. I am not sure what the concern is since read_flash_to_file() has a singular call site and CB:59291 is simply a matter of inlining read_flash_to_file() to the call site. To Daniel's point, it isn't about what the code could be doing but rather what it is actually doing.
In relation to the question of if do_read() *should* or *could* take 'filename' as type optional, well the user is write_buf_to_file() which returns 1 upon nullarity which is the bug that this patch fixes and that all other use cases of do_read() within cli_classic have 'filename' validated with,
`if ((read_it | write_it | verify_it) && check_filename(filename, "image"))`. Therefore the *should* is redundant and arguably more error prone as it caused the bug in the first place since validation is happening at multiple layers in a inconsistent manner.
I however see your logic however a deeper inspection reveals that we should make the top of the call stack responsible for the semantics of whether 'filename' is optional or not and not at a 'low level'. This results in consistent expectations of the caller of who is responsible. Shame C doesn't have types for this to put into the function signatures.
I would be far more in favor of a bug fix being merged as a priority over a refactor patch that simply inlines a function which is an orthogonal problem.
--
To view, visit https://review.coreboot.org/c/flashrom/+/59921
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ibc9a4e2966385863345f06662521d6d0e4685121
Gerrit-Change-Number: 59921
Gerrit-PatchSet: 4
Gerrit-Owner: Daniel Campello <campello(a)chromium.org>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Daniel Campello <campello(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Mon, 13 Dec 2021 01:18:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Daniel Campello <campello(a)chromium.org>
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: comment
Attention is currently required from: Felix Singer, Nico Huber.
Michael Niewöhner has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/60055 )
Change subject: SFDP: drop static table length check to make newer SFDP revisions work
......................................................................
Patch Set 1:
(1 comment)
Commit Message:
https://review.coreboot.org/c/flashrom/+/60055/comment/7c9f51d4_2791be7c
PS1, Line 28: ***RFC*** We could maintain a list of revisions/lengths but is it really
: worth it?
:
RFC
--
To view, visit https://review.coreboot.org/c/flashrom/+/60055
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Id84cde4ebc805d68e2984e8041fbc48d7ceebe34
Gerrit-Change-Number: 60055
Gerrit-PatchSet: 1
Gerrit-Owner: Michael Niewöhner <foss(a)mniewoehner.de>
Gerrit-Reviewer: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Comment-Date: Sat, 11 Dec 2021 22:05:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Felix Singer, Nico Huber.
Michael Niewöhner has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/60055 )
Change subject: SFDP: drop static table length check to make newer SFDP revisions work
......................................................................
Patch Set 1:
This change is ready for review.
--
To view, visit https://review.coreboot.org/c/flashrom/+/60055
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Id84cde4ebc805d68e2984e8041fbc48d7ceebe34
Gerrit-Change-Number: 60055
Gerrit-PatchSet: 1
Gerrit-Owner: Michael Niewöhner <foss(a)mniewoehner.de>
Gerrit-Reviewer: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Comment-Date: Sat, 11 Dec 2021 21:33:09 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Nico Huber.
Thomas Heijligen has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/58623 )
Change subject: Makefile: Make pkg-config mandatory to find libftdi1
......................................................................
Patch Set 8:
(1 comment)
File Makefile.include:
https://review.coreboot.org/c/flashrom/+/58623/comment/8f0c8372_115f3c2f
PS5, Line 40: 2>/dev/null
> How? I mean it's about unexpected errors, not expected ones. So I don't […]
she $(debug_shell will work until we move all this in a target. Then we have to do the logging again.
--
To view, visit https://review.coreboot.org/c/flashrom/+/58623
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I41f5186d9f3e063c12c8c6eea888d0b0bf534259
Gerrit-Change-Number: 58623
Gerrit-PatchSet: 8
Gerrit-Owner: Thomas Heijligen <src(a)posteo.de>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Comment-Date: Thu, 09 Dec 2021 21:12:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nico Huber <nico.h(a)gmx.de>
Comment-In-Reply-To: Thomas Heijligen <src(a)posteo.de>
Gerrit-MessageType: comment