Evan Benn has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/67472 )
Change subject: flashrom_tester: Fix cargo check and clippy warnings
......................................................................
Patch Set 3:
(2 comments)
Patchset:
PS3:
> If Peter is happy with it, so am I
Great thank you.
I dont have commit rights so please (anyone) chuck it in when you have a change.
Thanks
PS3:
Great
--
To view, visit https://review.coreboot.org/c/flashrom/+/67472
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I50c5af61e06df1bb6956f347cb6806a7eca6ce0e
Gerrit-Change-Number: 67472
Gerrit-PatchSet: 3
Gerrit-Owner: Evan Benn <evanbenn(a)google.com>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Mon, 19 Sep 2022 00:19:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: comment
Angel Pons has submitted this change. ( https://review.coreboot.org/c/flashrom/+/67649 )
Change subject: flashrom.c: Drop `programmer_param` global variable
......................................................................
flashrom.c: Drop `programmer_param` global variable
The `programmer_param` global variable is only valid within the scope of
the `programmer_init()` function, which calls a programmer-specific init
function that calls `extract_programmer_param_str()` to obtain the value
of programmer-specific parameters.
Get rid of this global variable by piping the "programmer_param" string
through a function parameter specifically added for this purpose in the
past, but was not used yet.
Change-Id: I59397451ea625bd431b15848bad5ec7cb926f22d
Signed-off-by: Angel Pons <th3fanbus(a)gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67649
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Nico Huber <nico.h(a)gmx.de>
Reviewed-by: Edward O'Callaghan <quasisec(a)chromium.org>
Reviewed-by: Thomas Heijligen <src(a)posteo.de>
---
M flashrom.c
1 file changed, 35 insertions(+), 11 deletions(-)
Approvals:
build bot (Jenkins): Verified
Nico Huber: Looks good to me, but someone else must approve
Thomas Heijligen: Looks good to me, approved
Edward O'Callaghan: Looks good to me, approved
diff --git a/flashrom.c b/flashrom.c
index f8c5e73..2604594 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -38,7 +38,6 @@
const char *chip_to_probe = NULL;
static const struct programmer_entry *programmer = NULL;
-static char *programmer_param = NULL;
/*
* Programmers supporting multiple buses can have differing size limits on
@@ -150,36 +149,37 @@
/* Default to allowing writes. Broken programmers set this to 0. */
programmer_may_write = true;
+ struct programmer_cfg cfg;
+
if (param) {
- programmer_param = strdup(param);
- if (!programmer_param) {
+ cfg.params = strdup(param);
+ if (!cfg.params) {
msg_perr("Out of memory!\n");
return ERROR_FATAL;
}
} else {
- programmer_param = NULL;
+ cfg.params = NULL;
}
msg_pdbg("Initializing %s programmer\n", programmer->name);
- ret = programmer->init(NULL);
- if (programmer_param && strlen(programmer_param)) {
+ ret = programmer->init(&cfg);
+ if (cfg.params && strlen(cfg.params)) {
if (ret != 0) {
/* It is quite possible that any unhandled programmer parameter would have been valid,
* but an error in actual programmer init happened before the parameter was evaluated.
*/
msg_pwarn("Unhandled programmer parameters (possibly due to another failure): %s\n",
- programmer_param);
+ cfg.params);
} else {
/* Actual programmer init was successful, but the user specified an invalid or unusable
* (for the current programmer configuration) parameter.
*/
- msg_perr("Unhandled programmer parameters: %s\n", programmer_param);
+ msg_perr("Unhandled programmer parameters: %s\n", cfg.params);
msg_perr("Aborting.\n");
ret = ERROR_FATAL;
}
}
- free(programmer_param);
- programmer_param = NULL;
+ free(cfg.params);
return ret;
}
@@ -294,7 +294,7 @@
char *extract_programmer_param_str(const struct programmer_cfg *cfg, const char *param_name)
{
- return extract_param(&programmer_param, param_name, ",");
+ return extract_param(&cfg->params, param_name, ",");
}
static int check_block_eraser(const struct flashctx *flash, int k, int log)
--
To view, visit https://review.coreboot.org/c/flashrom/+/67649
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I59397451ea625bd431b15848bad5ec7cb926f22d
Gerrit-Change-Number: 67649
Gerrit-PatchSet: 2
Gerrit-Owner: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: 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: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
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
Angel Pons has submitted this change. ( https://review.coreboot.org/c/flashrom/+/67094 )
Change subject: programmer_init: Work on a mutable copy of programmer params
......................................................................
programmer_init: Work on a mutable copy of programmer params
The signature of extract_param() was wrong all the time. It actually
modifies the passed, global `programmer_param` string. This only com-
piled w/o warnings because of a deficiency of the strstr() API. It
takes a const string as argument but returns a mutable pointer to
a substring of it.
As we take a const parameter string in the libflashrom API and should
not change that, we create a copy in programmer_init() instead.
Now that we free our copy of the programmer parameters at the end of
programmer_init() it's more obvious that the string can only be used
during initialization. So also clear `programmer_param` inside
programmer_init() instead of programmer_shutdown().
Change-Id: If6bb2e5e4312b07f756615984bd3757e92b86b0a
Signed-off-by: Nico Huber <nico.h(a)gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67094
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Angel Pons <th3fanbus(a)gmail.com>
Reviewed-by: Edward O'Callaghan <quasisec(a)chromium.org>
Reviewed-by: Thomas Heijligen <src(a)posteo.de>
---
M flashrom.c
1 file changed, 43 insertions(+), 5 deletions(-)
Approvals:
build bot (Jenkins): Verified
Thomas Heijligen: Looks good to me, approved
Angel Pons: Looks good to me, approved
Edward O'Callaghan: Looks good to me, approved
diff --git a/flashrom.c b/flashrom.c
index b68ba55..f8c5e73 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -38,7 +38,7 @@
const char *chip_to_probe = NULL;
static const struct programmer_entry *programmer = NULL;
-static const char *programmer_param = NULL;
+static char *programmer_param = NULL;
/*
* Programmers supporting multiple buses can have differing size limits on
@@ -150,7 +150,16 @@
/* Default to allowing writes. Broken programmers set this to 0. */
programmer_may_write = true;
- programmer_param = param;
+ if (param) {
+ programmer_param = strdup(param);
+ if (!programmer_param) {
+ msg_perr("Out of memory!\n");
+ return ERROR_FATAL;
+ }
+ } else {
+ programmer_param = NULL;
+ }
+
msg_pdbg("Initializing %s programmer\n", programmer->name);
ret = programmer->init(NULL);
if (programmer_param && strlen(programmer_param)) {
@@ -169,6 +178,8 @@
ret = ERROR_FATAL;
}
}
+ free(programmer_param);
+ programmer_param = NULL;
return ret;
}
@@ -187,8 +198,6 @@
int i = --shutdown_fn_count;
ret |= shutdown_fn[i].func(shutdown_fn[i].data);
}
-
- programmer_param = NULL;
registered_master_count = 0;
return ret;
@@ -227,7 +236,7 @@
* needle and remove everything from the first occurrence of needle to the next
* delimiter from haystack.
*/
-static char *extract_param(const char *const *haystack, const char *needle, const char *delim)
+static char *extract_param(char *const *haystack, const char *needle, const char *delim)
{
char *param_pos, *opt_pos, *rest;
char *opt = NULL;
--
To view, visit https://review.coreboot.org/c/flashrom/+/67094
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: If6bb2e5e4312b07f756615984bd3757e92b86b0a
Gerrit-Change-Number: 67094
Gerrit-PatchSet: 5
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: 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: Felix Singer <felixsinger(a)posteo.net>
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
Alexander Goncharov has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/67700 )
Change subject: stlinkv3_spi: fix uninitialized pointer
......................................................................
stlinkv3_spi: fix uninitialized pointer
If we compile flashrom using meson build system, the compiler will fail
due to -Werror=maybe-uninitialized. Let's initialize the pointer to
NULL as suggested by the compiler compiler.
TEST=`meson out && ninja -C out`
Change-Id: Ibaf25f67186724d9045ade849026782c3eac4952
Signed-off-by: Alexander Goncharov <chat(a)joursoir.net>
---
M stlinkv3_spi.c
1 file changed, 17 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/00/67700/1
diff --git a/stlinkv3_spi.c b/stlinkv3_spi.c
index 38fe9f9..8dc0cb3 100644
--- a/stlinkv3_spi.c
+++ b/stlinkv3_spi.c
@@ -482,7 +482,7 @@
int ret = 1;
int devIndex = 0;
struct libusb_context *usb_ctx;
- libusb_device_handle *stlinkv3_handle;
+ libusb_device_handle *stlinkv3_handle = NULL;
struct stlinkv3_spi_data *stlinkv3_data;
if (libusb_init(&usb_ctx)) {
--
To view, visit https://review.coreboot.org/c/flashrom/+/67700
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ibaf25f67186724d9045ade849026782c3eac4952
Gerrit-Change-Number: 67700
Gerrit-PatchSet: 1
Gerrit-Owner: Alexander Goncharov <chat(a)joursoir.net>
Gerrit-MessageType: newchange
Attention is currently required from: Thomas Heijligen, Edward O'Callaghan, Nikolai Artemiev, Peter Marheine.
Jonathon Hall has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/67695 )
Change subject: drivers: Move (un)map_flash_region from programmer to bus master
......................................................................
Patch Set 2:
(4 comments)
Patchset:
PS2:
> Moving the map/unmap functions out of the programmer_entry struct is a good thing. […]
Yeah I think that would also work. I agree I don't think any of the SPI/opaque masters actually need this. I mainly kept it around to keep this change a strict refactor (thought it would be easier to review with the actual change in behavior called out separately) and because I couldn't test the others.
I tried the ICH9 swseq briefly but just got timeouts on the boards I tested (with no changes); didn't have time to dig into it yet. The only hardware programmers I have are ch341a_spi and ft2232_spi.
File atapromise.c:
https://review.coreboot.org/c/flashrom/+/67695/comment/71eb665a_ede41570
PS2, Line 133: atapromise_map
> This may not be needed any longer, because `atapromise_map` has the same implementation as `fallback […]
Agree, will tweak this when I'm back Tuesday.
File atavia.c:
https://review.coreboot.org/c/flashrom/+/67695/comment/1253a66d_3c0e339f
PS2, Line 147: atavia_map
> This may also not be needed, CB:67656 […]
If you can test that would be awesome, FWIW I could keep this around even if we move the mapper into par_master though.
File serprog.c:
https://review.coreboot.org/c/flashrom/+/67695/comment/a0c95d76_3784822b
PS2, Line 582: .map_flash_region = serprog_map,
Does anyone know if this is needed?
I'm pretty sure ICH7/9 swseq don't need mappers, but if this one does, and we want to move the mapper into the bus master structs, then I will add a mapper to spi_master too.
--
To view, visit https://review.coreboot.org/c/flashrom/+/67695
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I9c3df6ae260bcdb246dfb0cd8e043919609b014b
Gerrit-Change-Number: 67695
Gerrit-PatchSet: 2
Gerrit-Owner: Jonathon Hall <jonathon.hall(a)puri.sm>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Reviewer: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Attention: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Comment-Date: Sat, 17 Sep 2022 19:09:23 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Thomas Heijligen <src(a)posteo.de>
Gerrit-MessageType: comment
Attention is currently required from: Jonathon Hall.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/67696 )
Change subject: ichspi: Do not mmap for hwseq
......................................................................
Patch Set 2: Code-Review+1
--
To view, visit https://review.coreboot.org/c/flashrom/+/67696
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ic7761327b4072dcb9917000db9eaacc9404e6823
Gerrit-Change-Number: 67696
Gerrit-PatchSet: 2
Gerrit-Owner: Jonathon Hall <jonathon.hall(a)puri.sm>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Jonathon Hall <jonathon.hall(a)puri.sm>
Gerrit-Comment-Date: Sat, 17 Sep 2022 14:32:57 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: Edward O'Callaghan, Jonathon Hall, Nikolai Artemiev, Peter Marheine.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/67695 )
Change subject: drivers: Move (un)map_flash_region from programmer to bus master
......................................................................
Patch Set 2: Code-Review+1
--
To view, visit https://review.coreboot.org/c/flashrom/+/67695
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I9c3df6ae260bcdb246dfb0cd8e043919609b014b
Gerrit-Change-Number: 67695
Gerrit-PatchSet: 2
Gerrit-Owner: Jonathon Hall <jonathon.hall(a)puri.sm>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Reviewer: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Jonathon Hall <jonathon.hall(a)puri.sm>
Gerrit-Attention: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Attention: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Comment-Date: Sat, 17 Sep 2022 14:32:17 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: Simon Buhrow, Nico Huber, Paul Menzel, Aarya.
Thomas Heijligen 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 54:
(1 comment)
File flashrom.c:
https://review.coreboot.org/c/flashrom/+/66104/comment/75ada731_6abff9c7
PS54, Line 1244: assert(!ret);
This assert get triggered by the unit tests.
You can run them locally by comiling with meson
`meson build_dir -Dprogrammer=all -Dtests=enabled` -- configure the build
`ninja -C build_dir` -- compile everything
`ninja -C build_dir test` -- run the tests
--
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: 54
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: Simon Buhrow
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Aarya <aarya.chaumal(a)gmail.com>
Gerrit-Comment-Date: Sat, 17 Sep 2022 08:55:16 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment