Attention is currently required from: Thomas Heijligen, Edward O'Callaghan.
Hello Felix Singer, build bot (Jenkins), Thomas Heijligen, Peter Marheine,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/70264
to look at the new patch set (#4).
Change subject: tree/: Drop default_spi_probe_opcode for NULL case
......................................................................
tree/: Drop default_spi_probe_opcode for NULL case
A NULL func pointer is necessary and sufficient for the
condition `NULL func pointer => true' as to not need this
boilerplate as it implies default behaviour of a supported
opcode within the `check_block_eraser()` match supported loop.
Ran;
```
$ find . -name '*.[c,h]' -exec sed -i '/.probe_opcode = default_spi_probe_opcode,/d' '{}' \;
```
Change-Id: Id502c5d2596ad1db52faf05723083620e4c52c12
Signed-off-by: Edward O'Callaghan <quasisec(a)google.com>
---
M bitbang_spi.c
M buspirate_spi.c
M ch341a_spi.c
M dediprog.c
M digilent_spi.c
M dirtyjtag_spi.c
M flashrom.c
M ft2232_spi.c
M include/chipdrivers.h
M include/programmer.h
M it87spi.c
M jlink_spi.c
M linux_spi.c
M mediatek_i2c_spi.c
M mstarddc_spi.c
M ni845x_spi.c
M parade_lspcon.c
M pickit2_spi.c
M raiden_debug_spi.c
M realtek_mst_i2c_spi.c
M sb600spi.c
M serprog.c
M spi.c
M spi25_statusreg.c
M stlinkv3_spi.c
M usbblaster_spi.c
M wbsio_spi.c
27 files changed, 30 insertions(+), 32 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/64/70264/4
--
To view, visit https://review.coreboot.org/c/flashrom/+/70264
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Id502c5d2596ad1db52faf05723083620e4c52c12
Gerrit-Change-Number: 70264
Gerrit-PatchSet: 4
Gerrit-Owner: 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-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-MessageType: newpatchset
Attention is currently required from: Thomas Heijligen.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/70264 )
Change subject: tree/: Drop default_spi_probe_opcode for NULL case
......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS1:
> Absolutely!
rebased, it should be fine to merge now?
--
To view, visit https://review.coreboot.org/c/flashrom/+/70264
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Id502c5d2596ad1db52faf05723083620e4c52c12
Gerrit-Change-Number: 70264
Gerrit-PatchSet: 2
Gerrit-Owner: 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-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-Comment-Date: Tue, 20 Dec 2022 02:09:33 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Thomas Heijligen <src(a)posteo.de>
Comment-In-Reply-To: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-MessageType: comment
Attention is currently required from: Thomas Heijligen, Edward O'Callaghan.
Hello Felix Singer, build bot (Jenkins), Thomas Heijligen, Peter Marheine,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/70264
to look at the new patch set (#2).
Change subject: tree/: Drop default_spi_probe_opcode for NULL case
......................................................................
tree/: Drop default_spi_probe_opcode for NULL case
A NULL func pointer is necessary and sufficient for the
condition `NULL func pointer => true' as to not need this
boilerplate as it implies default behaviour of a supported
opcode within the `check_block_eraser()` match supported loop.
Ran;
```
$ find . -name '*.[c,h]' -exec sed -i '/.probe_opcode = default_spi_probe_opcode,/d' '{}' \;
```
Change-Id: Id502c5d2596ad1db52faf05723083620e4c52c12
Signed-off-by: Edward O'Callaghan <quasisec(a)google.com>
---
M bitbang_spi.c
M buspirate_spi.c
M ch341a_spi.c
M dediprog.c
M digilent_spi.c
M dirtyjtag_spi.c
M flashrom.c
M ft2232_spi.c
M include/programmer.h
M it87spi.c
M jlink_spi.c
M linux_spi.c
M mediatek_i2c_spi.c
M mstarddc_spi.c
M ni845x_spi.c
M parade_lspcon.c
M pickit2_spi.c
M raiden_debug_spi.c
M realtek_mst_i2c_spi.c
M sb600spi.c
M serprog.c
M spi.c
M stlinkv3_spi.c
M usbblaster_spi.c
M wbsio_spi.c
25 files changed, 25 insertions(+), 32 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/64/70264/2
--
To view, visit https://review.coreboot.org/c/flashrom/+/70264
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Id502c5d2596ad1db52faf05723083620e4c52c12
Gerrit-Change-Number: 70264
Gerrit-PatchSet: 2
Gerrit-Owner: 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-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-MessageType: newpatchset
Attention is currently required from: Simon Buhrow, Nico Huber, Aarya, Anastasia Klimchuk.
Edward O'Callaghan 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 78:
(1 comment)
File flashrom.c:
https://review.coreboot.org/c/flashrom/+/66104/comment/1d7565dd_65ed527e
PS72, Line 1349: static int erase_by_layout
> If it is easier to not have your work sitting in review forever and you want to put everything initi […]
Like this, https://review.coreboot.org/c/flashrom/+/71119 feel free to hijack the patch and co-author it into your series.
--
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: 78
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: Edward O'Callaghan <quasisec(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: Aarya <aarya.chaumal(a)gmail.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Mon, 19 Dec 2022 23:58:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Edward O'Callaghan <quasisec(a)chromium.org>
Comment-In-Reply-To: Aarya <aarya.chaumal(a)gmail.com>
Gerrit-MessageType: comment
Attention is currently required from: Simon Buhrow, Nico Huber, Aarya, Anastasia Klimchuk.
Edward O'Callaghan 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 78:
(10 comments)
Commit Message:
https://review.coreboot.org/c/flashrom/+/66104/comment/d509bb8f_dd83febd
PS78, Line 6:
: flashrom.c: Add wrapper function to use the erase algorithm
:
: Add a function to call the erase algorithm.
commit message is unrelated to content.
File flashrom.c:
https://review.coreboot.org/c/flashrom/+/66104/comment/5b908617_ea80c258
PS72, Line 1349: static int erase_by_layout
> It would be my view to more your whole implementation into its own separate file. […]
If it is easier to not have your work sitting in review forever and you want to put everything initially in flashrom.c I would suggest the following pattern for the minimal amount of reshuffling for you:
i) Create some trampoline functions that will dispatch into your algorithm and a few if branches to jump to them. Use a static bool global `use_legacy_erase_path = true;` and branch off that.
ii) Adding all the new functions in one go atomically without the need for the prototypes hacks.
iii) Have a small commit that toggles `use_legacy_erase_path` from `true->false`.
So for step (i), for this function in another commit rename it as `erase_by_layout_legacy()` and call it with:
```
static int erase_by_layout(struct flashctx *const flashctx)
{
if (use_legacy_erase_path)
return erase_by_layout_legacy(flashctx);
}
```
Subsequently for step (ii) you can do:
```
static int erase_by_layout(struct flashctx *const flashctx)
{
if (use_legacy_erase_path)
return erase_by_layout_legacy(flashctx);
return erase_by_layout_optimised(flashctx);
}
```
File flashrom.c:
https://review.coreboot.org/c/flashrom/+/66104/comment/f72f5d49_79174b17
PS78, Line 720: <= len
what is happening here? Seems like its own change but not what the commit says "add wrapping function".
https://review.coreboot.org/c/flashrom/+/66104/comment/2a6cb487_e468e330
PS78, Line 1374: size_t
`const uint32_t`, A `size_t` is a a system specific type.
https://review.coreboot.org/c/flashrom/+/66104/comment/7e589648_a742f96f
PS78, Line 1378: int
const
https://review.coreboot.org/c/flashrom/+/66104/comment/36afffc5_54b6d68b
PS78, Line 1382: curcontents == NULL || newcontents == NULL
`!ptr` is canonical. Also `erase_layout` never checked.
https://review.coreboot.org/c/flashrom/+/66104/comment/a97a9573_3f4f1113
PS78, Line 1422: write_by_layout
in a separate commit before this one, rename as `write_by_layout_legacy()` and,
```
static int write_by_layout(struct flashctx *const flashctx,
uint8_t *const curcontents,
const uint8_t *const newcontents)
{
if (use_legacy_erase_path)
return write_by_layout_legacy(flashctx, curcontents, newcontents);
}
```
then you can put your new implementation in the above in this commit.
https://review.coreboot.org/c/flashrom/+/66104/comment/a59babe2_580b6c5b
PS78, Line 1425: const struct flashrom_layout *const flash_layout = get_layout(flashctx);
: const struct romentry *entry = NULL;
: struct erase_layout *erase_layout = create_erase_layout(flashctx);
move below `erasefn_count` and `ret`
https://review.coreboot.org/c/flashrom/+/66104/comment/ad34dc3d_9c2e4f09
PS78, Line 1427: erase_layout
check for nullarity?
https://review.coreboot.org/c/flashrom/+/66104/comment/7ba21b18_09cb3e93
PS78, Line 1428: int
`const`
--
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: 78
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: Edward O'Callaghan <quasisec(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: Aarya <aarya.chaumal(a)gmail.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Mon, 19 Dec 2022 23:45:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Edward O'Callaghan <quasisec(a)chromium.org>
Comment-In-Reply-To: Aarya <aarya.chaumal(a)gmail.com>
Gerrit-MessageType: comment
Attention is currently required from: Simon Buhrow, Nico Huber, Thomas Heijligen, Paul Menzel, Aarya.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/65879 )
Change subject: flashrom.c:Add function to get a flattened view of the chip erase blocks
......................................................................
Patch Set 46:
(1 comment)
File flashrom.c:
https://review.coreboot.org/c/flashrom/+/65879/comment/2c88fff2_5f896f94
PS42, Line 1249: index
> Maybe: […]
Sounds like a good suggestion to me Simon.
--
To view, visit https://review.coreboot.org/c/flashrom/+/65879
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Iafe78de00daa55f7114bd4ce09465dd88074ece4
Gerrit-Change-Number: 65879
Gerrit-PatchSet: 46
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: Edward O'Callaghan <quasisec(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: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Aarya <aarya.chaumal(a)gmail.com>
Gerrit-Comment-Date: Mon, 19 Dec 2022 23:13:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Simon Buhrow
Comment-In-Reply-To: Edward O'Callaghan <quasisec(a)chromium.org>
Comment-In-Reply-To: Aarya <aarya.chaumal(a)gmail.com>
Gerrit-MessageType: comment
Edward O'Callaghan has submitted this change. ( https://review.coreboot.org/c/flashrom/+/66717 )
(
21 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: flashrom.c: Update check_block_eraser function to use probe opcode
......................................................................
flashrom.c: Update check_block_eraser function to use probe opcode
Update the check_block_eraser function to use probe_opcode to see if the
given block_eraser is supported by the spi master. This will help to get
a real count of usable block_erasers.
Change-Id: I6591a84ae1fe5bc1648051cc30b9393450033852
Signed-off-by: Aarya Chaumal <aarya.chaumal(a)gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/66717
Reviewed-by: Edward O'Callaghan <quasisec(a)chromium.org>
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
---
M flashrom.c
1 file changed, 29 insertions(+), 0 deletions(-)
Approvals:
build bot (Jenkins): Verified
Edward O'Callaghan: Looks good to me, approved
diff --git a/flashrom.c b/flashrom.c
index 573f10b..785da6f 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -446,6 +446,18 @@
"eraseblock layout is not defined. ");
return 1;
}
+
+ if (flash->mst->buses_supported & BUS_SPI) {
+ const uint8_t *opcode = spi_get_opcode_from_erasefn(eraser.block_erase);
+ for (int i = 0; opcode[i]; i++) {
+ if (!flash->mst->spi.probe_opcode(flash, opcode[i])) {
+ if (log)
+ msg_cdbg("block erase function and layout found "
+ "but SPI master doesn't support the function. ");
+ return 1;
+ }
+ }
+ }
// TODO: Once erase functions are annotated with allowed buses, check that as well.
return 0;
}
--
To view, visit https://review.coreboot.org/c/flashrom/+/66717
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I6591a84ae1fe5bc1648051cc30b9393450033852
Gerrit-Change-Number: 66717
Gerrit-PatchSet: 26
Gerrit-Owner: Aarya <aarya.chaumal(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
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-MessageType: merged
Attention is currently required from: Thomas Heijligen, Angel Pons, qianfan, Anastasia Klimchuk.
Nicholas Chin has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/70573 )
Change subject: ch347_spi.c: Add initial support for the WCH CH347
......................................................................
Patch Set 3: Code-Review-1
(2 comments)
Patchset:
PS3:
> I've added some comments on your patch. […]
I've moved unique parts of this patch (CB:70573) to a new patch (CB:71066) which is rebased on top of CB:70529.
PS3:
Giving this -1 for now to make sure this doesn't get submitted without CB:70529 (Qianfan's port which was uploaded before mine) and CB:71066 (extra features in my port rebased on top of Qianfan's code) having been reviewed.
--
To view, visit https://review.coreboot.org/c/flashrom/+/70573
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I31b86c41076cc45d4a416a73fa1131350fb745ba
Gerrit-Change-Number: 70573
Gerrit-PatchSet: 3
Gerrit-Owner: Nicholas Chin <nic.c3.14(a)gmail.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Nicholas Chin <nic.c3.14(a)gmail.com>
Gerrit-Reviewer: Thomas Heijligen <src(a)posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Alexander Goncharov <chat(a)joursoir.net>
Gerrit-CC: qianfan <qianfanguijin(a)163.com>
Gerrit-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: qianfan <qianfanguijin(a)163.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Mon, 19 Dec 2022 18:52:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: qianfan <qianfanguijin(a)163.com>
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>
Comment-In-Reply-To: Nicholas Chin <nic.c3.14(a)gmail.com>
Gerrit-MessageType: comment