Attention is currently required from: Furquan Shaikh, Tim Wawrzynczak, Anastasia Klimchuk.
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/56721 )
Change subject: internal: Return early from map_flash for >16MiB on x86
......................................................................
Patch Set 3:
(1 comment)
Patchset:
PS1:
> Don't call map_flash for X86 you mean? or get rid of the call to map_flash here https://review.coreboot.org/plugins/gitiles/flashrom/+/refs/heads/master/fl… ?
The latter. The call should be done by the programmer drivers that make use of
the mapping, I guess.
--
To view, visit https://review.coreboot.org/c/flashrom/+/56721
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I60244b6970118dbdfdbb5b8424fc0a8acd9def2e
Gerrit-Change-Number: 56721
Gerrit-PatchSet: 3
Gerrit-Owner: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Furquan Shaikh <furquan(a)google.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Furquan Shaikh <furquan(a)google.com>
Gerrit-Attention: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Tue, 17 Aug 2021 13:38:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nico Huber <nico.h(a)gmx.de>
Comment-In-Reply-To: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
Comment-In-Reply-To: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-MessageType: comment
Attention is currently required from: Nico Huber, Miklós Márton, Anastasia Klimchuk.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/56637 )
Change subject: ni845x_spi: Fix signed - unsigned comparisons
......................................................................
Patch Set 1:
(2 comments)
File ni845x_spi.c:
https://review.coreboot.org/c/flashrom/+/56637/comment/9582fb63_3b0f3859
PS1, Line 556: CS_number = CS_str[0] - '0';
> That's not a problem though, is it? These are just numbers in C. It might […]
Is underflow behavior defined for `unsigned char`?
https://review.coreboot.org/c/flashrom/+/56637/comment/d6659230_f79066b4
PS1, Line 556: CS_number = CS_str[0] - '0';
: free(CS_str);
: if (strlen(CS_str) > 1 || 7 < CS_number) {
: msg_perr("Only CS 0-7 supported\n");
: return 1;
: }
> I would just use strtoul() TBH :)
It's simpler, sounds good.
--
To view, visit https://review.coreboot.org/c/flashrom/+/56637
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I48ef927aa28433fb0e3b3a1f3fb2e797095e53bd
Gerrit-Change-Number: 56637
Gerrit-PatchSet: 1
Gerrit-Owner: Miklós Márton <martonmiklosqdev(a)gmail.com>
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: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Miklós Márton <martonmiklosqdev(a)gmail.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Tue, 17 Aug 2021 10:56:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nico Huber <nico.h(a)gmx.de>
Comment-In-Reply-To: Angel Pons <th3fanbus(a)gmail.com>
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: comment
Attention is currently required from: Miklós Márton, Angel Pons, Anastasia Klimchuk.
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/56637 )
Change subject: ni845x_spi: Fix signed - unsigned comparisons
......................................................................
Patch Set 1:
(3 comments)
File ni845x_spi.c:
https://review.coreboot.org/c/flashrom/+/56637/comment/d140ebc5_d7f3f631
PS1, Line 188: strtol
> Use `strtoul()` instead?
+1
https://review.coreboot.org/c/flashrom/+/56637/comment/0abca4ce_09d4ea0e
PS1, Line 556: CS_number = CS_str[0] - '0';
> This line converts string to number, but only two lines below the condition is checked whether the s […]
That's not a problem though, is it? These are just numbers in C. It might
underflow, but that's still defined behavior and the `7 < CS_number` would
catch it?
https://review.coreboot.org/c/flashrom/+/56637/comment/f92a4df8_ed289fae
PS1, Line 556: CS_number = CS_str[0] - '0';
: free(CS_str);
: if (strlen(CS_str) > 1 || 7 < CS_number) {
: msg_perr("Only CS 0-7 supported\n");
: return 1;
: }
> The assignment to `CS_number` can underflow. I'd do the parsing as follows: […]
I would just use strtoul() TBH :)
--
To view, visit https://review.coreboot.org/c/flashrom/+/56637
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I48ef927aa28433fb0e3b3a1f3fb2e797095e53bd
Gerrit-Change-Number: 56637
Gerrit-PatchSet: 1
Gerrit-Owner: Miklós Márton <martonmiklosqdev(a)gmail.com>
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: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Miklós Márton <martonmiklosqdev(a)gmail.com>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Tue, 17 Aug 2021 10:51:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Angel Pons <th3fanbus(a)gmail.com>
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: comment
Attention is currently required from: Miklós Márton, Angel Pons.
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/56636 )
Change subject: ni845x_spi: handle PROGRAMFILES(X86) env var properly
......................................................................
Patch Set 1:
(1 comment)
File Makefile:
https://review.coreboot.org/c/flashrom/+/56636/comment/6c9eb95d_267dda5e
PS1, Line 750: X
Did the casing change? X instead of x
--
To view, visit https://review.coreboot.org/c/flashrom/+/56636
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I397619a5038567d649a417ce6b9d8ac9e1c8c67b
Gerrit-Change-Number: 56636
Gerrit-PatchSet: 1
Gerrit-Owner: Miklós Márton <martonmiklosqdev(a)gmail.com>
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: Miklós Márton <martonmiklosqdev(a)gmail.com>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Tue, 17 Aug 2021 10:38:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Miklós Márton, Angel Pons.
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/56636 )
Change subject: ni845x_spi: handle PROGRAMFILES(X86) env var properly
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
> Unfortunately no. […]
What I remember from the original review: we used the ${} notation to avoid trouble
the clash with the literal parentheses. IIRC, it worked back then? so I wonder what
changed :-/
Note, ${} is still expanded by `make`. It just looks like a shell expansion.
--
To view, visit https://review.coreboot.org/c/flashrom/+/56636
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I397619a5038567d649a417ce6b9d8ac9e1c8c67b
Gerrit-Change-Number: 56636
Gerrit-PatchSet: 1
Gerrit-Owner: Miklós Márton <martonmiklosqdev(a)gmail.com>
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: Miklós Márton <martonmiklosqdev(a)gmail.com>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Tue, 17 Aug 2021 10:37:57 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Miklós Márton <martonmiklosqdev(a)gmail.com>
Comment-In-Reply-To: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: comment
Attention is currently required from: Furquan Shaikh, Tim Wawrzynczak, Anastasia Klimchuk.
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/56721 )
Change subject: internal: Return early from map_flash for >16MiB on x86
......................................................................
Patch Set 3: Code-Review-1
(4 comments)
Patchset:
PS1:
> just noticed this comment. […]
Well, the Promontory support there looks like a WIP hack to me. For instance,
how should we support >16MiB chips there? The commit message doesn't seem
to mention why the memory mapping is used.
Patchset:
PS3:
> Could this get merged?
IMHO, fixing the calls is still a much better solution.
File physmap.c:
https://review.coreboot.org/c/flashrom/+/56721/comment/6f39dd35_e3938237
PS3, Line 264: #if IS_X86
It shouldn't be necessary to use a preprocessor guard. Also, what you
probably intend to check is if an internal programmer targeting the
BIOS chip on x86 is used. If another programmer is used, the host
architecture shouldn't matter.
https://review.coreboot.org/c/flashrom/+/56721/comment/e26e4b89_cc37203a
PS3, Line 268: c
`c` is for chip, while this is programmer code `p`.
--
To view, visit https://review.coreboot.org/c/flashrom/+/56721
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I60244b6970118dbdfdbb5b8424fc0a8acd9def2e
Gerrit-Change-Number: 56721
Gerrit-PatchSet: 3
Gerrit-Owner: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Furquan Shaikh <furquan(a)google.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Furquan Shaikh <furquan(a)google.com>
Gerrit-Attention: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Tue, 17 Aug 2021 09:52:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Nico Huber <nico.h(a)gmx.de>
Comment-In-Reply-To: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
Comment-In-Reply-To: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-MessageType: comment
Nico Huber has submitted this change. ( https://review.coreboot.org/c/flashrom/+/55932 )
Change subject: spi_master: Add shutdown function in spi_master struct
......................................................................
spi_master: Add shutdown function in spi_master struct
With this, register_spi_master can take care of register_shutdown
as well, and every spi master only needs to call register_spi_master
instead of calling both register_spi_master and register_shutdown.
Testing:
In dummyflasher, comment out free(data) in shutdown. Test fails with error:
../dummyflasher.c:949: note: block 0x55e0727a6e40 allocated here
ERROR: dummy_init_and_shutdown_test_success leaked 1 block(s)
Means, shutdown function is invoked for drivers with "old" API
(so, transitioning from old to new API is not breaking anything).
Next patches in the chain converts spi masters to use new API.
BUG=b:185191942
TEST=builds and ninja test
Change-Id: I2dc80dceca2f8204bcd0dad1f51753d7e79f1af5
Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/55932
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Nico Huber <nico.h(a)gmx.de>
---
M programmer.h
M spi.c
2 files changed, 8 insertions(+), 0 deletions(-)
Approvals:
build bot (Jenkins): Verified
Nico Huber: Looks good to me, approved
diff --git a/programmer.h b/programmer.h
index 95e2cda..ec55987 100644
--- a/programmer.h
+++ b/programmer.h
@@ -356,6 +356,7 @@
int (*read)(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
int (*write_256)(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
int (*write_aai)(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
+ int (*shutdown)(void *data);
void *data;
};
diff --git a/spi.c b/spi.c
index 4ac3914..f2e91c4 100644
--- a/spi.c
+++ b/spi.c
@@ -135,6 +135,13 @@
{
struct registered_master rmst = {0};
+ if (mst->shutdown) {
+ if (register_shutdown(mst->shutdown, data)) {
+ mst->shutdown(data); /* cleanup */
+ return 1;
+ }
+ }
+
if (!mst->write_aai || !mst->write_256 || !mst->read || !mst->command ||
!mst->multicommand ||
((mst->command == default_spi_send_command) &&
--
To view, visit https://review.coreboot.org/c/flashrom/+/55932
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I2dc80dceca2f8204bcd0dad1f51753d7e79f1af5
Gerrit-Change-Number: 55932
Gerrit-PatchSet: 8
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Thomas Heijligen <src(a)posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-MessageType: merged
Attention is currently required from: Thomas Heijligen, Angel Pons, Anastasia Klimchuk.
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/56103 )
Change subject: spi_master: Use new API to register shutdown function
......................................................................
Patch Set 6: Code-Review+2
(3 comments)
Patchset:
PS6:
This also fixes a lot resource leakage in case register_shutdown()
would fail. That's worth to mention in the commit message!
Maybe we can also test it? I haven't looked closely if any of the
affected programmer drivers are hooked up for lifecycle testing.
If they are, hardcoding register_shutdown() to fail should result
in less leakage after this change.
File ch341a_spi.c:
https://review.coreboot.org/c/flashrom/+/56103/comment/d827b913_fb1204bd
PS6, Line 511: return 0;
Just raising an eyebrow: this changes unrelated behaviour. Maybe worth to
mention in the commit message: Fixes propagation of register_spi_master()
return values.
File dediprog.c:
https://review.coreboot.org/c/flashrom/+/56103/comment/8f15da3c_1009ae7d
PS6, Line 1276: /* shutdown function does cleanup */
Still somewhat true, but less obvious what is meant.
--
To view, visit https://review.coreboot.org/c/flashrom/+/56103
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ib60300f9ddb295a255d5ef3f8da0e07064207140
Gerrit-Change-Number: 56103
Gerrit-PatchSet: 6
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Miklós Márton <martonmiklosqdev(a)gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Thomas Heijligen <src(a)posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Tue, 17 Aug 2021 09:38:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment