Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons, Anastasia Klimchuk, Sergii Dmytruk.
Nikolai Artemiev has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/58480 )
Change subject: flashchips,writeprotect_ranges: add range decoding function
......................................................................
Patch Set 11:
(5 comments)
File flash.h:
https://review.coreboot.org/c/flashrom/+/58480/comment/1b9e84d9_04a2c0ed
PS10, Line 202: range_decode_fn_t
> In this typedef wp_ prefix would be informative. […]
Done
https://review.coreboot.org/c/flashrom/+/58480/comment/0b646f42_c909d9db
PS10, Line 319: decode_range
> If typedef gets wp_ prefix, this name can be decode_wp_range.
I like that name better, but it won't fit within 2 tabs like other flashchip fields so the flashchip definitions will look odd. Maybe get_wp_range? But I think decode is more accurate.
File libflashrom.h:
https://review.coreboot.org/c/flashrom/+/58480/comment/0a522d5b_e9a47ffa
PS10, Line 132: uint32_t chip_len;
> Why is this field here? Looks like it should have been an additional parameter to `decode_range` fun […]
Like the `chip` field in `struct flashrom_wp_chip_state`, it was mostly there for convenience, e.g. it is also used by the function that converts it to a string.
I've fixed it now.
File writeprotect_ranges.c:
https://review.coreboot.org/c/flashrom/+/58480/comment/fc8e4551_2adda57b
PS10, Line 19: ithat
> typo
Done
https://review.coreboot.org/c/flashrom/+/58480/comment/d91f00de_ee45f540
PS10, Line 40: range->chip_len;
> Same as Sergii said, chip_len doesn't seem to belong to range. […]
Done
--
To view, visit https://review.coreboot.org/c/flashrom/+/58480
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Id163ed80938a946a502ed116e48e8236e36eb203
Gerrit-Change-Number: 58480
Gerrit-PatchSet: 11
Gerrit-Owner: Nikolai Artemiev <nartemiev(a)google.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: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
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-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Attention: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
Gerrit-Comment-Date: Fri, 19 Nov 2021 10:19:57 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>
Comment-In-Reply-To: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
Gerrit-MessageType: comment
Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons, Anastasia Klimchuk, Sergii Dmytruk.
Nikolai Artemiev has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/58479 )
Change subject: libflashrom,writeprotect: add support for reading/writing WP configs
......................................................................
Patch Set 10:
(6 comments)
File libflashrom.h:
https://review.coreboot.org/c/flashrom/+/58479/comment/48957021_d01c6a76
PS9, Line 131: int flashrom_wp_read_chip_config(const struct flashrom_flashctx *flash, struct flashrom_wp_chip_config *cfg);
: int flashrom_wp_write_chip_config(struct flashrom_flashctx *flash, const struct flashrom_wp_chip_config *cfg);
: int flashrom_wp_compare_chip_configs(const struct flashrom_wp_chip_config *cfga, const struct flashrom_wp_chip_config *cfgb);
> You can omit parameter names if they are self-explanatory from parameter type, which all of these se […]
Done
File writeprotect.c:
https://review.coreboot.org/c/flashrom/+/58479/comment/a519d6bf_e0eb314f
PS9, Line 27: #define wp_chip_config flashrom_wp_chip_config
: #define wp_range flashrom_wp_range
: #define wp_mode flashrom_wp_mode
> Oh, so why this prefix was added from the very beginning? ;)
Yep, I'm not sure how much I like it, but it does save a lot of unnecessary in the code.
https://review.coreboot.org/c/flashrom/+/58479/comment/e3f83446_1f7619cc
PS9, Line 39: if (spi_read_register(flash, bit.reg, value))
: return 1;
> Let's propagate return value, […]
Done
https://review.coreboot.org/c/flashrom/+/58479/comment/7756b38b_e700a1e6
PS9, Line 128: return ret;
> This should be on its own line (and same below).
Done
https://review.coreboot.org/c/flashrom/+/58479/comment/4fe1823d_abfffc67
PS9, Line 158: if (ord == 0) ord = cfga->srp[i] - cfgb->srp[i];
> How does it work? If ord becomes non-0 in the first loop cycle, then the rest of (ord == 0) are skip […]
If you unroll the loop it looks like this:
if (ord == 0) ord = cfga->srp[1] - cfgb->srp[1];
if (ord == 0) ord = cfga->srp[0] - cfgb->srp[0];
The earlier comparisons are more important so we should only change the value of ord if all previous comparisons gave 0.
https://review.coreboot.org/c/flashrom/+/58479/comment/2e198c07_28f0121b
PS9, Line 161: ord = cfga->cmp - cfgb->cmp;
> Please make it on its own line, and the same for other conditionals below (including ones inside for […]
Done
--
To view, visit https://review.coreboot.org/c/flashrom/+/58479
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I3ad25708c3321b8fb0216c3eaf6ffc07616537ad
Gerrit-Change-Number: 58479
Gerrit-PatchSet: 10
Gerrit-Owner: Nikolai Artemiev <nartemiev(a)google.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: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
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-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Attention: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
Gerrit-Comment-Date: Fri, 19 Nov 2021 10:19:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: comment
Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons, Anastasia Klimchuk, Sergii Dmytruk.
Nikolai Artemiev has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/58478 )
Change subject: flash: add structure to represent chip wp configuration
......................................................................
Patch Set 10:
(2 comments)
File flash.h:
https://review.coreboot.org/c/flashrom/+/58478/comment/f9b5fe89_b177b154
PS9, Line 203: flashrom_
> I am thinking... do we really need "flashrom" prefix in this struct type name? […]
This is also exposed through libflashrom.h so I think we should keep the
"flashrom_" prefix.
https://review.coreboot.org/c/flashrom/+/58478/comment/79510c9d_2aafa06f
PS9, Line 219: /* Used for intrepreting configuration bits above */
: const struct flashchip *chip;
> Correction: I found implementation in CB:59183 and further in the chain (and added comments there). […]
Yeah this was kind of a hack, I've changed it now.
--
To view, visit https://review.coreboot.org/c/flashrom/+/58478
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I17dee630248ce7b51e624a6e46d7097d5d0de809
Gerrit-Change-Number: 58478
Gerrit-PatchSet: 10
Gerrit-Owner: Nikolai Artemiev <nartemiev(a)google.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: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
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-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Attention: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
Gerrit-Comment-Date: Fri, 19 Nov 2021 10:19:46 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: comment
Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons, Anastasia Klimchuk, Sergii Dmytruk.
Nikolai Artemiev has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/58475 )
Change subject: spi25_statusreg: make register read/write functions generic
......................................................................
Patch Set 10:
(4 comments)
File spi25_statusreg.c:
https://review.coreboot.org/c/flashrom/+/58475/comment/ff650868_863f2a48
PS9, Line 31:
> If you add new line it looks nicer, and easier to read (and I think consistent with most of long com […]
Done
https://review.coreboot.org/c/flashrom/+/58475/comment/050c051c_086d620a
PS9, Line 32:
> Is this one extra space? probably not needed?
Done
https://review.coreboot.org/c/flashrom/+/58475/comment/2aa4a2d0_0ed8431e
PS9, Line 120: msg_cerr("Cannot read register: not supported by chip\n");
> Just to clarify: here the error comes in else clause, which I understand. […]
The `if (write_cmd_len == 0)` is used to check this. The next CL adds some nested if statements that prevent using an `else` statement.
https://review.coreboot.org/c/flashrom/+/58475/comment/b51b7af4_c192904f
PS9, Line 143: uint8_t status;
> Is it 0 initialised?
Done
--
To view, visit https://review.coreboot.org/c/flashrom/+/58475
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I0a3951bbf993f2d8d830143b29d3ce16cc6901d7
Gerrit-Change-Number: 58475
Gerrit-PatchSet: 10
Gerrit-Owner: Nikolai Artemiev <nartemiev(a)google.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: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
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-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Attention: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
Gerrit-Comment-Date: Fri, 19 Nov 2021 10:19:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: comment
Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons, Anastasia Klimchuk, Sergii Dmytruk.
Nikolai Artemiev has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/58474 )
Change subject: writeprotect, cli_classic: delete old writeprotect code
......................................................................
Patch Set 10:
(3 comments)
File cli_classic.c:
https://review.coreboot.org/c/flashrom/+/58474/comment/046e4e5c_b58abb01
PS9, Line 159: int set_wp_enable,
: int set_wp_disable,
: int wp_status,
: int set_wp_range,
: int wp_list,
> These all are commands/actions? I noticed some of them start with verb "set" and others start with a […]
Done - I've renamed them and moved all the WP CLI code to the final CL.
https://review.coreboot.org/c/flashrom/+/58474/comment/e6bf2d26_de3ebe41
PS9, Line 786: set_wp_range || (set_wp_region && wp_region)
> A tiny bit confusing, because function param is named simply `set_wp_range` however actual argument […]
I've refactored it a bit in the WP CLI patch.
--wp-region is just a different way of specifying a protection region using a fmap file. It should mostly do the same thing as --wp-range.
File libflashrom.h:
https://review.coreboot.org/c/flashrom/+/58474/comment/b61ed326_9fd45cb7
PS9, Line 4: 2010
> I don't see why a commit that says `delete` in its summary should be adding anything.
Done - I've now completely removed WP CLI code so we don't need to add the flashrom_wp_mode enum in this CL.
As for the copyright line, I just copied it from the writeprotect.h file along with the wp mode enum.
--
To view, visit https://review.coreboot.org/c/flashrom/+/58474
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I67e9b31f86465e5a8f7d3def637198671ee818a8
Gerrit-Change-Number: 58474
Gerrit-PatchSet: 10
Gerrit-Owner: Nikolai Artemiev <nartemiev(a)google.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: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
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-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Attention: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
Gerrit-Comment-Date: Fri, 19 Nov 2021 10:19:22 +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