Attention is currently required from: Edward O'Callaghan, Angel Pons.
Hello build bot (Jenkins), Nico Huber, Daniel Campello, Angel Pons, Anastasia Klimchuk,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/60068
to look at the new patch set (#5).
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 cli_classic call site.
This leaves do_erase() a redudant wrapper and moves us a step
closer to cli_classic as a pure libflashrom user by using
flashrom_flash_erase().
BUG=b:208132085
TEST=`flashrom -E`
Change-Id: I8566164e7dbad69cf478b24208014f10fb99e4d0
Signed-off-by: Edward O'Callaghan <quasisec(a)google.com>
---
M cli_classic.c
M flash.h
M flashrom.c
3 files changed, 14 insertions(+), 21 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/68/60068/5
--
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: 5
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: 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-CC: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: newpatchset
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 5: Code-Review+2
(1 comment)
Patchset:
PS4:
> Yes this patch is solving a bug, but ... the bug was introduced 7 months ago, and no one noticed. This is ofc not an excuse to have broken code, but I think we can afford to spend few extra days to do the right thing. CB:59291 is pretty much ready, and tested, so there is not much risk in rebasing on top of it.
Soon we will be 8 months and CB:59291 is neither ready, tested nor directly related to resolving this legitimate bug. Resolving to merge so the most pressing issue is brought to resolution first.
--
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: 5
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: Fri, 21 Jan 2022 00:22:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Edward O'Callaghan <quasisec(a)chromium.org>
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: Edward O'Callaghan.
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/61286 )
Change subject: flashrom.c: Move {read,write}_buf_from_include_args() to layout
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
Isn't it CLI code, technically?
--
To view, visit https://review.coreboot.org/c/flashrom/+/61286
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I61d4460ea26e07b67c99baeae5cb3840c25cb913
Gerrit-Change-Number: 61286
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Comment-Date: Fri, 21 Jan 2022 00:14:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Edward O'Callaghan, Angel Pons.
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/60068 )
Change subject: cli_classic.c: Convert do_erase() to libflashrom call
......................................................................
Patch Set 4:
(1 comment)
Commit Message:
https://review.coreboot.org/c/flashrom/+/60068/comment/b47b409d_47e15c5f
PS4, Line 12: closer to cli_classic as a pure libflashrom user.
It does, but kind of by moving CLI code into libflashrom. do_erase()
is practically CLI code, it's just in the wrong file. Also, adding a
FIXME to libflashrom doesn't look like progress. I guess the FIXME
is the reason that the call is in CLI code. How about we just move it
into `cli_classic.c`?
--
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: 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: 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-CC: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Thu, 20 Jan 2022 23:50:17 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Nico Huber, Edward O'Callaghan.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/60430 )
Change subject: flashrom: Convert do_read() into a libflashrom user
......................................................................
Patch Set 3: Code-Review+2
--
To view, visit https://review.coreboot.org/c/flashrom/+/60430
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Id2addadb891c482ee3f69da806062d7a88776675
Gerrit-Change-Number: 60430
Gerrit-PatchSet: 3
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
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-CC: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Comment-Date: Thu, 20 Jan 2022 23:31:59 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: Nico Huber.
Hello build bot (Jenkins), Nico Huber, Anastasia Klimchuk,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/60430
to look at the new patch set (#3).
Change subject: flashrom: Convert do_read() into a libflashrom user
......................................................................
flashrom: Convert do_read() into a libflashrom user
Aspire towards a goal of making cli_classic more of just
a user of libflashrom than having quasi-parallel paths in
flashrom.c
This converts the do_read() provider wrapper into a pure
libflashrom user.
BUG=b:208132085
TEST=`$ sudo ./flashrom -p internal -r /tmp/bios.bin`
TEST=`$ sudo ./flashrom -p internal -l /tmp/layout -i FOO -r /tmp/foo.bin`
Change-Id: Id2addadb891c482ee3f69da806062d7a88776675
Signed-off-by: Edward O'Callaghan <quasisec(a)google.com>
---
M flashrom.c
1 file changed, 17 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/30/60430/3
--
To view, visit https://review.coreboot.org/c/flashrom/+/60430
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Id2addadb891c482ee3f69da806062d7a88776675
Gerrit-Change-Number: 60430
Gerrit-PatchSet: 3
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
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-CC: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-MessageType: newpatchset
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/+/60069 )
Change subject: flashrom.c: Make {read,write}_buf_from_include_args() public
......................................................................
Patch Set 3:
(1 comment)
File flash.h:
https://review.coreboot.org/c/flashrom/+/60069/comment/7c7a9e2f_77bff3c3
PS3, Line 353: read_buf_from_include_args
> That would add to the public API though so needs careful thought
The layout/flashrom refactor would look something like this https://review.coreboot.org/c/flashrom/+/61286 but a bunch more work is needed for dealing with all the other *_by_layout() workers.
--
To view, visit https://review.coreboot.org/c/flashrom/+/60069
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ia0abec655a682ca449d0e8ba620886a2d616b86d
Gerrit-Change-Number: 60069
Gerrit-PatchSet: 3
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: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-CC: Thomas Heijligen <src(a)posteo.de>
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: Thu, 20 Jan 2022 23:24:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Edward O'Callaghan <quasisec(a)chromium.org>
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: comment
Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/61286 )
Change subject: flashrom.c: Move {read,write}_buf_from_include_args() to layout
......................................................................
flashrom.c: Move {read,write}_buf_from_include_args() to layout
It makes more sense for these to be apart of layout.c.
BUG=b:208132085
TEST=`make`
Change-Id: I61d4460ea26e07b67c99baeae5cb3840c25cb913
Signed-off-by: Edward O'Callaghan <quasisec(a)google.com>
Spotted-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
M flash.h
M flashrom.c
M layout.c
M layout.h
4 files changed, 69 insertions(+), 68 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/86/61286/1
diff --git a/flash.h b/flash.h
index e464dd4..391a2d4 100644
--- a/flash.h
+++ b/flash.h
@@ -350,9 +350,7 @@
void list_programmers_linebreak(int startcol, int cols, int paren);
int selfcheck(void);
int read_buf_from_file(unsigned char *buf, unsigned long size, const char *filename);
-int read_buf_from_include_args(const struct flashctx *const flash, unsigned char *buf);
int write_buf_to_file(const unsigned char *buf, unsigned long size, const char *filename);
-int write_buf_to_include_args(const struct flashctx *const flash, unsigned char *buf);
int prepare_flash_access(struct flashctx *, bool read_it, bool write_it, bool erase_it, bool verify_it);
void finalize_flash_access(struct flashctx *);
int do_read(struct flashctx *, const char *filename);
diff --git a/flashrom.c b/flashrom.c
index c7adba8..ffe738b 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -920,43 +920,6 @@
}
/**
- * @brief Reads content to buffer from one or more files.
- *
- * Reads content to supplied buffer from files. If a filename is specified for
- * individual regions using the partial read syntax ('-i <region>[:<filename>]')
- * then this will read file data into the corresponding region in the
- * supplied buffer.
- *
- * @param flashctx Flash context to be used.
- * @param buf Chip-sized buffer to write data to
- * @return 0 on success
- */
-int read_buf_from_include_args(const struct flashctx *const flash,
- unsigned char *buf)
-{
- const struct flashrom_layout *const layout = get_layout(flash);
- const struct romentry *entry = NULL;
-
- /*
- * Content will be read from -i args, so they must not overlap since
- * we need to know exactly what content to write to the ROM.
- */
- if (included_regions_overlap(layout)) {
- msg_gerr("Error: Included regions must not overlap when writing.\n");
- return 1;
- }
-
- while ((entry = layout_next_included(layout, entry))) {
- if (!entry->file)
- continue;
- if (read_buf_from_file(buf + entry->start,
- entry->end - entry->start + 1, entry->file))
- return 1;
- }
- return 0;
-}
-
-/**
* @brief Writes passed data buffer into a file
*
* @param buf Buffer with data to write
@@ -1017,35 +980,6 @@
}
/**
- * @brief Writes content from buffer to one or more files.
- *
- * Writes content from supplied buffer to files. If a filename is specified for
- * individual regions using the partial read syntax ('-i <region>[:<filename>]')
- * then this will write files using data from the corresponding region in the
- * supplied buffer.
- *
- * @param flashctx Flash context to be used.
- * @param buf Chip-sized buffer to read data from
- * @return 0 on success
- */
-int write_buf_to_include_args(const struct flashctx *const flash,
- unsigned char *buf)
-{
- const struct flashrom_layout *const layout = get_layout(flash);
- const struct romentry *entry = NULL;
-
- while ((entry = layout_next_included(layout, entry))) {
- if (!entry->file)
- continue;
- if (write_buf_to_file(buf + entry->start,
- entry->end - entry->start + 1, entry->file))
- return 1;
- }
-
- return 0;
-}
-
-/**
* @brief Reads the included layout regions into a buffer.
*
* If there is no layout set in the given flash context, the whole chip will
diff --git a/layout.c b/layout.c
index 05bee19..d33ac21 100644
--- a/layout.c
+++ b/layout.c
@@ -299,6 +299,72 @@
return ret;
}
+/**
+ * @brief Reads content to buffer from one or more files.
+ *
+ * Reads content to supplied buffer from files. If a filename is specified for
+ * individual regions using the partial read syntax ('-i <region>[:<filename>]')
+ * then this will read file data into the corresponding region in the
+ * supplied buffer.
+ *
+ * @param flashctx Flash context to be used.
+ * @param buf Chip-sized buffer to write data to
+ * @return 0 on success
+ */
+int read_buf_from_include_args(const struct flashrom_flashctx *const flash,
+ unsigned char *buf)
+{
+ const struct flashrom_layout *const layout = get_layout(flash);
+ const struct romentry *entry = NULL;
+
+ /*
+ * Content will be read from -i args, so they must not overlap since
+ * we need to know exactly what content to write to the ROM.
+ */
+ if (included_regions_overlap(layout)) {
+ msg_gerr("Error: Included regions must not overlap when writing.\n");
+ return 1;
+ }
+
+ while ((entry = layout_next_included(layout, entry))) {
+ if (!entry->file)
+ continue;
+ if (read_buf_from_file(buf + entry->start,
+ entry->end - entry->start + 1, entry->file))
+ return 1;
+ }
+ return 0;
+}
+
+/**
+ * @brief Writes content from buffer to one or more files.
+ *
+ * Writes content from supplied buffer to files. If a filename is specified for
+ * individual regions using the partial read syntax ('-i <region>[:<filename>]')
+ * then this will write files using data from the corresponding region in the
+ * supplied buffer.
+ *
+ * @param flashctx Flash context to be used.
+ * @param buf Chip-sized buffer to read data from
+ * @return 0 on success
+ */
+int write_buf_to_include_args(const struct flashrom_flashctx *const flash,
+ unsigned char *buf)
+{
+ const struct flashrom_layout *const layout = get_layout(flash);
+ const struct romentry *entry = NULL;
+
+ while ((entry = layout_next_included(layout, entry))) {
+ if (!entry->file)
+ continue;
+ if (write_buf_to_file(buf + entry->start,
+ entry->end - entry->start + 1, entry->file))
+ return 1;
+ }
+
+ return 0;
+}
+
void prepare_layout_for_extraction(struct flashctx *flash)
{
const struct flashrom_layout *const l = get_layout(flash);
diff --git a/layout.h b/layout.h
index abbdc22..5e41b89 100644
--- a/layout.h
+++ b/layout.h
@@ -59,6 +59,9 @@
int process_include_args(struct flashrom_layout *, const struct layout_include_args *);
void cleanup_include_args(struct layout_include_args **);
+int read_buf_from_include_args(const struct flashrom_flashctx *const flash, unsigned char *buf);
+int write_buf_to_include_args(const struct flashrom_flashctx *const flash, unsigned char *buf);
+
const struct romentry *layout_next_included_region(const struct flashrom_layout *, chipoff_t);
const struct romentry *layout_next_included(const struct flashrom_layout *, const struct romentry *);
const struct romentry *layout_next(const struct flashrom_layout *, const struct romentry *);
--
To view, visit https://review.coreboot.org/c/flashrom/+/61286
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I61d4460ea26e07b67c99baeae5cb3840c25cb913
Gerrit-Change-Number: 61286
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/+/60069 )
Change subject: flashrom.c: Make {read,write}_buf_from_include_args() public
......................................................................
Patch Set 3:
(1 comment)
File flash.h:
https://review.coreboot.org/c/flashrom/+/60069/comment/15e49719_d9804f03
PS3, Line 353: read_buf_from_include_args
> Then maybe libflashrom. […]
That would add to the public API though so needs careful thought
--
To view, visit https://review.coreboot.org/c/flashrom/+/60069
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ia0abec655a682ca449d0e8ba620886a2d616b86d
Gerrit-Change-Number: 60069
Gerrit-PatchSet: 3
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: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-CC: Thomas Heijligen <src(a)posteo.de>
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: Thu, 20 Jan 2022 23:19:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Edward O'Callaghan <quasisec(a)chromium.org>
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: comment