Simon Buhrow has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/40477 )
Change subject: ft2232_spi.c - Pack WREN and op in one ftdi_write_data() call to save programming time
......................................................................
Patch Set 6:
(1 comment)
> Patch Set 3:
>
> (1 comment)
https://review.coreboot.org/c/flashrom/+/40477/2/ft2232_spi.c
File ft2232_spi.c:
https://review.coreboot.org/c/flashrom/+/40477/2/ft2232_spi.c@549
PS2, Line 549: return 0;
> Well, in the usual use case with maximum buf size equal to normal page program operations, I agree. […]
Done in patchset 6: Set buf to fix size to fix realloc issue.
--
To view, visit https://review.coreboot.org/c/flashrom/+/40477
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ie4a07499ec5ef0af23818593f45dc427285a9e8a
Gerrit-Change-Number: 40477
Gerrit-PatchSet: 6
Gerrit-Owner: Simon Buhrow
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-CC: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Comment-Date: Mon, 27 Apr 2020 08:29:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Simon Buhrow
Comment-In-Reply-To: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-MessageType: comment
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/40477
to look at the new patch set (#6).
Change subject: ft2232_spi.c - Pack WREN and op in one ftdi_write_data() call to save programming time
......................................................................
ft2232_spi.c - Pack WREN and op in one ftdi_write_data() call to save programming time
Every ftdi_write_data() call is quite time consuming as the ftdi-chips seems to take always 2-3ms to respond.
This leads to what the comment already says: Minimize USB transfers by packing as many commands as possible together.
So I packed the WREN command together with the following operation which can be program or erase operation.
This saves about 1 minute when programming a 128MBit Flash with my config!
See timings WREN in extra ftdi_write_data() call:
https://ibb.co/0c1J25d
WREN packed with op:
https://ibb.co/7G1hLkj
I´m using ftdi-2232H chip. That´s why I put it at this place.
If anyone has a good overview about all programmers:
This could be implemented in spi_write_cmd() in case that it is compatible to all programmers
or this principle could be transfered to other programmers which act in a similar way.
Signed-off-by: Simon Buhrow <simon.buhrow(a)posteo.de>
Change-Id: Ie4a07499ec5ef0af23818593f45dc427285a9e8a
---
M ft2232_spi.c
1 file changed, 18 insertions(+), 11 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/77/40477/6
--
To view, visit https://review.coreboot.org/c/flashrom/+/40477
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ie4a07499ec5ef0af23818593f45dc427285a9e8a
Gerrit-Change-Number: 40477
Gerrit-PatchSet: 6
Gerrit-Owner: Simon Buhrow
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-CC: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-MessageType: newpatchset
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/40477
to look at the new patch set (#5).
Change subject: Set buffers size fix to 4096 Signed-off-by: Simon Buhrow <simon.buhrow(a)posteo.de> Change-Id: Ie4a07499ec5ef0af23818593f45dc427285a9e8a
......................................................................
Set buffers size fix to 4096
Signed-off-by: Simon Buhrow <simon.buhrow(a)posteo.de>
Change-Id: Ie4a07499ec5ef0af23818593f45dc427285a9e8a
---
M ft2232_spi.c
1 file changed, 18 insertions(+), 11 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/77/40477/5
--
To view, visit https://review.coreboot.org/c/flashrom/+/40477
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ie4a07499ec5ef0af23818593f45dc427285a9e8a
Gerrit-Change-Number: 40477
Gerrit-PatchSet: 5
Gerrit-Owner: Simon Buhrow
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-CC: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-MessageType: newpatchset
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/40477
to look at the new patch set (#4).
Change subject: ft2232_spi.c - Pack WREN and op in one ftdi_write_data() call to save programming time
......................................................................
ft2232_spi.c - Pack WREN and op in one ftdi_write_data() call to save programming time
Every ftdi_write_data() call is quite time consuming as the ftdi-chips seems to take always 2-3ms to respond.
This leads to what the comment already says: Minimize USB transfers by packing as many commands as possible together.
So I packed the WREN command together with the following operation which can be program or erase operation.
This saves about 1 minute when programming a 128MBit Flash with my config!
See timings WREN in extra ftdi_write_data() call:
https://ibb.co/0c1J25d
WREN packed with op:
https://ibb.co/7G1hLkj
I´m using ftdi-2232H chip. That´s why I put it at this place.
If anyone has a good overview about all programmers:
This could be implemented in spi_write_cmd() in case that it is compatible to all programmers
or this principle could be transfered to other programmers which act in a similar way.
Signed-off-by: Simon Buhrow <simon.buhrow(a)posteo.de>
Change-Id: Ie4a07499ec5ef0af23818593f45dc427285a9e8a
---
M ft2232_spi.c
1 file changed, 19 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/77/40477/4
--
To view, visit https://review.coreboot.org/c/flashrom/+/40477
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ie4a07499ec5ef0af23818593f45dc427285a9e8a
Gerrit-Change-Number: 40477
Gerrit-PatchSet: 4
Gerrit-Owner: Simon Buhrow
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-CC: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-MessageType: newpatchset
Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/39975 )
Change subject: ft2232_spi.c: Improve handling of static buffer
......................................................................
ft2232_spi.c: Improve handling of static buffer
If `buf` became NULL because of an error, subsequent calls to the
`ft2232_spi_send_command` function with a smaller buffer size will
result in a null pointer dereference. Add an additional null check
before using `buf` to prevent that. Moreover, use `size_t` for the
`bufsize` and `oldbufsize` variables, as it's what `realloc` uses.
Change-Id: Idc4237ddca94c42ce2a930e6d00fd2d14e4f125c
Signed-off-by: Angel Pons <th3fanbus(a)gmail.com>
---
M ft2232_spi.c
1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/75/39975/1
diff --git a/ft2232_spi.c b/ft2232_spi.c
index 1a5b2fe..84aebb3 100644
--- a/ft2232_spi.c
+++ b/ft2232_spi.c
@@ -468,8 +468,8 @@
static unsigned char *buf = NULL;
/* failed is special. We use bitwise ops, but it is essentially bool. */
int i = 0, ret = 0, failed = 0;
- int bufsize;
- static int oldbufsize = 0;
+ size_t bufsize;
+ static size_t oldbufsize = 0;
if (writecnt > 65536 || readcnt > 65536)
return SPI_INVALID_LENGTH;
@@ -477,7 +477,7 @@
/* buf is not used for the response from the chip. */
bufsize = max(writecnt + 9, 260 + 9);
/* Never shrink. realloc() calls are expensive. */
- if (bufsize > oldbufsize) {
+ if (!buf || bufsize > oldbufsize) {
buf = realloc(buf, bufsize);
if (!buf) {
msg_perr("Out of memory!\n");
--
To view, visit https://review.coreboot.org/c/flashrom/+/39975
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Idc4237ddca94c42ce2a930e6d00fd2d14e4f125c
Gerrit-Change-Number: 39975
Gerrit-PatchSet: 1
Gerrit-Owner: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: newchange