Attention is currently required from: Aarya, Nikolai Artemiev, Sergii Dmytruk.
Anastasia Klimchuk has posted comments on this change by Sergii Dmytruk. ( https://review.coreboot.org/c/flashrom/+/84102?usp=email )
Change subject: Complete and fix progress feature implementation for all operations
......................................................................
Patch Set 2:
(1 comment)
File en29lv640b.c:
https://review.coreboot.org/c/flashrom/+/84102/comment/9b17c834_ccbff766?us… :
PS1, Line 29: /* chunksize is 2 */
> This can also be a separate commit which updates the comment only.
CB:84422
--
To view, visit https://review.coreboot.org/c/flashrom/+/84102?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: If1e40fc97f443c4f0c0501cef11cff1f3f84c051
Gerrit-Change-Number: 84102
Gerrit-PatchSet: 2
Gerrit-Owner: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
Gerrit-Reviewer: Aarya <aarya.chaumal(a)gmail.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(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-Attention: Aarya <aarya.chaumal(a)gmail.com>
Gerrit-Attention: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Attention: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
Gerrit-Comment-Date: Thu, 19 Sep 2024 12:05:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>
Anastasia Klimchuk has posted comments on this change by Anastasia Klimchuk. ( https://review.coreboot.org/c/flashrom/+/84423?usp=email )
Change subject: dummyflasher: Enable higher frequency emulation
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
Note: need to ensure this change works together with CB:84102 and all tests pass at the end of a chain.
--
To view, visit https://review.coreboot.org/c/flashrom/+/84423?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: Iaca5d95f8f977bf0c2283c6458d8977e6ce70251
Gerrit-Change-Number: 84423
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Thu, 19 Sep 2024 12:04:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: Aarya, Nikolai Artemiev, Sergii Dmytruk.
Anastasia Klimchuk has posted comments on this change by Sergii Dmytruk. ( https://review.coreboot.org/c/flashrom/+/84102?usp=email )
Change subject: Complete and fix progress feature implementation for all operations
......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS2:
Still working on the tests, might need some time to get them work.
I extracted few things into separate commits, but this one need some more time (and update to devel.rst)
--
To view, visit https://review.coreboot.org/c/flashrom/+/84102?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: If1e40fc97f443c4f0c0501cef11cff1f3f84c051
Gerrit-Change-Number: 84102
Gerrit-PatchSet: 2
Gerrit-Owner: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
Gerrit-Reviewer: Aarya <aarya.chaumal(a)gmail.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(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-Attention: Aarya <aarya.chaumal(a)gmail.com>
Gerrit-Attention: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Attention: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
Gerrit-Comment-Date: Thu, 19 Sep 2024 12:02:01 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Anastasia Klimchuk has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/84423?usp=email )
Change subject: dummyflasher: Enable higher frequency emulation
......................................................................
dummyflasher: Enable higher frequency emulation
The patch also adds a section on a manpage to explain the freq
parameter in dummyflasher.
Change-Id: Iaca5d95f8f977bf0c2283c6458d8977e6ce70251
Signed-off-by: Anastasia Klimchuk <aklm(a)flashrom.org>
---
M doc/classic_cli_manpage.rst
M dummyflasher.c
2 files changed, 14 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/23/84423/1
diff --git a/doc/classic_cli_manpage.rst b/doc/classic_cli_manpage.rst
index e2ce684..ba77b7a 100644
--- a/doc/classic_cli_manpage.rst
+++ b/doc/classic_cli_manpage.rst
@@ -616,6 +616,15 @@
syntax where ``state`` is ``yes`` or ``no`` (default value). ``yes`` means active state of the pin implies that chip is
write-protected (on real hardware the pin is usually negated, but not here).
+**Frequency**
+ Frequency can be emulated in ``Hz`` (default), ``KHz``, or ``MHz`` (not case sensitive).
+ If ``freq`` parameter is passed in from command line, commands will delay for certain time before returning,
+ so that to emulate the requested frequency.
+
+ The delay is calculated based on the assumption that we only work with bytes and transfer at 1 bit/Hz::
+
+ flashrom -p dummy:emulate=W25Q128FV,freq=64mhz
+
nic3com, nicrealtek, nicnatsemi, nicintel, nicintel_eeprom, nicintel_spi, gfxnvidia, ogp_spi, drkaiser, satasii, satamv, atahpt, atavia, atapromise, it8212 programmers
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/dummyflasher.c b/dummyflasher.c
index cf4ca03..283e0c6 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -55,7 +55,7 @@
uint8_t emu_status_len; /* number of emulated status registers */
/* If "freq" parameter is passed in from command line, commands will delay
* for this period before returning. */
- unsigned long int delay_us;
+ unsigned long long delay_ns;
unsigned int emu_max_byteprogram_size;
unsigned int emu_max_aai_size;
unsigned int emu_jedec_se_size;
@@ -901,7 +901,7 @@
msg_pspew(" 0x%02x", readarr[i]);
msg_pspew("\n");
- default_delay((writecnt + readcnt) * emu_data->delay_us);
+ default_delay(((writecnt + readcnt) * emu_data->delay_ns) / 1000);
return 0;
}
@@ -1128,7 +1128,7 @@
/* frequency to emulate in Hz (default), KHz, or MHz */
tmp = extract_programmer_param_str(cfg, "freq");
if (tmp) {
- unsigned long int freq;
+ unsigned long long freq;
char *units = tmp;
char *end = tmp + strlen(tmp);
@@ -1172,7 +1172,7 @@
return 1;
}
/* Assume we only work with bytes and transfer at 1 bit/Hz */
- data->delay_us = (1000000 * 8) / freq;
+ data->delay_ns = (1000000000ull * 8) / freq;
}
free(tmp);
@@ -1402,7 +1402,7 @@
return 1;
}
data->emu_chip = EMULATE_NONE;
- data->delay_us = 0;
+ data->delay_ns = 0;
data->spi_write_256_chunksize = 256;
msg_pspew("%s\n", __func__);
--
To view, visit https://review.coreboot.org/c/flashrom/+/84423?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: Iaca5d95f8f977bf0c2283c6458d8977e6ce70251
Gerrit-Change-Number: 84423
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Anastasia Klimchuk has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/84421?usp=email )
Change subject: dediprog: Fix comment about usb transfer size
......................................................................
dediprog: Fix comment about usb transfer size
Change-Id: I1ad7f89b0a6c91907440e3897ac262bd82f846d5
Signed-off-by: Anastasia Klimchuk <aklm(a)flashrom.org>
---
M dediprog.c
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/21/84421/1
diff --git a/dediprog.c b/dediprog.c
index 734fcfa..aa3a1cf 100644
--- a/dediprog.c
+++ b/dediprog.c
@@ -593,7 +593,7 @@
static int dediprog_spi_bulk_write(struct flashctx *flash, const uint8_t *buf, unsigned int chunksize,
unsigned int start, unsigned int len, uint8_t dedi_spi_cmd)
{
- /* USB transfer size must be 512, other sizes will NOT work at all.
+ /* USB transfer size must be 256, other sizes will NOT work at all.
* chunksize is the real data size per USB bulk transfer. The remaining
* space in a USB bulk transfer must be filled with 0xff padding.
*/
--
To view, visit https://review.coreboot.org/c/flashrom/+/84421?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: I1ad7f89b0a6c91907440e3897ac262bd82f846d5
Gerrit-Change-Number: 84421
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Attention is currently required from: Aarya, Anastasia Klimchuk, Nikolai Artemiev.
Anastasia Klimchuk has uploaded a new patch set (#2) to the change originally created by Sergii Dmytruk. ( https://review.coreboot.org/c/flashrom/+/84102?usp=email )
The following approvals got outdated and were removed:
Verified-1 by build bot (Jenkins)
Change subject: Complete and fix progress feature implementation for all operations
......................................................................
Complete and fix progress feature implementation for all operations
Original progress reporting implemented in CB:49643 and it has some
issues, for example:
size_t start_address = start;
size_t end_address = len - start;
End address is anything but length minus start address.
update_progress(flash,
FLASHROM_PROGRESS_READ,
/*current*/ start - start_address + to_read,
/*total*/ end_address);
Total should just be length if that's how current value is computed.
---
libflashrom needs to know total size ahead of time.
That's init_progress() and changed update_progress().
It also needs to store the last current value to be able to update it.
That's stage_progress in flashrom_flashctx.
Measuring accurately amount of data which will be read/erased/written
isn't easy because things can be skipped as optimizations. Current
values are probably off, there are TODO/FIXME comments.
---
CLI shares terminal with the rest of the code and has to maintain more
state to handle that reasonably well.
The progress doesn't just dump lots of stuff on the screen which
probably won't fly because of CB:64668, but it's not hard to adjust
this.
---
A script to test the CLI:
\#!/bin/bash
t=${1:-rewW}
shift
if [[ $t =~ r ]]; then
echo ">>> READ"
./flashrom -p dummy:emulate=W25Q128FV,freq=64mhz -r dump.rom --progress "$@"
echo
fi
if [[ $t =~ e ]]; then
echo ">>> ERASE"
./flashrom -p dummy:emulate=W25Q128FV,freq=64mhz -E --progress "$@"
echo
fi
if [[ $t =~ w ]]; then
echo ">>> WRITE (without erase)"
dd if=/dev/zero of=zero.rom bs=1M count=16 2> /dev/null
./flashrom -p dummy:emulate=W25Q128FV,freq=64mhz -w zero.rom --progress "$@"
echo
fi
if [[ $t =~ W ]]; then
echo ">>> WRITE (with erase)"
dd if=/dev/zero of=zero.rom bs=1M count=16 2> /dev/null
dd if=/dev/random of=random.rom bs=1M count=16 2> /dev/null
./flashrom -p dummy:emulate=W25Q128FV,freq=64mhz,image=random.rom -w zero.rom --progress "$@"
echo
fi
Change-Id: If1e40fc97f443c4f0c0501cef11cff1f3f84c051
Signed-off-by: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
Signed-off-by: Anastasia Klimchuk <aklm(a)flashrom.org>
---
M 82802ab.c
M at45db.c
M cli_classic.c
M cli_output.c
M dediprog.c
M en29lv640b.c
M erasure_layout.c
M flashrom.c
M include/flash.h
M it87spi.c
M jedec.c
M libflashrom.c
M linux_mtd.c
M parade_lspcon.c
M realtek_mst_i2c_spi.c
M spi.c
M spi25.c
M sst28sf040.c
18 files changed, 181 insertions(+), 38 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/02/84102/2
--
To view, visit https://review.coreboot.org/c/flashrom/+/84102?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: If1e40fc97f443c4f0c0501cef11cff1f3f84c051
Gerrit-Change-Number: 84102
Gerrit-PatchSet: 2
Gerrit-Owner: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
Gerrit-Reviewer: Aarya <aarya.chaumal(a)gmail.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(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-Attention: Aarya <aarya.chaumal(a)gmail.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Attention: Nikolai Artemiev <nartemiev(a)google.com>
Attention is currently required from: Aarya, Anastasia Klimchuk, Nikolai Artemiev, Peter Marheine.
Sergii Dmytruk has posted comments on this change by Sergii Dmytruk. ( https://review.coreboot.org/c/flashrom/+/84102?usp=email )
Change subject: More adequate progress
......................................................................
Patch Set 1:
(7 comments)
Patchset:
PS1:
> Sergii, thanks a lot for the patch, that's a great help. […]
Sure, please go for it. I can review and provide more details as needed, just don't have time/need to finish this properly.
Commit Message:
https://review.coreboot.org/c/flashrom/+/84102/comment/7fa24368_d2e255aa?us… :
PS1, Line 46:
: CLI shares terminal with the rest of the code
> What does it mean? I don't understand :(
I just meant that flashrom can print log output at any point (like it prints `DONE something`) so CLI implementation can't assume that nothing interferes with its output.
File dummyflasher.c:
https://review.coreboot.org/c/flashrom/+/84102/comment/2af2d3e3_1145c745?us… :
PS1, Line 58: unsigned long long delay_ns;
> This is changing to nano seconds, is it to be able to set a more fine-grained delay? […]
I think insufficient range was my first guess, before I noticed `(1000000 * 8) / freq` below. If frequency of 1Hz isn't necessary in 32-bit builds, then `long int` should be enough. 64MHz wasn't supported because `(1000000 * 8) / 64000000` results in zero delay (like any frequency above 8MHz).
Type of `freq` below doesn't need to change in any case.
File include/flash.h:
https://review.coreboot.org/c/flashrom/+/84102/comment/74c4eb9a_2775229e?us… :
PS1, Line 544: struct stage_progress {
: size_t current;
: size_t total;
: };
> And can this go to libflashrom. […]
This is not part of API, nothing in `libflashrom.h` uses this structure.
https://review.coreboot.org/c/flashrom/+/84102/comment/8edbf977_85a786b5?us… :
PS1, Line 587: struct stage_progress stage_progress[FLASHROM_PROGRESS_NR];
> Maybe this can go inside `struct flashrom_progress` ? Why do we need two structs on the same level, […]
That would change API and ABI. This was added for internal use to keep track of progress, while `struct flashrom_progress` is a parameter for a user callback which can also be allocated on client side and changed at will, potentially messing with flashrom's view of things.
File linux_mtd.c:
https://review.coreboot.org/c/flashrom/+/84102/comment/4caa98f3_c3707e9c?us… :
PS1, Line 298: update_progress(flash, FLASHROM_PROGRESS_ERASE, u + data->erasesize, len);
> Why you removed this? Should it be […]
It's for erasing which I think is handled uniformly in `erasure_layout.c`.
File spi.c:
https://review.coreboot.org/c/flashrom/+/84102/comment/a9799407_12dbdc0e?us… :
PS1, Line 118: update_progress(flash, FLASHROM_PROGRESS_READ, start - start_address + to_read, end_address);
> Why removing, should this be […]
`flash->mst->spi.read` updates progress, keeping this line results in progress on reading reaching over 100%.
This could be a single place to report read progress (like for erasing) and drop all similar calls in programmers, but granularity would likely be too coarse (erasing is different, there can be a command to erase the whole chip at once and you can only report it in one way: 0% -> 100%).
--
To view, visit https://review.coreboot.org/c/flashrom/+/84102?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: If1e40fc97f443c4f0c0501cef11cff1f3f84c051
Gerrit-Change-Number: 84102
Gerrit-PatchSet: 1
Gerrit-Owner: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
Gerrit-Reviewer: Aarya <aarya.chaumal(a)gmail.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(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-Attention: Aarya <aarya.chaumal(a)gmail.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Attention: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Attention: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Comment-Date: Sat, 14 Sep 2024 16:33:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>