summaryrefslogtreecommitdiff
path: root/util/iteflash.c
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@chromium.org>2021-03-31 03:37:01 +0000
committerAseda Aboagye <aaboagye@chromium.org>2021-03-31 03:42:19 +0000
commit3dc67ced44871bbfbfaa57adfde070fa18fce348 (patch)
tree0dd7c74ef539c796ab461709d72060b16b031729 /util/iteflash.c
parent1ca55af90536a83deb22e8ad85da78f5c3c30deb (diff)
downloadchrome-ec-3dc67ced44871bbfbfaa57adfde070fa18fce348.tar.gz
Revert "iteflash: speed up data write"
This reverts commit 3430629ed4e993594d83e9ea22f984f2cf5fce76. Reason for revert: Broke EC build util/iteflash.c: In function ‘is_empty_page’: util/iteflash.c:1216:2: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode for (int i = 0; i < size; i++) { ^ Original change's description: > iteflash: speed up data write > > In Cherry/Asurada, around 60% of the flash is not used. Skip writing > empty contents makes flash_ec runs 2x faster. > > BUG=none > TEST=Run `time util/flash_ec --board=cherry --image build/cherry/ec.bin` > Before this patch: 5min 54s > After: 2min 33s > And make sure the content is good. > BRANCH=none > > Signed-off-by: Ting Shen <phoenixshen@google.com> > Change-Id: I6aa5c3c00e2494b87a139f7a09aad9734e68c98d > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2785510 > Reviewed-by: Dino Li <dino.li@ite.corp-partner.google.com> > Reviewed-by: Eric Yilun Lin <yllin@chromium.org> > Commit-Queue: Ting Shen <phoenixshen@chromium.org> > Tested-by: Ting Shen <phoenixshen@chromium.org> Bug: none Change-Id: I5efd9197b934ad8014739b81625475706ad3b39a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2796375 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'util/iteflash.c')
-rw-r--r--util/iteflash.c16
1 files changed, 1 insertions, 15 deletions
diff --git a/util/iteflash.c b/util/iteflash.c
index d9f5d2a035..bf87c2dfb7 100644
--- a/util/iteflash.c
+++ b/util/iteflash.c
@@ -15,7 +15,6 @@
#include <linux/i2c-dev.h>
#include <linux/i2c.h>
#include <signal.h>
-#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -1211,16 +1210,6 @@ failed_read:
return res;
}
-static bool is_empty_page(uint8_t *buffer, int size)
-{
- for (int i = 0; i < size; i++) {
- if (buffer[i] != 0xFF)
- return false;
- }
-
- return true;
-}
-
static int command_write_pages(struct common_hnd *chnd, uint32_t address,
uint32_t size, uint8_t *buffer)
{
@@ -1804,10 +1793,7 @@ static int write_flash3(struct common_hnd *chnd, const char *filename,
while (res) {
cnt = (res > block_write_size) ? block_write_size : res;
- if (chnd->conf.erase && is_empty_page(&buf[offset], cnt)) {
- /* do nothing */
- } else if (command_write_pages3(chnd, offset, cnt, &buf[offset])
- < 0) {
+ if (command_write_pages3(chnd, offset, cnt, &buf[offset]) < 0) {
ret = -EIO;
goto failed_write;
}